Updated schema
Migrated pFlags, startBot
This commit is contained in:
parent
812801c752
commit
9cef19bc0e
@ -1452,7 +1452,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
angular.forEach(historyResult.history, function (id) {
|
||||
var message = AppMessagesManager.wrapForHistory(id);
|
||||
if ($scope.historyState.skipped) {
|
||||
delete message.unread;
|
||||
delete message.pFlags.unread;
|
||||
}
|
||||
if (historyResult.unreadOffset) {
|
||||
message.unreadAfter = true;
|
||||
@ -1839,7 +1839,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
$scope.historyState.typing.splice(0, $scope.historyState.typing.length);
|
||||
$scope.$broadcast('ui_history_append_new', {
|
||||
my: addedMessage.my,
|
||||
idleScroll: unreadAfterIdle && !historyMessage.out && $rootScope.idle.isIDLE
|
||||
idleScroll: unreadAfterIdle && !historyMessage.pFlags.out && $rootScope.idle.isIDLE
|
||||
});
|
||||
if (addedMessage.my && $scope.historyUnreadAfter) {
|
||||
delete $scope.historyUnreadAfter;
|
||||
@ -1848,9 +1848,9 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
|
||||
// console.log('append check', $rootScope.idle.isIDLE, addedMessage.peerID, $scope.curDialog.peerID, historyMessage, history.messages[history.messages.length - 2]);
|
||||
if ($rootScope.idle.isIDLE) {
|
||||
if (historyMessage.unread &&
|
||||
!historyMessage.out &&
|
||||
!(history.messages[history.messages.length - 2] || {}).unread) {
|
||||
if (historyMessage.pFlags.unread &&
|
||||
!historyMessage.pFlags.out &&
|
||||
!(history.messages[history.messages.length - 2] || {}).pFlags.unread) {
|
||||
|
||||
$scope.historyUnreadAfter = historyMessage.mid;
|
||||
unreadAfterIdle = true;
|
||||
@ -1910,7 +1910,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
var hasOut = false;
|
||||
var unreadAfterNew = false;
|
||||
var historyMessage = history.messages[history.messages.length - 1];
|
||||
var lastIsRead = !historyMessage || !historyMessage.unread;
|
||||
var lastIsRead = !historyMessage || !historyMessage.pFlags.unread;
|
||||
for (i = 0; i < len; i++) {
|
||||
messageID = msgs[i];
|
||||
if (messageID < maxID ||
|
||||
@ -1921,15 +1921,15 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
history.messages.push(historyMessage);
|
||||
history.ids.push(messageID);
|
||||
if (!unreadAfterNew && isIDLE) {
|
||||
if (historyMessage.unread &&
|
||||
!historyMessage.out &&
|
||||
if (historyMessage.pFlags.unread &&
|
||||
!historyMessage.pFlags.out &&
|
||||
lastIsRead) {
|
||||
unreadAfterNew = messageID;
|
||||
} else {
|
||||
lastIsRead = !historyMessage.unread;
|
||||
lastIsRead = !historyMessage.pFlags.unread;
|
||||
}
|
||||
}
|
||||
if (!hasOut && historyMessage.out) {
|
||||
if (!hasOut && historyMessage.pFlags.out) {
|
||||
hasOut = true;
|
||||
}
|
||||
}
|
||||
|
@ -116,8 +116,8 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
});
|
||||
|
||||
var deregisterUnreadAfter;
|
||||
if (!$scope.historyMessage.out &&
|
||||
($scope.historyMessage.unread || $scope.historyMessage.unreadAfter)) {
|
||||
if (!$scope.historyMessage.pFlags.out &&
|
||||
($scope.historyMessage.pFlags.unread || $scope.historyMessage.unreadAfter)) {
|
||||
var applyUnreadAfter = function () {
|
||||
if ($scope.peerHistory.peerID != $scope.historyPeer.id) {
|
||||
return;
|
||||
@ -141,10 +141,10 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
applyUnreadAfter();
|
||||
deregisterUnreadAfter = $scope.$on('messages_unread_after', applyUnreadAfter);
|
||||
}
|
||||
if ($scope.historyMessage.unread && $scope.historyMessage.out) {
|
||||
if ($scope.historyMessage.pFlags.unread && $scope.historyMessage.pFlags.out) {
|
||||
element.addClass(unreadClass);
|
||||
var deregisterUnread = $scope.$on('messages_read', function () {
|
||||
if (!$scope.historyMessage.unread) {
|
||||
if (!$scope.historyMessage.pFlags.unread) {
|
||||
element.removeClass(unreadClass);
|
||||
deregisterUnread();
|
||||
if (deregisterUnreadAfter && !unreadAfter) {
|
||||
@ -2947,8 +2947,8 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
$scope.mediaPlayer.player.play();
|
||||
|
||||
if ($scope.message &&
|
||||
!$scope.message.out &&
|
||||
$scope.message.media_unread) {
|
||||
!$scope.message.pFlags.out &&
|
||||
$scope.message.pFlags.media_unread) {
|
||||
AppMessagesManager.readMessages([$scope.message.mid]);
|
||||
}
|
||||
}, 300);
|
||||
|
@ -54,7 +54,7 @@ angular.module('myApp.filters', ['myApp.i18n'])
|
||||
|
||||
case 'userStatusBot':
|
||||
if (botChatPrivacy) {
|
||||
if (user.pFlags.botNoPrivacy) {
|
||||
if (user.pFlags.bot_chat_history) {
|
||||
return _('user_status_bot_noprivacy');
|
||||
} else {
|
||||
return _('user_status_bot_privacy');
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,8 @@
|
||||
boolFalse#bc799737 = Bool;
|
||||
boolTrue#997275b5 = Bool;
|
||||
|
||||
true#3fedd339 = True;
|
||||
|
||||
vector#1cb5c415 {t:Type} # [ t ] = Vector t;
|
||||
|
||||
error#c4b9f9bb code:int text:string = Error;
|
||||
@ -80,7 +82,7 @@ fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileL
|
||||
fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation;
|
||||
|
||||
userEmpty#200250ba id:int = User;
|
||||
user#22e49072 flags:# id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int = User;
|
||||
user#22e49072 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int = User;
|
||||
|
||||
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
|
||||
userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto;
|
||||
@ -93,25 +95,27 @@ userStatusLastWeek#7bf09fc = UserStatus;
|
||||
userStatusLastMonth#77ebc742 = UserStatus;
|
||||
|
||||
chatEmpty#9ba2d800 id:int = Chat;
|
||||
chat#7312bc48 flags:# id:int title:string photo:ChatPhoto participants_count:int date:int version:int = Chat;
|
||||
chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat;
|
||||
chatForbidden#7328bdb id:int title:string = Chat;
|
||||
channel#678e9587 flags:# id:int access_hash:long title:string username:flags.6?string photo:ChatPhoto date:int version:int = Chat;
|
||||
channel#678e9587 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true editor:flags.3?true moderator:flags.4?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true id:int access_hash:long title:string username:flags.6?string photo:ChatPhoto date:int version:int = Chat;
|
||||
channelForbidden#2d85832c id:int access_hash:long title:string = Chat;
|
||||
|
||||
chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> = ChatFull;
|
||||
channelFull#fab31aa3 flags:# id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int read_inbox_max_id:int unread_count:int unread_important_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite = ChatFull;
|
||||
channelFull#9e341ddf flags:# can_view_participants:flags.3?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int read_inbox_max_id:int unread_count:int unread_important_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int = ChatFull;
|
||||
|
||||
chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant;
|
||||
chatParticipantCreator#da13538a user_id:int = ChatParticipant;
|
||||
chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant;
|
||||
|
||||
chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants;
|
||||
chatParticipants#7841b415 chat_id:int admin_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants;
|
||||
chatParticipants#3f460fed chat_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants;
|
||||
|
||||
chatPhotoEmpty#37c1011c = ChatPhoto;
|
||||
chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto;
|
||||
|
||||
messageEmpty#83e5de54 id:int = Message;
|
||||
message#5ba66c13 flags:# id:int from_id:flags.8?int to_id:Peer fwd_from_id:flags.2?Peer fwd_date:flags.2?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int = Message;
|
||||
messageService#c06b9607 flags:# id:int from_id:flags.8?int to_id:Peer date:int action:MessageAction = Message;
|
||||
message#5ba66c13 flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true id:int from_id:flags.8?int to_id:Peer fwd_from_id:flags.2?Peer fwd_date:flags.2?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int = Message;
|
||||
messageService#c06b9607 flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true id:int from_id:flags.8?int to_id:Peer date:int action:MessageAction = Message;
|
||||
|
||||
messageMediaEmpty#3ded6320 = MessageMedia;
|
||||
messageMediaPhoto#3d8ce53d photo:Photo caption:string = MessageMedia;
|
||||
@ -133,6 +137,10 @@ messageActionChatAddUser#5e3cfc4b user_id:int = MessageAction;
|
||||
messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction;
|
||||
messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction;
|
||||
messageActionChannelCreate#95d2ac92 title:string = MessageAction;
|
||||
messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction;
|
||||
messageActionChatDeactivate#64ad20a8 = MessageAction;
|
||||
messageActionChatActivate#40ad8cb2 = MessageAction;
|
||||
messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction;
|
||||
|
||||
dialog#c1dd804a peer:Peer top_message:int read_inbox_max_id:int unread_count:int notify_settings:PeerNotifySettings = Dialog;
|
||||
dialogChannel#5b8496b2 peer:Peer top_message:int top_important_message:int read_inbox_max_id:int unread_count:int unread_important_count:int notify_settings:PeerNotifySettings pts:int = Dialog;
|
||||
@ -260,6 +268,8 @@ updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update;
|
||||
updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update;
|
||||
updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector<int> pts:int pts_count:int = Update;
|
||||
updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update;
|
||||
updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update;
|
||||
updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update;
|
||||
|
||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||
|
||||
@ -268,12 +278,12 @@ updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Ve
|
||||
updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference;
|
||||
|
||||
updatesTooLong#e317af7e = Updates;
|
||||
updateShortMessage#f7d91a46 flags:# id:int user_id:int message:string pts:int pts_count:int date:int fwd_from_id:flags.2?Peer fwd_date:flags.2?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
|
||||
updateShortChatMessage#cac7fdd2 flags:# id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from_id:flags.2?Peer fwd_date:flags.2?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
|
||||
updateShortMessage#f7d91a46 flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from_id:flags.2?Peer fwd_date:flags.2?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
|
||||
updateShortChatMessage#cac7fdd2 flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from_id:flags.2?Peer fwd_date:flags.2?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
|
||||
updateShort#78d4dec1 update:Update date:int = Updates;
|
||||
updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
|
||||
updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
|
||||
updateShortSentMessage#11f1331c flags:# id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> = Updates;
|
||||
updateShortSentMessage#11f1331c flags:# unread:flags.0?true out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> = Updates;
|
||||
|
||||
photos.photos#8dca6aa5 photos:Vector<Photo> users:Vector<User> = photos.Photos;
|
||||
photos.photosSlice#15051f54 count:int photos:Vector<Photo> users:Vector<User> = photos.Photos;
|
||||
@ -282,9 +292,9 @@ photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;
|
||||
|
||||
upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
|
||||
|
||||
dcOption#5d8c6cc flags:# id:int ip_address:string port:int = DcOption;
|
||||
dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true id:int ip_address:string port:int = DcOption;
|
||||
|
||||
config#4e32b894 date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int broadcast_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int disabled_features:Vector<DisabledFeature> = Config;
|
||||
config#6cb6e65e date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int disabled_features:Vector<DisabledFeature> = Config;
|
||||
|
||||
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
|
||||
|
||||
@ -421,13 +431,13 @@ chatInviteEmpty#69df3769 = ExportedChatInvite;
|
||||
chatInviteExported#fc2e05bc link:string = ExportedChatInvite;
|
||||
|
||||
chatInviteAlready#5a686d7c chat:Chat = ChatInvite;
|
||||
chatInvite#93e99b60 flags:# title:string = ChatInvite;
|
||||
chatInvite#93e99b60 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string = ChatInvite;
|
||||
|
||||
inputStickerSetEmpty#ffb62b95 = InputStickerSet;
|
||||
inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
|
||||
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
|
||||
|
||||
stickerSet#cd303b41 flags:# id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet;
|
||||
stickerSet#cd303b41 flags:# installed:flags.0?true disabled:flags.1?true official:flags.2?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet;
|
||||
|
||||
messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
|
||||
|
||||
@ -440,9 +450,9 @@ keyboardButton#a2fa4880 text:string = KeyboardButton;
|
||||
|
||||
keyboardButtonRow#77608b83 buttons:Vector<KeyboardButton> = KeyboardButtonRow;
|
||||
|
||||
replyKeyboardHide#a03e5b85 flags:# = ReplyMarkup;
|
||||
replyKeyboardForceReply#f4108aa0 flags:# = ReplyMarkup;
|
||||
replyKeyboardMarkup#3502758c flags:# rows:Vector<KeyboardButtonRow> = ReplyMarkup;
|
||||
replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup;
|
||||
replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup;
|
||||
replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector<KeyboardButtonRow> = ReplyMarkup;
|
||||
|
||||
help.appChangelogEmpty#af7e0394 = help.AppChangelog;
|
||||
help.appChangelog#4668e6bd text:string = help.AppChangelog;
|
||||
@ -468,12 +478,12 @@ messageRange#ae30253 min_id:int max_id:int = MessageRange;
|
||||
|
||||
messageGroup#e8346f53 min_id:int max_id:int count:int date:int = MessageGroup;
|
||||
|
||||
updates.channelDifferenceEmpty#3e11affb flags:# pts:int timeout:flags.1?int = updates.ChannelDifference;
|
||||
updates.channelDifferenceTooLong#5e167646 flags:# pts:int timeout:flags.1?int top_message:int top_important_message:int read_inbox_max_id:int unread_count:int unread_important_count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;
|
||||
updates.channelDifference#2064674e flags:# pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;
|
||||
updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference;
|
||||
updates.channelDifferenceTooLong#5e167646 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int top_important_message:int read_inbox_max_id:int unread_count:int unread_important_count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;
|
||||
updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector<Message> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> = updates.ChannelDifference;
|
||||
|
||||
channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter;
|
||||
channelMessagesFilter#cd77d957 flags:# ranges:Vector<MessageRange> = ChannelMessagesFilter;
|
||||
channelMessagesFilter#cd77d957 flags:# important_only:flags.0?true ranges:Vector<MessageRange> = ChannelMessagesFilter;
|
||||
channelMessagesFilterCollapsed#fa01232e = ChannelMessagesFilter;
|
||||
|
||||
channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant;
|
||||
@ -486,6 +496,7 @@ channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant;
|
||||
channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter;
|
||||
channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter;
|
||||
channelParticipantsKicked#3c37bb7a = ChannelParticipantsFilter;
|
||||
channelParticipantsBots#b0d1865b = ChannelParticipantsFilter;
|
||||
|
||||
channelRoleEmpty#b285a0c6 = ChannelParticipantRole;
|
||||
channelRoleModerator#9618d975 = ChannelParticipantRole;
|
||||
@ -564,15 +575,15 @@ contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer;
|
||||
messages.getMessages#4222fa74 id:Vector<int> = messages.Messages;
|
||||
messages.getDialogs#859b3d3c offset:int limit:int = messages.Dialogs;
|
||||
messages.getHistory#8a8ec2da peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
|
||||
messages.search#d4569248 flags:# peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages;
|
||||
messages.readHistory#b04f2510 peer:InputPeer max_id:int offset:int = messages.AffectedHistory;
|
||||
messages.deleteHistory#f4f8fb61 peer:InputPeer offset:int = messages.AffectedHistory;
|
||||
messages.search#d4569248 flags:# important_only:flags.0?true peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages;
|
||||
messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;
|
||||
messages.deleteHistory#b7c13bd9 peer:InputPeer max_id:int = messages.AffectedHistory;
|
||||
messages.deleteMessages#a5f18925 id:Vector<int> = messages.AffectedMessages;
|
||||
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
|
||||
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
|
||||
messages.sendMessage#fa88427a flags:# peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates;
|
||||
messages.sendMedia#c8f16791 flags:# peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates;
|
||||
messages.forwardMessages#708e0195 flags:# from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer = Updates;
|
||||
messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true broadcast:flags.4?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates;
|
||||
messages.sendMedia#c8f16791 flags:# broadcast:flags.4?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates;
|
||||
messages.forwardMessages#708e0195 flags:# broadcast:flags.4?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer = Updates;
|
||||
messages.reportSpam#cf1592db peer:InputPeer = Bool;
|
||||
messages.getChats#3c6aa187 id:Vector<int> = messages.Chats;
|
||||
messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull;
|
||||
@ -603,8 +614,13 @@ messages.importChatInvite#6c50051c hash:string = Updates;
|
||||
messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
|
||||
messages.installStickerSet#7b30c3a6 stickerset:InputStickerSet disabled:Bool = Bool;
|
||||
messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;
|
||||
messages.startBot#1b3e0ffc bot:InputUser chat_id:int random_id:long start_param:string = Updates;
|
||||
messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates;
|
||||
messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>;
|
||||
messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates;
|
||||
messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool;
|
||||
messages.deactivateChat#626f0b41 chat_id:int enabled:Bool = Updates;
|
||||
messages.migrateChat#15a3b8e3 chat_id:int = Updates;
|
||||
messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
|
||||
|
||||
updates.getState#edd4882a = updates.State;
|
||||
updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference;
|
||||
@ -638,7 +654,7 @@ channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipant
|
||||
channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant;
|
||||
channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;
|
||||
channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
|
||||
channels.createChannel#5521d844 flags:# title:string about:string users:Vector<InputUser> = Updates;
|
||||
channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates;
|
||||
channels.editAbout#13e27f1e channel:InputChannel about:string = Bool;
|
||||
channels.editAdmin#52b16962 channel:InputChannel user_id:InputUser role:ChannelParticipantRole = Bool;
|
||||
channels.editTitle#566decd0 channel:InputChannel title:string = Updates;
|
||||
|
@ -261,6 +261,7 @@ TLSerialization.prototype.storeObject = function (obj, type, field) {
|
||||
case 'bytes': return this.storeBytes(obj, field);
|
||||
case 'double': return this.storeDouble(obj, field);
|
||||
case 'Bool': return this.storeBool(obj, field);
|
||||
case 'true': return;
|
||||
}
|
||||
|
||||
if (angular.isArray(obj)) {
|
||||
@ -510,6 +511,7 @@ TLDeserialization.prototype.fetchObject = function (type, field) {
|
||||
case 'bytes': return this.fetchBytes(field);
|
||||
case 'double': return this.fetchDouble(field);
|
||||
case 'Bool': return this.fetchBool(field);
|
||||
case 'true': return true;
|
||||
}
|
||||
|
||||
field = field || type || 'Object';
|
||||
@ -613,12 +615,15 @@ TLDeserialization.prototype.fetchObject = function (type, field) {
|
||||
if (this.override[overrideKey]) {
|
||||
this.override[overrideKey].apply(this, [result, field + '[' + predicate + ']']);
|
||||
} else {
|
||||
var i, param, type, condType, fieldBit;
|
||||
var i, param, type, isCond, condType, fieldBit, value;
|
||||
var len = constructorData.params.length;
|
||||
for (i = 0; i < len; i++) {
|
||||
param = constructorData.params[i];
|
||||
type = param.type;
|
||||
if (type.indexOf('?') !== -1) {
|
||||
if (type == '#' && result.pFlags === undefined) {
|
||||
result.pFlags = {};
|
||||
}
|
||||
if (isCond = (type.indexOf('?') !== -1)) {
|
||||
condType = type.split('?');
|
||||
fieldBit = condType[0].split('.');
|
||||
if (!(result[fieldBit[0]] & (1 << fieldBit[1]))) {
|
||||
@ -627,7 +632,13 @@ TLDeserialization.prototype.fetchObject = function (type, field) {
|
||||
type = condType[1];
|
||||
}
|
||||
|
||||
result[param.name] = self.fetchObject(type, field + '[' + predicate + '][' + param.name + ']');
|
||||
value = self.fetchObject(type, field + '[' + predicate + '][' + param.name + ']');
|
||||
|
||||
if (isCond && type === 'true') {
|
||||
result.pFlags[param.name] = value;
|
||||
} else {
|
||||
result[param.name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ angular.module('myApp.services')
|
||||
|
||||
// Because we saved message without dialog present
|
||||
if (message.mid && message.mid > dialog.read_inbox_max_id) {
|
||||
message.unread = true;
|
||||
message.pFlags.unread = true;
|
||||
}
|
||||
|
||||
if (historiesStorage[peerID] === undefined) {
|
||||
@ -259,7 +259,7 @@ angular.module('myApp.services')
|
||||
dialog.top_message > maxSeenID
|
||||
) {
|
||||
var notifyPeer = message.flags & 16 ? message.from_id : peerID;
|
||||
if (message.unread && !message.out) {
|
||||
if (message.pFlags.unread && !message.pFlags.out) {
|
||||
NotificationsManager.getPeerMuted(notifyPeer).then(function (muted) {
|
||||
if (!muted) {
|
||||
notifyAboutMessage(message);
|
||||
@ -364,6 +364,7 @@ angular.module('myApp.services')
|
||||
from_id: peerID,
|
||||
to_id: AppPeersManager.getOutputPeer(peerID),
|
||||
flags: 0,
|
||||
pFlags: {},
|
||||
date: tsNow(true) + serverTimeOffset,
|
||||
action: {
|
||||
_: 'messageActionBotIntro',
|
||||
@ -499,7 +500,7 @@ angular.module('myApp.services')
|
||||
var i, message;
|
||||
for (i = result.history.length - 1; i >= 0; i--) {
|
||||
message = messagesStorage[result.history[i]];
|
||||
if (message && !message.out && message.unread) {
|
||||
if (message && !message.pFlags.out && message.pFlags.unread) {
|
||||
result.unreadOffset = i + 1;
|
||||
break;
|
||||
}
|
||||
@ -641,7 +642,7 @@ angular.module('myApp.services')
|
||||
function mergeReplyKeyboard (historyStorage, message) {
|
||||
// console.log('merge', message.mid, message.reply_markup, historyStorage.reply_markup);
|
||||
if (!message.reply_markup &&
|
||||
!message.out &&
|
||||
!message.pFlags.out &&
|
||||
!message.action) {
|
||||
return false;
|
||||
}
|
||||
@ -657,7 +658,7 @@ angular.module('myApp.services')
|
||||
}
|
||||
if (historyStorage.maxOutID &&
|
||||
message.mid < historyStorage.maxOutID &&
|
||||
messageReplyMarkup.pFlags.one_time) {
|
||||
messageReplyMarkup.pFlags.single_use) {
|
||||
messageReplyMarkup.pFlags.hidden = true;
|
||||
}
|
||||
messageReplyMarkup = angular.extend({
|
||||
@ -671,9 +672,9 @@ angular.module('myApp.services')
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.out) {
|
||||
if (message.pFlags.out) {
|
||||
if (lastReplyMarkup) {
|
||||
if (lastReplyMarkup.pFlags.one_time &&
|
||||
if (lastReplyMarkup.pFlags.single_use &&
|
||||
!lastReplyMarkup.pFlags.hidden &&
|
||||
(message.mid > lastReplyMarkup.mid || message.mid < 0) &&
|
||||
message.message) {
|
||||
@ -786,8 +787,13 @@ angular.module('myApp.services')
|
||||
});
|
||||
}
|
||||
|
||||
var flags = 0;
|
||||
if (AppPeersManager.isChannel(peerID)) {
|
||||
flags |= 1;
|
||||
}
|
||||
|
||||
return MtpApiManager.invokeApi('messages.search', {
|
||||
flags: 0,
|
||||
flags: flags,
|
||||
peer: inputPeer,
|
||||
q: query || '',
|
||||
filter: inputFilter || {_: 'inputMessagesFilterEmpty'},
|
||||
@ -842,7 +848,7 @@ angular.module('myApp.services')
|
||||
if (channel.pFlags.editor) {
|
||||
angular.forEach(msgIDs, function (msgID, i) {
|
||||
var message = getMessage(splitted.mids[channelID][i]);
|
||||
if (message.out) {
|
||||
if (message.pFlags.out) {
|
||||
goodMsgIDs.push(msgID);
|
||||
}
|
||||
});
|
||||
@ -888,28 +894,6 @@ angular.module('myApp.services')
|
||||
return $q.all(promises);
|
||||
}
|
||||
|
||||
function processAffectedHistory (inputPeer, affectedHistory, method) {
|
||||
ApiUpdatesManager.processUpdateMessage({
|
||||
_: 'updateShort',
|
||||
update: {
|
||||
_: 'updatePts',
|
||||
pts: affectedHistory.pts,
|
||||
pts_count: affectedHistory.pts_count
|
||||
}
|
||||
});
|
||||
if (!affectedHistory.offset) {
|
||||
return $q.when();
|
||||
}
|
||||
|
||||
return MtpApiManager.invokeApi(method, {
|
||||
peer: inputPeer,
|
||||
offset: affectedHistory.offset,
|
||||
max_id: 0
|
||||
}).then(function (affectedHistory) {
|
||||
return processAffectedHistory(inputPeer, affectedHistory, method);
|
||||
});
|
||||
}
|
||||
|
||||
function readHistory (inputPeer) {
|
||||
// console.trace('start read');
|
||||
var peerID = AppPeersManager.getPeerID(inputPeer),
|
||||
@ -929,7 +913,7 @@ angular.module('myApp.services')
|
||||
for (i = historyStorage.history.length; i >= 0; i--) {
|
||||
messageID = historyStorage.history[i];
|
||||
message = messagesStorage[messageID];
|
||||
if (message && !message.out && message.unread) {
|
||||
if (message && !message.pFlags.out && message.pFlags.unread) {
|
||||
foundUnread = true;
|
||||
break;
|
||||
}
|
||||
@ -952,10 +936,7 @@ angular.module('myApp.services')
|
||||
} else {
|
||||
apiPromise = MtpApiManager.invokeApi('messages.readHistory', {
|
||||
peer: inputPeer,
|
||||
offset: 0,
|
||||
max_id: 0
|
||||
}).then(function (affectedHistory) {
|
||||
return processAffectedHistory(inputPeer, affectedHistory, 'messages.readHistory');
|
||||
});
|
||||
}
|
||||
|
||||
@ -978,13 +959,13 @@ angular.module('myApp.services')
|
||||
for (i = 0; i < historyStorage.history.length; i++) {
|
||||
messageID = historyStorage.history[i];
|
||||
message = messagesStorage[messageID];
|
||||
if (message && !message.out) {
|
||||
message.unread = false;
|
||||
if (message && !message.pFlags.out) {
|
||||
message.pFlags.unread = false;
|
||||
if (messagesForHistory[messageID]) {
|
||||
messagesForHistory[messageID].unread = false;
|
||||
messagesForHistory[messageID].pFlags.unread = false;
|
||||
}
|
||||
if (messagesForDialogs[messageID]) {
|
||||
messagesForDialogs[messageID].unread = false;
|
||||
messagesForDialogs[messageID].pFlags.unread = false;
|
||||
}
|
||||
NotificationsManager.cancel('msg' + messageID);
|
||||
}
|
||||
@ -1012,17 +993,29 @@ angular.module('myApp.services')
|
||||
});
|
||||
}
|
||||
|
||||
function flushHistory (inputPeer) {
|
||||
// console.log('start flush');
|
||||
var peerID = AppPeersManager.getPeerID(inputPeer),
|
||||
historyStorage = historiesStorage[peerID];
|
||||
|
||||
function doFlushHistory (inputPeer) {
|
||||
return MtpApiManager.invokeApi('messages.deleteHistory', {
|
||||
peer: inputPeer,
|
||||
offset: 0
|
||||
max_id: 0
|
||||
}).then(function (affectedHistory) {
|
||||
return processAffectedHistory(inputPeer, affectedHistory, 'messages.deleteHistory');
|
||||
}).then(function () {
|
||||
ApiUpdatesManager.processUpdateMessage({
|
||||
_: 'updateShort',
|
||||
update: {
|
||||
_: 'updatePts',
|
||||
pts: affectedHistory.pts,
|
||||
pts_count: affectedHistory.pts_count
|
||||
}
|
||||
});
|
||||
if (!affectedHistory.offset) {
|
||||
return true;
|
||||
}
|
||||
return doFlushHistory(inputPeer);
|
||||
});
|
||||
}
|
||||
|
||||
function flushHistory (inputPeer) {
|
||||
var peerID = AppPeersManager.getPeerID(inputPeer);
|
||||
return doFlushHistory(inputPeer).then(function () {
|
||||
var foundDialog = getDialogByPeerID(peerID);
|
||||
if (foundDialog[0]) {
|
||||
dialogsStorage.dialogs.splice(foundDialog[1], 1);
|
||||
@ -1034,11 +1027,18 @@ angular.module('myApp.services')
|
||||
|
||||
function saveMessages (apiMessages) {
|
||||
angular.forEach(apiMessages, function (apiMessage) {
|
||||
if (apiMessage.pFlags === undefined) {
|
||||
apiMessage.pFlags = {};
|
||||
}
|
||||
if (!apiMessage.pFlags.out) {
|
||||
apiMessage.pFlags.out = false;
|
||||
}
|
||||
if (!apiMessage.pFlags.unread) {
|
||||
apiMessage.pFlags.unread = false;
|
||||
}
|
||||
if (apiMessage._ == 'messageEmpty') {
|
||||
return;
|
||||
}
|
||||
apiMessage.out = apiMessage.flags & 2 ? true : false;
|
||||
apiMessage.media_unread = apiMessage.flags & 32 ? true : false;
|
||||
|
||||
var toPeerID = AppPeersManager.getPeerID(apiMessage.to_id);
|
||||
var isChannel = apiMessage.to_id._ == 'peerChannel';
|
||||
@ -1048,11 +1048,11 @@ angular.module('myApp.services')
|
||||
apiMessage.mid = mid;
|
||||
messagesStorage[mid] = apiMessage;
|
||||
|
||||
if (channelID && !apiMessage.out) {
|
||||
if (channelID && !apiMessage.pFlags.out) {
|
||||
var dialog = getDialogByPeerID(toPeerID)[0];
|
||||
apiMessage.unread = dialog ? mid > dialog.read_inbox_max_id : true;
|
||||
apiMessage.pFlags.unread = dialog ? mid > dialog.read_inbox_max_id : true;
|
||||
} else {
|
||||
apiMessage.unread = apiMessage.flags & 1 ? true : false;
|
||||
apiMessage.pFlags.unread = apiMessage.flags & 1 ? true : false;
|
||||
}
|
||||
|
||||
if (apiMessage.reply_to_msg_id) {
|
||||
@ -1112,13 +1112,6 @@ angular.module('myApp.services')
|
||||
}
|
||||
}
|
||||
}
|
||||
if (apiMessage.reply_markup) {
|
||||
apiMessage.reply_markup.pFlags = {
|
||||
resize: (apiMessage.reply_markup.flags & 1) > 0,
|
||||
one_time: (apiMessage.reply_markup.flags & 2) > 0,
|
||||
selective: (apiMessage.reply_markup.flags & 4) > 0
|
||||
};
|
||||
}
|
||||
|
||||
if (apiMessage.message && apiMessage.message.length) {
|
||||
var myEntities = RichTextProcessor.parseEntities(apiMessage.message);
|
||||
@ -1139,6 +1132,7 @@ angular.module('myApp.services')
|
||||
historyStorage = historiesStorage[peerID],
|
||||
inputPeer = AppPeersManager.getInputPeerByID(peerID),
|
||||
flags = 0,
|
||||
pFlags = {},
|
||||
replyToMsgID = options.replyToMsgID,
|
||||
isChannel = AppPeersManager.isChannel(peerID),
|
||||
asChannel = isChannel ? true : false,
|
||||
@ -1154,8 +1148,10 @@ angular.module('myApp.services')
|
||||
var fromID = AppUsersManager.getSelf().id;
|
||||
if (peerID != fromID) {
|
||||
flags |= 2;
|
||||
pFlags.out = true;
|
||||
if (!isChannel && !AppUsersManager.isBot(peerID)) {
|
||||
flags |= 1;
|
||||
pFlags.unread = true;
|
||||
}
|
||||
}
|
||||
if (replyToMsgID) {
|
||||
@ -1172,6 +1168,7 @@ angular.module('myApp.services')
|
||||
from_id: fromID,
|
||||
to_id: AppPeersManager.getOutputPeer(peerID),
|
||||
flags: flags,
|
||||
pFlags: pFlags,
|
||||
date: tsNow(true) + serverTimeOffset,
|
||||
message: text,
|
||||
random_id: randomIDS,
|
||||
@ -1276,6 +1273,7 @@ angular.module('myApp.services')
|
||||
historyStorage = historiesStorage[peerID],
|
||||
inputPeer = AppPeersManager.getInputPeerByID(peerID),
|
||||
flags = 0,
|
||||
pFlags = {},
|
||||
replyToMsgID = options.replyToMsgID,
|
||||
isChannel = AppPeersManager.isChannel(peerID),
|
||||
asChannel = isChannel ? true : false,
|
||||
@ -1305,8 +1303,10 @@ angular.module('myApp.services')
|
||||
var fromID = AppUsersManager.getSelf().id;
|
||||
if (peerID != fromID) {
|
||||
flags |= 2;
|
||||
pFlags.out = true;
|
||||
if (!isChannel && !AppUsersManager.isBot(peerID)) {
|
||||
flags |= 1;
|
||||
pFlags.unread = true;
|
||||
}
|
||||
}
|
||||
if (replyToMsgID) {
|
||||
@ -1331,6 +1331,7 @@ angular.module('myApp.services')
|
||||
from_id: fromID,
|
||||
to_id: AppPeersManager.getOutputPeer(peerID),
|
||||
flags: flags,
|
||||
pFlags: pFlags,
|
||||
date: tsNow(true) + serverTimeOffset,
|
||||
message: '',
|
||||
media: media,
|
||||
@ -1494,10 +1495,13 @@ angular.module('myApp.services')
|
||||
}
|
||||
|
||||
var flags = 0;
|
||||
var pFlags = {};
|
||||
if (peerID != fromID) {
|
||||
flags |= 2;
|
||||
pFlags.out = true;
|
||||
if (!AppUsersManager.isBot(peerID)) {
|
||||
flags |= 1;
|
||||
pFlags.unread = true;
|
||||
}
|
||||
}
|
||||
if (replyToMsgID) {
|
||||
@ -1515,6 +1519,7 @@ angular.module('myApp.services')
|
||||
from_id: fromID,
|
||||
to_id: AppPeersManager.getOutputPeer(peerID),
|
||||
flags: flags,
|
||||
pFlags: pFlags,
|
||||
date: tsNow(true) + serverTimeOffset,
|
||||
message: '',
|
||||
media: media,
|
||||
@ -1621,36 +1626,37 @@ angular.module('myApp.services')
|
||||
};
|
||||
|
||||
function startBot (botID, chatID, startParam) {
|
||||
var peerID = chatID ? -chatID : botID;
|
||||
if (startParam) {
|
||||
var randomID = bigint(nextRandomInt(0xFFFFFFFF)).shiftLeft(32).add(bigint(nextRandomInt(0xFFFFFFFF))).toString();
|
||||
|
||||
return MtpApiManager.invokeApi('messages.startBot', {
|
||||
bot: AppUsersManager.getUserInput(botID),
|
||||
chat_id: AppChatsManager.getChatInput(chatID),
|
||||
peer: AppPeersManager.getInputPeerByID(peerID),
|
||||
random_id: randomID,
|
||||
start_param: startParam
|
||||
}).then(function (updates) {
|
||||
ApiUpdatesManager.processUpdateMessage(updates);
|
||||
});
|
||||
}
|
||||
|
||||
var peerID = chatID ? -chatID : botID;
|
||||
var inputPeer = AppPeersManager.getInputPeerByID(peerID);
|
||||
|
||||
if (chatID) {
|
||||
return MtpApiManager.invokeApi('messages.addChatUser', {
|
||||
chat_id: AppChatsManager.getChatInput(chatID),
|
||||
user_id: AppUsersManager.getUserInput(botID)
|
||||
}).then(function (updates) {
|
||||
ApiUpdatesManager.processUpdateMessage(updates);
|
||||
sendText(peerID, '/start@' + bot.username);
|
||||
}, function (error) {
|
||||
if (error && error.type == 'USER_ALREADY_PARTICIPANT') {
|
||||
var bot = AppUsersManager.getUser(botID);
|
||||
sendText(-chatID, '/start@' + bot.username);
|
||||
sendText(peerID, '/start@' + bot.username);
|
||||
error.handled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return sendText(botID, '/start');
|
||||
return sendText(peerID, '/start');
|
||||
}
|
||||
|
||||
function cancelPendingMessage (randomID) {
|
||||
@ -1777,7 +1783,7 @@ angular.module('myApp.services')
|
||||
|
||||
if (toID < 0) {
|
||||
return toID;
|
||||
} else if (message.out || message.flags & 2) {
|
||||
} else if (message.pFlags && message.pFlags.out || message.flags & 2) {
|
||||
return toID;
|
||||
}
|
||||
return message.from_id;
|
||||
@ -1796,7 +1802,7 @@ angular.module('myApp.services')
|
||||
|
||||
if (!message || !message.to_id) {
|
||||
if (dialog && dialog.peerID) {
|
||||
message = {_: 'message', to_id: AppPeersManager.getOutputPeer(dialog.peerID), deleted: true, date: tsNow(true)};
|
||||
message = {_: 'message', to_id: AppPeersManager.getOutputPeer(dialog.peerID), deleted: true, date: tsNow(true), pFlags: {}};
|
||||
message.deleted = true;
|
||||
} else {
|
||||
return message;
|
||||
@ -2316,7 +2322,7 @@ angular.module('myApp.services')
|
||||
MtpApiFileManager.downloadSmallFile(notificationPhoto.location, notificationPhoto.size).then(function (blob) {
|
||||
notification.image = FileManager.getUrl(blob, 'image/jpeg');
|
||||
|
||||
if (message.unread) {
|
||||
if (message.pFlags.unread) {
|
||||
NotificationsManager.notify(notification);
|
||||
}
|
||||
});
|
||||
@ -2379,11 +2385,11 @@ angular.module('myApp.services')
|
||||
notifyPeerToHandle.isMutedPromise.then(function (muted) {
|
||||
var topMessage = notifyPeerToHandle.top_message;
|
||||
if (muted ||
|
||||
!topMessage.unread) {
|
||||
!topMessage.pFlags.unread) {
|
||||
return;
|
||||
}
|
||||
setTimeout(function () {
|
||||
if (topMessage.unread) {
|
||||
if (topMessage.pFlags.unread) {
|
||||
notifyAboutMessage(topMessage, {
|
||||
fwd_count: notifyPeerToHandle.fwd_count
|
||||
});
|
||||
@ -2451,7 +2457,7 @@ angular.module('myApp.services')
|
||||
$rootScope.$broadcast('history_reply_markup', {peerID: peerID})
|
||||
}
|
||||
|
||||
if (!message.out && message.from_id) {
|
||||
if (!message.pFlags.out && message.from_id) {
|
||||
AppUsersManager.forceUserOnline(message.from_id);
|
||||
}
|
||||
|
||||
@ -2477,7 +2483,7 @@ angular.module('myApp.services')
|
||||
|
||||
var foundDialog = getDialogByPeerID(peerID);
|
||||
var dialog;
|
||||
var inboxUnread = !message.out && message.unread;
|
||||
var inboxUnread = !message.pFlags.out && message.pFlags.unread;
|
||||
|
||||
if (foundDialog.length) {
|
||||
dialog = foundDialog[0];
|
||||
@ -2555,25 +2561,25 @@ angular.module('myApp.services')
|
||||
}
|
||||
message = messagesStorage[messageID];
|
||||
|
||||
if (message.out != isOut) {
|
||||
if (message.pFlags.out != isOut) {
|
||||
continue;
|
||||
}
|
||||
if (!message.unread) {
|
||||
if (!message.pFlags.unread) {
|
||||
break;
|
||||
}
|
||||
// console.log('read', messageID, message.unread, message);
|
||||
if (message && message.unread) {
|
||||
message.unread = false;
|
||||
// console.log('read', messageID, message.pFlags.unread, message);
|
||||
if (message && message.pFlags.unread) {
|
||||
message.pFlags.unread = false;
|
||||
if (messagesForHistory[messageID]) {
|
||||
messagesForHistory[messageID].unread = false;
|
||||
messagesForHistory[messageID].pFlags.unread = false;
|
||||
if (!foundAffected) {
|
||||
foundAffected = true;
|
||||
}
|
||||
}
|
||||
if (messagesForDialogs[messageID]) {
|
||||
messagesForDialogs[messageID].unread = false;
|
||||
messagesForDialogs[messageID].pFlags.unread = false;
|
||||
}
|
||||
if (!message.out) {
|
||||
if (!message.pFlags.out) {
|
||||
if (foundDialog) {
|
||||
newUnreadCount = --foundDialog[0].unread_count;
|
||||
}
|
||||
@ -2597,10 +2603,10 @@ angular.module('myApp.services')
|
||||
for (i = 0; i < len; i++) {
|
||||
messageID = messages[i];
|
||||
if (message = messagesStorage[messageID]) {
|
||||
delete message.media_unread;
|
||||
delete message.pFlags.media_unread;
|
||||
}
|
||||
if (historyMessage = messagesForHistory[messageID]) {
|
||||
delete historyMessage.media_unread;
|
||||
delete historyMessage.pFlags.media_unread;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2619,8 +2625,8 @@ angular.module('myApp.services')
|
||||
peerID = getMessagePeer(message);
|
||||
history = historiesUpdated[peerID] || (historiesUpdated[peerID] = {count: 0, unread: 0, msgs: {}});
|
||||
|
||||
if (!message.out && message.unread) {
|
||||
history.unread++;
|
||||
if (!message.pFlags.out && message.pFlags.unread) {
|
||||
history.pFlags.unread++;
|
||||
NotificationsManager.cancel('msg' + messageID);
|
||||
}
|
||||
history.count++;
|
||||
@ -2641,8 +2647,7 @@ angular.module('myApp.services')
|
||||
from_id: message.from_id,
|
||||
to_id: message.to_id,
|
||||
flags: message.flags,
|
||||
out: message.out,
|
||||
unread: message.unread,
|
||||
pFlags: message.pFlags,
|
||||
date: message.date
|
||||
};
|
||||
}
|
||||
@ -2651,8 +2656,8 @@ angular.module('myApp.services')
|
||||
angular.forEach(historiesUpdated, function (updatedData, peerID) {
|
||||
var foundDialog = getDialogByPeerID(peerID);
|
||||
if (foundDialog) {
|
||||
if (updatedData.unread) {
|
||||
foundDialog[0].unread_count -= updatedData.unread;
|
||||
if (updatedData.pFlags.unread) {
|
||||
foundDialog[0].unread_count -= updatedData.pFlags.unread;
|
||||
|
||||
$rootScope.$broadcast('dialog_unread', {peerID: peerID, count: foundDialog[0].unread_count});
|
||||
}
|
||||
|
@ -113,16 +113,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
usernames[searchUsername] = userID;
|
||||
}
|
||||
|
||||
apiUser.pFlags = {
|
||||
self: (apiUser.flags & (1 << 10)) > 0,
|
||||
contact: (apiUser.flags & (1 << 11)) > 0,
|
||||
mutual: (apiUser.flags & (1 << 12)) > 0,
|
||||
deleted: (apiUser.flags & (1 << 13)) > 0,
|
||||
bot: (apiUser.flags & (1 << 14)) > 0,
|
||||
botNoPrivacy: (apiUser.flags & (1 << 15)) > 0,
|
||||
botNoGroups: (apiUser.flags & (1 << 16)) > 0,
|
||||
verified: (apiUser.flags & (1 << 17)) > 0
|
||||
};
|
||||
if (apiUser.pFlags === undefined) {
|
||||
apiUser.pFlags = {};
|
||||
}
|
||||
|
||||
apiUser.sortName = apiUser.pFlags.deleted ? '' : SearchIndexManager.cleanSearchText(apiUser.first_name + ' ' + (apiUser.last_name || ''));
|
||||
|
||||
@ -575,23 +568,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
}
|
||||
apiChat.rTitle = RichTextProcessor.wrapRichText(apiChat.title, {noLinks: true, noLinebreaks: true}) || _('chat_title_deleted');
|
||||
|
||||
var flags = apiChat.flags;
|
||||
apiChat.pFlags = {
|
||||
creator: (flags & (1 << 0)) > 0,
|
||||
kicked: (flags & (1 << 1)) > 0,
|
||||
left: (flags & (1 << 2)) > 0
|
||||
};
|
||||
|
||||
if (apiChat._ == 'channel') {
|
||||
angular.extend(apiChat.pFlags, {
|
||||
editor: (apiChat.flags & (1 << 3)) > 0,
|
||||
moderator: (apiChat.flags & (1 << 4)) > 0,
|
||||
broadcast: (apiChat.flags & (1 << 5)) > 0,
|
||||
username: (apiChat.flags & (1 << 6)) > 0,
|
||||
verified: (apiChat.flags & (1 << 7)) > 0
|
||||
});
|
||||
};
|
||||
|
||||
var titleWords = SearchIndexManager.cleanSearchText(apiChat.title || '').split(' ');
|
||||
var firstWord = titleWords.shift();
|
||||
var lastWord = titleWords.pop();
|
||||
@ -599,6 +575,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
|
||||
apiChat.num = (Math.abs(apiChat.id >> 1) % 8) + 1;
|
||||
|
||||
if (apiChat.pFlags === undefined) {
|
||||
apiChat.pFlags = {};
|
||||
}
|
||||
|
||||
if (apiChat.username) {
|
||||
var searchUsername = SearchIndexManager.cleanUsername(apiChat.username);
|
||||
usernames[searchUsername] = apiChat.id;
|
||||
@ -656,6 +636,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
return false;
|
||||
}
|
||||
|
||||
function isMegagroup (id) {
|
||||
var chat = chats[id];
|
||||
if (chat && chat._ == 'channel' && chat.pFlags.megagroup) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getChatInput (id) {
|
||||
return id || 0;
|
||||
}
|
||||
@ -702,10 +690,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
|
||||
if (chatFull.participants && chatFull.participants._ == 'chatParticipants') {
|
||||
MtpApiManager.getUserID().then(function (myID) {
|
||||
chatFull.isAdmin = (myID == chatFull.participants.admin_id);
|
||||
var isAdmin = chat.pFlags.creator || chat.pFlags.admins_enabled && chat.pFlags.admin;
|
||||
angular.forEach(chatFull.participants.participants, function(participant){
|
||||
participant.canLeave = myID == participant.user_id;
|
||||
participant.canKick = !participant.canLeave && (chatFull.isAdmin || myID == participant.inviter_id);
|
||||
participant.canKick = !participant.canLeave && (
|
||||
chat.pFlags.creator ||
|
||||
participant._ == 'chatParticipant' && (isAdmin || myID == participant.inviter_id)
|
||||
);
|
||||
|
||||
// just for order by last seen
|
||||
participant.user = AppUsersManager.getUser(participant.user_id);
|
||||
@ -769,6 +760,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
saveApiChat: saveApiChat,
|
||||
getChat: getChat,
|
||||
isChannel: isChannel,
|
||||
isMegagroup: isMegagroup,
|
||||
hasRights: hasRights,
|
||||
saveChannelAccess: saveChannelAccess,
|
||||
getChatInput: getChatInput,
|
||||
@ -917,6 +909,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
return (peerID < 0) && AppChatsManager.isChannel(-peerID);
|
||||
}
|
||||
|
||||
function isMegagroup (peerID) {
|
||||
return (peerID < 0) && AppChatsManager.isMegagroup(-peerID);
|
||||
}
|
||||
|
||||
function isBot (peerID) {
|
||||
return (peerID > 0) && AppUsersManager.isBot(peerID);
|
||||
}
|
||||
@ -932,6 +928,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
getPeerPhoto: getPeerPhoto,
|
||||
resolveUsername: resolveUsername,
|
||||
isChannel: isChannel,
|
||||
isMegagroup: isMegagroup,
|
||||
isBot: isBot
|
||||
}
|
||||
})
|
||||
@ -2526,6 +2523,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
message: {
|
||||
_: 'message',
|
||||
flags: updateMessage.flags,
|
||||
pFlags: updateMessage.pFlags,
|
||||
id: updateMessage.id,
|
||||
from_id: fromID,
|
||||
to_id: AppPeersManager.getOutputPeer(toID),
|
||||
@ -2672,7 +2670,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
|
||||
console.log(dT(), 'apply channel diff', channelState.pts);
|
||||
|
||||
if (differenceResult._ == 'updates.channelDifference' && !(differenceResult.flags & 1)) {
|
||||
if (differenceResult._ == 'updates.channelDifference' &&
|
||||
!differenceResult.pFlags['final']) {
|
||||
getChannelDifference(channelID);
|
||||
} else {
|
||||
console.log(dT(), 'finished channel get diff');
|
||||
|
@ -43,6 +43,7 @@ pre {
|
||||
overflow: auto;
|
||||
padding: 3px;
|
||||
border: 1px solid #dedede;
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
a {
|
||||
|
@ -15,7 +15,7 @@
|
||||
<span ng-switch-when="1" ng-bind="::audio.file_name"></span>
|
||||
<span ng-switch-default my-i18n="message_attach_audio_message"></span>
|
||||
</a>
|
||||
<i ng-if="::message.media_unread || false" ng-show="message.media_unread" class="icon icon-audio-unread"></i>
|
||||
<i ng-if="::message.pFlags.media_unread || false" ng-show="message.pFlags.media_unread" class="icon icon-audio-unread"></i>
|
||||
<div class="audio_player_meta" ng-if="!audio.downloaded || !(mediaPlayer.player.duration || audio.duration)" ng-switch="audio.progress.enabled">
|
||||
<span ng-switch-when="true" class="audio_player_size" ng-bind="audio.progress | formatSizeProgress"></span>
|
||||
<span ng-switch-default class="audio_player_size" ng-bind="audio.size | formatSize"></span>
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-if="chatFull.chat._ != 'chatForbidden' && !chatFull.chat.pFlags.left && chatFull.isAdmin">
|
||||
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-if="chatFull.chat._ != 'chatForbidden' && !chatFull.chat.pFlags.left && chatFull.chat.pFlags.creator">
|
||||
<!-- <i class="md_modal_section_icon md_modal_section_icon_more"></i> -->
|
||||
|
||||
<div class="md_modal_section_link_wrap">
|
||||
|
@ -4,12 +4,12 @@
|
||||
<div class="im_dialog_date" ng-bind="dialogMessage.dateText"></div>
|
||||
<span
|
||||
class="im_dialog_badge badge"
|
||||
ng-show="dialogMessage.unreadCount > 0 && !dialogMessage.out"
|
||||
ng-show="dialogMessage.unreadCount > 0 && !dialogMessage.pFlags.out"
|
||||
ng-bind="dialogMessage.unreadCount"
|
||||
></span>
|
||||
<i
|
||||
class="im_dialog_unread"
|
||||
ng-show="dialogMessage.out && dialogMessage.unread"
|
||||
ng-show="dialogMessage.pFlags.out && dialogMessage.pFlags.unread"
|
||||
></i>
|
||||
</div>
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
<div ng-switch-default class="im_dialog_message">
|
||||
<span ng-switch="dialogMessage.peerID > 0 || dialogMessage.fromID < 0">
|
||||
<span ng-switch-when="true">
|
||||
<span class="im_dialog_chat_from_wrap" ng-if="dialogMessage.out">
|
||||
<span class="im_dialog_chat_from_wrap" ng-if="dialogMessage.pFlags.out">
|
||||
<span
|
||||
class="im_dialog_chat_from"
|
||||
my-i18n="conversation_you"
|
||||
@ -42,7 +42,7 @@
|
||||
</span>
|
||||
</span>
|
||||
<span ng-switch-default>
|
||||
<span class="im_dialog_chat_from_wrap" ng-switch="dialogMessage.out && dialogMessage._ != 'messageService'">
|
||||
<span class="im_dialog_chat_from_wrap" ng-switch="dialogMessage.pFlags.out && dialogMessage._ != 'messageService'">
|
||||
<span
|
||||
ng-switch-when="false"
|
||||
class="im_dialog_chat_from"
|
||||
|
@ -23,13 +23,13 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-switch-default class="im_content_message_wrap" ng-class="::[historyMessage.out ? 'im_message_out' : 'im_message_in', historyMessage.fwdFromID ? 'im_message_fwd' : '']">
|
||||
<div ng-switch-default class="im_content_message_wrap" ng-class="::[historyMessage.pFlags.out ? 'im_message_out' : 'im_message_in', historyMessage.fwdFromID ? 'im_message_fwd' : '']">
|
||||
<i class="icon icon-select-tick"></i>
|
||||
|
||||
<a class="im_message_error_btn" ng-if="::historyMessage.pending || historyMessage.error || false" ng-click="historyMessage.send()">
|
||||
<i class="icon-message-status" tooltip="Try again"></i>
|
||||
</a>
|
||||
<i ng-if="::historyMessage.unread && historyMessage.out || historyMessage.pending || false" class="icon-message-status" ng-show="!historyMessage.error"></i>
|
||||
<i ng-if="::historyMessage.pFlags.unread && historyMessage.pFlags.out || historyMessage.pending || false" class="icon-message-status" ng-show="!historyMessage.error"></i>
|
||||
|
||||
<a class="im_message_from_photo pull-left" my-peer-photolink="::historyMessage.fromID" img-class="im_message_from_photo"></a>
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
||||
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-init="f.showMoreActions = !user.phone.length">
|
||||
<i class="md_modal_section_icon md_modal_section_icon_more"></i>
|
||||
|
||||
<div class="md_modal_section_link_wrap" ng-if="user.pFlags.bot && !user.pFlags.botNoGroups">
|
||||
<div class="md_modal_section_link_wrap" ng-if="user.pFlags.bot && !user.pFlags.bot_nochats">
|
||||
<a class="md_modal_section_link" ng-click="inviteToGroup()" my-i18n="user_modal_add_to_group"></a>
|
||||
</div>
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
<span ng-switch-when="1" ng-bind="::audio.file_name"></span>
|
||||
<span ng-switch-default my-i18n="message_attach_audio_message"></span>
|
||||
</a>
|
||||
<i ng-if="::message.media_unread || false" ng-show="message.media_unread" class="icon icon-audio-unread"></i>
|
||||
<i ng-if="::message.pFlags.media_unread || false" ng-show="message.pFlags.media_unread" class="icon icon-audio-unread"></i>
|
||||
<div class="audio_player_meta" ng-if="!audio.downloaded || !(mediaPlayer.player.duration || audio.duration)" ng-switch="audio.progress.enabled">
|
||||
<span ng-switch-when="true" class="audio_player_size" ng-bind="audio.progress | formatSizeProgress"></span>
|
||||
<span ng-switch-default class="audio_player_size" ng-bind="audio.size | formatSize"></span>
|
||||
|
@ -62,7 +62,7 @@
|
||||
<div class="mobile_modal_action_wrap" ng-if="!chatFull.chat.pFlags.left && chatFull.participants.participants.length">
|
||||
<a class="mobile_modal_action" ng-click="inviteToGroup()" my-i18n="group_modal_add_member"></a>
|
||||
</div>
|
||||
<div class="mobile_modal_action_wrap" ng-if="chatFull.chat._ != 'chatForbidden' && !chatFull.chat.pFlags.left && chatFull.isAdmin">
|
||||
<div class="mobile_modal_action_wrap" ng-if="chatFull.chat._ != 'chatForbidden' && !chatFull.chat.pFlags.left && chatFull.chat.pFlags.creator">
|
||||
<a class="mobile_modal_action" ng-click="inviteViaLink()" my-i18n="group_modal_menu_share_link"></a>
|
||||
</div>
|
||||
|
||||
|
@ -4,12 +4,12 @@
|
||||
<div class="im_dialog_date" ng-bind="dialogMessage.dateText"></div>
|
||||
<span
|
||||
class="im_dialog_badge badge"
|
||||
ng-show="dialogMessage.unreadCount > 0 && !dialogMessage.out"
|
||||
ng-show="dialogMessage.unreadCount > 0 && !dialogMessage.pFlags.out"
|
||||
ng-bind="dialogMessage.unreadCount"
|
||||
></span>
|
||||
<i
|
||||
class="im_dialog_unread"
|
||||
ng-show="dialogMessage.out && dialogMessage.unread"
|
||||
ng-show="dialogMessage.pFlags.out && dialogMessage.pFlags.unread"
|
||||
></i>
|
||||
</div>
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
<div ng-switch-default class="im_dialog_message">
|
||||
<span ng-switch="dialogMessage.peerID > 0 || dialogMessage.fromID < 0">
|
||||
<span ng-switch-when="true">
|
||||
<span class="im_dialog_chat_from_wrap" ng-if="dialogMessage.out">
|
||||
<span class="im_dialog_chat_from_wrap" ng-if="dialogMessage.pFlags.out">
|
||||
<span
|
||||
class="im_dialog_chat_from"
|
||||
my-i18n="conversation_you"
|
||||
@ -42,7 +42,7 @@
|
||||
</span>
|
||||
</span>
|
||||
<span ng-switch-default>
|
||||
<span class="im_dialog_chat_from_wrap" ng-switch="dialogMessage.out && dialogMessage._ != 'messageService'">
|
||||
<span class="im_dialog_chat_from_wrap" ng-switch="dialogMessage.pFlags.out && dialogMessage._ != 'messageService'">
|
||||
<span
|
||||
ng-switch-when="false"
|
||||
class="im_dialog_chat_from"
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-switch-default class="im_content_message_wrap" ng-class="::[historyMessage.out ? 'im_message_out' : 'im_message_in', historyMessage.fwdFromID ? 'im_message_fwd' : '']">
|
||||
<div ng-switch-default class="im_content_message_wrap" ng-class="::[historyMessage.pFlags.out ? 'im_message_out' : 'im_message_in', historyMessage.fwdFromID ? 'im_message_fwd' : '']">
|
||||
|
||||
<a class="im_message_from_photo pull-left" my-peer-photolink="::historyMessage.fromID" img-class="im_message_from_photo"></a>
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<a class="im_message_error_btn" ng-if="::historyMessage.pending || historyMessage.error || false" ng-click="historyMessage.send()">
|
||||
<i class="icon-message-status" tooltip="Try again"></i>
|
||||
</a>
|
||||
<i ng-if="::historyMessage.unread && historyMessage.out || historyMessage.pending || false" class="icon-message-status" ng-show="!historyMessage.error"></i>
|
||||
<i ng-if="::historyMessage.pFlags.unread && historyMessage.pFlags.out || historyMessage.pending || false" class="icon-message-status" ng-show="!historyMessage.error"></i>
|
||||
<span class="im_message_date" ng-bind="::historyMessage.date | time"></span>
|
||||
</div>
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
||||
<a class="mobile_modal_action" ng-click="shareContact()" my-i18n="user_modal_share_contact"></a>
|
||||
</div>
|
||||
|
||||
<div class="mobile_modal_action_wrap" ng-if="user.pFlags.bot && !user.pFlags.botNoGroups">
|
||||
<div class="mobile_modal_action_wrap" ng-if="user.pFlags.bot && !user.pFlags.bot_nochats">
|
||||
<a class="mobile_modal_action" ng-click="inviteToGroup()" my-i18n="user_modal_add_to_group"></a>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user