From 562d0baf8d65ea4e3e9826319687c54ad9f5947d Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 26 Oct 2016 22:49:18 +0200 Subject: [PATCH] Cleanup. --- .../messenger/AutoMessageReplyReceiver.java | 2 +- .../telegram/messenger/MediaController.java | 2 +- .../org/telegram/messenger/MessageObject.java | 8 +- .../messenger/MessagesController.java | 3646 +--------- .../messenger/SendMessagesHelper.java | 42 +- .../telegram/messenger/WearReplyReceiver.java | 2 +- .../main/java/org/telegram/tgnet/TLRPC.java | 6151 +---------------- .../java/org/telegram/ui/ChatActivity.java | 6 +- .../ui/Components/ChatActivityEnterView.java | 4 +- .../java/org/telegram/ui/LaunchActivity.java | 2 +- .../java/org/telegram/ui/ProfileActivity.java | 2 +- 11 files changed, 52 insertions(+), 9815 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AutoMessageReplyReceiver.java b/TMessagesProj/src/main/java/org/telegram/messenger/AutoMessageReplyReceiver.java index 5ae6a615b..7710e51cd 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AutoMessageReplyReceiver.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AutoMessageReplyReceiver.java @@ -32,7 +32,7 @@ public class AutoMessageReplyReceiver extends BroadcastReceiver { if (dialog_id == 0 || max_id == 0) { return; } - SendMessagesHelper.getInstance().sendMessageText(text.toString(), dialog_id, null, null, true, null, null, null); + SendMessagesHelper.getInstance().sendMessageText(text.toString(), dialog_id, null, null, true, null, null); MessagesController.getInstance().markDialogAsRead(dialog_id, max_id, max_id, 0, true, false); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index 402e14bad..f1b60d65a 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -2697,7 +2697,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, audioToSend.attributes.add(attributeAudio); if (duration > 700) { if (send == 1) { - SendMessagesHelper.getInstance().sendMessageDocument(audioToSend, null, recordingAudioFileToSend.getAbsolutePath(), recordDialogId, recordReplyingMessageObject, null, null); + SendMessagesHelper.getInstance().sendMessageDocument(audioToSend, null, recordingAudioFileToSend.getAbsolutePath(), recordDialogId, recordReplyingMessageObject, null); } NotificationCenter.getInstance().postNotificationName(NotificationCenter.audioDidSent, send == 2 ? audioToSend : null, send == 2 ? recordingAudioFileToSend.getAbsolutePath() : null); } else { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java index ad45b64c3..514e5d94f 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java @@ -471,7 +471,7 @@ public class MessageObject { public void setType() { int oldType = type; - if (messageOwner instanceof TLRPC.TL_message || messageOwner instanceof TLRPC.TL_messageForwarded_old2) { + if (messageOwner instanceof TLRPC.TL_message /*|| messageOwner instanceof TLRPC.TL_messageForwarded_old2*/) { if (isMediaEmpty()) { type = 0; if (messageText == null || messageText.length() == 0) { @@ -910,9 +910,9 @@ public class MessageObject { boolean useManualParse = !hasEntities && ( messageOwner instanceof TLRPC.TL_message_old || - messageOwner instanceof TLRPC.TL_message_old2 || - messageOwner instanceof TLRPC.TL_message_old3 || - messageOwner instanceof TLRPC.TL_message_old4 || + //messageOwner instanceof TLRPC.TL_message_old2 || + //messageOwner instanceof TLRPC.TL_message_old3 || + //messageOwner instanceof TLRPC.TL_message_old4 || messageOwner instanceof TLRPC.TL_messageForwarded_old || messageOwner instanceof TLRPC.TL_messageForwarded_old2 || messageOwner instanceof TLRPC.TL_message_secret || diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 3381f1c21..1dff9bb90 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -409,10 +409,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter TLRPC.Peer inputPeer; if (id < 0) { TLRPC.Chat chat = getInstance().getChat(-id); - if (chat instanceof TLRPC.TL_channel || chat instanceof TLRPC.TL_channelForbidden) { + /*if (chat instanceof TLRPC.TL_channel || chat instanceof TLRPC.TL_channelForbidden) { inputPeer = new TLRPC.TL_peerChannel(); inputPeer.channel_id = -id; - } else { + } else*/ { inputPeer = new TLRPC.TL_peerChat(); inputPeer.chat_id = -id; } @@ -806,674 +806,12 @@ public class MessagesController implements NotificationCenter.NotificationCenter return fullUsersAbout.get(uid); } - /* - public void cancelLoadFullUser(int uid) { - loadingFullUsers.remove((Integer) uid); - } - - public void cancelLoadFullChat(int cid) { - loadingFullChats.remove((Integer) cid); - } - */ protected void clearFullUsers() { loadedFullUsers.clear(); loadedFullChats.clear(); } - /* - private void reloadDialogsReadValue(ArrayList dialogs, long did) { - if (dialogs.isEmpty()) { - return; - } - TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs(); - if (dialogs != null) { - for (int a = 0; a < dialogs.size(); a++) { - req.peers.add(getInputPeer((int) dialogs.get(a).id)); - } - } else { - req.peers.add(getInputPeer((int) did)); - } - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (response != null) { - TLRPC.TL_messages_peerDialogs res = (TLRPC.TL_messages_peerDialogs) response; - ArrayList arrayList = new ArrayList<>(); - for (int a = 0; a < res.dialogs.size(); a++) { - TLRPC.TL_dialog dialog = res.dialogs.get(a); - if (dialog.read_inbox_max_id == 0) { - dialog.read_inbox_max_id = 1; - } - if (dialog.read_outbox_max_id == 0) { - dialog.read_outbox_max_id = 1; - } - if (dialog.id == 0 && dialog.peer != null) { - if (dialog.peer.user_id != 0) { - dialog.id = dialog.peer.user_id; - } else if (dialog.peer.chat_id != 0) { - dialog.id = -dialog.peer.chat_id; - } else if (dialog.peer.channel_id != 0) { - dialog.id = -dialog.peer.channel_id; - } - } - - Integer value = dialogs_read_inbox_max.get(dialog.id); - if (value == null) { - value = 0; - } - dialogs_read_inbox_max.put(dialog.id, Math.max(dialog.read_inbox_max_id, value)); - if (value == 0) { - if (dialog.peer.channel_id != 0) { - TLRPC.TL_updateReadChannelInbox update = new TLRPC.TL_updateReadChannelInbox(); - update.channel_id = dialog.peer.channel_id; - update.max_id = dialog.read_inbox_max_id; - arrayList.add(update); - } else { - TLRPC.TL_updateReadHistoryInbox update = new TLRPC.TL_updateReadHistoryInbox(); - update.peer = dialog.peer; - update.max_id = dialog.read_inbox_max_id; - arrayList.add(update); - } - } - - value = dialogs_read_outbox_max.get(dialog.id); - if (value == null) { - value = 0; - } - dialogs_read_outbox_max.put(dialog.id, Math.max(dialog.read_outbox_max_id, value)); - if (value == 0) { - if (dialog.peer.channel_id != 0) { - TLRPC.TL_updateReadChannelOutbox update = new TLRPC.TL_updateReadChannelOutbox(); - update.channel_id = dialog.peer.channel_id; - update.max_id = dialog.read_outbox_max_id; - arrayList.add(update); - } else { - TLRPC.TL_updateReadHistoryOutbox update = new TLRPC.TL_updateReadHistoryOutbox(); - update.peer = dialog.peer; - update.max_id = dialog.read_outbox_max_id; - arrayList.add(update); - } - } - } - if (!arrayList.isEmpty()) { - processUpdateArray(arrayList, null, null, false); - } - } - } - }); - } - */ - - /* - public void loadFullChat(final int chat_id, final int classGuid, boolean force) { - if (loadingFullChats.contains(chat_id) || !force && loadedFullChats.contains(chat_id)) { - return; - } - loadingFullChats.add(chat_id); - TLObject request; - final TLRPC.Chat chat = getChat(chat_id); - if (ChatObject.isChannel(chat_id)) { - TLRPC.TL_channels_getFullChannel req = new TLRPC.TL_channels_getFullChannel(); - req.channel = getInputChannel(chat_id); - request = req; - } else { - TLRPC.TL_messages_getFullChat req = new TLRPC.TL_messages_getFullChat(); - req.chat_id = chat_id; - request = req; - } - int reqId = ConnectionsManager.getInstance().sendRequest(request, new RequestDelegate() { - @Override - public void run(TLObject response, final TLRPC.TL_error error) { - if (error == null) { - final TLRPC.TL_messages_chatFull res = (TLRPC.TL_messages_chatFull) response; - MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, true, true); - MessagesStorage.getInstance().updateChatInfo(res.full_chat, false); - - if (ChatObject.isChannel(chat)) { - long dialog_id = -chat_id; - Integer value = dialogs_read_inbox_max.get(dialog_id); - if (value == null) { - value = MessagesStorage.getInstance().getDialogReadMax(true, dialog_id); - } - - dialogs_read_inbox_max.put(dialog_id, Math.max(res.full_chat.read_inbox_max_id, value)); - if (value == 0) { - ArrayList arrayList = new ArrayList<>(); - TLRPC.TL_updateReadChannelInbox update = new TLRPC.TL_updateReadChannelInbox(); - update.channel_id = chat_id; - update.max_id = res.full_chat.read_inbox_max_id; - arrayList.add(update); - processUpdateArray(arrayList, null, null, false); - } - - value = dialogs_read_outbox_max.get(dialog_id); - if (value == null) { - value = MessagesStorage.getInstance().getDialogReadMax(true, dialog_id); - } - dialogs_read_outbox_max.put(dialog_id, Math.max(res.full_chat.read_outbox_max_id, value)); - if (value == 0) { - ArrayList arrayList = new ArrayList<>(); - TLRPC.TL_updateReadChannelOutbox update = new TLRPC.TL_updateReadChannelOutbox(); - update.channel_id = chat_id; - update.max_id = res.full_chat.read_outbox_max_id; - arrayList.add(update); - processUpdateArray(arrayList, null, null, false); - } - } - - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - applyDialogNotificationsSettings(-chat_id, res.full_chat.notify_settings); - for (int a = 0; a < res.full_chat.bot_info.size(); a++) { - TLRPC.BotInfo botInfo = res.full_chat.bot_info.get(a); - BotQuery.putBotInfo(botInfo); - } - exportedChats.put(chat_id, res.full_chat.exported_invite); - loadingFullChats.remove((Integer) chat_id); - loadedFullChats.add(chat_id); - if (!res.chats.isEmpty()) { - TLRPC.Chat chat = res.chats.get(0); - chat.address = res.full_chat.about; - } - - putUsers(res.users, false); - putChats(res.chats, false); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatInfoDidLoaded, res.full_chat, classGuid, false, null); - } - }); - } else { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - checkChannelError(error.text, chat_id); - loadingFullChats.remove((Integer) chat_id); - } - }); - } - } - }); - if (classGuid != 0) { - ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid); - } - } - */ - - /* - public void loadFullUser(final TLRPC.User user, final int classGuid, boolean force) { - if (user == null || loadingFullUsers.contains(user.id) || !force && loadedFullUsers.contains(user.id)) { - return; - } - loadingFullUsers.add(user.id); - TLRPC.TL_users_getFullUser req = new TLRPC.TL_users_getFullUser(); - req.id = getInputUser(user); - int reqId = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(final TLObject response, TLRPC.TL_error error) { - if (error == null) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - TLRPC.TL_userFull userFull = (TLRPC.TL_userFull) response; - applyDialogNotificationsSettings(user.id, userFull.notify_settings); - EDIT BY MR - if (userFull.bot_info instanceof TLRPC.TL_botInfo) { - BotQuery.putBotInfo(userFull.bot_info); - } - if (userFull.about != null && userFull.about.length() > 0) { - fullUsersAbout.put(user.id, userFull.about); - } else { - fullUsersAbout.remove(user.id); - } - loadingFullUsers.remove((Integer) user.id); - loadedFullUsers.add(user.id); - String names = user.first_name + user.last_name + user.username; - ArrayList users = new ArrayList<>(); - users.add(userFull.user); - putUsers(users, false); - //MessagesStorage.getInstance().putUsersAndChats(users, null, false, true); - if (names != null && !names.equals(userFull.user.first_name + userFull.user.last_name + userFull.user.username)) { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_NAME); - } - if (userFull.bot_info instanceof TLRPC.TL_botInfo) { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.botInfoDidLoaded, userFull.bot_info, classGuid); - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.userInfoDidLoaded, user.id); - } - }); - } else { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - loadingFullUsers.remove((Integer) user.id); - } - }); - } - } - }); - ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid); - } - */ - - /* - private void reloadMessages(final ArrayList mids, final long dialog_id) { - if (mids.isEmpty()) { - return; - } - TLObject request; - final ArrayList result = new ArrayList<>(); - final TLRPC.Chat chat = ChatObject.getChatByDialog(dialog_id); - if (ChatObject.isChannel(chat)) { - TLRPC.TL_channels_getMessages req = new TLRPC.TL_channels_getMessages(); - req.channel = getInputChannel(chat); - req.id = result; - request = req; - } else { - TLRPC.TL_messages_getMessages req = new TLRPC.TL_messages_getMessages(); - req.id = result; - request = req; - } - ArrayList arrayList = reloadingMessages.get(dialog_id); - for (int a = 0; a < mids.size(); a++) { - Integer mid = mids.get(a); - if (arrayList != null && arrayList.contains(mid)) { - continue; - } - result.add(mid); - } - if (result.isEmpty()) { - return; - } - if (arrayList == null) { - arrayList = new ArrayList<>(); - reloadingMessages.put(dialog_id, arrayList); - } - arrayList.addAll(result); - ConnectionsManager.getInstance().sendRequest(request, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error == null) { - TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response; - - final HashMap usersLocal = new HashMap<>(); - for (int a = 0; a < messagesRes.users.size(); a++) { - TLRPC.User u = messagesRes.users.get(a); - usersLocal.put(u.id, u); - } - final HashMap chatsLocal = new HashMap<>(); - for (int a = 0; a < messagesRes.chats.size(); a++) { - TLRPC.Chat c = messagesRes.chats.get(a); - chatsLocal.put(c.id, c); - } - - Integer inboxValue = dialogs_read_inbox_max.get(dialog_id); - if (inboxValue == null) { - //inboxValue = MessagesStorage.getInstance().getDialogReadMax(true, dialog_id); - dialogs_read_inbox_max.put(dialog_id, inboxValue); - } - - Integer outboxValue = dialogs_read_outbox_max.get(dialog_id); - if (outboxValue == null) { - //outboxValue = MessagesStorage.getInstance().getDialogReadMax(true, dialog_id); - dialogs_read_outbox_max.put(dialog_id, outboxValue); - } - - final ArrayList objects = new ArrayList<>(); - for (int a = 0; a < messagesRes.messages.size(); a++) { - TLRPC.Message message = messagesRes.messages.get(a); - if (chat != null && chat.megagroup) { - message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP; - } - message.dialog_id = dialog_id; - message.unread = (message.out ? outboxValue : inboxValue) < message.id; - objects.add(new MessageObject(message, usersLocal, chatsLocal, true)); - } - - ImageLoader.saveMessagesThumbs(messagesRes.messages); - //MessagesStorage.getInstance().putMessages(messagesRes, dialog_id, -1, 0, false); - - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - ArrayList arrayList = reloadingMessages.get(dialog_id); - if (arrayList != null) { - arrayList.removeAll(result); - if (arrayList.isEmpty()) { - reloadingMessages.remove(dialog_id); - } - } - MessageObject dialogObj = dialogMessage.get(dialog_id); - if (dialogObj != null) { - for (int a = 0; a < objects.size(); a++) { - MessageObject obj = objects.get(a); - if (dialogObj != null && dialogObj.getId() == obj.getId()) { - dialogMessage.put(dialog_id, obj); - if (obj.messageOwner.to_id.channel_id == 0) { - obj = dialogMessagesByIds.remove(obj.getId()); - if (obj != null) { - dialogMessagesByIds.put(obj.getId(), obj); - } - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - break; - } - } - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.replaceMessagesObjects, dialog_id, objects); - } - }); - } - } - }); - } - */ - - /* - public void hideReportSpam(final long dialogId, TLRPC.User currentUser, TLRPC.Chat currentChat) { - if (currentUser == null && currentChat == null) { - return; - } - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); - SharedPreferences.Editor editor = preferences.edit(); - editor.putInt("spam3_" + dialogId, 1); - editor.commit(); - TLRPC.TL_messages_hideReportSpam req = new TLRPC.TL_messages_hideReportSpam(); - if (currentUser != null) { - req.peer = MessagesController.getInputPeer(currentUser.id); - } else if (currentChat != null) { - req.peer = MessagesController.getInputPeer(-currentChat.id); - } - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - - } - }); - } - */ - - /* - public void reportSpam(final long dialogId, TLRPC.User currentUser, TLRPC.Chat currentChat) { - if (currentUser == null && currentChat == null) { - return; - } - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); - SharedPreferences.Editor editor = preferences.edit(); - editor.putInt("spam3_" + dialogId, 1); - editor.commit(); - TLRPC.TL_messages_reportSpam req = new TLRPC.TL_messages_reportSpam(); - if (currentChat != null) { - req.peer = MessagesController.getInputPeer(-currentChat.id); - } else if (currentUser != null) { - req.peer = MessagesController.getInputPeer(currentUser.id); - } - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - - } - }, ConnectionsManager.RequestFlagFailOnServerErrors); - } - */ - - public void loadPeerSettings(final long dialogId, TLRPC.User currentUser, TLRPC.Chat currentChat) { - /* EDIT BY MR - if (loadingPeerSettings.containsKey(dialogId) || currentUser == null && currentChat == null) { - return; - } - loadingPeerSettings.put(dialogId, true); - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); - if (preferences.getInt("spam3_" + dialogId, 0) == 1) { - return; - } - boolean hidden = preferences.getBoolean("spam_" + dialogId, false); - if (hidden) { - TLRPC.TL_messages_hideReportSpam req = new TLRPC.TL_messages_hideReportSpam(); - if (currentUser != null) { - req.peer = MessagesController.getInputPeer(currentUser.id); - } else if (currentChat != null) { - req.peer = MessagesController.getInputPeer(-currentChat.id); - } - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - loadingPeerSettings.remove(dialogId); - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); - SharedPreferences.Editor editor = preferences.edit(); - editor.remove("spam_" + dialogId); - editor.putInt("spam3_" + dialogId, 1); - editor.commit(); - } - }); - } - }); - return; - } - TLRPC.TL_messages_getPeerSettings req = new TLRPC.TL_messages_getPeerSettings(); - if (currentUser != null) { - req.peer = MessagesController.getInputPeer(currentUser.id); - } else if (currentChat != null) { - req.peer = MessagesController.getInputPeer(-currentChat.id); - } - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(final TLObject response, TLRPC.TL_error error) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - loadingPeerSettings.remove(dialogId); - if (response != null) { - TLRPC.TL_peerSettings res = (TLRPC.TL_peerSettings) response; - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); - SharedPreferences.Editor editor = preferences.edit(); - if (!res.report_spam) { - editor.putInt("spam3_" + dialogId, 1); - } else { - editor.putInt("spam3_" + dialogId, 2); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.peerSettingsDidLoaded, dialogId); - } - editor.commit(); - } - } - }); - } - }); - */ - } - - /* - protected void processNewChannelDifferenceParams(int pts, int pts_count, int channelId) { - FileLog.e("tmessages", "processNewChannelDifferenceParams pts = " + pts + " pts_count = " + pts_count + " channeldId = " + channelId); - TLRPC.TL_dialog dialog = dialogs_dict.get((long) -channelId); - if (!DialogObject.isChannel(dialog)) { - return; - } - Integer channelPts = channelsPts.get(channelId); - if (channelPts == null) { - channelPts = MessagesStorage.getInstance().getChannelPtsSync(channelId); - if (channelPts == 0) { - channelPts = 1; - } - channelsPts.put(channelId, channelPts); - } - if (channelPts + pts_count == pts) { - FileLog.e("tmessages", "APPLY CHANNEL PTS"); - channelsPts.put(channelId, pts); - MessagesStorage.getInstance().saveChannelPts(channelId, pts); - } else if (channelPts != pts) { - Long updatesStartWaitTime = updatesStartWaitTimeChannels.get(channelId); - Boolean gettingDifferenceChannel = gettingDifferenceChannels.get(channelId); - if (gettingDifferenceChannel == null) { - gettingDifferenceChannel = false; - } - if (gettingDifferenceChannel || updatesStartWaitTime == null || Math.abs(System.currentTimeMillis() - updatesStartWaitTime) <= 1500) { - FileLog.e("tmessages", "ADD CHANNEL UPDATE TO QUEUE pts = " + pts + " pts_count = " + pts_count); - if (updatesStartWaitTime == null) { - updatesStartWaitTimeChannels.put(channelId, System.currentTimeMillis()); - } - UserActionUpdatesPts updates = new UserActionUpdatesPts(); - updates.pts = pts; - updates.pts_count = pts_count; - updates.chat_id = channelId; - ArrayList arrayList = updatesQueueChannels.get(channelId); - if (arrayList == null) { - arrayList = new ArrayList<>(); - updatesQueueChannels.put(channelId, arrayList); - } - arrayList.add(updates); - } else { - getChannelDifference(channelId); - } - } - } - */ - - /* - protected void processNewDifferenceParams(int seq, int pts, int date, int pts_count) { - FileLog.e("tmessages", "processNewDifferenceParams seq = " + seq + " pts = " + pts + " date = " + date + " pts_count = " + pts_count); - if (pts != -1) { - if (MessagesStorage.lastPtsValue + pts_count == pts) { - FileLog.e("tmessages", "APPLY PTS"); - MessagesStorage.lastPtsValue = pts; - MessagesStorage.getInstance().saveDiffParams(MessagesStorage.lastSeqValue, MessagesStorage.lastPtsValue, MessagesStorage.lastDateValue, MessagesStorage.lastQtsValue); - } else if (MessagesStorage.lastPtsValue != pts) { - if (gettingDifference || updatesStartWaitTimePts == 0 || Math.abs(System.currentTimeMillis() - updatesStartWaitTimePts) <= 1500) { - FileLog.e("tmessages", "ADD UPDATE TO QUEUE pts = " + pts + " pts_count = " + pts_count); - if (updatesStartWaitTimePts == 0) { - updatesStartWaitTimePts = System.currentTimeMillis(); - } - UserActionUpdatesPts updates = new UserActionUpdatesPts(); - updates.pts = pts; - updates.pts_count = pts_count; - updatesQueuePts.add(updates); - } else { - getDifference(); - } - } - } - if (seq != -1) { - if (MessagesStorage.lastSeqValue + 1 == seq) { - FileLog.e("tmessages", "APPLY SEQ"); - MessagesStorage.lastSeqValue = seq; - if (date != -1) { - MessagesStorage.lastDateValue = date; - } - MessagesStorage.getInstance().saveDiffParams(MessagesStorage.lastSeqValue, MessagesStorage.lastPtsValue, MessagesStorage.lastDateValue, MessagesStorage.lastQtsValue); - } else if (MessagesStorage.lastSeqValue != seq) { - if (gettingDifference || updatesStartWaitTimeSeq == 0 || Math.abs(System.currentTimeMillis() - updatesStartWaitTimeSeq) <= 1500) { - FileLog.e("tmessages", "ADD UPDATE TO QUEUE seq = " + seq); - if (updatesStartWaitTimeSeq == 0) { - updatesStartWaitTimeSeq = System.currentTimeMillis(); - } - UserActionUpdatesSeq updates = new UserActionUpdatesSeq(); - updates.seq = seq; - updatesQueueSeq.add(updates); - } else { - getDifference(); - } - } - } - } - */ - - /* - public void didAddedNewTask(final int minDate, final SparseArray> mids) { - Utilities.stageQueue.postRunnable(new Runnable() { - @Override - public void run() { - if (currentDeletingTaskMids == null && !gettingNewDeleteTask || currentDeletingTaskTime != 0 && minDate < currentDeletingTaskTime) { - getNewDeleteTask(null); - } - } - }); - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.didCreatedNewDeleteTask, mids); - } - }); - } - */ - - public void getNewDeleteTask(final ArrayList oldTask) { - Utilities.stageQueue.postRunnable(new Runnable() { - @Override - public void run() { - gettingNewDeleteTask = true; - //MessagesStorage.getInstance().getNewTask(oldTask); - } - }); - } - - /* - private boolean checkDeletingTask(boolean runnable) { - int currentServerTime = ConnectionsManager.getInstance().getCurrentTime(); - - if (currentDeletingTaskMids != null && (runnable || currentDeletingTaskTime != 0 && currentDeletingTaskTime <= currentServerTime)) { - currentDeletingTaskTime = 0; - if (currentDeleteTaskRunnable != null && !runnable) { - Utilities.stageQueue.cancelRunnable(currentDeleteTaskRunnable); - } - currentDeleteTaskRunnable = null; - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - deleteMessages(currentDeletingTaskMids, null, null, 0); - - Utilities.stageQueue.postRunnable(new Runnable() { - @Override - public void run() { - getNewDeleteTask(currentDeletingTaskMids); - currentDeletingTaskTime = 0; - currentDeletingTaskMids = null; - } - }); - } - }); - return true; - } - return false; - } - */ - - /* - public void processLoadedDeleteTask(final int taskTime, final ArrayList messages) { - Utilities.stageQueue.postRunnable(new Runnable() { - @Override - public void run() { - gettingNewDeleteTask = false; - if (messages != null) { - currentDeletingTaskTime = taskTime; - currentDeletingTaskMids = messages; - - if (currentDeleteTaskRunnable != null) { - Utilities.stageQueue.cancelRunnable(currentDeleteTaskRunnable); - currentDeleteTaskRunnable = null; - } - - if (!checkDeletingTask(false)) { - currentDeleteTaskRunnable = new Runnable() { - @Override - public void run() { - checkDeletingTask(true); - } - }; - int currentServerTime = ConnectionsManager.getInstance().getCurrentTime(); - Utilities.stageQueue.postRunnable(currentDeleteTaskRunnable, (long) Math.abs(currentServerTime - currentDeletingTaskTime) * 1000); - } - } else { - currentDeletingTaskTime = 0; - currentDeletingTaskMids = null; - } - } - }); - } - */ - public void loadDialogPhotos(final int did, final int offset, final int count, final long max_id, final boolean fromCache, final int classGuid) { if (fromCache) { //MessagesStorage.getInstance().getDialogPhotos(did, offset, count, max_id, classGuid); @@ -1700,15 +1038,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter }); } - /* - public void uploadAndApplyUserAvatar(TLRPC.PhotoSize bigPhoto) { - if (bigPhoto != null) { - uploadingAvatar = FileLoader.getInstance().getDirectory(FileLoader.MEDIA_DIR_CACHE) + "/" + bigPhoto.location.volume_id + "_" + bigPhoto.location.local_id + ".jpg"; - FileLoader.getInstance().uploadFile(uploadingAvatar, false, true); - } - } - */ - public void markChannelDialogMessageAsDeleted(ArrayList messages, final int channelId) { MessageObject obj = dialogMessage.get((long) -channelId); if (obj != null) { @@ -1780,187 +1109,12 @@ public class MessagesController implements NotificationCenter.NotificationCenter } } - /* - public void pinChannelMessage(TLRPC.Chat chat, int id, boolean notify) { - TLRPC.TL_channels_updatePinnedMessage req = new TLRPC.TL_channels_updatePinnedMessage(); - req.channel = getInputChannel(chat); - req.id = id; - req.silent = !notify; - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error == null) { - TLRPC.Updates updates = (TLRPC.Updates) response; - processUpdates(updates, false); - } - } - }); - } - */ - - /* - public void deleteUserChannelHistory(final TLRPC.Chat chat, final TLRPC.User user, int offset) { - if (offset == 0) { - MessagesStorage.getInstance().deleteUserChannelHistory(chat.id, user.id); - } - TLRPC.TL_channels_deleteUserHistory req = new TLRPC.TL_channels_deleteUserHistory(); - req.channel = getInputChannel(chat); - req.user_id = getInputUser(user); - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error == null) { - TLRPC.TL_messages_affectedHistory res = (TLRPC.TL_messages_affectedHistory) response; - if (res.offset > 0) { - deleteUserChannelHistory(chat, user, res.offset); - } - processNewChannelDifferenceParams(res.pts, res.pts_count, chat.id); - } - } - }); - } - */ - public void deleteDialog(final long did, final int onlyHistory) { deleteDialog(did, true, onlyHistory, 0); } private void deleteDialog(final long did, final boolean first, final int onlyHistory, final int max_id) { - /* - int lower_part = (int) did; - int high_id = (int) (did >> 32); - int max_id_delete = max_id; - if (onlyHistory == 2) { - MessagesStorage.getInstance().deleteDialog(did, onlyHistory); - return; - } - if (onlyHistory == 0 || onlyHistory == 3) { - AndroidUtilities.uninstallShortcut(did); - } - - if (first) { - MessagesStorage.getInstance().deleteDialog(did, onlyHistory); - TLRPC.TL_dialog dialog = dialogs_dict.get(did); - if (dialog != null) { - if (max_id_delete == 0) { - max_id_delete = Math.max(0, dialog.top_message); - } - if (onlyHistory == 0 || onlyHistory == 3) { - dialogs.remove(dialog); - if (dialogsServerOnly.remove(dialog) && DialogObject.isChannel(dialog)) { - Utilities.stageQueue.postRunnable(new Runnable() { - @Override - public void run() { - channelsPts.remove(-(int) did); - shortPollChannels.delete(-(int) did); - needShortPollChannels.delete(-(int) did); - } - }); - } - dialogsGroupsOnly.remove(dialog); - dialogs_dict.remove(did); - dialogs_read_inbox_max.remove(did); - dialogs_read_outbox_max.remove(did); - nextDialogsCacheOffset--; - } else { - dialog.unread_count = 0; - } - int lastMessageId; - MessageObject object = dialogMessage.remove(dialog.id); - if (object != null) { - lastMessageId = object.getId(); - dialogMessagesByIds.remove(object.getId()); - } else { - lastMessageId = dialog.top_message; - object = dialogMessagesByIds.remove(dialog.top_message); - } - if (object != null && object.messageOwner.random_id != 0) { - dialogMessagesByRandomIds.remove(object.messageOwner.random_id); - } - if (onlyHistory == 1 && lower_part != 0 && lastMessageId > 0) { - TLRPC.TL_messageService message = new TLRPC.TL_messageService(); - message.id = dialog.top_message; - message.out = false; - message.from_id = UserConfig.getClientUserId(); - message.flags |= 256; - message.action = new TLRPC.TL_messageActionHistoryClear(); - message.date = dialog.last_message_date; - if (lower_part > 0) { - message.to_id = new TLRPC.TL_peerUser(); - message.to_id.user_id = lower_part; - } else { - TLRPC.Chat chat = getChat(-lower_part); - if (ChatObject.isChannel(chat)) { - message.to_id = new TLRPC.TL_peerChannel(); - message.to_id.channel_id = -lower_part; - } else { - message.to_id = new TLRPC.TL_peerChat(); - message.to_id.chat_id = -lower_part; - } - } - final MessageObject obj = new MessageObject(message, null, createdDialogIds.contains(message.dialog_id)); - final ArrayList objArr = new ArrayList<>(); - objArr.add(obj); - ArrayList arr = new ArrayList<>(); - arr.add(message); - updateInterfaceWithMessages(did, objArr); - //MessagesStorage.getInstance().putMessages(arr, false, true, false, 0); - } else { - dialog.top_message = 0; - } - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.removeAllMessagesFromDialog, did, false); - - MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { - @Override - public void run() { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - NotificationsController.getInstance().removeNotificationsForDialog(did); - } - }); - } - }); - - } - - if (high_id == 1 || onlyHistory == 3) { - return; - } - - if (lower_part != 0) { - TLRPC.InputPeer peer = getInputPeer(lower_part); - if (peer == null || peer instanceof TLRPC.TL_inputPeerChannel) { - return; - } - TLRPC.TL_messages_deleteHistory req = new TLRPC.TL_messages_deleteHistory(); - req.peer = peer; - req.max_id = max_id_delete; - req.just_clear = onlyHistory != 0; - final int max_id_delete_final = max_id_delete; - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error == null) { - TLRPC.TL_messages_affectedHistory res = (TLRPC.TL_messages_affectedHistory) response; - if (res.offset > 0) { - deleteDialog(did, false, onlyHistory, max_id_delete_final); - } - processNewDifferenceParams(-1, res.pts, -1, res.pts_count); - } - } - }, ConnectionsManager.RequestFlagInvokeAfter); - } else { - if (onlyHistory == 1) { - SecretChatHelper.getInstance().sendClearHistoryMessage(getEncryptedChat(high_id), null); - } else { - SecretChatHelper.getInstance().declineSecretChat(high_id); - } - } - */ } public MediaController.SearchImage saveGif(TLRPC.Document document) { @@ -2022,23 +1176,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter //MessagesStorage.getInstance().loadChatInfo(chat_id, semaphore, force, false); } - /* - public void processChatInfo(int chat_id, final TLRPC.ChatFull info, final ArrayList usersArr, final boolean fromCache, boolean force, final boolean byChannelUsers, final MessageObject pinnedMessageObject) { - if (fromCache && chat_id > 0 && !byChannelUsers) { - loadFullChat(chat_id, 0, force); - } - if (info != null) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - putUsers(usersArr, fromCache); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatInfoDidLoaded, info, 0, byChannelUsers, pinnedMessageObject); - } - }); - } - } - */ - public void updateTimerProc() { long currentTime = System.currentTimeMillis(); @@ -2227,227 +1364,13 @@ public class MessagesController implements NotificationCenter.NotificationCenter } } - /* EDIT BY MR - private String getUserNameForTyping(TLRPC.User user) { - if (user == null) { - return ""; - } - if (user.first_name != null && user.first_name.length() > 0) { - return user.first_name; - } else if (user.last_name != null && user.last_name.length() > 0) { - return user.last_name; - } - return ""; - } - */ - private void updatePrintingStrings() { - /* EDIT BY MR - final HashMap newPrintingStrings = new HashMap<>(); - final HashMap newPrintingStringsTypes = new HashMap<>(); - - ArrayList keys = new ArrayList<>(printingUsers.keySet()); - for (HashMap.Entry> entry : printingUsers.entrySet()) { - long key = entry.getKey(); - ArrayList arr = entry.getValue(); - - int lower_id = (int) key; - - if (lower_id > 0 || lower_id == 0 || arr.size() == 1) { - PrintingUser pu = arr.get(0); - TLRPC.User user = getUser(pu.userId); - if (user == null) { - return; - } - if (pu.action instanceof TLRPC.TL_sendMessageRecordAudioAction) { - if (lower_id < 0) { - newPrintingStrings.put(key, LocaleController.formatString("IsRecordingAudio", R.string.IsRecordingAudio, getUserNameForTyping(user))); - } else { - newPrintingStrings.put(key, LocaleController.getString("RecordingAudio", R.string.RecordingAudio)); - } - newPrintingStringsTypes.put(key, 1); - } else if (pu.action instanceof TLRPC.TL_sendMessageUploadAudioAction) { - if (lower_id < 0) { - newPrintingStrings.put(key, LocaleController.formatString("IsSendingAudio", R.string.IsSendingAudio, getUserNameForTyping(user))); - } else { - newPrintingStrings.put(key, LocaleController.getString("SendingAudio", R.string.SendingAudio)); - } - newPrintingStringsTypes.put(key, 2); - } else if (pu.action instanceof TLRPC.TL_sendMessageUploadVideoAction || pu.action instanceof TLRPC.TL_sendMessageRecordVideoAction) { - if (lower_id < 0) { - newPrintingStrings.put(key, LocaleController.formatString("IsSendingVideo", R.string.IsSendingVideo, getUserNameForTyping(user))); - } else { - newPrintingStrings.put(key, LocaleController.getString("SendingVideoStatus", R.string.SendingVideoStatus)); - } - newPrintingStringsTypes.put(key, 2); - } else if (pu.action instanceof TLRPC.TL_sendMessageUploadDocumentAction) { - if (lower_id < 0) { - newPrintingStrings.put(key, LocaleController.formatString("IsSendingFile", R.string.IsSendingFile, getUserNameForTyping(user))); - } else { - newPrintingStrings.put(key, LocaleController.getString("SendingFile", R.string.SendingFile)); - } - newPrintingStringsTypes.put(key, 2); - } else if (pu.action instanceof TLRPC.TL_sendMessageUploadPhotoAction) { - if (lower_id < 0) { - newPrintingStrings.put(key, LocaleController.formatString("IsSendingPhoto", R.string.IsSendingPhoto, getUserNameForTyping(user))); - } else { - newPrintingStrings.put(key, LocaleController.getString("SendingPhoto", R.string.SendingPhoto)); - } - newPrintingStringsTypes.put(key, 2); - } else { - if (lower_id < 0) { - newPrintingStrings.put(key, String.format("%s %s", getUserNameForTyping(user), LocaleController.getString("IsTyping", R.string.IsTyping))); - } else { - newPrintingStrings.put(key, LocaleController.getString("Typing", R.string.Typing)); - } - newPrintingStringsTypes.put(key, 0); - } - } else { - int count = 0; - String label = ""; - for (PrintingUser pu : arr) { - TLRPC.User user = getUser(pu.userId); - if (user != null) { - if (label.length() != 0) { - label += ", "; - } - label += getUserNameForTyping(user); - count++; - } - if (count == 2) { - break; - } - } - if (label.length() != 0) { - if (count == 1) { - newPrintingStrings.put(key, String.format("%s %s", label, LocaleController.getString("IsTyping", R.string.IsTyping))); - } else { - if (arr.size() > 2) { - newPrintingStrings.put(key, String.format("%s %s", label, LocaleController.formatPluralString("AndMoreTyping", arr.size() - 2))); - } else { - newPrintingStrings.put(key, String.format("%s %s", label, LocaleController.getString("AreTyping", R.string.AreTyping))); - } - } - newPrintingStringsTypes.put(key, 0); - } - } - } - - lastPrintingStringCount = newPrintingStrings.size(); - - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - printingStrings = newPrintingStrings; - printingStringsTypes = newPrintingStringsTypes; - } - }); - */ } public void cancelTyping(int action, long dialog_id) { - /* EDIT BY MR - HashMap typings = sendingTypings.get(action); - if (typings != null) { - typings.remove(dialog_id); - } - */ } public void sendTyping(final long dialog_id, final int action, int classGuid) { - /* EDIT BY MR - if (dialog_id == 0) { - return; - } - HashMap typings = sendingTypings.get(action); - if (typings != null && typings.get(dialog_id) != null) { - return; - } - if (typings == null) { - typings = new HashMap<>(); - sendingTypings.put(action, typings); - } - int lower_part = (int) dialog_id; - int high_id = (int) (dialog_id >> 32); - if (lower_part != 0) { - if (high_id == 1) { - return; - } - - TLRPC.TL_messages_setTyping req = new TLRPC.TL_messages_setTyping(); - req.peer = getInputPeer(lower_part); - if (req.peer instanceof TLRPC.TL_inputPeerChannel) { - TLRPC.Chat chat = getChat(req.peer.channel_id); - if (chat == null || !chat.megagroup) { - return; - } - } - if (req.peer == null) { - return; - } - if (action == 0) { - req.action = new TLRPC.TL_sendMessageTypingAction(); - } else if (action == 1) { - req.action = new TLRPC.TL_sendMessageRecordAudioAction(); - } else if (action == 2) { - req.action = new TLRPC.TL_sendMessageCancelAction(); - } else if (action == 3) { - req.action = new TLRPC.TL_sendMessageUploadDocumentAction(); - } else if (action == 4) { - req.action = new TLRPC.TL_sendMessageUploadPhotoAction(); - } else if (action == 5) { - req.action = new TLRPC.TL_sendMessageUploadVideoAction(); - } - typings.put(dialog_id, true); - int reqId = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - HashMap typings = sendingTypings.get(action); - if (typings != null) { - typings.remove(dialog_id); - } - } - }); - } - }, ConnectionsManager.RequestFlagFailOnServerErrors); - if (classGuid != 0) { - ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid); - } - } else { - if (action != 0) { - return; - } - TLRPC.EncryptedChat chat = getEncryptedChat(high_id); - if (chat.auth_key != null && chat.auth_key.length > 1 && chat instanceof TLRPC.TL_encryptedChat) { - TLRPC.TL_messages_setEncryptedTyping req = new TLRPC.TL_messages_setEncryptedTyping(); - req.peer = new TLRPC.TL_inputEncryptedChat(); - req.peer.chat_id = chat.id; - req.peer.access_hash = chat.access_hash; - req.typing = true; - typings.put(dialog_id, true); - int reqId = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - HashMap typings = sendingTypings.get(action); - if (typings != null) { - typings.remove(dialog_id); - } - } - }); - } - }, ConnectionsManager.RequestFlagFailOnServerErrors); - if (classGuid != 0) { - ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid); - } - } - } - */ } public void loadMessages(final long dialog_id, final int count, final int max_id, boolean fromCache, int midDate, final int classGuid, final int load_type, final int last_message_id, final boolean isChannel, final int loadIndex) { @@ -2455,46 +1378,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter } public void loadMessages(final long dialog_id, final int count, final int max_id, boolean fromCache, int midDate, final int classGuid, final int load_type, final int last_message_id, final boolean isChannel, final int loadIndex, final int first_unread, final int unread_count, final int last_date, final boolean queryFromServer) { - /* EDIT BY MR - FileLog.e("tmessages", "load messages in chat " + dialog_id + " count " + count + " max_id " + max_id + " cache " + fromCache + " mindate = " + midDate + " guid " + classGuid + " load_type " + load_type + " last_message_id " + last_message_id + " index " + loadIndex + " firstUnread " + first_unread + " underad count " + unread_count + " last_date " + last_date + " queryFromServer " + queryFromServer); - int lower_part = (int) dialog_id; - if (fromCache || lower_part == 0) { - MessagesStorage.getInstance().getMessages(dialog_id, count, max_id, midDate, classGuid, load_type, isChannel, loadIndex); - } else { - TLRPC.TL_messages_getHistory req = new TLRPC.TL_messages_getHistory(); - req.peer = getInputPeer(lower_part); - if (load_type == 3) { - req.add_offset = -count / 2; - } else if (load_type == 1) { - req.add_offset = -count - 1; - } else if (load_type == 2 && max_id != 0) { - req.add_offset = -count + 6; - } else { - if (lower_part < 0 && max_id != 0) { - TLRPC.Chat chat = getChat(-lower_part); - if (ChatObject.isChannel(chat)) { - req.add_offset = -1; - req.limit += 1; - } - } - } - req.limit = count; - req.offset_id = max_id; - int reqId = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (response != null) { - final TLRPC.messages_Messages res = (TLRPC.messages_Messages) response; - if (res.messages.size() > count) { - res.messages.remove(0); - } - processLoadedMessages(res, dialog_id, count, max_id, false, classGuid, first_unread, last_message_id, unread_count, last_date, load_type, isChannel, false, loadIndex, queryFromServer); - } - } - }); - ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid); - } - */ + } public void reloadWebPages(final long dialog_id, HashMap> webpagesToReload) { @@ -2550,159 +1434,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter } } - /* - public void processLoadedMessages(final TLRPC.messages_Messages messagesRes, final long dialog_id, final int count, final int max_id, final boolean isCache, final int classGuid, - final int first_unread, final int last_message_id, final int unread_count, final int last_date, final int load_type, final boolean isChannel, final boolean isEnd, final int loadIndex, final boolean queryFromServer) { - FileLog.e("tmessages", "processLoadedMessages size " + messagesRes.messages.size() + " in chat " + dialog_id + " count " + count + " max_id " + max_id + " cache " + isCache + " guid " + classGuid + " load_type " + load_type + " last_message_id " + last_message_id + " isChannel " + isChannel + " index " + loadIndex + " firstUnread " + first_unread + " underad count " + unread_count + " last_date " + last_date + " queryFromServer " + queryFromServer); - Utilities.stageQueue.postRunnable(new Runnable() { - @Override - public void run() { - boolean createDialog = false; - boolean isMegagroup = false; - if (messagesRes instanceof TLRPC.TL_messages_channelMessages) { - int channelId = -(int) dialog_id; - Integer channelPts = channelsPts.get(channelId); - if (channelPts == null) { - channelPts = MessagesStorage.getInstance().getChannelPtsSync(channelId); - if (channelPts == 0) { - channelsPts.put(channelId, messagesRes.pts); - createDialog = true; - if (needShortPollChannels.indexOfKey(channelId) >= 0 && shortPollChannels.indexOfKey(channelId) < 0) { - getChannelDifference(channelId, 2, 0); - } else { - getChannelDifference(channelId); - } - } - } - for (int a = 0; a < messagesRes.chats.size(); a++) { - TLRPC.Chat chat = messagesRes.chats.get(a); - if (chat.id == channelId) { - isMegagroup = chat.megagroup; - break; - } - } - } - int lower_id = (int) dialog_id; - int high_id = (int) (dialog_id >> 32); - if (!isCache) { - ImageLoader.saveMessagesThumbs(messagesRes.messages); - } - if (high_id != 1 && lower_id != 0 && isCache && messagesRes.messages.size() == 0) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - loadMessages(dialog_id, count, load_type == 2 && queryFromServer ? first_unread : max_id, false, 0, classGuid, load_type, last_message_id, isChannel, loadIndex, first_unread, unread_count, last_date, queryFromServer); - } - }); - return; - } - final HashMap usersDict = new HashMap<>(); - final HashMap chatsDict = new HashMap<>(); - for (int a = 0; a < messagesRes.users.size(); a++) { - TLRPC.User u = messagesRes.users.get(a); - usersDict.put(u.id, u); - } - for (int a = 0; a < messagesRes.chats.size(); a++) { - TLRPC.Chat c = messagesRes.chats.get(a); - chatsDict.put(c.id, c); - } - int size = messagesRes.messages.size(); - if (!isCache) { - Integer inboxValue = dialogs_read_inbox_max.get(dialog_id); - if (inboxValue == null) { - inboxValue = MessagesStorage.getInstance().getDialogReadMax(true, dialog_id); - dialogs_read_inbox_max.put(dialog_id, inboxValue); - } - - Integer outboxValue = dialogs_read_outbox_max.get(dialog_id); - if (outboxValue == null) { - outboxValue = MessagesStorage.getInstance().getDialogReadMax(true, dialog_id); - dialogs_read_outbox_max.put(dialog_id, outboxValue); - } - - for (int a = 0; a < size; a++) { - TLRPC.Message message = messagesRes.messages.get(a); - if (!isCache && message.post && !message.out) { - message.media_unread = true; - } - if (isMegagroup) { - message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP; - } - - if (message.action instanceof TLRPC.TL_messageActionChatDeleteUser) { - TLRPC.User user = usersDict.get(message.action.user_id); - if (user != null && user.bot) { - message.reply_markup = new TLRPC.TL_replyKeyboardHide(); - } - } - if (message.action instanceof TLRPC.TL_messageActionChatMigrateTo || message.action instanceof TLRPC.TL_messageActionChannelCreate) { - message.unread = false; - message.media_unread = false; - } else { - message.unread = (message.out ? outboxValue : inboxValue) < message.id; - } - } - MessagesStorage.getInstance().putMessages(messagesRes, dialog_id, load_type, max_id, createDialog); - } - final ArrayList objects = new ArrayList<>(); - final ArrayList messagesToReload = new ArrayList<>(); - final HashMap> webpagesToReload = new HashMap<>(); - TLRPC.InputChannel inputChannel = null; - for (int a = 0; a < size; a++) { - TLRPC.Message message = messagesRes.messages.get(a); - message.dialog_id = dialog_id; - MessageObject messageObject = new MessageObject(message, usersDict, chatsDict, true); - objects.add(messageObject); - if (isCache) { - if (message.media instanceof TLRPC.TL_messageMediaUnsupported) { - if (message.media.bytes != null && (message.media.bytes.length == 0 || message.media.bytes.length == 1 && message.media.bytes[0] < TLRPC.LAYER)) { - messagesToReload.add(message.id); - } - } else if (message.media instanceof TLRPC.TL_messageMediaWebPage) { - if (message.media.webpage instanceof TLRPC.TL_webPagePending && message.media.webpage.date <= ConnectionsManager.getInstance().getCurrentTime()) { - messagesToReload.add(message.id); - } else if (message.media.webpage instanceof TLRPC.TL_webPageUrlPending) { - ArrayList arrayList = webpagesToReload.get(message.media.webpage.url); - if (arrayList == null) { - arrayList = new ArrayList<>(); - webpagesToReload.put(message.media.webpage.url, arrayList); - } - arrayList.add(messageObject); - } - } - } - } - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - putUsers(messagesRes.users, isCache); - putChats(messagesRes.chats, isCache); - int first_unread_final = Integer.MAX_VALUE; - if (queryFromServer && load_type == 2) { - for (int a = 0; a < messagesRes.messages.size(); a++) { - TLRPC.Message message = messagesRes.messages.get(a); - if (!message.out && message.id > first_unread && message.id < first_unread_final) { - first_unread_final = message.id; - } - } - } - if (first_unread_final == Integer.MAX_VALUE) { - first_unread_final = first_unread; - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.messagesDidLoaded, dialog_id, count, objects, isCache, first_unread_final, last_message_id, unread_count, last_date, load_type, isEnd, classGuid, loadIndex); - if (!messagesToReload.isEmpty()) { - reloadMessages(messagesToReload, dialog_id); - } - if (!webpagesToReload.isEmpty()) { - reloadWebPages(dialog_id, webpagesToReload); - } - } - }); - } - }); - } - */ - public void loadDialogs(final int offset, final int count, boolean fromCache) { if (loadingDialogs) { return; @@ -2754,391 +1485,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter } } - - /* - public void processLoadedDialogs(final TLRPC.messages_Dialogs dialogsRes, final ArrayList encChats, final int offset, final int count, final int loadType, final boolean resetEnd, final boolean migrate) { - Utilities.stageQueue.postRunnable(new Runnable() { - @Override - public void run() { - FileLog.e("tmessages", "loaded loadType " + loadType + " count " + dialogsRes.dialogs.size()); - if (loadType == 1 && dialogsRes.dialogs.size() == 0) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - putUsers(dialogsRes.users, true); - loadingDialogs = false; - if (resetEnd) { - dialogsEndReached = false; - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - loadDialogs(0, count, false); - } - }); - return; - } - - final HashMap new_dialogs_dict = new HashMap<>(); - final HashMap new_dialogMessage = new HashMap<>(); - final HashMap usersDict = new HashMap<>(); - final HashMap chatsDict = new HashMap<>(); - - for (int a = 0; a < dialogsRes.users.size(); a++) { - TLRPC.User u = dialogsRes.users.get(a); - usersDict.put(u.id, u); - } - for (int a = 0; a < dialogsRes.chats.size(); a++) { - TLRPC.Chat c = dialogsRes.chats.get(a); - chatsDict.put(c.id, c); - } - if (loadType == 1) { - nextDialogsCacheOffset = offset + count; - } - - for (int a = 0; a < dialogsRes.messages.size(); a++) { - TLRPC.Message message = dialogsRes.messages.get(a); - if (message.to_id.channel_id != 0) { - TLRPC.Chat chat = chatsDict.get(message.to_id.channel_id); - if (chat != null && chat.left) { - continue; - } - if (chat != null && chat.megagroup) { - message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP; - } - } else if (message.to_id.chat_id != 0) { - TLRPC.Chat chat = chatsDict.get(message.to_id.chat_id); - if (chat != null && chat.migrated_to != null) { - continue; - } - } - if (loadType != 1 && message.post && !message.out) { - message.media_unread = true; - } - MessageObject messageObject = new MessageObject(message, usersDict, chatsDict, false); - new_dialogMessage.put(messageObject.getDialogId(), messageObject); - } - - final ArrayList dialogsToReload = new ArrayList<>(); - for (int a = 0; a < dialogsRes.dialogs.size(); a++) { - TLRPC.TL_dialog d = dialogsRes.dialogs.get(a); - if (d.id == 0 && d.peer != null) { - if (d.peer.user_id != 0) { - d.id = d.peer.user_id; - } else if (d.peer.chat_id != 0) { - d.id = -d.peer.chat_id; - } else if (d.peer.channel_id != 0) { - d.id = -d.peer.channel_id; - } - } - if (d.id == 0) { - continue; - } - if (d.last_message_date == 0) { - MessageObject mess = new_dialogMessage.get(d.id); - if (mess != null) { - d.last_message_date = mess.messageOwner.date; - } - } - boolean allowCheck = true; - if (DialogObject.isChannel(d)) { - TLRPC.Chat chat = chatsDict.get(-(int) d.id); - if (chat != null) { - if (!chat.megagroup) { - allowCheck = false; - } - if (chat.left) { - continue; - } - } - channelsPts.put(-(int) d.id, d.pts); - } else if ((int) d.id < 0) { - TLRPC.Chat chat = chatsDict.get(-(int) d.id); - if (chat != null && chat.migrated_to != null) { - continue; - } - } - new_dialogs_dict.put(d.id, d); - - if (allowCheck && loadType == 1 && (d.read_outbox_max_id == 0 || d.read_inbox_max_id == 0) && d.top_message != 0) { - dialogsToReload.add(d); - } - - Integer value = dialogs_read_inbox_max.get(d.id); - if (value == null) { - value = 0; - } - dialogs_read_inbox_max.put(d.id, Math.max(value, d.read_inbox_max_id)); - - value = dialogs_read_outbox_max.get(d.id); - if (value == null) { - value = 0; - } - dialogs_read_outbox_max.put(d.id, Math.max(value, d.read_outbox_max_id)); - } - - if (loadType != 1) { - ImageLoader.saveMessagesThumbs(dialogsRes.messages); - - for (int a = 0; a < dialogsRes.messages.size(); a++) { - TLRPC.Message message = dialogsRes.messages.get(a); - if (message.action instanceof TLRPC.TL_messageActionChatDeleteUser) { - TLRPC.User user = usersDict.get(message.action.user_id); - if (user != null && user.bot) { - message.reply_markup = new TLRPC.TL_replyKeyboardHide(); - } - } - - if (message.action instanceof TLRPC.TL_messageActionChatMigrateTo || message.action instanceof TLRPC.TL_messageActionChannelCreate) { - message.unread = false; - message.media_unread = false; - } else { - ConcurrentHashMap read_max = message.out ? dialogs_read_outbox_max : dialogs_read_inbox_max; - Integer value = read_max.get(message.dialog_id); - if (value == null) { - value = 0;//MessagesStorage.getInstance().getDialogReadMax(message.out, message.dialog_id); - read_max.put(message.dialog_id, value); - } - message.unread = value < message.id; - } - } - //MessagesStorage.getInstance().putDialogs(dialogsRes); - } - if (loadType == 2) { - //TLRPC.Chat chat = dialogsRes.chats.get(0); - //getChannelDifference(chat.id); - //checkChannelInviter(chat.id); - } - - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - if (loadType != 1) { - applyDialogsNotificationsSettings(dialogsRes.dialogs); - if (!UserConfig.draftsLoaded) { - DraftQuery.loadDrafts(); - } - } - putUsers(dialogsRes.users, loadType == 1); - putChats(dialogsRes.chats, loadType == 1); - if (encChats != null) { - for (int a = 0; a < encChats.size(); a++) { - TLRPC.EncryptedChat encryptedChat = encChats.get(a); - - if (encryptedChat instanceof TLRPC.TL_encryptedChat && AndroidUtilities.getMyLayerVersion(encryptedChat.layer) < SecretChatHelper.CURRENT_SECRET_CHAT_LAYER) { - SecretChatHelper.getInstance().sendNotifyLayerMessage(encryptedChat, null); - } - - putEncryptedChat(encryptedChat, true); - } - } - if (!migrate) { - loadingDialogs = false; - } - boolean added = false; - - int lastDialogDate = migrate && !dialogs.isEmpty() ? dialogs.get(dialogs.size() - 1).last_message_date : 0; - for (HashMap.Entry pair : new_dialogs_dict.entrySet()) { - Long key = pair.getKey(); - TLRPC.TL_dialog value = pair.getValue(); - if (migrate && lastDialogDate != 0 && value.last_message_date < lastDialogDate) { - continue; - } - TLRPC.TL_dialog currentDialog = dialogs_dict.get(key); - if (loadType != 1 && value.draft instanceof TLRPC.TL_draftMessage) { - DraftQuery.saveDraft(value.id, value.draft, null, false); - } - if (currentDialog == null) { - added = true; - dialogs_dict.put(key, value); - MessageObject messageObject = new_dialogMessage.get(value.id); - dialogMessage.put(key, messageObject); - if (messageObject != null && messageObject.messageOwner.to_id.channel_id == 0) { - dialogMessagesByIds.put(messageObject.getId(), messageObject); - if (messageObject.messageOwner.random_id != 0) { - dialogMessagesByRandomIds.put(messageObject.messageOwner.random_id, messageObject); - } - } - } else { - if (loadType != 1) { - currentDialog.notify_settings = value.notify_settings; - } - MessageObject oldMsg = dialogMessage.get(key); - if (oldMsg != null && oldMsg.deleted || oldMsg == null || currentDialog.top_message > 0) { - if (value.top_message >= currentDialog.top_message) { - dialogs_dict.put(key, value); - MessageObject messageObject = new_dialogMessage.get(value.id); - dialogMessage.put(key, messageObject); - if (messageObject != null && messageObject.messageOwner.to_id.channel_id == 0) { - dialogMessagesByIds.put(messageObject.getId(), messageObject); - if (messageObject != null && messageObject.messageOwner.random_id != 0) { - dialogMessagesByRandomIds.put(messageObject.messageOwner.random_id, messageObject); - } - } - if (oldMsg != null) { - dialogMessagesByIds.remove(oldMsg.getId()); - if (oldMsg.messageOwner.random_id != 0) { - dialogMessagesByRandomIds.remove(oldMsg.messageOwner.random_id); - } - } - } - } else { - MessageObject newMsg = new_dialogMessage.get(value.id); - if (oldMsg.deleted || newMsg == null || newMsg.messageOwner.date > oldMsg.messageOwner.date) { - dialogs_dict.put(key, value); - dialogMessage.put(key, newMsg); - if (newMsg != null && newMsg.messageOwner.to_id.channel_id == 0) { - dialogMessagesByIds.put(newMsg.getId(), newMsg); - if (newMsg != null && newMsg.messageOwner.random_id != 0) { - dialogMessagesByRandomIds.put(newMsg.messageOwner.random_id, newMsg); - } - } - dialogMessagesByIds.remove(oldMsg.getId()); - if (oldMsg.messageOwner.random_id != 0) { - dialogMessagesByRandomIds.remove(oldMsg.messageOwner.random_id); - } - } - } - } - } - - dialogs.clear(); - dialogs.addAll(dialogs_dict.values()); - sortDialogs(migrate ? chatsDict : null); - - if (loadType != 2) { - if (!migrate) { - dialogsEndReached = (dialogsRes.dialogs.size() == 0 || dialogsRes.dialogs.size() != count) && loadType == 0; - } - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - - if (migrate) { - UserConfig.migrateOffsetId = offset; - UserConfig.saveConfig(false); - migratingDialogs = false; - NotificationCenter.getInstance().postNotificationName(NotificationCenter.needReloadRecentDialogsSearch); - } else { - generateUpdateMessage(); - if (!added && loadType == 1) { - loadDialogs(0, count, false); - } - } - migrateDialogs(UserConfig.migrateOffsetId, UserConfig.migrateOffsetDate, UserConfig.migrateOffsetUserId, UserConfig.migrateOffsetChatId, UserConfig.migrateOffsetChannelId, UserConfig.migrateOffsetAccess); - if (!dialogsToReload.isEmpty()) { - reloadDialogsReadValue(dialogsToReload, 0); - } - } - }); - } - }); - } - */ - - /* - private void applyDialogNotificationsSettings(long dialog_id, TLRPC.PeerNotifySettings notify_settings) { - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); - int currentValue = preferences.getInt("notify2_" + dialog_id, 0); - int currentValue2 = preferences.getInt("notifyuntil_" + dialog_id, 0); - SharedPreferences.Editor editor = preferences.edit(); - boolean updated = false; - TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id); - if (dialog != null) { - dialog.notify_settings = notify_settings; - } - editor.putBoolean("silent_" + dialog_id, notify_settings.silent); - if (notify_settings.mute_until > ConnectionsManager.getInstance().getCurrentTime()) { - int until = 0; - if (notify_settings.mute_until > ConnectionsManager.getInstance().getCurrentTime() + 60 * 60 * 24 * 365) { - if (currentValue != 2) { - updated = true; - editor.putInt("notify2_" + dialog_id, 2); - if (dialog != null) { - dialog.notify_settings.mute_until = Integer.MAX_VALUE; - } - } - } else { - if (currentValue != 3 || currentValue2 != notify_settings.mute_until) { - updated = true; - until = notify_settings.mute_until; - editor.putInt("notify2_" + dialog_id, 3); - editor.putInt("notifyuntil_" + dialog_id, notify_settings.mute_until); - if (dialog != null) { - dialog.notify_settings.mute_until = until; - } - } - } - //MessagesStorage.getInstance().setDialogFlags(dialog_id, ((long) until << 32) | 1); - NotificationsController.getInstance().removeNotificationsForDialog(dialog_id); - } else { - if (currentValue != 0 && currentValue != 1) { - updated = true; - if (dialog != null) { - dialog.notify_settings.mute_until = 0; - } - editor.remove("notify2_" + dialog_id); - } - //MessagesStorage.getInstance().setDialogFlags(dialog_id, 0); - } - editor.commit(); - if (updated) { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.notificationsSettingsUpdated); - } - } - */ - - /* - private void applyDialogsNotificationsSettings(ArrayList dialogs) { - SharedPreferences.Editor editor = null; - for (int a = 0; a < dialogs.size(); a++) { - TLRPC.TL_dialog dialog = dialogs.get(a); - if (dialog.peer != null && dialog.notify_settings instanceof TLRPC.TL_peerNotifySettings) { - if (editor == null) { - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); - editor = preferences.edit(); - } - int dialog_id; - if (dialog.peer.user_id != 0) { - dialog_id = dialog.peer.user_id; - } else if (dialog.peer.chat_id != 0) { - dialog_id = -dialog.peer.chat_id; - } else { - dialog_id = -dialog.peer.channel_id; - } - editor.putBoolean("silent_" + dialog_id, dialog.notify_settings.silent); - if (dialog.notify_settings.mute_until != 0) { - if (dialog.notify_settings.mute_until > ConnectionsManager.getInstance().getCurrentTime() + 60 * 60 * 24 * 365) { - editor.putInt("notify2_" + dialog_id, 2); - dialog.notify_settings.mute_until = Integer.MAX_VALUE; - } else { - editor.putInt("notify2_" + dialog_id, 3); - editor.putInt("notifyuntil_" + dialog_id, dialog.notify_settings.mute_until); - } - } else { - editor.remove("notify2_" + dialog_id); - } - } - } - if (editor != null) { - editor.commit(); - } - } - */ - - public void processDialogsUpdateRead(final HashMap dialogsToUpdate) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - for (HashMap.Entry entry : dialogsToUpdate.entrySet()) { - TLRPC.TL_dialog currentDialog = dialogs_dict.get(entry.getKey()); - if (currentDialog != null) { - currentDialog.unread_count = entry.getValue(); - } - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_READ_DIALOG_MESSAGE); - NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate); - } - }); - } - protected void checkLastDialogMessage(final TLRPC.TL_dialog dialog, final TLRPC.InputPeer peer, long taskId) { final int lower_id = (int) dialog.id; if (lower_id == 0 || checkingLastMessagesDialogs.containsKey(lower_id)) { @@ -3413,175 +1759,15 @@ public class MessagesController implements NotificationCenter.NotificationCenter } public void markMessageContentAsRead(final MessageObject messageObject) { - /* - ArrayList arrayList = new ArrayList<>(); - long messageId = messageObject.getId(); - if (messageObject.messageOwner.to_id.channel_id != 0) { - messageId |= ((long) messageObject.messageOwner.to_id.channel_id) << 32; - } - arrayList.add(messageId); - MessagesStorage.getInstance().markMessagesContentAsRead(arrayList); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.messagesReadContent, arrayList); - if (messageObject.getId() < 0) { - markMessageAsRead(messageObject.getDialogId(), messageObject.messageOwner.random_id, Integer.MIN_VALUE); - } else { - TLRPC.TL_messages_readMessageContents req = new TLRPC.TL_messages_readMessageContents(); - req.id.add(messageObject.getId()); - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error == null) { - TLRPC.TL_messages_affectedMessages res = (TLRPC.TL_messages_affectedMessages) response; - processNewDifferenceParams(-1, res.pts, -1, res.pts_count); - } - } - }); - } - */ } public void markMessageAsRead(final long dialog_id, final long random_id, int ttl) { if (random_id == 0 || dialog_id == 0 || ttl <= 0 && ttl != Integer.MIN_VALUE) { return; } - /* - int lower_part = (int) dialog_id; - int high_id = (int) (dialog_id >> 32); - if (lower_part != 0) { - return; - } - TLRPC.EncryptedChat chat = getEncryptedChat(high_id); - if (chat == null) { - return; - } - ArrayList random_ids = new ArrayList<>(); - random_ids.add(random_id); - SecretChatHelper.getInstance().sendMessagesReadMessage(chat, random_ids, null); - if (ttl > 0) { - int time = ConnectionsManager.getInstance().getCurrentTime(); - MessagesStorage.getInstance().createTaskForSecretChat(chat.id, time, time, 0, random_ids); - } - */ } public void markDialogAsRead(final long dialog_id, final int max_id, final int max_positive_id, final int max_date, final boolean was, final boolean popup) { - /* - int lower_part = (int) dialog_id; - int high_id = (int) (dialog_id >> 32); - - if (lower_part != 0) { - if (max_positive_id == 0 || high_id == 1) { - return; - } - TLRPC.InputPeer inputPeer = getInputPeer(lower_part); - TLObject req; - long messageId = max_positive_id; - if (inputPeer instanceof TLRPC.TL_inputPeerChannel) { - TLRPC.TL_channels_readHistory request = new TLRPC.TL_channels_readHistory(); - request.channel = getInputChannel(-lower_part); - request.max_id = max_positive_id; - req = request; - messageId |= ((long) -lower_part) << 32; - } else { - TLRPC.TL_messages_readHistory request = new TLRPC.TL_messages_readHistory(); - request.peer = inputPeer; - request.max_id = max_positive_id; - req = request; - } - Integer value = dialogs_read_inbox_max.get(dialog_id); - if (value == null) { - value = 0; - } - dialogs_read_inbox_max.put(dialog_id, Math.max(value, max_positive_id)); - - MessagesStorage.getInstance().processPendingRead(dialog_id, messageId, max_date); - MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { - @Override - public void run() { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id); - if (dialog != null) { - dialog.unread_count = 0; - NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_READ_DIALOG_MESSAGE); - } - if (!popup) { - NotificationsController.getInstance().processReadMessages(null, dialog_id, 0, max_positive_id, false); - HashMap dialogsToUpdate = new HashMap<>(); - dialogsToUpdate.put(dialog_id, 0); - NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate); - } else { - NotificationsController.getInstance().processReadMessages(null, dialog_id, 0, max_positive_id, true); - HashMap dialogsToUpdate = new HashMap<>(); - dialogsToUpdate.put(dialog_id, -1); - NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate); - } - } - }); - } - }); - - if (max_positive_id != Integer.MAX_VALUE) { - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error == null) { - if (response instanceof TLRPC.TL_messages_affectedMessages) { - TLRPC.TL_messages_affectedMessages res = (TLRPC.TL_messages_affectedMessages) response; - processNewDifferenceParams(-1, res.pts, -1, res.pts_count); - } - } - } - }); - } - } else { - if (max_date == 0) { - return; - } - TLRPC.EncryptedChat chat = getEncryptedChat(high_id); - if (chat.auth_key != null && chat.auth_key.length > 1 && chat instanceof TLRPC.TL_encryptedChat) { - TLRPC.TL_messages_readEncryptedHistory req = new TLRPC.TL_messages_readEncryptedHistory(); - req.peer = new TLRPC.TL_inputEncryptedChat(); - req.peer.chat_id = chat.id; - req.peer.access_hash = chat.access_hash; - req.max_date = max_date; - - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - MessagesStorage.getInstance().processPendingRead(dialog_id, max_id, max_date, true); - } - }); - } - MessagesStorage.getInstance().processPendingRead(dialog_id, max_id, max_date); - - MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { - @Override - public void run() { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - NotificationsController.getInstance().processReadMessages(null, dialog_id, max_date, 0, popup); - TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id); - if (dialog != null) { - dialog.unread_count = 0; - NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_READ_DIALOG_MESSAGE); - } - HashMap dialogsToUpdate = new HashMap<>(); - dialogsToUpdate.put(dialog_id, 0); - NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate); - } - }); - } - }); - - if (chat.ttl > 0 && was) { - int serverTime = Math.max(ConnectionsManager.getInstance().getCurrentTime(), max_date); - MessagesStorage.getInstance().createTaskForSecretChat(chat.id, serverTime, serverTime, 0, null); - } - } - */ } public int createChat(String title, ArrayList selectedContacts, final String about, int type, final BaseFragment fragment) { @@ -3732,331 +1918,13 @@ public class MessagesController implements NotificationCenter.NotificationCenter return 0; } - /* - public void convertToMegaGroup(final Context context, int chat_id) { - TLRPC.TL_messages_migrateChat req = new TLRPC.TL_messages_migrateChat(); - req.chat_id = chat_id; - final ProgressDialog progressDialog = new ProgressDialog(context); - progressDialog.setMessage(LocaleController.getString("Loading", R.string.Loading)); - progressDialog.setCanceledOnTouchOutside(false); - progressDialog.setCancelable(false); - final int reqId = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error == null) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - if (!((Activity) context).isFinishing()) { - try { - progressDialog.dismiss(); - } catch (Exception e) { - FileLog.e("tmessages", e); - } - } - } - }); - TLRPC.Updates updates = (TLRPC.Updates) response; - processUpdates((TLRPC.Updates) response, false); - } else { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - if (!((Activity) context).isFinishing()) { - try { - progressDialog.dismiss(); - } catch (Exception e) { - FileLog.e("tmessages", e); - } - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); - builder.setMessage(LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred)); - builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); - builder.show().setCanceledOnTouchOutside(true); - } - } - }); - } - } - }); - progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, LocaleController.getString("Cancel", R.string.Cancel), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - ConnectionsManager.getInstance().cancelRequest(reqId, true); - try { - dialog.dismiss(); - } catch (Exception e) { - FileLog.e("tmessages", e); - } - } - }); - try { - progressDialog.show(); - } catch (Exception e) { - //don't promt - } - } - */ - - public void addUserToChat(final int chat_id, final TLRPC.User user, final TLRPC.ChatFull info, int count_fwd, String botHash, final BaseFragment fragment) { - /* - if (user == null) { - return; - } - - if (chat_id > 0) { - TLObject request; - - final boolean isChannel = ChatObject.isChannel(chat_id); - final boolean isMegagroup = isChannel && getChat(chat_id).megagroup; - final TLRPC.InputUser inputUser = getInputUser(user); - if (botHash == null || isChannel && !isMegagroup) { - if (isChannel) { - if (inputUser instanceof TLRPC.TL_inputUserSelf) { - if (joiningToChannels.contains(chat_id)) { - return; - } - TLRPC.TL_channels_joinChannel req = new TLRPC.TL_channels_joinChannel(); - req.channel = getInputChannel(chat_id); - request = req; - joiningToChannels.add(chat_id); - } else { - if (user.bot && !isMegagroup) { - TLRPC.TL_channels_editAdmin req = new TLRPC.TL_channels_editAdmin(); - req.channel = getInputChannel(chat_id); - req.user_id = getInputUser(user); - req.role = new TLRPC.TL_channelRoleEditor(); - request = req; - } else { - TLRPC.TL_channels_inviteToChannel req = new TLRPC.TL_channels_inviteToChannel(); - req.channel = getInputChannel(chat_id); - req.users.add(inputUser); - request = req; - } - } - } else { - TLRPC.TL_messages_addChatUser req = new TLRPC.TL_messages_addChatUser(); - req.chat_id = chat_id; - req.fwd_limit = count_fwd; - req.user_id = inputUser; - request = req; - } - } else { - TLRPC.TL_messages_startBot req = new TLRPC.TL_messages_startBot(); - req.bot = inputUser; - if (isChannel) { - req.peer = getInputPeer(-chat_id); - } else { - req.peer = new TLRPC.TL_inputPeerChat(); - req.peer.chat_id = chat_id; - } - req.start_param = botHash; - req.random_id = Utilities.random.nextLong(); - request = req; - } - - ConnectionsManager.getInstance().sendRequest(request, new RequestDelegate() { - @Override - public void run(TLObject response, final TLRPC.TL_error error) { - if (isChannel && inputUser instanceof TLRPC.TL_inputUserSelf) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - joiningToChannels.remove((Integer) chat_id); - } - }); - } - if (error != null) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - if (fragment != null) { - AlertsCreator.showAddUserAlert(error.text, fragment, isChannel && !isMegagroup); -- EDIT BY MR - } else { - if (error.text.equals("PEER_FLOOD")) { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.needShowAlert, 1); - } - } - } - }); - return; - } - boolean hasJoinMessage = false; - TLRPC.Updates updates = (TLRPC.Updates) response; - for (int a = 0; a < updates.updates.size(); a++) { - TLRPC.Update update = updates.updates.get(a); - if (update instanceof TLRPC.TL_updateNewChannelMessage) { - if (((TLRPC.TL_updateNewChannelMessage) update).message.action instanceof TLRPC.TL_messageActionChatAddUser) { - hasJoinMessage = true; - break; - } - } - } - processUpdates(updates, false); - if (isChannel) { - if (!hasJoinMessage && inputUser instanceof TLRPC.TL_inputUserSelf) { - generateJoinMessage(chat_id, true); - } - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - loadFullChat(chat_id, 0, true); - } - }, 1000); - } - if (isChannel && inputUser instanceof TLRPC.TL_inputUserSelf) { - MessagesStorage.getInstance().updateDialogsWithDeletedMessages(new ArrayList(), true, chat_id); - } - } - }); - } else { - if (info instanceof TLRPC.TL_chatFull) { - for (int a = 0; a < info.participants.participants.size(); a++) { - if (info.participants.participants.get(a).user_id == user.id) { - return; - } - } - - TLRPC.Chat chat = getChat(chat_id); - chat.participants_count++; - ArrayList chatArrayList = new ArrayList<>(); - chatArrayList.add(chat); - MessagesStorage.getInstance().putUsersAndChats(null, chatArrayList, true, true); - - TLRPC.TL_chatParticipant newPart = new TLRPC.TL_chatParticipant(); - newPart.user_id = user.id; - newPart.inviter_id = UserConfig.getClientUserId(); - newPart.date = ConnectionsManager.getInstance().getCurrentTime(); - info.participants.participants.add(0, newPart); - MessagesStorage.getInstance().updateChatInfo(info, true); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatInfoDidLoaded, info, 0, false, null); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_CHAT_MEMBERS); - } - } - */ + public void addUserToChat(final int chat_id, final TLRPC.User user, final TLRPC.ChatFull info, int count_fwd, String botHash, final BaseFragment fragment) { } public void deleteUserFromChat(final int chat_id, final TLRPC.User user, final TLRPC.ChatFull info) { - /* - if (user == null) { - return; - } - if (chat_id > 0) { - final TLRPC.InputUser inputUser = getInputUser(user); - TLObject request; - TLRPC.Chat chat = getChat(chat_id); - final boolean isChannel = ChatObject.isChannel(chat); - if (isChannel) { - if (inputUser instanceof TLRPC.TL_inputUserSelf) { - if (chat.creator) { - TLRPC.TL_channels_deleteChannel req = new TLRPC.TL_channels_deleteChannel(); - req.channel = getInputChannel(chat); - request = req; - } else { - TLRPC.TL_channels_leaveChannel req = new TLRPC.TL_channels_leaveChannel(); - req.channel = getInputChannel(chat); - request = req; - } - } else { - TLRPC.TL_channels_kickFromChannel req = new TLRPC.TL_channels_kickFromChannel(); - req.channel = getInputChannel(chat); - req.user_id = inputUser; - req.kicked = true; - request = req; - } - } else { - TLRPC.TL_messages_deleteChatUser req = new TLRPC.TL_messages_deleteChatUser(); - req.chat_id = chat_id; - req.user_id = getInputUser(user); - request = req; - } - ConnectionsManager.getInstance().sendRequest(request, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (user.id == UserConfig.getClientUserId()) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - deleteDialog(-chat_id, 0); - } - }); - } - if (error != null) { - return; - } - final TLRPC.Updates updates = (TLRPC.Updates) response; - processUpdates(updates, false); - if (isChannel && !(inputUser instanceof TLRPC.TL_inputUserSelf)) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - loadFullChat(chat_id, 0, true); - } - }, 1000); - } - } - }, ConnectionsManager.RequestFlagInvokeAfter); - } else { - if (info instanceof TLRPC.TL_chatFull) { - TLRPC.Chat chat = getChat(chat_id); - chat.participants_count--; - ArrayList chatArrayList = new ArrayList<>(); - chatArrayList.add(chat); - MessagesStorage.getInstance().putUsersAndChats(null, chatArrayList, true, true); - - boolean changed = false; - for (int a = 0; a < info.participants.participants.size(); a++) { - TLRPC.ChatParticipant p = info.participants.participants.get(a); - if (p.user_id == user.id) { - info.participants.participants.remove(a); - changed = true; - break; - } - } - if (changed) { - MessagesStorage.getInstance().updateChatInfo(info, true); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatInfoDidLoaded, info, 0, false, null); - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_CHAT_MEMBERS); - } - } - */ } public void changeChatTitle(int chat_id, String title) { - /* - if (chat_id > 0) { - TLObject request; - if (ChatObject.isChannel(chat_id)) { - TLRPC.TL_channels_editTitle req = new TLRPC.TL_channels_editTitle(); - req.channel = getInputChannel(chat_id); - req.title = title; - request = req; - } else { - TLRPC.TL_messages_editChatTitle req = new TLRPC.TL_messages_editChatTitle(); - req.chat_id = chat_id; - req.title = title; - request = req; - } - ConnectionsManager.getInstance().sendRequest(request, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error != null) { - return; - } - processUpdates((TLRPC.Updates) response, false); - } - }, ConnectionsManager.RequestFlagInvokeAfter); - } else { - TLRPC.Chat chat = getChat(chat_id); - chat.title = title; - ArrayList chatArrayList = new ArrayList<>(); - chatArrayList.add(chat); - //MessagesStorage.getInstance().putUsersAndChats(null, chatArrayList, true, true); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_CHAT_NAME); - } - */ } public void changeChatAvatar(int chat_id, TLRPC.InputFile uploadedAvatar) { @@ -4095,164 +1963,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter }, ConnectionsManager.RequestFlagInvokeAfter); } - /* - public void unregistedPush() { - if (UserConfig.registeredForPush && UserConfig.pushString.length() == 0) { - TLRPC.TL_account_unregisterDevice req = new TLRPC.TL_account_unregisterDevice(); - req.token = UserConfig.pushString; - req.token_type = 2; - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - - } - }); - } - } - */ - - /* EDIT BY MR - public void performLogout(boolean byUser) { - SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE).edit(); - editor.clear().commit(); - editor = ApplicationLoader.applicationContext.getSharedPreferences("emoji", Activity.MODE_PRIVATE).edit(); - editor.putLong("lastGifLoadTime", 0).commit(); - editor = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).edit(); - editor.remove("gifhint").commit(); - - if (byUser) { - unregistedPush(); - TLRPC.TL_auth_logOut req = new TLRPC.TL_auth_logOut(); - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - ConnectionsManager.getInstance().cleanup(); - } - }); - } else { - ConnectionsManager.getInstance().cleanup(); - } - UserConfig.clearConfig(); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.appDidLogout); - MessagesStorage.getInstance().cleanup(false); - cleanup(); - ContactsController.getInstance().deleteAllAppAccounts(); - } - */ - - /* - public void generateUpdateMessage() { - if (BuildVars.DEBUG_VERSION || UserConfig.lastUpdateVersion == null || UserConfig.lastUpdateVersion.equals(BuildVars.BUILD_VERSION_STRING)) { - return; - } - TLRPC.TL_help_getAppChangelog req = new TLRPC.TL_help_getAppChangelog(); - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error == null) { - UserConfig.lastUpdateVersion = BuildVars.BUILD_VERSION_STRING; - UserConfig.saveConfig(false); - } - if (response instanceof TLRPC.TL_help_appChangelog) { - TLRPC.TL_updateServiceNotification update = new TLRPC.TL_updateServiceNotification(); - update.message = ((TLRPC.TL_help_appChangelog) response).text; - update.media = new TLRPC.TL_messageMediaEmpty(); - update.type = "update"; - update.popup = false; - ArrayList updates = new ArrayList<>(); - updates.add(update); - processUpdateArray(updates, null, null, false); - } - } - }); - } - */ - - /* - public void registerForPush(final String regid) { - if (regid == null || regid.length() == 0 || registeringForPush || UserConfig.getClientUserId() == 0) { - return; - } - if (UserConfig.registeredForPush && regid.equals(UserConfig.pushString)) { - return; - } - registeringForPush = true; - TLRPC.TL_account_registerDevice req = new TLRPC.TL_account_registerDevice(); - req.token_type = 2; - req.token = regid; - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (response instanceof TLRPC.TL_boolTrue) { - FileLog.e("tmessages", "registered for push"); - UserConfig.registeredForPush = true; - UserConfig.pushString = regid; - UserConfig.saveConfig(false); - } - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - registeringForPush = false; - } - }); - } - }); - } - */ - - /* - public void loadCurrentState() { - if (updatingState) { - return; - } - updatingState = true; - TLRPC.TL_updates_getState req = new TLRPC.TL_updates_getState(); - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - updatingState = false; - if (error == null) { - TLRPC.TL_updates_state res = (TLRPC.TL_updates_state) response; - MessagesStorage.lastDateValue = res.date; - MessagesStorage.lastPtsValue = res.pts; - MessagesStorage.lastSeqValue = res.seq; - MessagesStorage.lastQtsValue = res.qts; - for (int a = 0; a < 3; a++) { - processUpdatesQueue(a, 2); - } - MessagesStorage.getInstance().saveDiffParams(MessagesStorage.lastSeqValue, MessagesStorage.lastPtsValue, MessagesStorage.lastDateValue, MessagesStorage.lastQtsValue); - } else { - if (error.code != 401) { - loadCurrentState(); - } - } - } - }); - } - */ - - /* - private int getUpdateSeq(TLRPC.Updates updates) { - if (updates instanceof TLRPC.TL_updatesCombined) { - return updates.seq_start; - } else { - return updates.seq; - } - } - */ - - /* - private void setUpdatesStartTime(int type, long time) { - if (type == 0) { - updatesStartWaitTimeSeq = time; - } else if (type == 1) { - updatesStartWaitTimePts = time; - } else if (type == 2) { - updatesStartWaitTimeQts = time; - } - } - */ - public long getUpdatesStartTime(int type) { if (type == 0) { return updatesStartWaitTimeSeq; @@ -4264,809 +1974,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter return 0; } - /* - private int isValidUpdate(TLRPC.Updates updates, int type) { - if (type == 0) { - int seq = getUpdateSeq(updates); - if (MessagesStorage.lastSeqValue + 1 == seq || MessagesStorage.lastSeqValue == seq) { - return 0; - } else if (MessagesStorage.lastSeqValue < seq) { - return 1; - } else { - return 2; - } - } else if (type == 1) { - if (updates.pts <= MessagesStorage.lastPtsValue) { - return 2; - } else if (MessagesStorage.lastPtsValue + updates.pts_count == updates.pts) { - return 0; - } else { - return 1; - } - } else if (type == 2) { - if (updates.pts <= MessagesStorage.lastQtsValue) { - return 2; - } else if (MessagesStorage.lastQtsValue + updates.updates.size() == updates.pts) { - return 0; - } else { - return 1; - } - } - return 0; - } - */ - - /* - private void processChannelsUpdatesQueue(int channelId, int state) { - ArrayList updatesQueue = updatesQueueChannels.get(channelId); - if (updatesQueue == null) { - return; - } - Integer channelPts = channelsPts.get(channelId); - if (updatesQueue.isEmpty() || channelPts == null) { - updatesQueueChannels.remove(channelId); - return; - } - Collections.sort(updatesQueue, new Comparator() { - @Override - public int compare(TLRPC.Updates updates, TLRPC.Updates updates2) { - return AndroidUtilities.compare(updates.pts, updates2.pts); - } - }); - boolean anyProceed = false; - if (state == 2) { - channelsPts.put(channelId, updatesQueue.get(0).pts); - } - for (int a = 0; a < updatesQueue.size(); a++) { - TLRPC.Updates updates = updatesQueue.get(a); - int updateState; - if (updates.pts <= channelPts) { - updateState = 2; - } else if (channelPts + updates.pts_count == updates.pts) { - updateState = 0; - } else { - updateState = 1; - } - if (updateState == 0) { - processUpdates(updates, true); - anyProceed = true; - updatesQueue.remove(a); - a--; - } else if (updateState == 1) { - Long updatesStartWaitTime = updatesStartWaitTimeChannels.get(channelId); - if (updatesStartWaitTime != null && (anyProceed || Math.abs(System.currentTimeMillis() - updatesStartWaitTime) <= 1500)) { - FileLog.e("tmessages", "HOLE IN CHANNEL " + channelId + " UPDATES QUEUE - will wait more time"); - if (anyProceed) { - updatesStartWaitTimeChannels.put(channelId, System.currentTimeMillis()); - } - return; - } else { - FileLog.e("tmessages", "HOLE IN CHANNEL " + channelId + " UPDATES QUEUE - getChannelDifference "); - updatesStartWaitTimeChannels.remove(channelId); - updatesQueueChannels.remove(channelId); - getChannelDifference(channelId); - return; - } - } else { - updatesQueue.remove(a); - a--; - } - } - updatesQueueChannels.remove(channelId); - updatesStartWaitTimeChannels.remove(channelId); - FileLog.e("tmessages", "UPDATES CHANNEL " + channelId + " QUEUE PROCEED - OK"); - } - */ - - /* - private void processUpdatesQueue(int type, int state) { - ArrayList updatesQueue = null; - if (type == 0) { - updatesQueue = updatesQueueSeq; - Collections.sort(updatesQueue, new Comparator() { - @Override - public int compare(TLRPC.Updates updates, TLRPC.Updates updates2) { - return AndroidUtilities.compare(getUpdateSeq(updates), getUpdateSeq(updates2)); - } - }); - } else if (type == 1) { - updatesQueue = updatesQueuePts; - Collections.sort(updatesQueue, new Comparator() { - @Override - public int compare(TLRPC.Updates updates, TLRPC.Updates updates2) { - return AndroidUtilities.compare(updates.pts, updates2.pts); - } - }); - } else if (type == 2) { - updatesQueue = updatesQueueQts; - Collections.sort(updatesQueue, new Comparator() { - @Override - public int compare(TLRPC.Updates updates, TLRPC.Updates updates2) { - return AndroidUtilities.compare(updates.pts, updates2.pts); - } - }); - } - if (updatesQueue != null && !updatesQueue.isEmpty()) { - boolean anyProceed = false; - if (state == 2) { - TLRPC.Updates updates = updatesQueue.get(0); - if (type == 0) { - MessagesStorage.lastSeqValue = getUpdateSeq(updates); - } else if (type == 1) { - MessagesStorage.lastPtsValue = updates.pts; - } else { - MessagesStorage.lastQtsValue = updates.pts; - } - } - for (int a = 0; a < updatesQueue.size(); a++) { - TLRPC.Updates updates = updatesQueue.get(a); - int updateState = isValidUpdate(updates, type); - if (updateState == 0) { - processUpdates(updates, true); - anyProceed = true; - updatesQueue.remove(a); - a--; - } else if (updateState == 1) { - if (getUpdatesStartTime(type) != 0 && (anyProceed || Math.abs(System.currentTimeMillis() - getUpdatesStartTime(type)) <= 1500)) { - FileLog.e("tmessages", "HOLE IN UPDATES QUEUE - will wait more time"); - if (anyProceed) { - setUpdatesStartTime(type, System.currentTimeMillis()); - } - return; - } else { - FileLog.e("tmessages", "HOLE IN UPDATES QUEUE - getDifference"); - setUpdatesStartTime(type, 0); - updatesQueue.clear(); - getDifference(); - return; - } - } else { - updatesQueue.remove(a); - a--; - } - } - updatesQueue.clear(); - FileLog.e("tmessages", "UPDATES QUEUE PROCEED - OK"); - } - setUpdatesStartTime(type, 0); - } - */ - - /* - protected void loadUnknownChannel(final TLRPC.Chat channel, final long taskId) { - if (!(channel instanceof TLRPC.TL_channel) || gettingUnknownChannels.containsKey(channel.id)) { - return; - } - gettingUnknownChannels.put(channel.id, true); - TLRPC.TL_inputPeerChannel inputPeer = new TLRPC.TL_inputPeerChannel(); - inputPeer.channel_id = channel.id; - inputPeer.access_hash = channel.access_hash; - TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs(); - req.peers.add(inputPeer); - final long newTaskId; - if (taskId == 0) { - NativeByteBuffer data = null; - try { - data = new NativeByteBuffer(4 + channel.getObjectSize()); - data.writeInt32(0); - channel.serializeToStream(data); - - } catch (Exception e) { - FileLog.e("tmessages", e); - } - newTaskId = 0;//MessagesStorage.getInstance().createPendingTask(data); - } else { - newTaskId = taskId; - } - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (response != null) { - TLRPC.TL_messages_peerDialogs res = (TLRPC.TL_messages_peerDialogs) response; - if (!res.dialogs.isEmpty() && !res.chats.isEmpty()) { - TLRPC.TL_messages_dialogs dialogs = new TLRPC.TL_messages_dialogs(); - dialogs.dialogs.addAll(res.dialogs); - dialogs.messages.addAll(res.messages); - dialogs.users.addAll(res.users); - dialogs.chats.addAll(res.chats); - processLoadedDialogs(dialogs, null, 0, 1, 2, false, false); - } - } - if (newTaskId != 0) { - //MessagesStorage.getInstance().removePendingTask(newTaskId); - } - gettingUnknownChannels.remove(channel.id); - } - }); - } - */ - - /* - public void startShortPoll(final int channelId, final boolean stop) { - Utilities.stageQueue.postRunnable(new Runnable() { - @Override - public void run() { - if (stop) { - needShortPollChannels.delete(channelId); - } else { - needShortPollChannels.put(channelId, 0); - if (shortPollChannels.indexOfKey(channelId) < 0) { - getChannelDifference(channelId, 2, 0); - } - } - } - }); - } - */ - - /* - private void getChannelDifference(final int channelId) { - getChannelDifference(channelId, 0, 0); - } - - protected void getChannelDifference(final int channelId, final int newDialogType, final long taskId) { - Boolean gettingDifferenceChannel = gettingDifferenceChannels.get(channelId); - if (gettingDifferenceChannel == null) { - gettingDifferenceChannel = false; - } - if (gettingDifferenceChannel) { - return; - } - int limit = 100; - Integer channelPts; - if (newDialogType == 1) { - channelPts = channelsPts.get(channelId); - if (channelPts != null) { - return; - } - channelPts = 1; - limit = 1; - } else { - channelPts = channelsPts.get(channelId); - if (channelPts == null) { - channelPts = MessagesStorage.getInstance().getChannelPtsSync(channelId); - if (channelPts != 0) { - channelsPts.put(channelId, channelPts); - } - if (channelPts == 0 && newDialogType == 2) { - return; - } - } - if (channelPts == 0) { - return; - } - } - - final long newTaskId; - if (taskId == 0) { - NativeByteBuffer data = null; - try { - data = new NativeByteBuffer(12); - data.writeInt32(1); - data.writeInt32(channelId); - data.writeInt32(newDialogType); - } catch (Exception e) { - FileLog.e("tmessages", e); - } - newTaskId = MessagesStorage.getInstance().createPendingTask(data); - } else { - newTaskId = taskId; - } - - gettingDifferenceChannels.put(channelId, true); - TLRPC.TL_updates_getChannelDifference req = new TLRPC.TL_updates_getChannelDifference(); - req.channel = getInputChannel(channelId); - req.filter = new TLRPC.TL_channelMessagesFilterEmpty(); - req.pts = channelPts; - req.limit = limit; - FileLog.e("tmessages", "start getChannelDifference with pts = " + channelPts + " channelId = " + channelId); - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, final TLRPC.TL_error error) { - if (error == null) { - final TLRPC.updates_ChannelDifference res = (TLRPC.updates_ChannelDifference) response; - - final HashMap usersDict = new HashMap<>(); - for (int a = 0; a < res.users.size(); a++) { - TLRPC.User user = res.users.get(a); - usersDict.put(user.id, user); - } - TLRPC.Chat channel = null; - for (int a = 0; a < res.chats.size(); a++) { - TLRPC.Chat chat = res.chats.get(a); - if (chat.id == channelId) { - channel = chat; - break; - } - } - final TLRPC.Chat channelFinal = channel; - - final ArrayList msgUpdates = new ArrayList<>(); - if (!res.other_updates.isEmpty()) { - for (int a = 0; a < res.other_updates.size(); a++) { - TLRPC.Update upd = res.other_updates.get(a); - if (upd instanceof TLRPC.TL_updateMessageID) { - msgUpdates.add((TLRPC.TL_updateMessageID) upd); - res.other_updates.remove(a); - a--; - } - } - } - - MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, true, true); - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - putUsers(res.users, false); - putChats(res.chats, false); - } - }); - - MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { - @Override - public void run() { - if (!msgUpdates.isEmpty()) { - final HashMap corrected = new HashMap<>(); - for (TLRPC.TL_updateMessageID update : msgUpdates) { - long[] ids = MessagesStorage.getInstance().updateMessageStateAndId(update.random_id, null, update.id, 0, false, channelId); - if (ids != null) { - corrected.put(update.id, ids); - } - } - - if (!corrected.isEmpty()) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - for (HashMap.Entry entry : corrected.entrySet()) { - Integer newId = entry.getKey(); - long[] ids = entry.getValue(); - Integer oldId = (int) ids[1]; - SendMessagesHelper.getInstance().processSentMessage(oldId); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.messageReceivedByServer, oldId, newId, null, ids[0]); - } - } - }); - } - } - - Utilities.stageQueue.postRunnable(new Runnable() { - @Override - public void run() { - if (res instanceof TLRPC.TL_updates_channelDifference || res instanceof TLRPC.TL_updates_channelDifferenceEmpty) { - if (!res.new_messages.isEmpty()) { - final HashMap> messages = new HashMap<>(); - ImageLoader.saveMessagesThumbs(res.new_messages); - - final ArrayList pushMessages = new ArrayList<>(); - long dialog_id = -channelId; - Integer inboxValue = dialogs_read_inbox_max.get(dialog_id); - if (inboxValue == null) { - inboxValue = MessagesStorage.getInstance().getDialogReadMax(true, dialog_id); - dialogs_read_inbox_max.put(dialog_id, inboxValue); - } - - Integer outboxValue = dialogs_read_outbox_max.get(dialog_id); - if (outboxValue == null) { - outboxValue = MessagesStorage.getInstance().getDialogReadMax(true, dialog_id); - dialogs_read_outbox_max.put(dialog_id, outboxValue); - } - - for (int a = 0; a < res.new_messages.size(); a++) { - TLRPC.Message message = res.new_messages.get(a); - message.unread = !(channelFinal != null && channelFinal.left || (message.out ? outboxValue : inboxValue) >= message.id || message.action instanceof TLRPC.TL_messageActionChannelCreate); - if (channelFinal != null && channelFinal.megagroup) { - message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP; - } - - MessageObject obj = new MessageObject(message, usersDict, createdDialogIds.contains(dialog_id)); - if (!obj.isOut() && obj.isUnread()) { - pushMessages.add(obj); - } - - long uid = -channelId; - ArrayList arr = messages.get(uid); - if (arr == null) { - arr = new ArrayList<>(); - messages.put(uid, arr); - } - arr.add(obj); - } - - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - for (HashMap.Entry> pair : messages.entrySet()) { - Long key = pair.getKey(); - ArrayList value = pair.getValue(); - updateInterfaceWithMessages(key, value); - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - } - }); - MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { - @Override - public void run() { - if (!pushMessages.isEmpty()) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - NotificationsController.getInstance().processNewMessages(pushMessages, true); - } - }); - } - MessagesStorage.getInstance().putMessages(res.new_messages, true, false, false, MediaController.getInstance().getAutodownloadMask()); - } - }); - } - - if (!res.other_updates.isEmpty()) { - processUpdateArray(res.other_updates, res.users, res.chats, true); - } - processChannelsUpdatesQueue(channelId, 1); - MessagesStorage.getInstance().saveChannelPts(channelId, res.pts); - } else if (res instanceof TLRPC.TL_updates_channelDifferenceTooLong) { - long dialog_id = -channelId; - - Integer inboxValue = dialogs_read_inbox_max.get(dialog_id); - if (inboxValue == null) { - inboxValue = MessagesStorage.getInstance().getDialogReadMax(true, dialog_id); - dialogs_read_inbox_max.put(dialog_id, inboxValue); - } - - Integer outboxValue = dialogs_read_outbox_max.get(dialog_id); - if (outboxValue == null) { - outboxValue = MessagesStorage.getInstance().getDialogReadMax(true, dialog_id); - dialogs_read_outbox_max.put(dialog_id, outboxValue); - } - - for (int a = 0; a < res.messages.size(); a++) { - TLRPC.Message message = res.messages.get(a); - message.dialog_id = -channelId; - message.unread = !(message.action instanceof TLRPC.TL_messageActionChannelCreate || channelFinal != null && channelFinal.left || (message.out ? outboxValue : inboxValue) >= message.id); - if (channelFinal != null && channelFinal.megagroup) { - message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP; - } - } - MessagesStorage.getInstance().overwriteChannel(channelId, (TLRPC.TL_updates_channelDifferenceTooLong) res, newDialogType); - } - gettingDifferenceChannels.remove(channelId); - channelsPts.put(channelId, res.pts); - - if ((res.flags & 2) != 0) { - shortPollChannels.put(channelId, (int) (System.currentTimeMillis() / 1000) + res.timeout); - } - if (!res.isFinal) { - getChannelDifference(channelId); - } - FileLog.e("tmessages", "received channel difference with pts = " + res.pts + " channelId = " + channelId); - FileLog.e("tmessages", "new_messages = " + res.new_messages.size() + " messages = " + res.messages.size() + " users = " + res.users.size() + " chats = " + res.chats.size() + " other updates = " + res.other_updates.size()); - - if (newTaskId != 0) { - MessagesStorage.getInstance().removePendingTask(newTaskId); - } - } - }); - } - }); - } else { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - checkChannelError(error.text, channelId); - } - }); - gettingDifferenceChannels.remove(channelId); - if (newTaskId != 0) { - MessagesStorage.getInstance().removePendingTask(newTaskId); - } - } - } - }); - } - - private void checkChannelError(String text, int channelId) { - switch (text) { - case "CHANNEL_PRIVATE": - NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatInfoCantLoad, channelId, 0); - break; - case "CHANNEL_PUBLIC_GROUP_NA": - NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatInfoCantLoad, channelId, 1); - break; - case "USER_BANNED_IN_CHANNEL": - NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatInfoCantLoad, channelId, 2); - break; - } - } - */ - public void getDifference() { - //getDifference(MessagesStorage.lastPtsValue, MessagesStorage.lastDateValue, MessagesStorage.lastQtsValue, false); } - /* - public void getDifference(int pts, int date, int qts, boolean slice) { - registerForPush(UserConfig.pushString); - if (MessagesStorage.lastPtsValue == 0) { - loadCurrentState(); - return; - } - if (!slice && gettingDifference) { - return; - } - if (!firstGettingTask) { - getNewDeleteTask(null); - firstGettingTask = true; - } - gettingDifference = true; - TLRPC.TL_updates_getDifference req = new TLRPC.TL_updates_getDifference(); - req.pts = pts; - req.date = date; - req.qts = qts; - if (req.date == 0) { - req.date = ConnectionsManager.getInstance().getCurrentTime(); - } - FileLog.e("tmessages", "start getDifference with date = " + MessagesStorage.lastDateValue + " pts = " + MessagesStorage.lastPtsValue + " seq = " + MessagesStorage.lastSeqValue); - ConnectionsManager.getInstance().setIsUpdating(true); - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error == null) { - final TLRPC.updates_Difference res = (TLRPC.updates_Difference) response; - - if (res instanceof TLRPC.TL_updates_differenceSlice) { - getDifference(res.intermediate_state.pts, res.intermediate_state.date, res.intermediate_state.qts, true); - } - - final HashMap usersDict = new HashMap<>(); - final HashMap chatsDict = new HashMap<>(); - for (int a = 0; a < res.users.size(); a++) { - TLRPC.User user = res.users.get(a); - usersDict.put(user.id, user); - } - for (int a = 0; a < res.chats.size(); a++) { - TLRPC.Chat chat = res.chats.get(a); - chatsDict.put(chat.id, chat); - } - - final ArrayList msgUpdates = new ArrayList<>(); - if (!res.other_updates.isEmpty()) { - for (int a = 0; a < res.other_updates.size(); a++) { - TLRPC.Update upd = res.other_updates.get(a); - if (upd instanceof TLRPC.TL_updateMessageID) { - msgUpdates.add((TLRPC.TL_updateMessageID) upd); - res.other_updates.remove(a); - a--; - } - } - } - - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - putUsers(res.users, false); - putChats(res.chats, false); - } - }); - - MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { - @Override - public void run() { - //MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, true, false); - if (!msgUpdates.isEmpty()) { - final HashMap corrected = new HashMap<>(); - for (TLRPC.TL_updateMessageID update : msgUpdates) { - long[] ids = MessagesStorage.getInstance().updateMessageStateAndId(update.random_id, null, update.id, 0, false, 0); - if (ids != null) { - corrected.put(update.id, ids); - } - } - - if (!corrected.isEmpty()) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - for (HashMap.Entry entry : corrected.entrySet()) { - Integer newId = entry.getKey(); - long[] ids = entry.getValue(); - Integer oldId = (int) ids[1]; - SendMessagesHelper.getInstance().processSentMessage(oldId); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.messageReceivedByServer, oldId, newId, null, ids[0]); - } - } - }); - } - } - - Utilities.stageQueue.postRunnable(new Runnable() { - @Override - public void run() { - if (!res.new_messages.isEmpty() || !res.new_encrypted_messages.isEmpty()) { - final HashMap> messages = new HashMap<>(); - for (TLRPC.EncryptedMessage encryptedMessage : res.new_encrypted_messages) { - ArrayList decryptedMessages = SecretChatHelper.getInstance().decryptMessage(encryptedMessage); - if (decryptedMessages != null && !decryptedMessages.isEmpty()) { - for (TLRPC.Message message : decryptedMessages) { - res.new_messages.add(message); - } - } - } - - ImageLoader.saveMessagesThumbs(res.new_messages); - - final ArrayList pushMessages = new ArrayList<>(); - for (int a = 0; a < res.new_messages.size(); a++) { - TLRPC.Message message = res.new_messages.get(a); - - if (message.action instanceof TLRPC.TL_messageActionChatDeleteUser) { - TLRPC.User user = usersDict.get(message.action.user_id); - if (user != null && user.bot) { - message.reply_markup = new TLRPC.TL_replyKeyboardHide(); - } - } - - if (message.dialog_id == 0) { - if (message.to_id.chat_id != 0) { - message.dialog_id = -message.to_id.chat_id; - } else { - if (message.to_id.user_id == UserConfig.getClientUserId()) { - message.to_id.user_id = message.from_id; - } - message.dialog_id = message.to_id.user_id; - } - } - - if (message.action instanceof TLRPC.TL_messageActionChatMigrateTo || message.action instanceof TLRPC.TL_messageActionChannelCreate) { - message.unread = false; - message.media_unread = false; - } else { - ConcurrentHashMap read_max = message.out ? dialogs_read_outbox_max : dialogs_read_inbox_max; - Integer value = read_max.get(message.dialog_id); - if (value == null) { - value = MessagesStorage.getInstance().getDialogReadMax(message.out, message.dialog_id); - read_max.put(message.dialog_id, value); - } - message.unread = value < message.id; - } - - MessageObject obj = new MessageObject(message, usersDict, chatsDict, createdDialogIds.contains(message.dialog_id)); - - if (!obj.isOut() && obj.isUnread()) { - pushMessages.add(obj); - } - - ArrayList arr = messages.get(message.dialog_id); - if (arr == null) { - arr = new ArrayList<>(); - messages.put(message.dialog_id, arr); - } - arr.add(obj); - } - - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - for (HashMap.Entry> pair : messages.entrySet()) { - Long key = pair.getKey(); - ArrayList value = pair.getValue(); - updateInterfaceWithMessages(key, value); - } - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - } - }); - MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { - @Override - public void run() { - if (!pushMessages.isEmpty()) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - NotificationsController.getInstance().processNewMessages(pushMessages, !(res instanceof TLRPC.TL_updates_differenceSlice)); - } - }); - } - MessagesStorage.getInstance().putMessages(res.new_messages, true, false, false, MediaController.getInstance().getAutodownloadMask()); - } - }); - - //SecretChatHelper.getInstance().processPendingEncMessages(); - } - - if (!res.other_updates.isEmpty()) { - processUpdateArray(res.other_updates, res.users, res.chats, true); - } - - if (res instanceof TLRPC.TL_updates_difference) { - gettingDifference = false; - MessagesStorage.lastSeqValue = res.state.seq; - MessagesStorage.lastDateValue = res.state.date; - MessagesStorage.lastPtsValue = res.state.pts; - MessagesStorage.lastQtsValue = res.state.qts; - ConnectionsManager.getInstance().setIsUpdating(false); - for (int a = 0; a < 3; a++) { - processUpdatesQueue(a, 1); - } - } else if (res instanceof TLRPC.TL_updates_differenceSlice) { - MessagesStorage.lastDateValue = res.intermediate_state.date; - MessagesStorage.lastPtsValue = res.intermediate_state.pts; - MessagesStorage.lastQtsValue = res.intermediate_state.qts; - } else if (res instanceof TLRPC.TL_updates_differenceEmpty) { - gettingDifference = false; - MessagesStorage.lastSeqValue = res.seq; - MessagesStorage.lastDateValue = res.date; - ConnectionsManager.getInstance().setIsUpdating(false); - for (int a = 0; a < 3; a++) { - processUpdatesQueue(a, 1); - } - } - MessagesStorage.getInstance().saveDiffParams(MessagesStorage.lastSeqValue, MessagesStorage.lastPtsValue, MessagesStorage.lastDateValue, MessagesStorage.lastQtsValue); - FileLog.e("tmessages", "received difference with date = " + MessagesStorage.lastDateValue + " pts = " + MessagesStorage.lastPtsValue + " seq = " + MessagesStorage.lastSeqValue + " messages = " + res.new_messages.size() + " users = " + res.users.size() + " chats = " + res.chats.size() + " other updates = " + res.other_updates.size()); - } - }); - } - }); - } else { - gettingDifference = false; - ConnectionsManager.getInstance().setIsUpdating(false); - } - } - }); - } - */ - - /* - public void generateJoinMessage(final int chat_id, boolean ignoreLeft) { - TLRPC.Chat chat = getChat(chat_id); - if (chat == null || !ChatObject.isChannel(chat_id) || (chat.left || chat.kicked) && !ignoreLeft) { - return; - } - - TLRPC.TL_messageService message = new TLRPC.TL_messageService(); - message.flags = TLRPC.MESSAGE_FLAG_HAS_FROM_ID; - message.local_id = message.id = UserConfig.getNewMessageId(); - message.date = ConnectionsManager.getInstance().getCurrentTime(); - message.from_id = UserConfig.getClientUserId(); - message.to_id = new TLRPC.TL_peerChannel(); - message.to_id.channel_id = chat_id; - message.dialog_id = -chat_id; - message.post = true; - message.action = new TLRPC.TL_messageActionChatAddUser(); - message.action.users.add(UserConfig.getClientUserId()); - if (chat.megagroup) { - message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP; - } - UserConfig.saveConfig(false); - - final ArrayList pushMessages = new ArrayList<>(); - final ArrayList messagesArr = new ArrayList<>(); - - messagesArr.add(message); - MessageObject obj = new MessageObject(message, null, true); - pushMessages.add(obj); - - MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { - @Override - public void run() { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - NotificationsController.getInstance().processNewMessages(pushMessages, true); - } - }); - } - }); - MessagesStorage.getInstance().putMessages(messagesArr, true, true, false, MediaController.getInstance().getAutodownloadMask()); - - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - updateInterfaceWithMessages(-chat_id, pushMessages); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - } - }); - } - */ - private int getUpdateType(TLRPC.Update update) { if (update instanceof TLRPC.TL_updateNewMessage || update instanceof TLRPC.TL_updateReadMessagesContents || update instanceof TLRPC.TL_updateReadHistoryInbox || update instanceof TLRPC.TL_updateReadHistoryOutbox || update instanceof TLRPC.TL_updateDeleteMessages || update instanceof TLRPC.TL_updateWebPage || @@ -5082,487 +1992,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter } public void processUpdates(final TLRPC.Updates updates, boolean fromQueue) { - /* - ArrayList needGetChannelsDiff = null; - boolean needGetDiff = false; - boolean needReceivedQueue = false; - boolean updateStatus = false; - if (updates instanceof TLRPC.TL_updateShort) { - ArrayList arr = new ArrayList<>(); - arr.add(updates.update); - processUpdateArray(arr, null, null, false); - } else if (updates instanceof TLRPC.TL_updateShortChatMessage || updates instanceof TLRPC.TL_updateShortMessage) { - final int user_id = updates instanceof TLRPC.TL_updateShortChatMessage ? updates.from_id : updates.user_id; - TLRPC.User user = getUser(user_id); - TLRPC.User user2 = null; - TLRPC.User user3 = null; - TLRPC.Chat channel = null; - - if (user == null || user.min) { - user = MessagesStorage.getInstance().getUserSync(user_id); - if (user != null && user.min) { - user = null; - } - putUser(user, true); - } - - boolean needFwdUser = false; - if (updates.fwd_from != null) { - if (updates.fwd_from.from_id != 0) { - user2 = getUser(updates.fwd_from.from_id); - if (user2 == null) { - user2 = MessagesStorage.getInstance().getUserSync(updates.fwd_from.from_id); - putUser(user2, true); - } - needFwdUser = true; - } - if (updates.fwd_from.channel_id != 0) { - channel = getChat(updates.fwd_from.channel_id); - if (channel == null) { - channel = MessagesStorage.getInstance().getChatSync(updates.fwd_from.channel_id); - putChat(channel, true); - } - needFwdUser = true; - } - } - - boolean needBotUser = false; - if (updates.via_bot_id != 0) { - user3 = getUser(updates.via_bot_id); - if (user3 == null) { - user3 = MessagesStorage.getInstance().getUserSync(updates.via_bot_id); - putUser(user3, true); - } - needBotUser = true; - } - - boolean missingData; - if (updates instanceof TLRPC.TL_updateShortMessage) { - missingData = user == null || needFwdUser && user2 == null && channel == null || needBotUser && user3 == null; - } else { - TLRPC.Chat chat = getChat(updates.chat_id); - if (chat == null) { - chat = MessagesStorage.getInstance().getChatSync(updates.chat_id); - putChat(chat, true); - } - missingData = chat == null || user == null || needFwdUser && user2 == null && channel == null || needBotUser && user3 == null; - } - if (!missingData && !updates.entities.isEmpty()) { - for (int a = 0; a < updates.entities.size(); a++) { - TLRPC.MessageEntity entity = updates.entities.get(a); - if (entity instanceof TLRPC.TL_messageEntityMentionName) { - int uid = ((TLRPC.TL_messageEntityMentionName) entity).user_id; - TLRPC.User entityUser = getUser(uid); - if (entityUser == null || entityUser.min) { - entityUser = MessagesStorage.getInstance().getUserSync(uid); - if (entityUser != null && entityUser.min) { - entityUser = null; - } - if (entityUser == null) { - missingData = true; - break; - } - putUser(user, true); - } - } - } - } - if (user != null && user.status != null && user.status.expires <= 0) { - onlinePrivacy.put(user.id, ConnectionsManager.getInstance().getCurrentTime()); - updateStatus = true; - } - - if (missingData) { - needGetDiff = true; - } else { - if (MessagesStorage.lastPtsValue + updates.pts_count == updates.pts) { - TLRPC.TL_message message = new TLRPC.TL_message(); - message.id = updates.id; - if (updates instanceof TLRPC.TL_updateShortMessage) { - if (updates.out) { - message.from_id = UserConfig.getClientUserId(); - } else { - message.from_id = user_id; - } - message.to_id = new TLRPC.TL_peerUser(); - message.to_id.user_id = user_id; - message.dialog_id = user_id; - } else { - message.from_id = user_id; - message.to_id = new TLRPC.TL_peerChat(); - message.to_id.chat_id = updates.chat_id; - message.dialog_id = -updates.chat_id; - } - - message.fwd_from = updates.fwd_from; - message.silent = updates.silent; - message.out = updates.out; - message.mentioned = updates.mentioned; - message.media_unread = updates.media_unread; - message.entities = updates.entities; - message.message = updates.message; - message.date = updates.date; - message.via_bot_id = updates.via_bot_id; - message.flags = updates.flags | TLRPC.MESSAGE_FLAG_HAS_FROM_ID; - message.reply_to_msg_id = updates.reply_to_msg_id; - message.media = new TLRPC.TL_messageMediaEmpty(); - - ConcurrentHashMap read_max = message.out ? dialogs_read_outbox_max : dialogs_read_inbox_max; - Integer value = read_max.get(message.dialog_id); - if (value == null) { - value = MessagesStorage.getInstance().getDialogReadMax(message.out, message.dialog_id); - read_max.put(message.dialog_id, value); - } - message.unread = value < message.id; - - MessagesStorage.lastPtsValue = updates.pts; - final MessageObject obj = new MessageObject(message, null, createdDialogIds.contains(message.dialog_id)); - final ArrayList objArr = new ArrayList<>(); - objArr.add(obj); - ArrayList arr = new ArrayList<>(); - arr.add(message); - if (updates instanceof TLRPC.TL_updateShortMessage) { - final boolean printUpdate = !updates.out && updatePrintingUsersWithNewMessages(updates.user_id, objArr); - if (printUpdate) { - updatePrintingStrings(); - } - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - if (printUpdate) { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_USER_PRINT); - } - updateInterfaceWithMessages(user_id, objArr); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - } - }); - } else { - final boolean printUpdate = updatePrintingUsersWithNewMessages(-updates.chat_id, objArr); - if (printUpdate) { - updatePrintingStrings(); - } - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - if (printUpdate) { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_USER_PRINT); - } - - updateInterfaceWithMessages(-updates.chat_id, objArr); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - } - }); - } - if (!obj.isOut()) { - MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { - @Override - public void run() { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - NotificationsController.getInstance().processNewMessages(objArr, true); - } - }); - } - }); - } - MessagesStorage.getInstance().putMessages(arr, false, true, false, 0); - } else if (MessagesStorage.lastPtsValue != updates.pts) { - FileLog.e("tmessages", "need get diff short message, pts: " + MessagesStorage.lastPtsValue + " " + updates.pts + " count = " + updates.pts_count); - if (gettingDifference || updatesStartWaitTimePts == 0 || Math.abs(System.currentTimeMillis() - updatesStartWaitTimePts) <= 1500) { - if (updatesStartWaitTimePts == 0) { - updatesStartWaitTimePts = System.currentTimeMillis(); - } - FileLog.e("tmessages", "add to queue"); - updatesQueuePts.add(updates); - } else { - needGetDiff = true; - } - } - } - } else if (updates instanceof TLRPC.TL_updatesCombined || updates instanceof TLRPC.TL_updates) { - HashMap minChannels = null; - for (int a = 0; a < updates.chats.size(); a++) { - TLRPC.Chat chat = updates.chats.get(a); - if (chat instanceof TLRPC.TL_channel) { - if (chat.min) { - TLRPC.Chat existChat = getChat(chat.id); - if (existChat == null || existChat.min) { - TLRPC.Chat cacheChat = MessagesStorage.getInstance().getChatSync(updates.chat_id); - if (existChat == null) { - putChat(cacheChat, true); - } - existChat = cacheChat; - } - if (existChat == null || existChat.min) { - if (minChannels == null) { - minChannels = new HashMap<>(); - } - minChannels.put(chat.id, chat); - } - } - } - } - if (minChannels != null) { - for (int a = 0; a < updates.updates.size(); a++) { - TLRPC.Update update = updates.updates.get(a); - if (update instanceof TLRPC.TL_updateNewChannelMessage) { - int channelId = ((TLRPC.TL_updateNewChannelMessage) update).message.to_id.channel_id; - if (minChannels.containsKey(channelId)) { - FileLog.e("tmessages", "need get diff because of min channel " + channelId); - needGetDiff = true; - break; - } - } - } - } - if (!needGetDiff) { - //MessagesStorage.getInstance().putUsersAndChats(updates.users, updates.chats, true, true); - Collections.sort(updates.updates, updatesComparator); - for (int a = 0; a < updates.updates.size(); a++) { - TLRPC.Update update = updates.updates.get(a); - if (getUpdateType(update) == 0) { - TLRPC.TL_updates updatesNew = new TLRPC.TL_updates(); - updatesNew.updates.add(update); - updatesNew.pts = update.pts; - updatesNew.pts_count = update.pts_count; - for (int b = a + 1; b < updates.updates.size(); b++) { - TLRPC.Update update2 = updates.updates.get(b); - if (getUpdateType(update2) == 0 && updatesNew.pts + update2.pts_count == update2.pts) { - updatesNew.updates.add(update2); - updatesNew.pts = update2.pts; - updatesNew.pts_count += update2.pts_count; - updates.updates.remove(b); - b--; - } else { - break; - } - } - if (MessagesStorage.lastPtsValue + updatesNew.pts_count == updatesNew.pts) { - if (!processUpdateArray(updatesNew.updates, updates.users, updates.chats, false)) { - FileLog.e("tmessages", "need get diff inner TL_updates, seq: " + MessagesStorage.lastSeqValue + " " + updates.seq); - needGetDiff = true; - } else { - MessagesStorage.lastPtsValue = updatesNew.pts; - } - } else if (MessagesStorage.lastPtsValue != updatesNew.pts) { - FileLog.e("tmessages", update + " need get diff, pts: " + MessagesStorage.lastPtsValue + " " + updatesNew.pts + " count = " + updatesNew.pts_count); - if (gettingDifference || updatesStartWaitTimePts == 0 || updatesStartWaitTimePts != 0 && Math.abs(System.currentTimeMillis() - updatesStartWaitTimePts) <= 1500) { - if (updatesStartWaitTimePts == 0) { - updatesStartWaitTimePts = System.currentTimeMillis(); - } - FileLog.e("tmessages", "add to queue"); - updatesQueuePts.add(updatesNew); - } else { - needGetDiff = true; - } - } - } else if (getUpdateType(update) == 1) { - TLRPC.TL_updates updatesNew = new TLRPC.TL_updates(); - updatesNew.updates.add(update); - updatesNew.pts = update.qts; - for (int b = a + 1; b < updates.updates.size(); b++) { - TLRPC.Update update2 = updates.updates.get(b); - if (getUpdateType(update2) == 1 && updatesNew.pts + 1 == update2.qts) { - updatesNew.updates.add(update2); - updatesNew.pts = update2.qts; - updates.updates.remove(b); - b--; - } else { - break; - } - } - if (MessagesStorage.lastQtsValue == 0 || MessagesStorage.lastQtsValue + updatesNew.updates.size() == updatesNew.pts) { - processUpdateArray(updatesNew.updates, updates.users, updates.chats, false); - MessagesStorage.lastQtsValue = updatesNew.pts; - needReceivedQueue = true; - } else if (MessagesStorage.lastPtsValue != updatesNew.pts) { - FileLog.e("tmessages", update + " need get diff, qts: " + MessagesStorage.lastQtsValue + " " + updatesNew.pts); - if (gettingDifference || updatesStartWaitTimeQts == 0 || updatesStartWaitTimeQts != 0 && Math.abs(System.currentTimeMillis() - updatesStartWaitTimeQts) <= 1500) { - if (updatesStartWaitTimeQts == 0) { - updatesStartWaitTimeQts = System.currentTimeMillis(); - } - FileLog.e("tmessages", "add to queue"); - updatesQueueQts.add(updatesNew); - } else { - needGetDiff = true; - } - } - } else if (getUpdateType(update) == 2) { - int channelId = getUpdateChannelId(update); - boolean skipUpdate = false; - Integer channelPts = channelsPts.get(channelId); - if (channelPts == null) { - channelPts = MessagesStorage.getInstance().getChannelPtsSync(channelId); - if (channelPts == 0) { - for (int c = 0; c < updates.chats.size(); c++) { - TLRPC.Chat chat = updates.chats.get(c); - if (chat.id == channelId) { - loadUnknownChannel(chat, 0); - skipUpdate = true; - break; - } - } - } else { - channelsPts.put(channelId, channelPts); - } - } - TLRPC.TL_updates updatesNew = new TLRPC.TL_updates(); - updatesNew.updates.add(update); - updatesNew.pts = update.pts; - updatesNew.pts_count = update.pts_count; - for (int b = a + 1; b < updates.updates.size(); b++) { - TLRPC.Update update2 = updates.updates.get(b); - if (getUpdateType(update2) == 2 && channelId == getUpdateChannelId(update2) && updatesNew.pts + update2.pts_count == update2.pts) { - updatesNew.updates.add(update2); - updatesNew.pts = update2.pts; - updatesNew.pts_count += update2.pts_count; - updates.updates.remove(b); - b--; - } else { - break; - } - } - if (!skipUpdate) { - if (channelPts + updatesNew.pts_count == updatesNew.pts) { - if (!processUpdateArray(updatesNew.updates, updates.users, updates.chats, false)) { - FileLog.e("tmessages", "need get channel diff inner TL_updates, channel_id = " + channelId); - if (needGetChannelsDiff == null) { - needGetChannelsDiff = new ArrayList<>(); - } else if (!needGetChannelsDiff.contains(channelId)) { - needGetChannelsDiff.add(channelId); - } - } else { - channelsPts.put(channelId, updatesNew.pts); - MessagesStorage.getInstance().saveChannelPts(channelId, updatesNew.pts); - } - } else if (channelPts != updatesNew.pts) { - FileLog.e("tmessages", update + " need get channel diff, pts: " + channelPts + " " + updatesNew.pts + " count = " + updatesNew.pts_count + " channelId = " + channelId); - Long updatesStartWaitTime = updatesStartWaitTimeChannels.get(channelId); - Boolean gettingDifferenceChannel = gettingDifferenceChannels.get(channelId); - if (gettingDifferenceChannel == null) { - gettingDifferenceChannel = false; - } - if (gettingDifferenceChannel || updatesStartWaitTime == null || Math.abs(System.currentTimeMillis() - updatesStartWaitTime) <= 1500) { - if (updatesStartWaitTime == null) { - updatesStartWaitTimeChannels.put(channelId, System.currentTimeMillis()); - } - FileLog.e("tmessages", "add to queue"); - ArrayList arrayList = updatesQueueChannels.get(channelId); - if (arrayList == null) { - arrayList = new ArrayList<>(); - updatesQueueChannels.put(channelId, arrayList); - } - arrayList.add(updatesNew); - } else { - if (needGetChannelsDiff == null) { - needGetChannelsDiff = new ArrayList<>(); - } else if (!needGetChannelsDiff.contains(channelId)) { - needGetChannelsDiff.add(channelId); - } - } - } - } else { - FileLog.e("tmessages", "need load unknown channel = " + channelId); - } - } else { - break; - } - updates.updates.remove(a); - a--; - } - - boolean processUpdate; - if (updates instanceof TLRPC.TL_updatesCombined) { - processUpdate = MessagesStorage.lastSeqValue + 1 == updates.seq_start || MessagesStorage.lastSeqValue == updates.seq_start; - } else { - processUpdate = MessagesStorage.lastSeqValue + 1 == updates.seq || updates.seq == 0 || updates.seq == MessagesStorage.lastSeqValue; - } - if (processUpdate) { - processUpdateArray(updates.updates, updates.users, updates.chats, false); - if (updates.date != 0) { - MessagesStorage.lastDateValue = updates.date; - } - if (updates.seq != 0) { - MessagesStorage.lastSeqValue = updates.seq; - } - } else { - if (updates instanceof TLRPC.TL_updatesCombined) { - FileLog.e("tmessages", "need get diff TL_updatesCombined, seq: " + MessagesStorage.lastSeqValue + " " + updates.seq_start); - } else { - FileLog.e("tmessages", "need get diff TL_updates, seq: " + MessagesStorage.lastSeqValue + " " + updates.seq); - } - - if (gettingDifference || updatesStartWaitTimeSeq == 0 || Math.abs(System.currentTimeMillis() - updatesStartWaitTimeSeq) <= 1500) { - if (updatesStartWaitTimeSeq == 0) { - updatesStartWaitTimeSeq = System.currentTimeMillis(); - } - FileLog.e("tmessages", "add TL_updates/Combined to queue"); - updatesQueueSeq.add(updates); - } else { - needGetDiff = true; - } - } - } - } else if (updates instanceof TLRPC.TL_updatesTooLong) { - FileLog.e("tmessages", "need get diff TL_updatesTooLong"); - needGetDiff = true; - } else if (updates instanceof UserActionUpdatesSeq) { - MessagesStorage.lastSeqValue = updates.seq; - } else if (updates instanceof UserActionUpdatesPts) { - if (updates.chat_id != 0) { - channelsPts.put(updates.chat_id, updates.pts); - MessagesStorage.getInstance().saveChannelPts(updates.chat_id, updates.pts); - } else { - MessagesStorage.lastPtsValue = updates.pts; - } - } - //SecretChatHelper.getInstance().processPendingEncMessages(); - if (!fromQueue) { - ArrayList keys = new ArrayList<>(updatesQueueChannels.keySet()); - for (int a = 0; a < keys.size(); a++) { - Integer key = keys.get(a); - if (needGetChannelsDiff != null && needGetChannelsDiff.contains(key)) { - getChannelDifference(key); - } else { - processChannelsUpdatesQueue(key, 0); - } - } - if (needGetDiff) { - getDifference(); - } else { - for (int a = 0; a < 3; a++) { - processUpdatesQueue(a, 0); - } - } - } - if (needReceivedQueue) { - TLRPC.TL_messages_receivedQueue req = new TLRPC.TL_messages_receivedQueue(); - req.max_qts = MessagesStorage.lastQtsValue; - ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - - } - }); - } - if (updateStatus) { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_STATUS); - } - }); - } - MessagesStorage.getInstance().saveDiffParams(MessagesStorage.lastSeqValue, MessagesStorage.lastPtsValue, MessagesStorage.lastDateValue, MessagesStorage.lastQtsValue); - */ - } - - /* - private boolean isNotifySettingsMuted(TLRPC.PeerNotifySettings settings) { - return settings instanceof TLRPC.TL_peerNotifySettings && settings.mute_until > ConnectionsManager.getInstance().getCurrentTime(); - } - */ + } public boolean isDialogMuted(long dialog_id) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); @@ -5578,45 +2008,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter return false; } - /* - private boolean updatePrintingUsersWithNewMessages(long uid, ArrayList messages) { - if (uid > 0) { - ArrayList arr = printingUsers.get(uid); - if (arr != null) { - printingUsers.remove(uid); - return true; - } - } else if (uid < 0) { - ArrayList messagesUsers = new ArrayList<>(); - for (MessageObject message : messages) { - if (!messagesUsers.contains(message.messageOwner.from_id)) { - messagesUsers.add(message.messageOwner.from_id); - } - } - - ArrayList arr = printingUsers.get(uid); - boolean changed = false; - if (arr != null) { - for (int a = 0; a < arr.size(); a++) { - PrintingUser user = arr.get(a); - if (messagesUsers.contains(user.userId)) { - arr.remove(a); - a--; - if (arr.isEmpty()) { - printingUsers.remove(uid); - } - changed = true; - } - } - } - if (changed) { - return true; - } - } - return false; - } - */ - protected void updateInterfaceWithMessages(long uid, ArrayList messages) { updateInterfaceWithMessages(uid, messages, false); } @@ -5795,33 +2186,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter } public static boolean checkCanOpenChat(Bundle bundle, BaseFragment fragment) { - /* EDIT BY MR - if (bundle == null || fragment == null) { - return true; - } - TLRPC.User user = null; - TLRPC.Chat chat = null; - int user_id = bundle.getInt("user_id", 0); - int chat_id = bundle.getInt("chat_id", 0); - if (user_id != 0) { - user = MessagesController.getInstance().getUser(user_id); - } else if (chat_id != 0) { - chat = MessagesController.getInstance().getChat(chat_id); - } - if (user == null && chat == null) { - return true; - } - String reason = null; - if (chat != null) { - reason = getRestrictionReason(chat.restriction_reason); - } else if (user != null) { - reason = getRestrictionReason(user.restriction_reason); - } - if (reason != null) { - showCantOpenAlert(fragment, reason); - return false; - } - */ return true; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java index c24715875..5ec38a032 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java @@ -690,7 +690,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } } } - SendMessagesHelper.getInstance().sendMessageDocument((TLRPC.TL_document) document, null, null, peer, replyingMessageObject, null, null); + SendMessagesHelper.getInstance().sendMessageDocument((TLRPC.TL_document) document, null, null, peer, replyingMessageObject, null); } /* @@ -1042,31 +1042,31 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } */ - public void sendMessageContact(TLRPC.User user, long peer, MessageObject reply_to_msg, TLRPC.ReplyMarkup replyMarkup, HashMap params) { + public void sendMessageContact(TLRPC.User user, long peer, MessageObject reply_to_msg, HashMap params) { sendMessage__(null, null, null, null, user, null, peer, null, reply_to_msg, null, true, - null, replyMarkup, params); + null, null, params); } - public void sendMessageDocument(TLRPC.TL_document document, VideoEditedInfo videoEditedInfo, String path, long peer, MessageObject reply_to_msg, TLRPC.ReplyMarkup replyMarkup, HashMap params) { + public void sendMessageDocument(TLRPC.TL_document document, VideoEditedInfo videoEditedInfo, String path, long peer, MessageObject reply_to_msg, HashMap params) { sendMessage__(null, null, null, videoEditedInfo, null, document, peer, path, reply_to_msg, null, true, - null, replyMarkup, params); + null, null, params); } - public void sendMessageText(String message, long peer, MessageObject reply_to_msg, TLRPC.WebPage webPage, boolean searchLinks, ArrayList entities, TLRPC.ReplyMarkup replyMarkup, HashMap params) { + public void sendMessageText(String message, long peer, MessageObject reply_to_msg, TLRPC.WebPage webPage, boolean searchLinks, ArrayList entities, HashMap params) { sendMessage__(message, null, null, null, null, null, peer, null, reply_to_msg, webPage, searchLinks, - entities, replyMarkup, params); + entities, null, params); } /* - public void sendMessageLocation(TLRPC.MessageMedia location, long peer, MessageObject reply_to_msg, TLRPC.ReplyMarkup replyMarkup, HashMap params) { + public void sendMessageLocation(TLRPC.MessageMedia location, long peer, MessageObject reply_to_msg, HashMap params) { sendMessage__(null, location, null, null, null, null, peer, null, reply_to_msg, null, true, null, - replyMarkup, params); + null, params); } */ - public void sendMessagePhoto(TLRPC.TL_photo photo, String path, long peer, MessageObject reply_to_msg, TLRPC.ReplyMarkup replyMarkup, HashMap params) { + public void sendMessagePhoto(TLRPC.TL_photo photo, String path, long peer, MessageObject reply_to_msg, HashMap params) { sendMessage__(null, null, photo, null, null, null, peer, path, reply_to_msg, null, true, null, - replyMarkup, params); + null, params); } private void sendMessage__(String message, @@ -1081,7 +1081,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter TLRPC.WebPage webPage, boolean searchLinks, ArrayList entities, - TLRPC.ReplyMarkup replyMarkup, + Object replyMarkup, HashMap params) { if (peer == 0) { // peer == dialog id return; @@ -1283,10 +1283,10 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter newMsg.flags |= TLRPC.MESSAGE_FLAG_REPLY; newMsg.reply_to_msg_id = reply_to_msg.getId(); } - if (replyMarkup != null /*&& encryptedChat == null*/) { + /*if (replyMarkup != null && encryptedChat == null) { newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_MARKUP; newMsg.reply_markup = replyMarkup; - } + }*/ if (lower_id != 0) { /*if (high_id == 1) { if (currentChatInfo == null) { @@ -2173,7 +2173,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { - SendMessagesHelper.getInstance().sendMessageDocument(documentFinal, null, pathFinal, dialog_id, reply_to_msg, null, params); + SendMessagesHelper.getInstance().sendMessageDocument(documentFinal, null, pathFinal, dialog_id, reply_to_msg, params); } }); return true; @@ -2246,7 +2246,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { - SendMessagesHelper.getInstance().sendMessageDocument(documentFinal, null, messageObject.messageOwner.attachPath, dialog_id, reply_to_msg, null, params); + SendMessagesHelper.getInstance().sendMessageDocument(documentFinal, null, messageObject.messageOwner.attachPath, dialog_id, reply_to_msg, params); } }); } @@ -2408,7 +2408,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { - SendMessagesHelper.getInstance().sendMessageDocument(documentFinal, null, pathFinal, dialog_id, reply_to_msg, null, params); + SendMessagesHelper.getInstance().sendMessageDocument(documentFinal, null, pathFinal, dialog_id, reply_to_msg, params); } }); } else { @@ -2458,7 +2458,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { - SendMessagesHelper.getInstance().sendMessagePhoto(photoFinal, needDownloadHttpFinal ? searchImage.imageUrl : null, dialog_id, reply_to_msg, null, params); + SendMessagesHelper.getInstance().sendMessagePhoto(photoFinal, needDownloadHttpFinal ? searchImage.imageUrl : null, dialog_id, reply_to_msg, params); } }); } @@ -2499,7 +2499,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter //int count = (int) Math.ceil(textFinal.length() / 4096.0f); //for (int a = 0; a < count; a++) { // String mess = textFinal.substring(a * 4096, Math.min((a + 1) * 4096, textFinal.length())); - SendMessagesHelper.getInstance().sendMessageText(textFinal, dialog_id, null, null, true, null, null, null); + SendMessagesHelper.getInstance().sendMessageText(textFinal, dialog_id, null, null, true, null, null); //} } } @@ -2610,7 +2610,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { - SendMessagesHelper.getInstance().sendMessagePhoto(photoFinal, null, dialog_id, reply_to_msg, null, params); + SendMessagesHelper.getInstance().sendMessagePhoto(photoFinal, null, dialog_id, reply_to_msg, params); } }); } @@ -2739,7 +2739,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { - SendMessagesHelper.getInstance().sendMessageDocument(videoFinal, videoEditedInfo, finalPath, dialog_id, reply_to_msg, null, params); + SendMessagesHelper.getInstance().sendMessageDocument(videoFinal, videoEditedInfo, finalPath, dialog_id, reply_to_msg, params); } }); } else { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/WearReplyReceiver.java b/TMessagesProj/src/main/java/org/telegram/messenger/WearReplyReceiver.java index e84b24979..a718e63d1 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/WearReplyReceiver.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/WearReplyReceiver.java @@ -32,7 +32,7 @@ public class WearReplyReceiver extends BroadcastReceiver { if (dialog_id == 0 || max_id == 0) { return; } - SendMessagesHelper.getInstance().sendMessageText(text.toString(), dialog_id, null, null, true, null, null, null); + SendMessagesHelper.getInstance().sendMessageText(text.toString(), dialog_id, null, null, true, null, null); MessagesController.getInstance().markDialogAsRead(dialog_id, max_id, max_id, 0, true, false); } } diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java index 6229fc7a6..206af23a4 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java @@ -14,42 +14,9 @@ import java.util.HashMap; @SuppressWarnings("unchecked") public class TLRPC { - /* - public static final int USER_FLAG_ACCESS_HASH = 0x00000001; - public static final int USER_FLAG_FIRST_NAME = 0x00000002; - public static final int USER_FLAG_LAST_NAME = 0x00000004; - public static final int USER_FLAG_USERNAME = 0x00000008; - public static final int USER_FLAG_PHONE = 0x00000010; - public static final int USER_FLAG_PHOTO = 0x00000020; - public static final int USER_FLAG_STATUS = 0x00000040; - public static final int USER_FLAG_UNUSED = 0x00000080; - public static final int USER_FLAG_UNUSED2 = 0x00000100; - public static final int USER_FLAG_UNUSED3 = 0x00000200; - */ - //public static final int USER_FLAG_SELF = 0x00000400; - //public static final int USER_FLAG_CONTACT = 0x00000800; - //public static final int USER_FLAG_MUTUAL_CONTACT = 0x00001000; - //public static final int USER_FLAG_DELETED = 0x00002000; - //public static final int USER_FLAG_BOT = 0x00004000; - //public static final int USER_FLAG_BOT_READING_HISTORY = 0x00008000; - //public static final int USER_FLAG_BOT_CANT_JOIN_GROUP = 0x00010000; - //public static final int USER_FLAG_VERIFIED = 0x00020000; - - //public static final int CHAT_FLAG_CREATOR = 0x00000001; - //public static final int CHAT_FLAG_USER_KICKED = 0x00000002; - //public static final int CHAT_FLAG_USER_LEFT = 0x00000004; - //public static final int CHAT_FLAG_USER_IS_EDITOR = 0x00000008; - //public static final int CHAT_FLAG_USER_IS_MODERATOR = 0x00000010; - //public static final int CHAT_FLAG_IS_BROADCAST = 0x00000020; public static final int CHAT_FLAG_IS_PUBLIC = 0x00000040; - //public static final int CHAT_FLAG_IS_VERIFIED = 0x00000080; - - //public static final int MESSAGE_FLAG_UNREAD = 0x00000001; - //public static final int MESSAGE_FLAG_OUT = 0x00000002; public static final int MESSAGE_FLAG_FWD = 0x00000004; public static final int MESSAGE_FLAG_REPLY = 0x00000008; - //public static final int MESSAGE_FLAG_MENTION = 0x00000010; - //public static final int MESSAGE_FLAG_CONTENT_UNREAD = 0x00000020; public static final int MESSAGE_FLAG_HAS_MARKUP = 0x00000040; public static final int MESSAGE_FLAG_HAS_ENTITIES = 0x00000080; public static final int MESSAGE_FLAG_HAS_FROM_ID = 0x00000100; @@ -94,25 +61,6 @@ public class TLRPC { } } - public static class NotifyPeer extends TLObject { - public Peer peer; - - public static NotifyPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - NotifyPeer result = null; - return result; - } - } - - public static class messages_SentEncryptedMessage extends TLObject { - public int date; - public EncryptedFile file; - - public static messages_SentEncryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_SentEncryptedMessage result = null; - return result; - } - } - public static class TL_error extends TLObject { public static int constructor = 0xc4b9f9bb; @@ -511,28 +459,6 @@ public class TLRPC { } } - public static class help_AppChangelog extends TLObject { - public String text; - - public static help_AppChangelog TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - help_AppChangelog result = null; - return result; - } - } - - public static class EncryptedFile extends TLObject { - public long id; - public long access_hash; - public int size; - public int dc_id; - public int key_fingerprint; - - public static EncryptedFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - EncryptedFile result = null; - return result; - } - } - public static class Peer extends TLObject { public int channel_id; public int user_id; @@ -544,20 +470,6 @@ public class TLRPC { } } - public static class TL_peerChannel extends Peer { - public static int constructor = 0xbddde532; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - channel_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(channel_id); - } - } - public static class TL_peerUser extends Peer { public static int constructor = 0x9db1bc6d; @@ -617,391 +529,6 @@ public class TLRPC { } } - public static class TL_channels_channelParticipant extends TLObject { - public static int constructor = 0xd0d9b163; - - public ChannelParticipant participant; - public ArrayList users = new ArrayList<>(); - - public static TL_channels_channelParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_channels_channelParticipant.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_channels_channelParticipant", constructor)); - } else { - return null; - } - } - TL_channels_channelParticipant result = new TL_channels_channelParticipant(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - participant = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - participant.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_authorization extends TLObject { - public static int constructor = 0x7bf2e6f6; - - public long hash; - public int flags; - public String device_model; - public String platform; - public String system_version; - public int api_id; - public String app_name; - public String app_version; - public int date_created; - public int date_active; - public String ip; - public String country; - public String region; - - public static TL_authorization TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_authorization.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_authorization", constructor)); - } else { - return null; - } - } - TL_authorization result = new TL_authorization(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readInt64(exception); - flags = stream.readInt32(exception); - device_model = stream.readString(exception); - platform = stream.readString(exception); - system_version = stream.readString(exception); - api_id = stream.readInt32(exception); - app_name = stream.readString(exception); - app_version = stream.readString(exception); - date_created = stream.readInt32(exception); - date_active = stream.readInt32(exception); - ip = stream.readString(exception); - country = stream.readString(exception); - region = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(hash); - stream.writeInt32(flags); - stream.writeString(device_model); - stream.writeString(platform); - stream.writeString(system_version); - stream.writeInt32(api_id); - stream.writeString(app_name); - stream.writeString(app_version); - stream.writeInt32(date_created); - stream.writeInt32(date_active); - stream.writeString(ip); - stream.writeString(country); - stream.writeString(region); - } - } - - public static class updates_Difference extends TLObject { - public int date; - public int seq; - public ArrayList new_messages = new ArrayList<>(); - public ArrayList new_encrypted_messages = new ArrayList<>(); - public ArrayList other_updates = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public TL_updates_state intermediate_state; - public TL_updates_state state; - - public static updates_Difference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - updates_Difference result = null; - return result; - } - } - - public static class TL_updates_differenceEmpty extends updates_Difference { - public static int constructor = 0x5d75a138; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - date = stream.readInt32(exception); - seq = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(date); - stream.writeInt32(seq); - } - } - - public static class TL_updates_differenceSlice extends updates_Difference { - public static int constructor = 0xa8fb1981; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - EncryptedMessage object = EncryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_encrypted_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - other_updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - intermediate_state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = new_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = new_encrypted_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_encrypted_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = other_updates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - other_updates.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - intermediate_state.serializeToStream(stream); - } - } - - public static class TL_updates_difference extends updates_Difference { - public static int constructor = 0xf49ca0; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - EncryptedMessage object = EncryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_encrypted_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - other_updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = new_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = new_encrypted_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_encrypted_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = other_updates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - other_updates.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - state.serializeToStream(stream); - } - } - public static class PrivacyKey extends TLObject { public static PrivacyKey TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { @@ -1010,24 +537,6 @@ public class TLRPC { } } - public static class TL_privacyKeyStatusTimestamp extends PrivacyKey { - public static int constructor = 0xbc2eab30; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_privacyKeyChatInvite extends PrivacyKey { - public static int constructor = 0x500e6dfa; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class GeoPoint extends TLObject { public double _long; public double lat; @@ -1038,15 +547,6 @@ public class TLRPC { } } - public static class TL_geoPointEmpty extends GeoPoint { - public static int constructor = 0x1117dd5f; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_geoPoint extends GeoPoint { public static int constructor = 0x2049d70c; @@ -1136,7 +636,6 @@ public class TLRPC { public int flags; public boolean channel; public boolean broadcast; - public boolean isPublic; public boolean megagroup; public String title; public Chat chat; @@ -1147,85 +646,6 @@ public class TLRPC { } } - public static class TL_chatInvite extends ChatInvite { - public static int constructor = 0x93e99b60; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - channel = (flags & 1) != 0; - broadcast = (flags & 2) != 0; - isPublic = (flags & 4) != 0; - megagroup = (flags & 8) != 0; - title = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = channel ? (flags | 1) : (flags &~ 1); - flags = broadcast ? (flags | 2) : (flags &~ 2); - flags = isPublic ? (flags | 4) : (flags &~ 4); - flags = megagroup ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - stream.writeString(title); - } - } - - public static class TL_chatInviteAlready extends ChatInvite { - public static int constructor = 0x5a686d7c; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - chat = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - chat.serializeToStream(stream); - } - } - - public static class help_AppUpdate extends TLObject { - public int id; - public boolean critical; - public String url; - public String text; - - public static help_AppUpdate TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - help_AppUpdate result = null; - return result; - } - } - - public static class TL_help_appUpdate extends help_AppUpdate { - public static int constructor = 0x8987f311; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - critical = stream.readBool(exception); - url = stream.readString(exception); - text = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeBool(critical); - stream.writeString(url); - stream.writeString(text); - } - } - - public static class TL_help_noAppUpdate extends help_AppUpdate { - public static int constructor = 0xc45a6536; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class SendMessageAction extends TLObject { public int progress; @@ -1235,131 +655,6 @@ public class TLRPC { } } - public static class TL_sendMessageUploadAudioAction extends SendMessageAction { - public static int constructor = 0xf351d7ab; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - progress = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(progress); - } - } - - public static class TL_sendMessageUploadPhotoAction extends SendMessageAction { - public static int constructor = 0xd1d34a26; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - progress = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(progress); - } - } - - public static class TL_sendMessageUploadDocumentAction_old extends TL_sendMessageUploadDocumentAction { - public static int constructor = 0x8faee98e; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_sendMessageUploadVideoAction extends SendMessageAction { - public static int constructor = 0xe9763aec; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - progress = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(progress); - } - } - - public static class TL_sendMessageCancelAction extends SendMessageAction { - public static int constructor = 0xfd5ec8f5; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_sendMessageGeoLocationAction extends SendMessageAction { - public static int constructor = 0x176f8ba1; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_sendMessageChooseContactAction extends SendMessageAction { - public static int constructor = 0x628cbc6f; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_sendMessageTypingAction extends SendMessageAction { - public static int constructor = 0x16bf744e; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_sendMessageUploadPhotoAction_old extends TL_sendMessageUploadPhotoAction { - public static int constructor = 0x990a3c1a; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_sendMessageUploadDocumentAction extends SendMessageAction { - public static int constructor = 0xaa0cd9e4; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - progress = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(progress); - } - } - - public static class TL_sendMessageRecordVideoAction extends SendMessageAction { - public static int constructor = 0xa187d66f; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class auth_SentCodeType extends TLObject { public int length; public String pattern; @@ -1426,53 +721,6 @@ public class TLRPC { } } - public static class TL_peerSettings extends TLObject { - public static int constructor = 0x818426cd; - - public int flags; - public boolean report_spam; - - public static TL_peerSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_peerSettings.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_peerSettings", constructor)); - } else { - return null; - } - } - TL_peerSettings result = new TL_peerSettings(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - report_spam = (flags & 1) != 0; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = report_spam ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - } - } - - public static class FoundGif extends TLObject { - public String url; - public Photo photo; - public Document document; - public String thumb_url; - public String content_url; - public String content_type; - public int w; - public int h; - - public static FoundGif TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - FoundGif result = null; - return result; - } - } - public static class TL_inputPhoneContact extends TLObject { public static int constructor = 0xf392b7f4; @@ -1557,15 +805,6 @@ public class TLRPC { } } - public static class TL_privacyValueAllowContacts extends PrivacyRule { - public static int constructor = 0xfffe1bac; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_privacyValueAllowAll extends PrivacyRule { public static int constructor = 0x65427b82; @@ -1604,48 +843,6 @@ public class TLRPC { } } - public static class TL_messageMediaUnsupported_old extends TL_messageMediaUnsupported { - public static int constructor = 0x29632a36; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - bytes = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(bytes); - } - } - - public static class TL_messageMediaAudio_layer45 extends MessageMedia { - public static int constructor = 0xc6b68300; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - audio_unused = Audio.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - audio_unused.serializeToStream(stream); - } - } - - public static class TL_messageMediaPhoto_old extends TL_messageMediaPhoto { - public static int constructor = 0xc8c45a2a; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - photo.serializeToStream(stream); - } - } - public static class TL_messageMediaUnsupported extends MessageMedia { public static int constructor = 0x9f84f49e; @@ -1686,34 +883,6 @@ public class TLRPC { } } - public static class TL_messageMediaVideo_old extends TL_messageMediaVideo_layer45 { - public static int constructor = 0xa2d24290; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - video_unused = Video.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - video_unused.serializeToStream(stream); - } - } - - public static class TL_messageMediaDocument_old extends TL_messageMediaDocument { - public static int constructor = 0x2fda2204; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - document.serializeToStream(stream); - } - } - public static class TL_messageMediaDocument extends MessageMedia { public static int constructor = 0xf3e02ea8; @@ -1766,22 +935,6 @@ public class TLRPC { } } - public static class TL_messageMediaVideo_layer45 extends MessageMedia { - public static int constructor = 0x5bcf1675; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - video_unused = Video.TLdeserialize(stream, stream.readInt32(exception), exception); - caption = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - video_unused.serializeToStream(stream); - stream.writeString(caption); - } - } - public static class TL_messageMediaGeo extends MessageMedia { public static int constructor = 0x56e0d474; @@ -1942,18 +1095,6 @@ public class TLRPC { } } - public static class messages_DhConfig extends TLObject { - public byte[] random; - public int g; - public byte[] p; - public int version; - - public static messages_DhConfig TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_DhConfig result = null; - return result; - } - } - public static class TL_messages_stickerSet extends TLObject { public static int constructor = 0xb60a24a6; @@ -1962,15 +1103,7 @@ public class TLRPC { public ArrayList documents = new ArrayList<>(); public static TL_messages_stickerSet TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_stickerSet.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_stickerSet", constructor)); - } else { - return null; - } - } TL_messages_stickerSet result = new TL_messages_stickerSet(); - result.readParams(stream, exception); return result; } @@ -2061,34 +1194,6 @@ public class TLRPC { } } - public static class TL_help_inviteText extends TLObject { - public static int constructor = 0x18cb9f78; - - public String message; - - public static TL_help_inviteText TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_help_inviteText.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_help_inviteText", constructor)); - } else { - return null; - } - } - TL_help_inviteText result = new TL_help_inviteText(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - message = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(message); - } - } - public static class Audio extends TLObject { public long id; public long access_hash; @@ -2107,130 +1212,6 @@ public class TLRPC { } } - public static class TL_audioEmpty_layer45 extends Audio { - public static int constructor = 0x586988d8; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - } - } - - public static class TL_audio_layer45 extends Audio { - public static int constructor = 0xf9e35055; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - dc_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(size); - stream.writeInt32(dc_id); - } - } - - public static class TL_audio_old extends TL_audio_layer45 { - public static int constructor = 0x427425e7; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - dc_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeInt32(size); - stream.writeInt32(dc_id); - } - } - - public static class TL_audioEncrypted extends TL_audio_layer45 { - public static int constructor = 0x555555F6; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - dc_id = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeInt32(size); - stream.writeInt32(dc_id); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_audio_old2 extends TL_audio_layer45 { - public static int constructor = 0xc7ac6496; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - dc_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(size); - stream.writeInt32(dc_id); - } - } - public static class BotInfo extends TLObject { public int user_id; public String description; @@ -2243,93 +1224,6 @@ public class TLRPC { } } - public static class TL_botInfoEmpty_layer48 extends TL_botInfo { - public static int constructor = 0xbb2e37ce; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_botInfo extends BotInfo { - public static int constructor = 0x98e81d3a; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt32(exception); - description = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(user_id); - stream.writeString(description); - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } - } - } - - public static class TL_botInfo_layer48 extends TL_botInfo { - public static int constructor = 0x9cf585d; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt32(exception); - version = stream.readInt32(exception); - stream.readString(exception); - description = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(user_id); - stream.writeInt32(version); - stream.writeString(""); - stream.writeString(description); - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } - } - } - public static class ReplyMarkup extends TLObject { public ArrayList rows = new ArrayList<>(); public int flags; @@ -2343,81 +1237,6 @@ public class TLRPC { } } - public static class TL_replyKeyboardHide extends ReplyMarkup { - public static int constructor = 0xa03e5b85; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - selective = (flags & 4) != 0; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = selective ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - } - } - - public static class TL_replyKeyboardForceReply extends ReplyMarkup { - public static int constructor = 0xf4108aa0; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - single_use = (flags & 2) != 0; - selective = (flags & 4) != 0; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = single_use ? (flags | 2) : (flags &~ 2); - flags = selective ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - } - } - - public static class TL_replyKeyboardMarkup extends ReplyMarkup { - public static int constructor = 0x3502758c; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - resize = (flags & 1) != 0; - single_use = (flags & 2) != 0; - selective = (flags & 4) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_keyboardButtonRow object = TL_keyboardButtonRow.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - rows.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = resize ? (flags | 1) : (flags &~ 1); - flags = single_use ? (flags | 2) : (flags &~ 2); - flags = selective ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = rows.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - rows.get(a).serializeToStream(stream); - } - } - } - public static class contacts_Contacts extends TLObject { public ArrayList contacts = new ArrayList<>(); public ArrayList users = new ArrayList<>(); @@ -2437,60 +1256,6 @@ public class TLRPC { } } - public static class TL_contacts_contacts extends contacts_Contacts { - public static int constructor = 0x6f8b8cb2; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_contact object = TL_contact.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - contacts.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = contacts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - contacts.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - public static class InputPrivacyKey extends TLObject { public static InputPrivacyKey TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { @@ -2582,62 +1347,6 @@ public class TLRPC { } } - public static class TL_photos_photosSlice extends photos_Photos { - public static int constructor = 0x15051f54; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = photos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - photos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - public static class ChatFull extends TLObject { public int flags; public boolean can_view_participants; @@ -2756,94 +1465,25 @@ public class TLRPC { } } - public static class TL_channelFull_layer52 extends TL_channelFull { - public static int constructor = 0x97bee562; + public static class TL_null extends TLObject { + public static int constructor = 0x56730bcc; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - can_view_participants = (flags & 8) != 0; - can_set_username = (flags & 64) != 0; - id = stream.readInt32(exception); - about = stream.readString(exception); - if ((flags & 1) != 0) { - participants_count = stream.readInt32(exception); - } - if ((flags & 2) != 0) { - admins_count = stream.readInt32(exception); - } - if ((flags & 4) != 0) { - kicked_count = stream.readInt32(exception); - } - read_inbox_max_id = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - stream.readInt32(exception); - chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { + public static TL_null TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + if (TL_null.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + throw new RuntimeException(String.format("can't parse magic %x in TL_null", constructor)); + } else { + return null; } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } - if ((flags & 16) != 0) { - migrated_from_chat_id = stream.readInt32(exception); - } - if ((flags & 16) != 0) { - migrated_from_max_id = stream.readInt32(exception); - } - if ((flags & 32) != 0) { - pinned_msg_id = stream.readInt32(exception); } + TL_null result = new TL_null(); + result.readParams(stream, exception); + return result; } public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(constructor); - flags = can_view_participants ? (flags | 8) : (flags &~ 8); - flags = can_set_username ? (flags | 64) : (flags &~ 64); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeString(about); - if ((flags & 1) != 0) { - stream.writeInt32(participants_count); - } - if ((flags & 2) != 0) { - stream.writeInt32(admins_count); - } - if ((flags & 4) != 0) { - stream.writeInt32(kicked_count); - } - stream.writeInt32(read_inbox_max_id); - stream.writeInt32(unread_count); - stream.writeInt32(0); - chat_photo.serializeToStream(stream); - notify_settings.serializeToStream(stream); - exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } - if ((flags & 16) != 0) { - stream.writeInt32(migrated_from_chat_id); - } - if ((flags & 16) != 0) { - stream.writeInt32(migrated_from_max_id); - } - if ((flags & 32) != 0) { - stream.writeInt32(pinned_msg_id); - } } } @@ -2890,201 +1530,6 @@ public class TLRPC { } } - public static class TL_channelFull_layer48 extends TL_channelFull { - public static int constructor = 0x9e341ddf; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - can_view_participants = (flags & 8) != 0; - id = stream.readInt32(exception); - about = stream.readString(exception); - if ((flags & 1) != 0) { - participants_count = stream.readInt32(exception); - } - if ((flags & 2) != 0) { - admins_count = stream.readInt32(exception); - } - if ((flags & 4) != 0) { - kicked_count = stream.readInt32(exception); - } - read_inbox_max_id = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - stream.readInt32(exception); - chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } - if ((flags & 16) != 0) { - migrated_from_chat_id = stream.readInt32(exception); - } - if ((flags & 16) != 0) { - migrated_from_max_id = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = can_view_participants ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeString(about); - if ((flags & 1) != 0) { - stream.writeInt32(participants_count); - } - if ((flags & 2) != 0) { - stream.writeInt32(admins_count); - } - if ((flags & 4) != 0) { - stream.writeInt32(kicked_count); - } - stream.writeInt32(read_inbox_max_id); - stream.writeInt32(unread_count); - stream.writeInt32(0); - chat_photo.serializeToStream(stream); - notify_settings.serializeToStream(stream); - exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } - if ((flags & 16) != 0) { - stream.writeInt32(migrated_from_chat_id); - } - if ((flags & 16) != 0) { - stream.writeInt32(migrated_from_max_id); - } - } - } - - public static class TL_channelFull_old extends TL_channelFull { - public static int constructor = 0xfab31aa3; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - can_view_participants = (flags & 8) != 0; - id = stream.readInt32(exception); - about = stream.readString(exception); - if ((flags & 1) != 0) { - participants_count = stream.readInt32(exception); - } - if ((flags & 2) != 0) { - admins_count = stream.readInt32(exception); - } - if ((flags & 4) != 0) { - kicked_count = stream.readInt32(exception); - } - read_inbox_max_id = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - stream.readInt32(exception); - chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = can_view_participants ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeString(about); - if ((flags & 1) != 0) { - stream.writeInt32(participants_count); - } - if ((flags & 2) != 0) { - stream.writeInt32(admins_count); - } - if ((flags & 4) != 0) { - stream.writeInt32(kicked_count); - } - stream.writeInt32(read_inbox_max_id); - stream.writeInt32(unread_count); - stream.writeInt32(0); - chat_photo.serializeToStream(stream); - notify_settings.serializeToStream(stream); - exported_invite.serializeToStream(stream); - } - } - - public static class TL_inputPeerNotifySettings extends TLObject { - public static int constructor = 0x38935eb2; - - public int flags; - public boolean show_previews; - public boolean silent; - public int mute_until; - public String sound; - - public static TL_inputPeerNotifySettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputPeerNotifySettings.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputPeerNotifySettings", constructor)); - } else { - return null; - } - } - TL_inputPeerNotifySettings result = new TL_inputPeerNotifySettings(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - show_previews = (flags & 1) != 0; - silent = (flags & 2) != 0; - mute_until = stream.readInt32(exception); - sound = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = show_previews ? (flags | 1) : (flags &~ 1); - flags = silent ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt32(mute_until); - stream.writeString(sound); - } - } - - public static class TL_null extends TLObject { - public static int constructor = 0x56730bcc; - - - public static TL_null TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_null.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_null", constructor)); - } else { - return null; - } - } - TL_null result = new TL_null(); - result.readParams(stream, exception); - return result; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_topPeerCategoryPeers extends TLObject { public static int constructor = 0xfb834291; @@ -3194,20 +1639,6 @@ public class TLRPC { } } - public static class TL_keyboardButton extends KeyboardButton { - public static int constructor = 0xa2fa4880; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - } - } - public static class TL_keyboardButtonSwitchInline extends KeyboardButton { public static int constructor = 0xea1b7a14; @@ -3268,103 +1699,6 @@ public class TLRPC { } } - public static class TL_botInlineMessageMediaAuto extends BotInlineMessage { - public static int constructor = 0xa74b15b; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - caption = stream.readString(exception); - if ((flags & 4) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(caption); - if ((flags & 4) != 0) { - reply_markup.serializeToStream(stream); - } - } - } - - public static class TL_botInlineMessageText extends BotInlineMessage { - public static int constructor = 0x8c7f65e2; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - no_webpage = (flags & 1) != 0; - message = stream.readString(exception); - if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 4) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = no_webpage ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeString(message); - if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 4) != 0) { - reply_markup.serializeToStream(stream); - } - } - } - - public static class TL_botInlineMessageMediaContact extends BotInlineMessage { - public static int constructor = 0x35edb4d4; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - phone_number = stream.readString(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - if ((flags & 4) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(phone_number); - stream.writeString(first_name); - stream.writeString(last_name); - if ((flags & 4) != 0) { - reply_markup.serializeToStream(stream); - } - } - } - public static class TL_botInlineMessageMediaVenue extends BotInlineMessage { public static int constructor = 0x4366232e; @@ -3459,46 +1793,6 @@ public class TLRPC { } } - public static class TL_boolFalse extends Bool { - public static int constructor = 0xbc799737; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_auth_exportedAuthorization extends TLObject { - public static int constructor = 0xdf969c2d; - - public int id; - public byte[] bytes; - - public static TL_auth_exportedAuthorization TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_auth_exportedAuthorization.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_auth_exportedAuthorization", constructor)); - } else { - return null; - } - } - TL_auth_exportedAuthorization result = new TL_auth_exportedAuthorization(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - bytes = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeByteArray(bytes); - } - } - public static class WebPage extends TLObject { public int flags; public long id; @@ -3568,92 +1862,6 @@ public class TLRPC { } } - public static class TL_webPage_old extends WebPage { - public static int constructor = 0xa31ea0b5; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readInt64(exception); - url = stream.readString(exception); - display_url = stream.readString(exception); - if ((flags & 1) != 0) { - type = stream.readString(exception); - } - if ((flags & 2) != 0) { - site_name = stream.readString(exception); - } - if ((flags & 4) != 0) { - title = stream.readString(exception); - } - if ((flags & 8) != 0) { - description = stream.readString(exception); - } - if ((flags & 16) != 0) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32) != 0) { - embed_url = stream.readString(exception); - } - if ((flags & 32) != 0) { - embed_type = stream.readString(exception); - } - if ((flags & 64) != 0) { - embed_width = stream.readInt32(exception); - } - if ((flags & 64) != 0) { - embed_height = stream.readInt32(exception); - } - if ((flags & 128) != 0) { - duration = stream.readInt32(exception); - } - if ((flags & 256) != 0) { - author = stream.readString(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeString(url); - stream.writeString(display_url); - if ((flags & 1) != 0) { - stream.writeString(type); - } - if ((flags & 2) != 0) { - stream.writeString(site_name); - } - if ((flags & 4) != 0) { - stream.writeString(title); - } - if ((flags & 8) != 0) { - stream.writeString(description); - } - if ((flags & 16) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 32) != 0) { - stream.writeString(embed_url); - } - if ((flags & 32) != 0) { - stream.writeString(embed_type); - } - if ((flags & 64) != 0) { - stream.writeInt32(embed_width); - } - if ((flags & 64) != 0) { - stream.writeInt32(embed_height); - } - if ((flags & 128) != 0) { - stream.writeInt32(duration); - } - if ((flags & 256) != 0) { - stream.writeString(author); - } - } - } - public static class TL_webPage extends WebPage { public static int constructor = 0xca820ed7; @@ -3805,71 +2013,6 @@ public class TLRPC { } } - public static class InputNotifyPeer extends TLObject { - - public static InputNotifyPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputNotifyPeer result = null; - return result; - } - } - - public static class TL_inputNotifyChats extends InputNotifyPeer { - public static int constructor = 0x4a95e84e; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputNotifyPeer extends InputNotifyPeer { - public static int constructor = 0xb8bc5b0c; - - public InputPeer peer; - - public void readParams(AbstractSerializedData stream, boolean exception) { - peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - } - } - - public static class TL_inputNotifyUsers extends InputNotifyPeer { - public static int constructor = 0x193b4417; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputNotifyGeoChatPeer extends InputNotifyPeer { - public static int constructor = 0x4d8ddec8; - - public TL_inputGeoChat peer; - - public void readParams(AbstractSerializedData stream, boolean exception) { - peer = TL_inputGeoChat.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - } - } - - public static class TL_inputNotifyAll extends InputNotifyPeer { - public static int constructor = 0xa429b886; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class InputFileLocation extends TLObject { public long id; public long access_hash; @@ -4044,58 +2187,6 @@ public class TLRPC { } } - public static class TL_userContact_old extends TL_userContact_old2 { - public static int constructor = 0xf2fb8319; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - access_hash = stream.readInt64(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeInt64(access_hash); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } - - public static class TL_userSelf_old extends TL_userSelf_old3 { - public static int constructor = 0x720535ec; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - inactive = stream.readBool(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - stream.writeBool(inactive); - } - } - public static class TL_userSelf_old3 extends User { public static int constructor = 0x1c60e608; @@ -4156,56 +2247,6 @@ public class TLRPC { } } - public static class TL_userRequest_old extends TL_userRequest_old2 { - public static int constructor = 0x22e8ceb0; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - access_hash = stream.readInt64(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeInt64(access_hash); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } - - public static class TL_userForeign_old extends TL_userForeign_old2 { - public static int constructor = 0x5214c89d; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - access_hash = stream.readInt64(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeInt64(access_hash); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } - public static class TL_userForeign_old2 extends User { public static int constructor = 0x75cf7a8; @@ -4232,296 +2273,7 @@ public class TLRPC { } } - public static class TL_userRequest_old2 extends User { - public static int constructor = 0xd9ccc4ef; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - username = stream.readString(exception); - access_hash = stream.readInt64(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(username); - stream.writeInt64(access_hash); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - } - } - - public static class TL_userDeleted_old extends TL_userDeleted_old2 { - public static int constructor = 0xb29ad7cc; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeString(first_name); - stream.writeString(last_name); - } - } - - public static class TL_userSelf_old2 extends TL_userSelf_old3 { - public static int constructor = 0x7007b451; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - username = stream.readString(exception); - phone = stream.readString(exception); - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - inactive = stream.readBool(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(username); - stream.writeString(phone); - photo.serializeToStream(stream); - status.serializeToStream(stream); - stream.writeBool(inactive); - } - } - - public static class TL_user_old extends TL_user { - public static int constructor = 0x22e49072; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - self = (flags & 1024) != 0; - contact = (flags & 2048) != 0; - mutual_contact = (flags & 4096) != 0; - deleted = (flags & 8192) != 0; - bot = (flags & 16384) != 0; - bot_chat_history = (flags & 32768) != 0; - bot_nochats = (flags & 65536) != 0; - verified = (flags & 131072) != 0; - explicit_content = (flags & 262144) != 0; - id = stream.readInt32(exception); - if ((flags & 1) != 0) { - access_hash = stream.readInt64(exception); - } - if ((flags & 2) != 0) { - first_name = stream.readString(exception); - } - if ((flags & 4) != 0) { - last_name = stream.readString(exception); - } - if ((flags & 8) != 0) { - username = stream.readString(exception); - } - if ((flags & 16) != 0) { - phone = stream.readString(exception); - } - if ((flags & 32) != 0) { - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 64) != 0) { - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 16384) != 0) { - bot_info_version = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = self ? (flags | 1024) : (flags &~ 1024); - flags = contact ? (flags | 2048) : (flags &~ 2048); - flags = mutual_contact ? (flags | 4096) : (flags &~ 4096); - flags = deleted ? (flags | 8192) : (flags &~ 8192); - flags = bot ? (flags | 16384) : (flags &~ 16384); - flags = bot_chat_history ? (flags | 32768) : (flags &~ 32768); - flags = bot_nochats ? (flags | 65536) : (flags &~ 65536); - flags = verified ? (flags | 131072) : (flags &~ 131072); - flags = explicit_content ? (flags | 262144) : (flags &~ 262144); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 1) != 0) { - stream.writeInt64(access_hash); - } - if ((flags & 2) != 0) { - stream.writeString(first_name); - } - if ((flags & 4) != 0) { - stream.writeString(last_name); - } - if ((flags & 8) != 0) { - stream.writeString(username); - } - if ((flags & 16) != 0) { - stream.writeString(phone); - } - if ((flags & 32) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 64) != 0) { - status.serializeToStream(stream); - } - if ((flags & 16384) != 0) { - stream.writeInt32(bot_info_version); - } - } - } - - public static class TL_user extends User { - public static int constructor = 0xd10d979a; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - self = (flags & 1024) != 0; - contact = (flags & 2048) != 0; - mutual_contact = (flags & 4096) != 0; - deleted = (flags & 8192) != 0; - bot = (flags & 16384) != 0; - bot_chat_history = (flags & 32768) != 0; - bot_nochats = (flags & 65536) != 0; - verified = (flags & 131072) != 0; - restricted = (flags & 262144) != 0; - min = (flags & 1048576) != 0; - bot_inline_geo = (flags & 2097152) != 0; - id = stream.readInt32(exception); - if ((flags & 1) != 0) { - access_hash = stream.readInt64(exception); - } - if ((flags & 2) != 0) { - first_name = stream.readString(exception); - } - if ((flags & 4) != 0) { - last_name = stream.readString(exception); - } - if ((flags & 8) != 0) { - username = stream.readString(exception); - } - if ((flags & 16) != 0) { - phone = stream.readString(exception); - } - if ((flags & 32) != 0) { - photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 64) != 0) { - status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 16384) != 0) { - bot_info_version = stream.readInt32(exception); - } - if ((flags & 262144) != 0) { - restriction_reason = stream.readString(exception); - } - if ((flags & 524288) != 0) { - bot_inline_placeholder = stream.readString(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = self ? (flags | 1024) : (flags &~ 1024); - flags = contact ? (flags | 2048) : (flags &~ 2048); - flags = mutual_contact ? (flags | 4096) : (flags &~ 4096); - flags = deleted ? (flags | 8192) : (flags &~ 8192); - flags = bot ? (flags | 16384) : (flags &~ 16384); - flags = bot_chat_history ? (flags | 32768) : (flags &~ 32768); - flags = bot_nochats ? (flags | 65536) : (flags &~ 65536); - flags = verified ? (flags | 131072) : (flags &~ 131072); - flags = restricted ? (flags | 262144) : (flags &~ 262144); - flags = min ? (flags | 1048576) : (flags &~ 1048576); - flags = bot_inline_geo ? (flags | 2097152) : (flags &~ 2097152); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 1) != 0) { - stream.writeInt64(access_hash); - } - if ((flags & 2) != 0) { - stream.writeString(first_name); - } - if ((flags & 4) != 0) { - stream.writeString(last_name); - } - if ((flags & 8) != 0) { - stream.writeString(username); - } - if ((flags & 16) != 0) { - stream.writeString(phone); - } - if ((flags & 32) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 64) != 0) { - status.serializeToStream(stream); - } - if ((flags & 16384) != 0) { - stream.writeInt32(bot_info_version); - } - if ((flags & 262144) != 0) { - stream.writeString(restriction_reason); - } - if ((flags & 524288) != 0) { - stream.writeString(bot_inline_placeholder); - } - } - } - - public static class ChannelParticipantRole extends TLObject { - - public static ChannelParticipantRole TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ChannelParticipantRole result = null; - return result; - } - } - - public static class TL_channelRoleEditor extends ChannelParticipantRole { - public static int constructor = 0x820bfe8c; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_channelRoleEmpty extends ChannelParticipantRole { - public static int constructor = 0xb285a0c6; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_channelRoleModerator extends ChannelParticipantRole { - public static int constructor = 0x9618d975; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class ChannelParticipantsFilter extends TLObject { + public static class ChannelParticipantsFilter extends TLObject { public static ChannelParticipantsFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { ChannelParticipantsFilter result = null; @@ -4529,15 +2281,6 @@ public class TLRPC { } } - public static class TL_channelParticipantsAdmins extends ChannelParticipantsFilter { - public static int constructor = 0xb4608969; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_channelParticipantsRecent extends ChannelParticipantsFilter { public static int constructor = 0xde3f3c79; @@ -4547,101 +2290,6 @@ public class TLRPC { } } - public static class TL_channelParticipantsKicked extends ChannelParticipantsFilter { - public static int constructor = 0x3c37bb7a; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_channelParticipantsBots extends ChannelParticipantsFilter { - public static int constructor = 0xb0d1865b; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class GeoChatMessage extends TLObject { - public int chat_id; - public int id; - public int from_id; - public int date; - public String message; - public MessageMedia media; - public MessageAction action; - - public static GeoChatMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - GeoChatMessage result = null; - return result; - } - } - - public static class TL_geoChatMessage extends GeoChatMessage { - public static int constructor = 0x4505f8e1; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - chat_id = stream.readInt32(exception); - id = stream.readInt32(exception); - from_id = stream.readInt32(exception); - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(chat_id); - stream.writeInt32(id); - stream.writeInt32(from_id); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - } - } - - public static class TL_geoChatMessageService extends GeoChatMessage { - public static int constructor = 0xd34fa24e; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - chat_id = stream.readInt32(exception); - id = stream.readInt32(exception); - from_id = stream.readInt32(exception); - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(chat_id); - stream.writeInt32(id); - stream.writeInt32(from_id); - stream.writeInt32(date); - action.serializeToStream(stream); - } - } - - public static class TL_geoChatMessageEmpty extends GeoChatMessage { - public static int constructor = 0x60311a9b; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - chat_id = stream.readInt32(exception); - id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(chat_id); - stream.writeInt32(id); - } - } - public static class MessageAction extends TLObject { public String title; public String address; @@ -4722,22 +2370,6 @@ public class TLRPC { } } - /* - public static class TL_messageActionChatMigrateTo extends MessageAction { - public static int constructor = 0x51bdb021; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - channel_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(channel_id); - } - } - */ - public static class TL_messageActionHistoryClear extends MessageAction { public static int constructor = 0x9fbab604; @@ -4761,22 +2393,6 @@ public class TLRPC { } } - public static class TL_messageActionChannelMigrateFrom extends MessageAction { - public static int constructor = 0xb055eaee; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - title = stream.readString(exception); - chat_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(title); - stream.writeInt32(chat_id); - } - } - public static class TL_messageActionChatAddUser extends MessageAction { public static int constructor = 0x488a7337; @@ -4852,15 +2468,6 @@ public class TLRPC { } } - public static class TL_messageActionGeoChatCheckin extends MessageAction { - public static int constructor = 0xc7d53de; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_messageActionChatJoinedByLink extends MessageAction { public static int constructor = 0xf89cf5e8; @@ -4875,20 +2482,6 @@ public class TLRPC { } } - public static class TL_messageActionChatAddUser_old extends TL_messageActionChatAddUser { - public static int constructor = 0x5e3cfc4b; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(user_id); - } - } - public static class TL_messageActionTTLChange extends MessageAction { public static int constructor = 0x55555552; @@ -4958,129 +2551,6 @@ public class TLRPC { } } - public static class TL_messageActionGeoChatCreate extends MessageAction { - public static int constructor = 0x6f038ebc; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - title = stream.readString(exception); - address = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(title); - stream.writeString(address); - } - } - - public static class ReportReason extends TLObject { - public String text; - - public static ReportReason TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ReportReason result = null; - return result; - } - } - - public static class TL_inputReportReasonSpam extends ReportReason { - public static int constructor = 0x58dbcab8; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputReportReasonViolence extends ReportReason { - public static int constructor = 0x1e22c78d; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputReportReasonOther extends ReportReason { - public static int constructor = 0xe1746d0a; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - } - } - - public static class TL_inputReportReasonPornography extends ReportReason { - public static int constructor = 0x2e59d922; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class PeerNotifyEvents extends TLObject { - - public static PeerNotifyEvents TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - PeerNotifyEvents result = null; - return result; - } - } - - public static class TL_peerNotifyEventsEmpty extends PeerNotifyEvents { - public static int constructor = 0xadd53cb3; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_peerNotifyEventsAll extends PeerNotifyEvents { - public static int constructor = 0x6d1ded88; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_chatLocated extends TLObject { - public static int constructor = 0x3631cf4c; - - public int chat_id; - public int distance; - - public static TL_chatLocated TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_chatLocated.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_chatLocated", constructor)); - } else { - return null; - } - } - TL_chatLocated result = new TL_chatLocated(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - chat_id = stream.readInt32(exception); - distance = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(chat_id); - stream.writeInt32(distance); - } - } - public static class DecryptedMessage extends TLObject { public long random_id; public int ttl; @@ -5236,32 +2706,6 @@ public class TLRPC { } } - public static class InputPeerNotifyEvents extends TLObject { - - public static InputPeerNotifyEvents TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputPeerNotifyEvents result = null; - return result; - } - } - - public static class TL_inputPeerNotifyEventsAll extends InputPeerNotifyEvents { - public static int constructor = 0xe86a2c74; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputPeerNotifyEventsEmpty extends InputPeerNotifyEvents { - public static int constructor = 0xf03064d8; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class Video extends TLObject { public long id; public long access_hash; @@ -5284,38 +2728,6 @@ public class TLRPC { } } - public static class TL_video_old3 extends TL_video_layer45 { - public static int constructor = 0xee9f4a4d; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(w); - stream.writeInt32(h); - } - } - public static class TL_video_layer45 extends Video { public static int constructor = 0xf72887d3; @@ -5348,156 +2760,6 @@ public class TLRPC { } } - public static class TL_videoEncrypted extends TL_video_layer45 { - public static int constructor = 0x55555553; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - caption = stream.readString(exception); - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - stream.writeString(caption); - stream.writeInt32(duration); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_video_old extends TL_video_layer45 { - public static int constructor = 0x5a04a49f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - caption = stream.readString(exception); - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - stream.writeString(caption); - stream.writeInt32(duration); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(w); - stream.writeInt32(h); - } - } - - public static class TL_video_old2 extends TL_video_layer45 { - public static int constructor = 0x388fa391; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - caption = stream.readString(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - stream.writeString(caption); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(w); - stream.writeInt32(h); - } - } - - public static class TL_videoEmpty_layer45 extends Video { - public static int constructor = 0xc10658a8; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - } - } - - public static class TL_exportedMessageLink extends TLObject { - public static int constructor = 0x1f486803; - - public String link; - - public static TL_exportedMessageLink TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_exportedMessageLink.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_exportedMessageLink", constructor)); - } else { - return null; - } - } - TL_exportedMessageLink result = new TL_exportedMessageLink(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - link = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(link); - } - } - public static class TopPeerCategory extends TLObject { public static TopPeerCategory TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { @@ -5515,15 +2777,6 @@ public class TLRPC { } } - public static class TL_topPeerCategoryGroups extends TopPeerCategory { - public static int constructor = 0xbd17a14a; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_topPeerCategoryBotsInline extends TopPeerCategory { public static int constructor = 0x148677e2; @@ -5533,24 +2786,6 @@ public class TLRPC { } } - public static class TL_topPeerCategoryChannels extends TopPeerCategory { - public static int constructor = 0x161d9628; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_topPeerCategoryBotsPM extends TopPeerCategory { - public static int constructor = 0xab661b5b; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_contactBlocked extends TLObject { public static int constructor = 0x561bc879; @@ -5592,15 +2827,6 @@ public class TLRPC { } } - public static class TL_inputDocumentEmpty extends InputDocument { - public static int constructor = 0x72f0eaae; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_inputDocument extends InputDocument { public static int constructor = 0x18798952; @@ -5617,79 +2843,6 @@ public class TLRPC { } } - /* - public static class TL_inputAppEvent extends TLObject { - public static int constructor = 0x770656a8; - - public double time; - public String type; - public long peer; - public String data; - - public static TL_inputAppEvent TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputAppEvent.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputAppEvent", constructor)); - } else { - return null; - } - } - TL_inputAppEvent result = new TL_inputAppEvent(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - time = stream.readDouble(exception); - type = stream.readString(exception); - peer = stream.readInt64(exception); - data = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeDouble(time); - stream.writeString(type); - stream.writeInt64(peer); - stream.writeString(data); - } - } - */ - - public static class TL_messages_affectedHistory extends TLObject { - public static int constructor = 0xb45c69d1; - - public int pts; - public int pts_count; - public int offset; - - public static TL_messages_affectedHistory TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_affectedHistory.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_affectedHistory", constructor)); - } else { - return null; - } - } - TL_messages_affectedHistory result = new TL_messages_affectedHistory(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - pts = stream.readInt32(exception); - pts_count = stream.readInt32(exception); - offset = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(pts); - stream.writeInt32(pts_count); - stream.writeInt32(offset); - } - } - public static class Document extends TLObject { public long id; public long access_hash; @@ -5711,70 +2864,6 @@ public class TLRPC { } } - public static class TL_documentEncrypted_old extends TL_document { - public static int constructor = 0x55555556; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - file_name = stream.readString(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - stream.writeString(file_name); - stream.writeString(mime_type); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_document_old extends TL_document { - public static int constructor = 0x9efc6326; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - file_name = stream.readString(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - stream.writeString(file_name); - stream.writeString(mime_type); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - } - } - public static class TL_documentEmpty extends Document { public static int constructor = 0x36f8c871; @@ -5895,161 +2984,6 @@ public class TLRPC { } } - public static class ContactLink extends TLObject { - - public static ContactLink TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ContactLink result = null; - return result; - } - } - - public static class TL_contactLinkNone extends ContactLink { - public static int constructor = 0xfeedd3ad; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_contactLinkContact extends ContactLink { - public static int constructor = 0xd502c2d0; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_contactLinkHasPhone extends ContactLink { - public static int constructor = 0x268f3f59; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_contactLinkUnknown extends ContactLink { - public static int constructor = 0x5f4f9247; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class InputPrivacyRule extends TLObject { - public ArrayList users = new ArrayList<>(); - - public static InputPrivacyRule TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputPrivacyRule result = null; - return result; - } - } - - public static class TL_inputPrivacyValueDisallowUsers extends InputPrivacyRule { - public static int constructor = 0x90110467; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputUser object = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_inputPrivacyValueDisallowAll extends InputPrivacyRule { - public static int constructor = 0xd66b66c9; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputPrivacyValueDisallowContacts extends InputPrivacyRule { - public static int constructor = 0xba52007; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputPrivacyValueAllowAll extends InputPrivacyRule { - public static int constructor = 0x184b35ce; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputPrivacyValueAllowContacts extends InputPrivacyRule { - public static int constructor = 0xd09e07b; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputPrivacyValueAllowUsers extends InputPrivacyRule { - public static int constructor = 0x131cc67f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputUser object = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - public static class InputMedia extends TLObject { public InputFile file; public InputFile thumb; @@ -6179,15 +3113,6 @@ public class TLRPC { } } - public static class TL_inputMediaEmpty extends InputMedia { - public static int constructor = 0x9664f57f; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_inputMediaUploadedPhoto extends InputMedia { public static int constructor = 0xf7aff1c0; @@ -6282,225 +3207,6 @@ public class TLRPC { } } - public static class geochats_Messages extends TLObject { - public int count; - public ArrayList messages = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - - public static geochats_Messages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - geochats_Messages result = null; - return result; - } - } - - public static class TL_geochats_messagesSlice extends geochats_Messages { - public static int constructor = 0xbc5863e8; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - GeoChatMessage object = GeoChatMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_geochats_messages extends geochats_Messages { - public static int constructor = 0xd1526db1; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - GeoChatMessage object = GeoChatMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class EncryptedMessage extends TLObject { - public long random_id; - public int chat_id; - public int date; - public byte[] bytes; - public EncryptedFile file; - - public static EncryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - EncryptedMessage result = null; - return result; - } - } - - public static class TL_encryptedMessageService extends EncryptedMessage { - public static int constructor = 0x23734b06; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - random_id = stream.readInt64(exception); - chat_id = stream.readInt32(exception); - date = stream.readInt32(exception); - bytes = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(random_id); - stream.writeInt32(chat_id); - stream.writeInt32(date); - stream.writeByteArray(bytes); - } - } - - public static class TL_encryptedMessage extends EncryptedMessage { - public static int constructor = 0xed18c118; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - random_id = stream.readInt64(exception); - chat_id = stream.readInt32(exception); - date = stream.readInt32(exception); - bytes = stream.readByteArray(exception); - file = EncryptedFile.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(random_id); - stream.writeInt32(chat_id); - stream.writeInt32(date); - stream.writeByteArray(bytes); - file.serializeToStream(stream); - } - } - public static class InputStickerSet extends TLObject { public long id; public long access_hash; @@ -6560,20 +3266,6 @@ public class TLRPC { } } - public static class TL_userStatusOffline extends UserStatus { - public static int constructor = 0x8c703f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - expires = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(expires); - } - } - public static class TL_userStatusLastWeek extends UserStatus { public static int constructor = 0x7bf09fc; @@ -6583,15 +3275,6 @@ public class TLRPC { } } - public static class TL_userStatusEmpty extends UserStatus { - public static int constructor = 0x9d05049; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_userStatusLastMonth extends UserStatus { public static int constructor = 0x77ebc742; @@ -6601,20 +3284,6 @@ public class TLRPC { } } - public static class TL_userStatusOnline extends UserStatus { - public static int constructor = 0xedb93949; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - expires = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(expires); - } - } - public static class TL_userStatusRecently extends UserStatus { public static int constructor = 0xe26f42f1; @@ -6624,39 +3293,6 @@ public class TLRPC { } } - /* - public static class TL_messages_messageEditData extends TLObject { - public static int constructor = 0x26b5dde6; - - public int flags; - public boolean caption; - - public static TL_messages_messageEditData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_messageEditData.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageEditData", constructor)); - } else { - return null; - } - } - TL_messages_messageEditData result = new TL_messages_messageEditData(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - caption = (flags & 1) != 0; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = caption ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - } - } - */ - public static class TL_contacts_importedContacts extends TLObject { public static int constructor = 0xad524315; @@ -6821,30 +3457,19 @@ public class TLRPC { public String query; public GeoPoint geo; public String offset; - public PeerNotifySettings notify_settings; public int channel_id; public SendMessageAction action; public boolean blocked; - public long auth_key_id; - public String device; public String location; public int max_id; public int qts; public boolean enabled; - public long random_id; - public ArrayList dc_options = new ArrayList<>(); - public ChatParticipants participants; public PrivacyKey key; public ArrayList rules = new ArrayList<>(); public UserStatus status; public int views; public String type; public MessageMedia media; - public boolean popup; - public boolean is_admin; - public TL_messages_stickerSet stickerset; - public ContactLink my_link; - public ContactLink foreign_link; public String first_name; public String last_name; public String username; @@ -6853,7 +3478,6 @@ public class TLRPC { public WebPage webpage; public EncryptedChat chat; public ArrayList order = new ArrayList<>(); - public int max_date; public UserProfilePhoto photo; public boolean previous; @@ -6903,23 +3527,6 @@ public class TLRPC { } } - public static class TL_updateChannelPinnedMessage extends Update { - public static int constructor = 0x98592475; - - public int id; - - public void readParams(AbstractSerializedData stream, boolean exception) { - channel_id = stream.readInt32(exception); - id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(channel_id); - stream.writeInt32(id); - } - } - public static class TL_updateWebPage extends Update { public static int constructor = 0x7f891213; @@ -7057,22 +3664,6 @@ public class TLRPC { } } - public static class TL_inputEncryptedFile extends InputEncryptedFile { - public static int constructor = 0x5a17b5e5; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - } - } - public static class TL_inputEncryptedFileBigUploaded extends InputEncryptedFile { public static int constructor = 0x2dc173c8; @@ -7091,15 +3682,6 @@ public class TLRPC { } } - public static class TL_inputEncryptedFileEmpty extends InputEncryptedFile { - public static int constructor = 0x1837c364; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_inputEncryptedFileUploaded extends InputEncryptedFile { public static int constructor = 0x64bd0306; @@ -7168,26 +3750,11 @@ public class TLRPC { } } - public static class TL_messages_allStickersNotModified extends messages_AllStickers { - public static int constructor = 0xe86602c3; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class DecryptedMessageAction extends TLObject { public int ttl_seconds; public int layer; public ArrayList random_ids = new ArrayList<>(); - public long exchange_id; - public long key_fingerprint; public SendMessageAction action; - public byte[] g_b; - public int start_seq_no; - public int end_seq_no; - public byte[] g_a; public static DecryptedMessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { DecryptedMessageAction result = null; @@ -7273,22 +3840,6 @@ public class TLRPC { } } - public static class TL_account_noPassword extends account_Password { - public static int constructor = 0x96dabc18; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - new_salt = stream.readByteArray(exception); - email_unconfirmed_pattern = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(new_salt); - stream.writeString(email_unconfirmed_pattern); - } - } - public static class UserProfilePhoto extends TLObject { public long photo_id; public FileLocation photo_small; @@ -7327,22 +3878,6 @@ public class TLRPC { } } - public static class TL_userProfilePhoto_old extends TL_userProfilePhoto { - public static int constructor = 0x990d1493; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - photo_small = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); - photo_big = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - photo_small.serializeToStream(stream); - photo_big.serializeToStream(stream); - } - } - public static class MessageEntity extends TLObject { public int offset; public int length; @@ -7423,22 +3958,6 @@ public class TLRPC { } } - public static class TL_messageEntityUnknown extends MessageEntity { - public static int constructor = 0xbb92ba95; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - } - } - public static class TL_messageEntityUrl extends MessageEntity { public static int constructor = 0x6ed02538; @@ -7588,51 +4107,6 @@ public class TLRPC { } } - public static class TL_photo_old extends TL_photo { - public static int constructor = 0x22b56751; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - caption = stream.readString(exception); - geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PhotoSize object = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sizes.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - stream.writeString(caption); - geo.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sizes.get(a).serializeToStream(stream); - } - } - } - public static class TL_photo extends Photo { public static int constructor = 0xcded42fe; @@ -7672,49 +4146,6 @@ public class TLRPC { } } - public static class TL_photo_old2 extends TL_photo { - public static int constructor = 0xc3838076; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PhotoSize object = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sizes.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(user_id); - stream.writeInt32(date); - geo.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sizes.get(a).serializeToStream(stream); - } - } - } - public static class TL_photoEmpty extends Photo { public static int constructor = 0x2331b22d; @@ -7729,56 +4160,6 @@ public class TLRPC { } } - public static class TL_encryptedChatRequested_old extends TL_encryptedChatRequested { - public static int constructor = 0xfda9a7b7; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt32(exception); - participant_id = stream.readInt32(exception); - g_a = stream.readByteArray(exception); - nonce = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32(admin_id); - stream.writeInt32(participant_id); - stream.writeByteArray(g_a); - stream.writeByteArray(nonce); - } - } - - public static class TL_encryptedChatRequested extends EncryptedChat { - public static int constructor = 0xc878527e; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt32(exception); - participant_id = stream.readInt32(exception); - g_a = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32(admin_id); - stream.writeInt32(participant_id); - stream.writeByteArray(g_a); - } - } - public static class TL_encryptedChat extends EncryptedChat { public static int constructor = 0xfa56ce36; @@ -7805,161 +4186,6 @@ public class TLRPC { } } - public static class TL_encryptedChat_old extends TL_encryptedChat { - public static int constructor = 0x6601d14f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt32(exception); - participant_id = stream.readInt32(exception); - g_a_or_b = stream.readByteArray(exception); - nonce = stream.readByteArray(exception); - key_fingerprint = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32(admin_id); - stream.writeInt32(participant_id); - stream.writeByteArray(g_a_or_b); - stream.writeByteArray(nonce); - stream.writeInt64(key_fingerprint); - } - } - - public static class TL_encryptedChatEmpty extends EncryptedChat { - public static int constructor = 0xab7ec0a0; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - } - } - - public static class TL_encryptedChatWaiting extends EncryptedChat { - public static int constructor = 0x3bf703dc; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt32(exception); - participant_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32(admin_id); - stream.writeInt32(participant_id); - } - } - - public static class TL_encryptedChatDiscarded extends EncryptedChat { - public static int constructor = 0x13d6dd27; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - } - } - - /* - public static class TL_geochats_statedMessage extends TLObject { - public static int constructor = 0x17b1578b; - - public GeoChatMessage message; - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public int seq; - - public static TL_geochats_statedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_geochats_statedMessage.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_geochats_statedMessage", constructor)); - } else { - return null; - } - } - TL_geochats_statedMessage result = new TL_geochats_statedMessage(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - message = GeoChatMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - seq = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - message.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - stream.writeInt32(seq); - } - } - */ - public static class TL_contact extends TLObject { public static int constructor = 0xf911c994; @@ -8203,95 +4429,6 @@ public class TLRPC { } } - public static class TL_contacts_topPeersNotModified extends contacts_TopPeers { - public static int constructor = 0xde266ef5; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - /* - public static class TL_help_support extends TLObject { - public static int constructor = 0x17c6b5f6; - - public String phone_number; - public User user; - - public static TL_help_support TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_help_support.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_help_support", constructor)); - } else { - return null; - } - } - TL_help_support result = new TL_help_support(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - phone_number = stream.readString(exception); - user = User.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - user.serializeToStream(stream); - } - } - */ - - public static class TL_messages_chats extends TLObject { - public static int constructor = 0x64ff9fd5; - - public ArrayList chats = new ArrayList<>(); - - public static TL_messages_chats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_chats.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_chats", constructor)); - } else { - return null; - } - } - TL_messages_chats result = new TL_messages_chats(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - } - } - public static class InputChannel extends TLObject { public int channel_id; public long access_hash; @@ -8358,311 +4495,6 @@ public class TLRPC { } } - public static class updates_ChannelDifference extends TLObject { - public int flags; - public boolean isFinal; - public int pts; - public int timeout; - public ArrayList new_messages = new ArrayList<>(); - public ArrayList other_updates = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public int top_message; - public int read_inbox_max_id; - public int read_outbox_max_id; - public int unread_count; - public ArrayList messages = new ArrayList<>(); - - public static updates_ChannelDifference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - updates_ChannelDifference result = null; - return result; - } - } - - public static class TL_updates_channelDifferenceEmpty extends updates_ChannelDifference { - public static int constructor = 0x3e11affb; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - isFinal = (flags & 1) != 0; - pts = stream.readInt32(exception); - if ((flags & 2) != 0) { - timeout = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = isFinal ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(pts); - if ((flags & 2) != 0) { - stream.writeInt32(timeout); - } - } - } - - public static class TL_updates_channelDifference extends updates_ChannelDifference { - public static int constructor = 0x2064674e; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - isFinal = (flags & 1) != 0; - pts = stream.readInt32(exception); - if ((flags & 2) != 0) { - timeout = stream.readInt32(exception); - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - other_updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = isFinal ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(pts); - if ((flags & 2) != 0) { - stream.writeInt32(timeout); - } - stream.writeInt32(0x1cb5c415); - int count = new_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = other_updates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - other_updates.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_updates_channelDifferenceTooLong extends updates_ChannelDifference { - public static int constructor = 0x410dee07; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - isFinal = (flags & 1) != 0; - pts = stream.readInt32(exception); - if ((flags & 2) != 0) { - timeout = stream.readInt32(exception); - } - top_message = stream.readInt32(exception); - read_inbox_max_id = stream.readInt32(exception); - read_outbox_max_id = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = isFinal ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(pts); - if ((flags & 2) != 0) { - stream.writeInt32(timeout); - } - stream.writeInt32(top_message); - stream.writeInt32(read_inbox_max_id); - stream.writeInt32(read_outbox_max_id); - stream.writeInt32(unread_count); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class ChannelMessagesFilter extends TLObject { - public int flags; - public boolean exclude_new_messages; - public ArrayList ranges = new ArrayList<>(); - - public static ChannelMessagesFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ChannelMessagesFilter result = null; - return result; - } - } - - public static class TL_channelMessagesFilterEmpty extends ChannelMessagesFilter { - public static int constructor = 0x94d42ee7; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_channelMessagesFilter extends ChannelMessagesFilter { - public static int constructor = 0xcd77d957; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - exclude_new_messages = (flags & 2) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_messageRange object = TL_messageRange.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - ranges.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = exclude_new_messages ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = ranges.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - ranges.get(a).serializeToStream(stream); - } - } - } - public static class TL_contacts_resolvedPeer extends TLObject { public static int constructor = 0x7f077ad9; @@ -8763,24 +4595,6 @@ public class TLRPC { } } - public static class TL_channelParticipantSelf extends ChannelParticipant { - public static int constructor = 0xa3289a6d; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt32(exception); - inviter_id = stream.readInt32(exception); - date = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(user_id); - stream.writeInt32(inviter_id); - stream.writeInt32(date); - } - } - public static class TL_channelParticipantEditor extends ChannelParticipant { public static int constructor = 0x98192d61; @@ -8799,24 +4613,6 @@ public class TLRPC { } } - public static class TL_channelParticipantKicked extends ChannelParticipant { - public static int constructor = 0x8cc5e69a; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt32(exception); - kicked_by = stream.readInt32(exception); - date = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(user_id); - stream.writeInt32(kicked_by); - stream.writeInt32(date); - } - } - public static class TL_channelParticipantModerator extends ChannelParticipant { public static int constructor = 0x91057fef; @@ -9085,59 +4881,6 @@ public class TLRPC { } } - public static class TL_chatParticipants_old extends TL_chatParticipants { - public static int constructor = 0x7841b415; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - chat_id = stream.readInt32(exception); - admin_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - ChatParticipant object = ChatParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } - version = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(chat_id); - stream.writeInt32(admin_id); - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } - stream.writeInt32(version); - } - } - - public static class TL_chatParticipantsForbidden_old extends TL_chatParticipantsForbidden { - public static int constructor = 0xfd2bb8a; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - chat_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(chat_id); - } - } - public static class DecryptedMessageMedia extends TLObject { public int duration; public String mime_type; @@ -9173,417 +4916,6 @@ public class TLRPC { } } - public static class TL_decryptedMessageMediaAudio extends DecryptedMessageMedia { - public static int constructor = 0x57e0a9cb; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_decryptedMessageMediaGeoPoint extends DecryptedMessageMedia { - public static int constructor = 0x35480a59; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - lat = stream.readDouble(exception); - _long = stream.readDouble(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeDouble(lat); - stream.writeDouble(_long); - } - } - - public static class TL_decryptedMessageMediaContact extends DecryptedMessageMedia { - public static int constructor = 0x588a0a97; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - phone_number = stream.readString(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - user_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeInt32(user_id); - } - } - - public static class TL_decryptedMessageMediaEmpty extends DecryptedMessageMedia { - public static int constructor = 0x89f5c4a; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_decryptedMessageMediaDocument extends DecryptedMessageMedia { - public static int constructor = 0x7afe8ae2; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - caption = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeString(mime_type); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - stream.writeString(caption); - } - } - - public static class TL_decryptedMessageMediaWebPage extends DecryptedMessageMedia { - public static int constructor = 0xe50511d8; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - } - } - - public static class TL_decryptedMessageMediaPhoto extends DecryptedMessageMedia { - public static int constructor = 0xf1fa8d78; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - caption = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - stream.writeString(caption); - } - } - - public static class TL_decryptedMessageMediaVideo extends DecryptedMessageMedia { - public static int constructor = 0x970c8c0e; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - caption = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - stream.writeString(caption); - } - } - - public static class TL_decryptedMessageMediaDocument_layer8 extends TL_decryptedMessageMediaDocument { - public static int constructor = 0xb095434b; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - file_name = stream.readString(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeString(file_name); - stream.writeString(mime_type); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_decryptedMessageMediaVideo_layer8 extends TL_decryptedMessageMediaVideo { - public static int constructor = 0x4cee6ef3; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - duration = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeInt32(duration); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_decryptedMessageMediaVenue extends DecryptedMessageMedia { - public static int constructor = 0x8a0df56f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - lat = stream.readDouble(exception); - _long = stream.readDouble(exception); - title = stream.readString(exception); - address = stream.readString(exception); - provider = stream.readString(exception); - venue_id = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeDouble(lat); - stream.writeDouble(_long); - stream.writeString(title); - stream.writeString(address); - stream.writeString(provider); - stream.writeString(venue_id); - } - } - - public static class TL_decryptedMessageMediaExternalDocument extends DecryptedMessageMedia { - public static int constructor = 0xfa95b0dd; - - public PhotoSize thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeString(mime_type); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } - } - } - - public static class TL_decryptedMessageMediaVideo_layer17 extends TL_decryptedMessageMediaVideo { - public static int constructor = 0x524a415d; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_decryptedMessageMediaAudio_layer8 extends TL_decryptedMessageMediaAudio { - public static int constructor = 0x6080758f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - duration = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(duration); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - - public static class TL_decryptedMessageMediaPhoto_layer8 extends TL_decryptedMessageMediaPhoto { - public static int constructor = 0x32798a8c; - - public byte[] thumb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - thumb = stream.readByteArray(exception); - thumb_w = stream.readInt32(exception); - thumb_h = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - size = stream.readInt32(exception); - key = stream.readByteArray(exception); - iv = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(thumb); - stream.writeInt32(thumb_w); - stream.writeInt32(thumb_h); - stream.writeInt32(w); - stream.writeInt32(h); - stream.writeInt32(size); - stream.writeByteArray(key); - stream.writeByteArray(iv); - } - } - public static class ChatParticipant extends TLObject { public int user_id; public int inviter_id; @@ -9684,43 +5016,6 @@ public class TLRPC { } } - public static class TL_chat_old2 extends TL_chat { - public static int constructor = 0x7312bc48; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - creator = (flags & 1) != 0; - kicked = (flags & 2) != 0; - left = (flags & 4) != 0; - admins_enabled = (flags & 8) != 0; - admin = (flags & 16) != 0; - deactivated = (flags & 32) != 0; - id = stream.readInt32(exception); - title = stream.readString(exception); - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - participants_count = stream.readInt32(exception); - date = stream.readInt32(exception); - version = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator ? (flags | 1) : (flags &~ 1); - flags = kicked ? (flags | 2) : (flags &~ 2); - flags = left ? (flags | 4) : (flags &~ 4); - flags = admins_enabled ? (flags | 8) : (flags &~ 8); - flags = admin ? (flags | 16) : (flags &~ 16); - flags = deactivated ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeString(title); - photo.serializeToStream(stream); - stream.writeInt32(participants_count); - stream.writeInt32(date); - stream.writeInt32(version); - } - } - public static class TL_channelForbidden extends Chat { public static int constructor = 0x8537784f; @@ -9826,73 +5121,6 @@ public class TLRPC { } } - public static class TL_channel_old extends TL_channel { - public static int constructor = 0x678e9587; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - creator = (flags & 1) != 0; - kicked = (flags & 2) != 0; - left = (flags & 4) != 0; - editor = (flags & 8) != 0; - moderator = (flags & 16) != 0; - broadcast = (flags & 32) != 0; - verified = (flags & 128) != 0; - megagroup = (flags & 256) != 0; - explicit_content = (flags & 512) != 0; - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - if ((flags & 64) != 0) { - username = stream.readString(exception); - } - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - version = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator ? (flags | 1) : (flags &~ 1); - flags = kicked ? (flags | 2) : (flags &~ 2); - flags = left ? (flags | 4) : (flags &~ 4); - flags = editor ? (flags | 8) : (flags &~ 8); - flags = moderator ? (flags | 16) : (flags &~ 16); - flags = broadcast ? (flags | 32) : (flags &~ 32); - flags = verified ? (flags | 128) : (flags &~ 128); - flags = megagroup ? (flags | 256) : (flags &~ 256); - flags = explicit_content ? (flags | 512) : (flags &~ 512); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeString(title); - if ((flags & 64) != 0) { - stream.writeString(username); - } - photo.serializeToStream(stream); - stream.writeInt32(date); - stream.writeInt32(version); - } - } - - public static class TL_chatForbidden_old extends TL_chatForbidden { - public static int constructor = 0xfb0ccc41; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - title = stream.readString(exception); - date = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeString(title); - stream.writeInt32(date); - } - } - public static class TL_chat extends Chat { public static int constructor = 0xd91cdd54; @@ -9936,142 +5164,6 @@ public class TLRPC { } } - public static class TL_geoChat extends Chat { - public static int constructor = 0x75eaea5a; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - address = stream.readString(exception); - venue = stream.readString(exception); - geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - participants_count = stream.readInt32(exception); - date = stream.readInt32(exception); - checked_in = stream.readBool(exception); - version = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeString(title); - stream.writeString(address); - stream.writeString(venue); - geo.serializeToStream(stream); - photo.serializeToStream(stream); - stream.writeInt32(participants_count); - stream.writeInt32(date); - stream.writeBool(checked_in); - stream.writeInt32(version); - } - } - - public static class TL_channelForbidden_layer52 extends Chat { - public static int constructor = 0x2d85832c; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeString(title); - } - } - - public static class TL_chat_old extends TL_chat { - public static int constructor = 0x6e9c9bc7; - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - title = stream.readString(exception); - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - participants_count = stream.readInt32(exception); - date = stream.readInt32(exception); - left = stream.readBool(exception); - version = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeString(title); - photo.serializeToStream(stream); - stream.writeInt32(participants_count); - stream.writeInt32(date); - stream.writeBool(left); - stream.writeInt32(version); - } - } - - public static class TL_channel_layer48 extends TL_channel { - public static int constructor = 0x4b1b7506; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - creator = (flags & 1) != 0; - kicked = (flags & 2) != 0; - left = (flags & 4) != 0; - editor = (flags & 8) != 0; - moderator = (flags & 16) != 0; - broadcast = (flags & 32) != 0; - verified = (flags & 128) != 0; - megagroup = (flags & 256) != 0; - restricted = (flags & 512) != 0; - democracy = (flags & 1024) != 0; - signatures = (flags & 2048) != 0; - id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - if ((flags & 64) != 0) { - username = stream.readString(exception); - } - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - version = stream.readInt32(exception); - if ((flags & 512) != 0) { - restriction_reason = stream.readString(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator ? (flags | 1) : (flags &~ 1); - flags = kicked ? (flags | 2) : (flags &~ 2); - flags = left ? (flags | 4) : (flags &~ 4); - flags = editor ? (flags | 8) : (flags &~ 8); - flags = moderator ? (flags | 16) : (flags &~ 16); - flags = broadcast ? (flags | 32) : (flags &~ 32); - flags = verified ? (flags | 128) : (flags &~ 128); - flags = megagroup ? (flags | 256) : (flags &~ 256); - flags = restricted ? (flags | 512) : (flags &~ 512); - flags = democracy ? (flags | 1024) : (flags &~ 1024); - flags = signatures ? (flags | 2048) : (flags &~ 2048); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt64(access_hash); - stream.writeString(title); - if ((flags & 64) != 0) { - stream.writeString(username); - } - photo.serializeToStream(stream); - stream.writeInt32(date); - stream.writeInt32(version); - if ((flags & 512) != 0) { - stream.writeString(restriction_reason); - } - } - } - public static class StickerSet extends TLObject { public long id; public long access_hash; @@ -10090,58 +5182,6 @@ public class TLRPC { } } - public static class TL_stickerSet_old extends TL_stickerSet { - public static int constructor = 0xa7a43b17; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - short_name = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeString(title); - stream.writeString(short_name); - } - } - - public static class TL_stickerSet extends StickerSet { - public static int constructor = 0xcd303b41; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - installed = (flags & 1) != 0; - disabled = (flags & 2) != 0; - official = (flags & 4) != 0; - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - title = stream.readString(exception); - short_name = stream.readString(exception); - count = stream.readInt32(exception); - hash = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = installed ? (flags | 1) : (flags &~ 1); - flags = disabled ? (flags | 2) : (flags &~ 2); - flags = official ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeString(title); - stream.writeString(short_name); - stream.writeInt32(count); - stream.writeInt32(hash); - } - } - public static class storage_FileType extends TLObject { public static storage_FileType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { @@ -10150,96 +5190,6 @@ public class TLRPC { } } - public static class TL_storage_fileUnknown extends storage_FileType { - public static int constructor = 0xaa963b05; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_storage_fileMp4 extends storage_FileType { - public static int constructor = 0xb3cea0e4; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_storage_fileWebp extends storage_FileType { - public static int constructor = 0x1081464c; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_storage_filePng extends storage_FileType { - public static int constructor = 0xa4f63c0; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_storage_fileGif extends storage_FileType { - public static int constructor = 0xcae1aadf; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_storage_filePdf extends storage_FileType { - public static int constructor = 0xae1e508d; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_storage_fileMp3 extends storage_FileType { - public static int constructor = 0x528a0677; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_storage_fileJpeg extends storage_FileType { - public static int constructor = 0x7efe0e; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_storage_fileMov extends storage_FileType { - public static int constructor = 0x4b09ebbc; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_storage_filePartial extends storage_FileType { - public static int constructor = 0x40bc6f52; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class auth_CodeType extends TLObject { public static auth_CodeType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { @@ -10310,33 +5260,6 @@ public class TLRPC { } } - public static class TL_inputMessagesFilterVideo extends MessagesFilter { - public static int constructor = 0x9fc00e65; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputMessagesFilterPhotos extends MessagesFilter { - public static int constructor = 0x9609a51c; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_inputMessagesFilterPhotoVideoDocuments extends MessagesFilter { - public static int constructor = 0xd95e73bb; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_inputMessagesFilterUrl extends MessagesFilter { public static int constructor = 0x7ef0dd87; @@ -10346,15 +5269,6 @@ public class TLRPC { } } - public static class TL_inputMessagesFilterGif extends MessagesFilter { - public static int constructor = 0xffc86587; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_inputMessagesFilterVoice extends MessagesFilter { public static int constructor = 0x50f5c392; @@ -10382,143 +5296,6 @@ public class TLRPC { } } - /* - public static class TL_geochats_located extends TLObject { - public static int constructor = 0x48feb267; - - public ArrayList results = new ArrayList<>(); - public ArrayList messages = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - - public static TL_geochats_located TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_geochats_located.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_geochats_located", constructor)); - } else { - return null; - } - } - TL_geochats_located result = new TL_geochats_located(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_chatLocated object = TL_chatLocated.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - GeoChatMessage object = GeoChatMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_messages_messageEmpty extends TLObject { - public static int constructor = 0x3f4e0648; - - - public static TL_messages_messageEmpty TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_messageEmpty.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageEmpty", constructor)); - } else { - return null; - } - } - TL_messages_messageEmpty result = new TL_messages_messageEmpty(); - result.readParams(stream, exception); - return result; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - */ - public static class TL_messageFwdHeader extends TLObject { public static int constructor = 0xc786ddcb; @@ -10647,37 +5424,6 @@ public class TLRPC { } } - public static class TL_inputGeoChat extends TLObject { - public static int constructor = 0x74d456fa; - - public int chat_id; - public long access_hash; - - public static TL_inputGeoChat TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputGeoChat.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputGeoChat", constructor)); - } else { - return null; - } - } - TL_inputGeoChat result = new TL_inputGeoChat(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - chat_id = stream.readInt32(exception); - access_hash = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(chat_id); - stream.writeInt64(access_hash); - } - } - public static class messages_SavedGifs extends TLObject { public int hash; public ArrayList gifs = new ArrayList<>(); @@ -10688,15 +5434,6 @@ public class TLRPC { } } - public static class TL_messages_savedGifsNotModified extends messages_SavedGifs { - public static int constructor = 0xe8025ca2; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_messages_savedGifs extends messages_SavedGifs { public static int constructor = 0x2e0709a5; @@ -10900,46 +5637,6 @@ public class TLRPC { } } - public static class TL_updates_state extends TLObject { - public static int constructor = 0xa56c2a3e; - - public int pts; - public int qts; - public int date; - public int seq; - public int unread_count; - - public static TL_updates_state TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_updates_state.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_updates_state", constructor)); - } else { - return null; - } - } - TL_updates_state result = new TL_updates_state(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - pts = stream.readInt32(exception); - qts = stream.readInt32(exception); - date = stream.readInt32(exception); - seq = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(pts); - stream.writeInt32(qts); - stream.writeInt32(date); - stream.writeInt32(seq); - stream.writeInt32(unread_count); - } - } - public static class Updates extends TLObject { public ArrayList updates = new ArrayList<>(); public ArrayList users = new ArrayList<>(); @@ -11496,50 +6193,6 @@ public class TLRPC { } } - public static class TL_messages_stickersNotModified extends messages_Stickers { - public static int constructor = 0xf1749a22; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_messages_stickers extends messages_Stickers { - public static int constructor = 0x8a8ecd32; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stickers.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(hash); - stream.writeInt32(0x1cb5c415); - int count = stickers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stickers.get(a).serializeToStream(stream); - } - } - } - public static class InputPeer extends TLObject { public int user_id; public long access_hash; @@ -11591,15 +6244,6 @@ public class TLRPC { } } - public static class TL_inputPeerSelf extends InputPeer { - public static int constructor = 0x7da07ec9; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_inputPeerChannel extends InputPeer { public static int constructor = 0x20adaef8; @@ -11753,24 +6397,6 @@ public class TLRPC { } } - public static class TL_inputPhotoCrop extends InputPhotoCrop { - public static int constructor = 0xd9915325; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - crop_left = stream.readDouble(exception); - crop_top = stream.readDouble(exception); - crop_width = stream.readDouble(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeDouble(crop_left); - stream.writeDouble(crop_top); - stream.writeDouble(crop_width); - } - } - public static class messages_Dialogs extends TLObject { public ArrayList dialogs = new ArrayList<>(); public ArrayList messages = new ArrayList<>(); @@ -12590,21 +7216,6 @@ public class TLRPC { } } - public static class TL_messages_exportChatInvite extends TLObject { - public static int constructor = 0x7d885289; - - public int chat_id; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return ExportedChatInvite.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(chat_id); - } - } - public static class TL_messages_checkChatInvite extends TLObject { public static int constructor = 0x3eadb1bb; @@ -12940,39 +7551,6 @@ public class TLRPC { } } - public static class TL_messageService_old2 extends TL_messageService { - public static int constructor = 0x1d86f70e; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = stream.readInt32(exception); - to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - flags |= MESSAGE_FLAG_HAS_FROM_ID; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(from_id); - to_id.serializeToStream(stream); - stream.writeInt32(date); - action.serializeToStream(stream); - } - } - public static class TL_message extends Message { public static int constructor = 0xc09be45f; @@ -13118,286 +7696,6 @@ public class TLRPC { } } - public static class TL_message_layer47 extends TL_message { - public static int constructor = 0xc992e15c; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = stream.readInt32(exception); - } - to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (from_id == 0) { - if (to_id.user_id != 0) { - from_id = to_id.user_id; - } else { - from_id = -to_id.channel_id; - } - } - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - Peer peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (peer instanceof TLRPC.TL_peerChannel) { - fwd_from.channel_id = peer.channel_id; - fwd_from.flags |= 2; - } else if (peer instanceof TLRPC.TL_peerUser) { - fwd_from.from_id = peer.user_id; - fwd_from.flags |= 1; - } - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - } else { - media = new TL_messageMediaEmpty(); - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if (id < 0 || (media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage) && message != null && message.length() != 0 && message.startsWith("-1"))) { - attachPath = stream.readString(exception); - if (id < 0 && attachPath.startsWith("||")) { - String args[] = attachPath.split("\\|\\|"); - if (args.length > 0) { - params = new HashMap<>(); - for (int a = 1; a < args.length - 1; a++) { - String args2[] = args[a].split("\\|=\\|"); - if (args2.length == 2) { - params.put(args2[0], args2[1]); - } - } - attachPath = args[args.length - 1]; - } - } - } - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - fwd_msg_id = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32(from_id); - } - to_id.serializeToStream(stream); - if ((flags & 4) != 0) { - if (fwd_from.from_id != 0) { - TLRPC.TL_peerUser peer = new TL_peerUser(); - peer.user_id = fwd_from.from_id; - peer.serializeToStream(stream); - } else { - TLRPC.TL_peerChannel peer = new TL_peerChannel(); - peer.channel_id = fwd_from.channel_id; - peer.serializeToStream(stream); - } - stream.writeInt32(fwd_from.date); - } - if ((flags & 2048) != 0) { - stream.writeInt32(via_bot_id); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - String path = attachPath; - if (id < 0 && params != null && params.size() > 0) { - for (HashMap.Entry entry : params.entrySet()) { - path = entry.getKey() + "|=|" + entry.getValue() + "||" + path; - } - path = "||" + path; - } - stream.writeString(path); - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - stream.writeInt32(fwd_msg_id); - } - } - } - - public static class TL_message_old7 extends TL_message { - public static int constructor = 0x5ba66c13; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = stream.readInt32(exception); - } - to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (from_id == 0) { - if (to_id.user_id != 0) { - from_id = to_id.user_id; - } else { - from_id = -to_id.channel_id; - } - } - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - Peer peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (peer instanceof TLRPC.TL_peerChannel) { - fwd_from.channel_id = peer.channel_id; - fwd_from.flags |= 2; - } else if (peer instanceof TLRPC.TL_peerUser) { - fwd_from.from_id = peer.user_id; - fwd_from.flags |= 1; - } - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - } else { - media = new TL_messageMediaEmpty(); - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if (id < 0 || (media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage) && message != null && message.length() != 0 && message.startsWith("-1"))) { - attachPath = stream.readString(exception); - } - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - fwd_msg_id = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32(from_id); - } - to_id.serializeToStream(stream); - if ((flags & 4) != 0) { - if (fwd_from.from_id != 0) { - TLRPC.TL_peerUser peer = new TL_peerUser(); - peer.user_id = fwd_from.from_id; - peer.serializeToStream(stream); - } else { - TLRPC.TL_peerChannel peer = new TL_peerChannel(); - peer.channel_id = fwd_from.channel_id; - peer.serializeToStream(stream); - } - stream.writeInt32(fwd_from.date); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - stream.writeString(attachPath); - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - stream.writeInt32(fwd_msg_id); - } - } - } - public static class TL_messageForwarded_old2 extends Message { public static int constructor = 0xa367e716; @@ -13449,432 +7747,7 @@ public class TLRPC { } } - public static class TL_message_old6 extends TL_message { - public static int constructor = 0x2bebfa86; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = stream.readInt32(exception); - to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - } else { - media = new TL_messageMediaEmpty(); - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if (id < 0 || (media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage) && message != null && message.length() != 0 && message.startsWith("-1"))) { - attachPath = stream.readString(exception); - } - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - fwd_msg_id = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(from_id); - to_id.serializeToStream(stream); - if ((flags & 4) != 0) { - stream.writeInt32(fwd_from.from_id); - stream.writeInt32(fwd_from.date); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - stream.writeString(attachPath); - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - stream.writeInt32(fwd_msg_id); - } - } - } - - public static class TL_message_old5 extends TL_message { - public static int constructor = 0xf07814c8; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = stream.readInt32(exception); - to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if (id < 0 || (media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage) && message != null && message.length() != 0 && message.startsWith("-1"))) { - attachPath = stream.readString(exception); - } - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - fwd_msg_id = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(from_id); - to_id.serializeToStream(stream); - if ((flags & 4) != 0) { - stream.writeInt32(fwd_from.from_id); - stream.writeInt32(fwd_from.date); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - stream.writeString(attachPath); - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - stream.writeInt32(fwd_msg_id); - } - } - } - - public static class TL_messageService_layer48 extends TL_messageService { - public static int constructor = 0xc06b9607; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = stream.readInt32(exception); - } - to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (from_id == 0) { - if (to_id.user_id != 0) { - from_id = to_id.user_id; - } else { - from_id = -to_id.channel_id; - } - } - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32(from_id); - } - to_id.serializeToStream(stream); - stream.writeInt32(date); - action.serializeToStream(stream); - } - } - - public static class TL_message_old4 extends TL_message { - public static int constructor = 0xc3060325; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = stream.readInt32(exception); - to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if (id < 0 || (media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage) && message != null && message.length() != 0 && message.startsWith("-1"))) { - attachPath = stream.readString(exception); - } - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - fwd_msg_id = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(from_id); - to_id.serializeToStream(stream); - if ((flags & 4) != 0) { - stream.writeInt32(fwd_from.from_id); - stream.writeInt32(fwd_from.date); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - stream.writeString(attachPath); - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - stream.writeInt32(fwd_msg_id); - } - } - } - - public static class TL_message_old3 extends TL_message { - public static int constructor = 0xa7ab1991; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = stream.readInt32(exception); - to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (id < 0 || (media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage) && message != null && message.length() != 0 && message.startsWith("-1"))) { - attachPath = stream.readString(exception); - } - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - fwd_msg_id = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(from_id); - to_id.serializeToStream(stream); - if ((flags & 4) != 0) { - stream.writeInt32(fwd_from.from_id); - stream.writeInt32(fwd_from.date); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - stream.writeString(attachPath); - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - stream.writeInt32(fwd_msg_id); - } - } - } - - public static class TL_message_old2 extends TL_message { - public static int constructor = 0x567699b3; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = stream.readInt32(exception); - to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (id < 0 || (media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage) && message != null && message.length() != 0 && message.startsWith("-1"))) { - attachPath = stream.readString(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(from_id); - to_id.serializeToStream(stream); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - stream.writeString(attachPath); - } - } - - public static class TL_messageService_old extends TL_messageService { - public static int constructor = 0x9f8d60bb; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - from_id = stream.readInt32(exception); - to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - out = stream.readBool(exception); - unread = stream.readBool(exception); - flags |= MESSAGE_FLAG_HAS_FROM_ID; - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt32(from_id); - to_id.serializeToStream(stream); - stream.writeBool(out); - stream.writeBool(unread); - stream.writeInt32(date); - action.serializeToStream(stream); - } - } - - public static class TL_messageForwarded_old extends TL_messageForwarded_old2 { + public static class TL_messageForwarded_old extends TL_messageForwarded_old2 { public static int constructor = 0x5f46804; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 974a8ad72..41410b7d6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -4618,7 +4618,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not user.first_name = name; user.last_name = ""; user.phone = number; - SendMessagesHelper.getInstance().sendMessageContact(user, dialog_id, replyingMessageObject, null, null); + SendMessagesHelper.getInstance().sendMessageContact(user, dialog_id, replyingMessageObject, null); } if (sent) { showReplyPanel(false, null, null, null, false, true); @@ -5196,7 +5196,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not //} } } else if (inlineReturn != 0) { - if (messageObject.messageOwner.reply_markup != null) { + /*if (messageObject.messageOwner.reply_markup != null) { for (int b = 0; b < messageObject.messageOwner.reply_markup.rows.size(); b++) { TLRPC.TL_keyboardButtonRow row = messageObject.messageOwner.reply_markup.rows.get(b); for (int c = 0; c < row.buttons.size(); c++) { @@ -5207,7 +5207,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } } - } + }*/ } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java index 1ad8e84ca..6cdedd7af 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -1346,7 +1346,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (playing != null && playing == audioToSendMessageObject) { MediaController.getInstance().cleanupPlayer(true, true); } - SendMessagesHelper.getInstance().sendMessageDocument(audioToSend, null, audioToSendPath, dialog_id, replyingMessageObject, null, null); + SendMessagesHelper.getInstance().sendMessageDocument(audioToSend, null, audioToSendPath, dialog_id, replyingMessageObject, null); if (delegate != null) { delegate.onMessageSend(null); } @@ -1389,7 +1389,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe //int count = (int) Math.ceil(text.length() / 4096.0f); //for (int a = 0; a < count; a++) { // CharSequence mess = text.subSequence(a * 4096, Math.min((a + 1) * 4096, text.length())); - SendMessagesHelper.getInstance().sendMessageText(text.toString(), dialog_id, replyingMessageObject, messageWebPage, messageWebPageSearch, MessagesQuery.getEntities(text), null, null); + SendMessagesHelper.getInstance().sendMessageText(text.toString(), dialog_id, replyingMessageObject, messageWebPage, messageWebPageSearch, MessagesQuery.getEntities(text), null); //} return true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index 324de5835..1573b9452 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -1445,7 +1445,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa } if (contactsToSend != null && !contactsToSend.isEmpty()) { for (TLRPC.User user : contactsToSend) { - SendMessagesHelper.getInstance().sendMessageContact(user, dialog_id, null, null, null); + SendMessagesHelper.getInstance().sendMessageContact(user, dialog_id, null, null); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 4a39e20f3..957326e46 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -2281,7 +2281,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. presentFragment(new ChatActivity(args), true); removeSelfFromStack(); TLRPC.User user = MessagesController.getInstance().getUser(user_id); - SendMessagesHelper.getInstance().sendMessageContact(user, dialog_id, null, null, null); + SendMessagesHelper.getInstance().sendMessageContact(user, dialog_id, null, null); } }