mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Update API scheme on layer 148: Usernames.
This commit is contained in:
parent
6997e165c6
commit
16e189a2ce
3 changed files with 27 additions and 16 deletions
|
@ -301,7 +301,7 @@ updateUserTyping#c01e857f user_id:long action:SendMessageAction = Update;
|
||||||
updateChatUserTyping#83487af0 chat_id:long from_id:Peer action:SendMessageAction = Update;
|
updateChatUserTyping#83487af0 chat_id:long from_id:Peer action:SendMessageAction = Update;
|
||||||
updateChatParticipants#7761198 participants:ChatParticipants = Update;
|
updateChatParticipants#7761198 participants:ChatParticipants = Update;
|
||||||
updateUserStatus#e5bdf8de user_id:long status:UserStatus = Update;
|
updateUserStatus#e5bdf8de user_id:long status:UserStatus = Update;
|
||||||
updateUserName#c3f202e0 user_id:long first_name:string last_name:string username:string = Update;
|
updateUserName#a7848924 user_id:long first_name:string last_name:string usernames:Vector<Username> = Update;
|
||||||
updateUserPhoto#f227868c user_id:long date:int photo:UserProfilePhoto previous:Bool = Update;
|
updateUserPhoto#f227868c user_id:long date:int photo:UserProfilePhoto previous:Bool = Update;
|
||||||
updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update;
|
updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update;
|
||||||
updateEncryptedChatTyping#1710f156 chat_id:int = Update;
|
updateEncryptedChatTyping#1710f156 chat_id:int = Update;
|
||||||
|
@ -957,6 +957,7 @@ channelAdminLogEventActionParticipantJoinByRequest#afb6144a invite:ExportedChatI
|
||||||
channelAdminLogEventActionToggleNoForwards#cb2ac766 new_value:Bool = ChannelAdminLogEventAction;
|
channelAdminLogEventActionToggleNoForwards#cb2ac766 new_value:Bool = ChannelAdminLogEventAction;
|
||||||
channelAdminLogEventActionSendMessage#278f2868 message:Message = ChannelAdminLogEventAction;
|
channelAdminLogEventActionSendMessage#278f2868 message:Message = ChannelAdminLogEventAction;
|
||||||
channelAdminLogEventActionChangeAvailableReactions#be4e0ef8 prev_value:ChatReactions new_value:ChatReactions = ChannelAdminLogEventAction;
|
channelAdminLogEventActionChangeAvailableReactions#be4e0ef8 prev_value:ChatReactions new_value:ChatReactions = ChannelAdminLogEventAction;
|
||||||
|
channelAdminLogEventActionChangeUsernames#f04fb3a9 prev_value:Vector<string> new_value:Vector<string> = ChannelAdminLogEventAction;
|
||||||
|
|
||||||
channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
|
channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
|
||||||
|
|
||||||
|
|
|
@ -1872,21 +1872,22 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case mtpc_updateUserName: {
|
case mtpc_updateUserName: {
|
||||||
auto &d = update.c_updateUserName();
|
const auto &d = update.c_updateUserName();
|
||||||
if (auto user = session().data().userLoaded(d.vuser_id())) {
|
if (const auto user = session().data().userLoaded(d.vuser_id())) {
|
||||||
if (!user->isContact()) {
|
const auto contact = user->isContact();
|
||||||
user->setName(
|
const auto first = contact
|
||||||
TextUtilities::SingleLine(qs(d.vfirst_name())),
|
? user->firstName
|
||||||
TextUtilities::SingleLine(qs(d.vlast_name())),
|
: qs(d.vfirst_name());
|
||||||
user->nameOrPhone,
|
const auto last = contact ? user->lastName : qs(d.vlast_name());
|
||||||
TextUtilities::SingleLine(qs(d.vusername())));
|
// #TODO usernames
|
||||||
} else {
|
const auto username = d.vusernames().v.isEmpty()
|
||||||
user->setName(
|
? QString()
|
||||||
TextUtilities::SingleLine(user->firstName),
|
: qs(d.vusernames().v.front().data().vusername());
|
||||||
TextUtilities::SingleLine(user->lastName),
|
user->setName(
|
||||||
user->nameOrPhone,
|
TextUtilities::SingleLine(first),
|
||||||
TextUtilities::SingleLine(qs(d.vusername())));
|
TextUtilities::SingleLine(last),
|
||||||
}
|
user->nameOrPhone,
|
||||||
|
TextUtilities::SingleLine(username));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
@ -697,6 +697,7 @@ void GenerateItems(
|
||||||
using LogNoForwards = MTPDchannelAdminLogEventActionToggleNoForwards;
|
using LogNoForwards = MTPDchannelAdminLogEventActionToggleNoForwards;
|
||||||
using LogActionSendMessage = MTPDchannelAdminLogEventActionSendMessage;
|
using LogActionSendMessage = MTPDchannelAdminLogEventActionSendMessage;
|
||||||
using LogEventActionChangeAvailableReactions = MTPDchannelAdminLogEventActionChangeAvailableReactions;
|
using LogEventActionChangeAvailableReactions = MTPDchannelAdminLogEventActionChangeAvailableReactions;
|
||||||
|
using LogEventActionChangeUsernames = MTPDchannelAdminLogEventActionChangeUsernames;
|
||||||
|
|
||||||
const auto session = &history->session();
|
const auto session = &history->session();
|
||||||
const auto id = event.vid().v;
|
const auto id = event.vid().v;
|
||||||
|
@ -1513,6 +1514,12 @@ void GenerateItems(
|
||||||
addSimpleServiceMessage(text);
|
addSimpleServiceMessage(text);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const auto createChangeUsernames = [&](
|
||||||
|
const LogEventActionChangeUsernames &data) {
|
||||||
|
// #TODO usernames
|
||||||
|
addSimpleServiceMessage({ "changed usernames" });
|
||||||
|
};
|
||||||
|
|
||||||
action.match([&](const LogTitle &data) {
|
action.match([&](const LogTitle &data) {
|
||||||
createChangeTitle(data);
|
createChangeTitle(data);
|
||||||
}, [&](const LogAbout &data) {
|
}, [&](const LogAbout &data) {
|
||||||
|
@ -1585,6 +1592,8 @@ void GenerateItems(
|
||||||
createSendMessage(data);
|
createSendMessage(data);
|
||||||
}, [&](const LogEventActionChangeAvailableReactions &data) {
|
}, [&](const LogEventActionChangeAvailableReactions &data) {
|
||||||
createChangeAvailableReactions(data);
|
createChangeAvailableReactions(data);
|
||||||
|
}, [&](const LogEventActionChangeUsernames &data) {
|
||||||
|
createChangeUsernames(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue