2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 07:35:12 +00:00

broadcast channels support started

This commit is contained in:
John Preston
2015-09-06 13:17:09 +03:00
parent 95ff7821a3
commit b53e35e046
31 changed files with 1006 additions and 525 deletions

View File

@@ -92,7 +92,7 @@ PeerData::PeerData(const PeerId &id) : id(id), lnk(new PeerLink(this))
, nameVersion(0)
, notify(UnknownNotifySettings)
{
if (!peerIsUser(id)) updateName(QString(), QString(), QString());
if (!peerIsUser(id) && !peerIsChannel(id)) updateName(QString(), QString(), QString());
}
void PeerData::updateName(const QString &newName, const QString &newNameOrPhone, const QString &newUsername) {
@@ -167,14 +167,6 @@ void PeerData::fillNames() {
}
}
const Text &PeerData::dialogName() const {
return (isUser() && !asUser()->phoneText.isEmpty()) ? asUser()->phoneText : nameText;
}
const QString &PeerData::shortName() const {
return isUser() ? asUser()->firstName : name;
}
void UserData::setName(const QString &first, const QString &last, const QString &phoneName, const QString &usern) {
bool updName = !first.isEmpty() || !last.isEmpty(), updUsername = (username != usern);
@@ -359,6 +351,17 @@ void ChannelData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see
}
}
void ChannelData::setName(const QString &newName, const QString &usern) {
bool updName = !newName.isEmpty(), updUsername = (username != usern);
updateName(newName.isEmpty() ? name : newName, QString(), usern);
if (updUsername) {
if (App::main()) {
App::main()->peerUsernameChanged(this);
}
}
}
void PhotoLink::onClick(Qt::MouseButton button) const {
if (button == Qt::LeftButton) {
App::wnd()->showPhoto(this, App::hoveredLinkItem());