From 02fcbc241e133bc08ba091c7feba8ab60cbecdf4 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Tue, 25 Oct 2016 16:36:24 +0200 Subject: [PATCH] Remove dead sending code. --- TMessagesProj/jni/mr_wrapper.c | 16 ++ .../telegram/messenger/AndroidUtilities.java | 2 + .../telegram/messenger/MediaController.java | 2 + .../org/telegram/messenger/MrMailbox.java | 14 +- .../messenger/SendMessagesHelper.java | 207 ++++++++++-------- .../main/java/org/telegram/tgnet/TLRPC.java | 44 +++- .../telegram/ui/Adapters/MentionsAdapter.java | 12 +- .../java/org/telegram/ui/ChatActivity.java | 29 ++- .../ui/Components/ChatAvatarContainer.java | 4 +- .../java/org/telegram/ui/PhotoViewer.java | 2 +- .../java/org/telegram/ui/ProfileActivity.java | 2 +- 11 files changed, 206 insertions(+), 128 deletions(-) diff --git a/TMessagesProj/jni/mr_wrapper.c b/TMessagesProj/jni/mr_wrapper.c index 965b1fbc7..4d4a08232 100644 --- a/TMessagesProj/jni/mr_wrapper.c +++ b/TMessagesProj/jni/mr_wrapper.c @@ -381,6 +381,22 @@ JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrChatSetDraft(JNIEnv *env, } +JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrChatSendMsg(JNIEnv *env, jclass c, jlong hChat, jstring text) +{ + jint msg_id = 0; + if( text ) { + mrmsg_t* msg = mrmsg_new(); + msg->m_type = MR_MSG_TEXT; + CHAR_REF(text); + msg->m_text = strdup(textPtr); + CHAR_UNREF(text); + msg_id = mrchat_send_msg((mrchat_t*)hChat, msg); + mrmsg_unref(msg); + } + return msg_id; +} + + /******************************************************************************* * MrMsglist ******************************************************************************/ diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java index 08e59675d..492f37172 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java @@ -602,6 +602,7 @@ public class AndroidUtilities { } } + /* public static AlertDialog.Builder buildTTLAlert(final Context context, final TLRPC.EncryptedChat encryptedChat) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(LocaleController.getString("MessageLifetime", R.string.MessageLifetime)); @@ -671,6 +672,7 @@ public class AndroidUtilities { }); return builder; } + */ public static void clearCursorDrawable(EditText editText) { if (editText == null) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index 1ba9876fa..1e7025c3d 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -1346,6 +1346,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, } listenerInProgress = false; processLaterArrays(); + /* try { ArrayList delayedMessages = SendMessagesHelper.getInstance().getDelayedMessages(fileName); if (delayedMessages != null) { @@ -1370,6 +1371,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, } catch (Exception e) { FileLog.e("tmessages", e); } + */ } else if (id == NotificationCenter.messagesDeleted) { int channelId = (Integer) args[1]; ArrayList markAsDeletedMessages = (ArrayList) args[0]; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MrMailbox.java b/TMessagesProj/src/main/java/org/telegram/messenger/MrMailbox.java index f6c981c1f..4ab19ae4c 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MrMailbox.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MrMailbox.java @@ -165,6 +165,7 @@ public class MrMailbox { public native static int MrChatGetTotalMsgCount (long hChat); public native static long MrChatGetSummary (long hChat); // returns hPoortext public native static long MrChatGetMsglist (long hChat, int offset, int amount); // returns hMsglist + public native static int MrChatSendMsg (long hChat, String text); // returns message id // MrMsglist objects public native static void MrMsglistUnref (long hMsglist); @@ -206,12 +207,13 @@ public class MrMailbox { public final static int MR_CHAT_ID_STRANGERS = 1; public final static int MR_STATE_UNDEFINED = 0; - public final static int MR_IN_UNREAD = 1; - public final static int MR_IN_READ = 3; - public final static int MR_OUT_PENDING = 5; - public final static int MR_OUT_ERROR = 6; - public final static int MR_OUT_DELIVERED = 7; - public final static int MR_OUT_READ = 9; + public final static int MR_IN_UNREAD = 10; + public final static int MR_IN_READ = 16; + public final static int MR_OUT_PENDING = 20; + public final static int MR_OUT_SENDING = 22; + public final static int MR_OUT_ERROR = 24; + public final static int MR_OUT_DELIVERED = 26; + public final static int MR_OUT_READ = 28; public final static int MR_TITLE_NORMAL = 0; public final static int MR_TITLE_DRAFT = 1; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java index c61ec9142..138c78343 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java @@ -27,8 +27,6 @@ import android.widget.Toast; import org.telegram.messenger.audioinfo.AudioInfo; import org.telegram.messenger.query.DraftQuery; -import org.telegram.messenger.query.SearchQuery; -import org.telegram.messenger.query.StickersQuery; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.QuickAckDelegate; import org.telegram.tgnet.RequestDelegate; @@ -538,6 +536,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter MessagesController.getInstance().deleteMessages(messages, null, null, object.messageOwner.to_id.channel_id); } + /* public boolean retrySendMessage(MessageObject messageObject, boolean unsent) { if (messageObject.getId() >= 0) { return false; @@ -555,35 +554,34 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter if (messageObject.messageOwner.random_id == 0) { messageObject.messageOwner.random_id = getNextRandomId(); } - /* - if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionSetMessageTTL) { - SecretChatHelper.getInstance().sendTTLMessage(encryptedChat, messageObject.messageOwner); - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionDeleteMessages) { - SecretChatHelper.getInstance().sendMessagesDeleteMessage(encryptedChat, null, messageObject.messageOwner); - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionFlushHistory) { - SecretChatHelper.getInstance().sendClearHistoryMessage(encryptedChat, messageObject.messageOwner); - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionNotifyLayer) { - SecretChatHelper.getInstance().sendNotifyLayerMessage(encryptedChat, messageObject.messageOwner); - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionReadMessages) { - SecretChatHelper.getInstance().sendMessagesReadMessage(encryptedChat, null, messageObject.messageOwner); - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionScreenshotMessages) { - SecretChatHelper.getInstance().sendScreenshotMessage(encryptedChat, null, messageObject.messageOwner); - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionTyping) { - - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionResend) { - - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionCommitKey) { - SecretChatHelper.getInstance().sendCommitKeyMessage(encryptedChat, messageObject.messageOwner); - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionAbortKey) { - SecretChatHelper.getInstance().sendAbortKeyMessage(encryptedChat, messageObject.messageOwner, 0); - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionRequestKey) { - SecretChatHelper.getInstance().sendRequestKeyMessage(encryptedChat, messageObject.messageOwner); - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionAcceptKey) { - SecretChatHelper.getInstance().sendAcceptKeyMessage(encryptedChat, messageObject.messageOwner); - } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionNoop) { - SecretChatHelper.getInstance().sendNoopMessage(encryptedChat, messageObject.messageOwner); - } - */ + // + //if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionSetMessageTTL) { + // SecretChatHelper.getInstance().sendTTLMessage(encryptedChat, messageObject.messageOwner); + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionDeleteMessages) { + // SecretChatHelper.getInstance().sendMessagesDeleteMessage(encryptedChat, null, messageObject.messageOwner); + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionFlushHistory) { + // SecretChatHelper.getInstance().sendClearHistoryMessage(encryptedChat, messageObject.messageOwner); + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionNotifyLayer) { + // SecretChatHelper.getInstance().sendNotifyLayerMessage(encryptedChat, messageObject.messageOwner); + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionReadMessages) { + // SecretChatHelper.getInstance().sendMessagesReadMessage(encryptedChat, null, messageObject.messageOwner); + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionScreenshotMessages) { + // SecretChatHelper.getInstance().sendScreenshotMessage(encryptedChat, null, messageObject.messageOwner); + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionTyping) { + // + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionResend) { + // + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionCommitKey) { + // SecretChatHelper.getInstance().sendCommitKeyMessage(encryptedChat, messageObject.messageOwner); + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionAbortKey) { + // SecretChatHelper.getInstance().sendAbortKeyMessage(encryptedChat, messageObject.messageOwner, 0); + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionRequestKey) { + // SecretChatHelper.getInstance().sendRequestKeyMessage(encryptedChat, messageObject.messageOwner); + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionAcceptKey) { + // SecretChatHelper.getInstance().sendAcceptKeyMessage(encryptedChat, messageObject.messageOwner); + //} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionNoop) { + // SecretChatHelper.getInstance().sendNoopMessage(encryptedChat, messageObject.messageOwner); + //} return true; } if (unsent) { @@ -592,6 +590,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter sendMessage(messageObject); return true; } + */ protected void processSentMessage(int id) { int prevSize = unsentMessages.size(); @@ -684,7 +683,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter SendMessagesHelper.getInstance().sendMessage((TLRPC.TL_document) document, null, null, peer, replyingMessageObject, null, null); } - public void sendMessage(ArrayList messages, final long peer) { + private void sendMessage(ArrayList messages, final long peer) { if ((int) peer == 0 || messages == null || messages.isEmpty()) { return; } @@ -1097,7 +1096,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } private void sendMessage(String message, TLRPC.MessageMedia location, TLRPC.TL_photo photo, VideoEditedInfo videoEditedInfo, TLRPC.User user, TLRPC.TL_document document, long peer, String path, MessageObject reply_to_msg, TLRPC.WebPage webPage, boolean searchLinks, MessageObject retryMessageObject, ArrayList entities, TLRPC.ReplyMarkup replyMarkup, HashMap params) { - if (peer == 0) { + if (peer == 0) { // peer == dialog id return; } @@ -1110,12 +1109,12 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter MessageObject newMsgObj = null; int type = -1; int lower_id = (int) peer; - int high_id = (int) (peer >> 32); - boolean isChannel = false; - TLRPC.EncryptedChat encryptedChat = null; - TLRPC.InputPeer sendToPeer = lower_id != 0 ? MessagesController.getInputPeer(lower_id) : null; - ArrayList sendToPeers = null; - if (lower_id == 0) { + //int high_id = (int) (peer >> 32); + //boolean isChannel = false; + //TLRPC.EncryptedChat encryptedChat = null; + //TLRPC.InputPeer sendToPeer = lower_id != 0 ? MessagesController.getInputPeer(lower_id) : null; + //ArrayList sendToPeers = null; + /*if (lower_id == 0) { encryptedChat = MessagesController.getInstance().getEncryptedChat(high_id); if (encryptedChat == null) { if (retryMessageObject != null) { @@ -1126,10 +1125,10 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } return; } - } else if (sendToPeer instanceof TLRPC.TL_inputPeerChannel) { + } else if (sendToPeer instanceof TLRPC.TL_inputPeerChannel) { TLRPC.Chat chat = MessagesController.getInstance().getChat(sendToPeer.channel_id); isChannel = chat != null && !chat.megagroup; - } + }*/ try { if (retryMessageObject != null) { @@ -1169,15 +1168,15 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } } else { if (message != null) { - if (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { + /*if (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { newMsg = new TLRPC.TL_message_secret(); - } else { + } else*/ { newMsg = new TLRPC.TL_message(); } if (entities != null && !entities.isEmpty()) { newMsg.entities = entities; } - if (encryptedChat != null && webPage instanceof TLRPC.TL_webPagePending) { + /*if (encryptedChat != null && webPage instanceof TLRPC.TL_webPagePending) { if (webPage.url != null) { TLRPC.WebPage newWebPage = new TLRPC.TL_webPageUrlPending(); newWebPage.url = webPage.url; @@ -1185,7 +1184,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } else { webPage = null; } - } + }*/ if (webPage == null) { newMsg.media = new TLRPC.TL_messageMediaEmpty(); } else { @@ -1199,9 +1198,9 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } newMsg.message = message; } else if (location != null) { - if (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { + /*if (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { newMsg = new TLRPC.TL_message_secret(); - } else { + } else*/ { newMsg = new TLRPC.TL_message(); } newMsg.media = location; @@ -1212,9 +1211,9 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter type = 1; } } else if (photo != null) { - if (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { + /*if (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { newMsg = new TLRPC.TL_message_secret(); - } else { + } else*/ { newMsg = new TLRPC.TL_message(); } newMsg.media = new TLRPC.TL_messageMediaPhoto(); @@ -1233,9 +1232,9 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter newMsg.attachPath = FileLoader.getPathToAttach(location1, true).toString(); } } else if (user != null) { - if (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { + /*if (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { newMsg = new TLRPC.TL_message_secret(); - } else { + } else*/ { newMsg = new TLRPC.TL_message(); } newMsg.media = new TLRPC.TL_messageMediaContact(); @@ -1256,9 +1255,9 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter type = 6; } } else if (document != null) { - if (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { + /*if (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { newMsg = new TLRPC.TL_message_secret(); - } else { + } else*/ { newMsg = new TLRPC.TL_message(); } newMsg.media = new TLRPC.TL_messageMediaDocument(); @@ -1278,12 +1277,12 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } else { newMsg.message = videoEditedInfo.getString(); } - if (encryptedChat != null && document.dc_id > 0 && !MessageObject.isStickerDocument(document)) { + /*if (encryptedChat != null && document.dc_id > 0 && !MessageObject.isStickerDocument(document)) { newMsg.attachPath = FileLoader.getPathToAttach(document).toString(); - } else { + } else*/ { newMsg.attachPath = path; } - if (encryptedChat != null && MessageObject.isStickerDocument(document)) { + /*if (encryptedChat != null && MessageObject.isStickerDocument(document)) { for (int a = 0; a < document.attributes.size(); a++) { TLRPC.DocumentAttribute attribute = document.attributes.get(a); if (attribute instanceof TLRPC.TL_documentAttributeSticker) { @@ -1306,16 +1305,16 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter break; } } - } + }*/ } if (newMsg.attachPath == null) { newMsg.attachPath = ""; } newMsg.local_id = newMsg.id = UserConfig.getNewMessageId(); newMsg.out = true; - if (isChannel && sendToPeer != null) { + /*if (isChannel && sendToPeer != null) { newMsg.from_id = -sendToPeer.channel_id; - } else { + } else*/ { newMsg.from_id = UserConfig.getClientUserId(); newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_FROM_ID; } @@ -1324,7 +1323,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter if (newMsg.random_id == 0) { newMsg.random_id = getNextRandomId(); } - if (params != null && params.containsKey("bot")) { + /*if (params != null && params.containsKey("bot")) { if (encryptedChat != null) { newMsg.via_bot_name = params.get("bot_name"); if (newMsg.via_bot_name == null) { @@ -1334,11 +1333,11 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter newMsg.via_bot_id = Utilities.parseInt(params.get("bot")); } newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_BOT_ID; - } + }*/ newMsg.params = params; newMsg.date = ConnectionsManager.getInstance().getCurrentTime(); newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_MEDIA; - if (sendToPeer instanceof TLRPC.TL_inputPeerChannel) { + /*if (sendToPeer instanceof TLRPC.TL_inputPeerChannel) { if (isChannel) { newMsg.views = 1; newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_VIEWS; @@ -1355,25 +1354,25 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } } } - } else { + } else*/ { newMsg.unread = true; } newMsg.dialog_id = peer; if (reply_to_msg != null) { - if (encryptedChat != null && reply_to_msg.messageOwner.random_id != 0) { + /*if (encryptedChat != null && reply_to_msg.messageOwner.random_id != 0) { newMsg.reply_to_random_id = reply_to_msg.messageOwner.random_id; newMsg.flags |= TLRPC.MESSAGE_FLAG_REPLY; - } else { + } else*/ { 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 (high_id == 1) { if (currentChatInfo == null) { //MessagesStorage.getInstance().markMessageAsSendError(newMsg); NotificationCenter.getInstance().postNotificationName(NotificationCenter.messageSendError, newMsg.id); @@ -1390,7 +1389,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } newMsg.to_id = new TLRPC.TL_peerChat(); newMsg.to_id.chat_id = lower_id; - } else { + } else*/ { newMsg.to_id = MessagesController.getPeer(lower_id); if (lower_id > 0) { TLRPC.User sendToUser = MessagesController.getInstance().getUser(lower_id); @@ -1403,7 +1402,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } } } - } else { + }/* else { newMsg.to_id = new TLRPC.TL_peerUser(); if (encryptedChat.participant_id == UserConfig.getClientUserId()) { newMsg.to_id.user_id = encryptedChat.admin_id; @@ -1434,10 +1433,10 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter newMsg.ttl = Math.max(encryptedChat.ttl, duration + 1); } } - } - if ((encryptedChat == null || AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 46) && high_id != 1 && MessageObject.isVoiceMessage(newMsg) && newMsg.to_id.channel_id == 0) { + }*/ + //if ((encryptedChat == null || AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 46) && high_id != 1 && MessageObject.isVoiceMessage(newMsg) && newMsg.to_id.channel_id == 0) { newMsg.media_unread = true; - } + //} newMsg.send_state = MessageObject.MESSAGE_SEND_STATE_SENDING; newMsgObj = new MessageObject(newMsg, null, true); @@ -1454,15 +1453,15 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter MessagesController.getInstance().updateInterfaceWithMessages(peer, objArr); NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - if (BuildVars.DEBUG_VERSION) { + /*if (BuildVars.DEBUG_VERSION) { if (sendToPeer != null) { FileLog.e("tmessages", "send message user_id = " + sendToPeer.user_id + " chat_id = " + sendToPeer.chat_id + " channel_id = " + sendToPeer.channel_id + " access_hash = " + sendToPeer.access_hash); } - } + }*/ - if (type == 0 || type == 9 && message != null && encryptedChat != null) { - if (encryptedChat == null) { - if (sendToPeers != null) { + if (type == 0 /*|| type == 9 && message != null && encryptedChat != null*/ ) { + /*if (encryptedChat == null)*/ { + /*if (sendToPeers != null) { TLRPC.TL_messages_sendBroadcast reqSend = new TLRPC.TL_messages_sendBroadcast(); ArrayList random_ids = new ArrayList<>(); for (int a = 0; a < sendToPeers.size(); a++) { @@ -1473,14 +1472,14 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter reqSend.media = new TLRPC.TL_inputMediaEmpty(); reqSend.random_id = random_ids; performSendMessageRequest(reqSend, newMsgObj, null); - } else { + } else */ { TLRPC.TL_messages_sendMessage reqSend = new TLRPC.TL_messages_sendMessage(); reqSend.message = message; reqSend.clear_draft = retryMessageObject == null; if (newMsg.to_id instanceof TLRPC.TL_peerChannel) { reqSend.silent = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE).getBoolean("silent_" + peer, false); } - reqSend.peer = sendToPeer; + reqSend.peer = null;//sendToPeer; reqSend.random_id = newMsg.random_id; if (reply_to_msg != null) { reqSend.flags |= 1; @@ -1498,7 +1497,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter DraftQuery.cleanDraft(peer, false); } } - } else { + } /* else { TLRPC.TL_decryptedMessage reqSend; if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 46) { reqSend = new TLRPC.TL_decryptedMessage(); @@ -1537,8 +1536,9 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter DraftQuery.cleanDraft(peer, false); } } - } else if (type >= 1 && type <= 3 || type >= 5 && type <= 8 || type == 9 && encryptedChat != null) { - if (encryptedChat == null) { + */ + } else if (type >= 1 && type <= 3 || type >= 5 && type <= 8 /*|| type == 9 && encryptedChat != null*/) { + /*if (encryptedChat == null)*/ { TLRPC.InputMedia inputMedia = null; DelayedMessage delayedMessage = null; if (type == 1) { @@ -1607,7 +1607,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter inputMedia.last_name = user.last_name; } else if (type == 7 || type == 9) { if (document.access_hash == 0) { - if (encryptedChat == null && originalPath != null && originalPath.length() > 0 && originalPath.startsWith("http") && params != null) { + if (/*encryptedChat == null &&*/ originalPath != null && originalPath.length() > 0 && originalPath.startsWith("http") && params != null) { inputMedia = new TLRPC.TL_inputMediaGifExternal(); String args[] = params.get("url").split("\\|"); if (args.length == 2) { @@ -1660,7 +1660,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter TLObject reqSend; - if (sendToPeers != null) { + /*if (sendToPeers != null) { TLRPC.TL_messages_sendBroadcast request = new TLRPC.TL_messages_sendBroadcast(); ArrayList random_ids = new ArrayList<>(); for (int a = 0; a < sendToPeers.size(); a++) { @@ -1677,9 +1677,9 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter if (retryMessageObject == null) { DraftQuery.cleanDraft(peer, false); } - } else { + } else */ { TLRPC.TL_messages_sendMedia request = new TLRPC.TL_messages_sendMedia(); - request.peer = sendToPeer; + request.peer = null;//sendToPeer; if (newMsg.to_id instanceof TLRPC.TL_peerChannel) { request.silent = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE).getBoolean("silent_" + peer, false); } @@ -1723,7 +1723,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter performSendMessageRequest(reqSend, newMsgObj, null); } } - } else { + } /* else { TLRPC.TL_decryptedMessage reqSend; if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 46) { reqSend = new TLRPC.TL_decryptedMessage(); @@ -1989,9 +1989,10 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter DraftQuery.cleanDraft(peer, false); } } + */ } else if (type == 4) { TLRPC.TL_messages_forwardMessages reqSend = new TLRPC.TL_messages_forwardMessages(); - reqSend.to_peer = sendToPeer; + reqSend.to_peer = null;//sendToPeer; if (retryMessageObject.messageOwner.ttl != 0) { TLRPC.Chat chat = MessagesController.getInstance().getChat(-retryMessageObject.messageOwner.ttl); reqSend.from_peer = new TLRPC.TL_inputPeerChannel(); @@ -2013,6 +2014,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } performSendMessageRequest(reqSend, newMsgObj, null); } else if (type == 9) { + /* TLRPC.TL_messages_sendInlineBotResult reqSend = new TLRPC.TL_messages_sendInlineBotResult(); reqSend.peer = sendToPeer; reqSend.random_id = newMsg.random_id; @@ -2030,6 +2032,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter DraftQuery.cleanDraft(peer, false); } performSendMessageRequest(reqSend, newMsgObj, null); + */ } } catch (Exception e) { FileLog.e("tmessages", e); @@ -2043,6 +2046,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } private void performSendDelayedMessage(final DelayedMessage message) { + /* if (message.type == 0) { if (message.httpLocation != null) { putToDelayedMessages(message.httpLocation, message); @@ -2159,6 +2163,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter FileLoader.getInstance().uploadFile(location, true, true); } } + */ } protected void stopVideoService(final String path) { @@ -2177,11 +2182,11 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter */ } - protected void putToSendingMessages(TLRPC.Message message) { + private void putToSendingMessages(TLRPC.Message message) { sendingMessages.put(message.id, message); } - protected void removeFromSendingMessages(int mid) { + private void removeFromSendingMessages(int mid) { sendingMessages.remove(mid); } @@ -2192,6 +2197,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter private void performSendMessageRequest(final TLObject req, final MessageObject msgObj, final String originalPath) { final TLRPC.Message newMsgObj = msgObj.messageOwner; putToSendingMessages(newMsgObj); + /* ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { @Override public void run(final TLObject response, final TLRPC.TL_error error) { @@ -2273,7 +2279,6 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter if (!isSentError) { newMsgObj.send_state = MessageObject.MESSAGE_SEND_STATE_SENT; NotificationCenter.getInstance().postNotificationName(NotificationCenter.messageReceivedByServer, oldId, (isBroadcast ? oldId : newMsgObj.id), newMsgObj, newMsgObj.dialog_id); //TODO remove later? - /* MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { @Override public void run() { @@ -2308,7 +2313,6 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } } }); - */ } } else { if (error.text.equals("PEER_FLOOD")) { @@ -2342,6 +2346,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter }); } }, ConnectionsManager.RequestFlagCanCompress | ConnectionsManager.RequestFlagInvokeAfter | (req instanceof TLRPC.TL_messages_sendMessage ? ConnectionsManager.RequestFlagNeedQuickAck : 0)); + */ } private void updateMediaPaths(MessageObject newMsgObj, TLRPC.Message sentMessage, String originalPath, boolean post) { @@ -2475,6 +2480,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } } + /* private void putToDelayedMessages(String location, DelayedMessage message) { ArrayList arrayList = delayedMessages.get(location); if (arrayList == null) { @@ -2487,6 +2493,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter protected ArrayList getDelayedMessages(String location) { return delayedMessages.get(location); } + */ protected long getNextRandomId() { long val = 0; @@ -2500,6 +2507,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter //MessagesStorage.getInstance().getUnsentMessages(1000); } + /* protected void processUnsentMessages(final ArrayList messages, final ArrayList users, final ArrayList chats, final ArrayList encryptedChats) { AndroidUtilities.runOnUIThread(new Runnable() { @Override @@ -2515,6 +2523,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } }); } + */ public TLRPC.TL_photo generatePhotoSizes(String path, Uri imageUri) { Bitmap bitmap = ImageLoader.loadBitmap(path, imageUri, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), true); @@ -2843,6 +2852,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter prepareSendingPhotos(paths, uris, dialog_id, reply_to_msg, captions); } + /* public static void prepareSendingBotContextResult(final TLRPC.BotInlineResult result, final HashMap params, final long dialog_id, final MessageObject reply_to_msg) { if (result == null) { return; @@ -3071,6 +3081,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter SendMessagesHelper.getInstance().sendMessage(user, dialog_id, reply_to_msg, result.send_message.reply_markup, params); } } + */ public static void prepareSendingPhotosSearch(final ArrayList photos, final long dialog_id, final MessageObject reply_to_msg) { if (photos == null || photos.isEmpty()) { @@ -3247,6 +3258,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { @Override public void run() { + */ Utilities.stageQueue.postRunnable(new Runnable() { @Override public void run() { @@ -3255,16 +3267,17 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter public void run() { String textFinal = getTrimmedString(text); if (textFinal.length() != 0) { - 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().sendMessage(mess, dialog_id, null, null, true, null, null, null); - } + //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().sendMessage(textFinal, dialog_id, null, null, true, null, null, null); + //} } } }); } }); + /* } }); */ diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java index 5eb6b5026..97bc4d074 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java @@ -14,6 +14,7 @@ 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; @@ -24,6 +25,7 @@ public class TLRPC { 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; @@ -379,6 +381,7 @@ public class TLRPC { } } + /* public static class TL_auth_checkedPhone extends TLObject { public static int constructor = 0x811ea28e; @@ -406,6 +409,7 @@ public class TLRPC { stream.writeBool(phone_registered); } } + */ public static class TL_messages_chatFull extends TLObject { public static int constructor = 0xe5d7d19c; @@ -9110,7 +9114,7 @@ public class TLRPC { result = new TL_updatePrivacy(); break; case 0x2cbd95af: - result = new TL_updateInlineBotCallbackQuery(); + //result = new TL_updateInlineBotCallbackQuery(); break; case 0x25d6c9c7: result = new TL_updateReadChannelOutbox(); @@ -9149,7 +9153,7 @@ public class TLRPC { result = new TL_updateUserName(); break; case 0xe48f964: - result = new TL_updateBotInlineSend(); + //result = new TL_updateBotInlineSend(); break; case 0xe40370a3: result = new TL_updateEditMessage(); @@ -9618,6 +9622,7 @@ public class TLRPC { } } + /* public static class TL_updateInlineBotCallbackQuery extends Update { public static int constructor = 0x2cbd95af; @@ -9638,6 +9643,7 @@ public class TLRPC { stream.writeByteArray(data); } } + */ public static class TL_updateReadChannelOutbox extends Update { public static int constructor = 0x25d6c9c7; @@ -9855,6 +9861,7 @@ public class TLRPC { } } + /* public static class TL_updateBotInlineSend extends Update { public static int constructor = 0xe48f964; @@ -9888,6 +9895,7 @@ public class TLRPC { } } } + */ public static class TL_updateEditMessage extends Update { public static int constructor = 0xe40370a3; @@ -11933,6 +11941,7 @@ public class TLRPC { } } + /* public static class TL_messages_botResults extends TLObject { public static int constructor = 0x256709a6; @@ -12036,6 +12045,7 @@ public class TLRPC { stream.writeInt64(access_hash); } } + */ public static class TL_messages_foundGifs extends TLObject { public static int constructor = 0x450a1c0a; @@ -16594,6 +16604,7 @@ public class TLRPC { } } + /* public static class TL_auth_checkPhone extends TLObject { public static int constructor = 0x6fe51dfb; @@ -16608,6 +16619,7 @@ public class TLRPC { stream.writeString(phone_number); } } + */ public static class TL_auth_sendCode extends TLObject { public static int constructor = 0x86aef0ec; @@ -16693,6 +16705,7 @@ public class TLRPC { } */ + /* public static class TL_auth_resetAuthorizations extends TLObject { public static int constructor = 0x9fab0d1a; @@ -16759,7 +16772,9 @@ public class TLRPC { stream.writeByteArray(bytes); } } + */ + /* public static class TL_auth_bindTempAuthKey extends TLObject { public static int constructor = 0xcdd42a05; @@ -16780,6 +16795,7 @@ public class TLRPC { stream.writeByteArray(encrypted_message); } } + */ public static class TL_account_registerDevice extends TLObject { public static int constructor = 0x637ea878; @@ -16815,6 +16831,7 @@ public class TLRPC { } } + /* public static class TL_account_updateNotifySettings extends TLObject { public static int constructor = 0x84be5b93; @@ -16831,7 +16848,9 @@ public class TLRPC { settings.serializeToStream(stream); } } + */ + /* public static class TL_account_getNotifySettings extends TLObject { public static int constructor = 0x12b3ad31; @@ -16846,6 +16865,7 @@ public class TLRPC { peer.serializeToStream(stream); } } + */ public static class TL_account_resetNotifySettings extends TLObject { public static int constructor = 0xdb7e1747; @@ -16860,6 +16880,7 @@ public class TLRPC { } } + /* public static class TL_account_updateProfile extends TLObject { public static int constructor = 0x78515775; @@ -16886,6 +16907,7 @@ public class TLRPC { } } } + */ public static class TL_account_updateStatus extends TLObject { public static int constructor = 0x6628562c; @@ -16902,6 +16924,7 @@ public class TLRPC { } } + /* public static class TL_account_getWallPapers extends TLObject { public static int constructor = 0xc04cfac2; @@ -16923,7 +16946,9 @@ public class TLRPC { stream.writeInt32(constructor); } } + */ + /* public static class TL_users_getUsers extends TLObject { public static int constructor = 0xd91a548; @@ -16952,7 +16977,9 @@ public class TLRPC { } } } + */ + /* public static class TL_account_reportPeer extends TLObject { public static int constructor = 0xae189d5f; @@ -16969,6 +16996,7 @@ public class TLRPC { reason.serializeToStream(stream); } } + */ public static class TL_users_getFullUser extends TLObject { public static int constructor = 0xca30a5b1; @@ -19024,6 +19052,7 @@ public class TLRPC { } } + /* public static class TL_messages_getInlineBotResults extends TLObject { public static int constructor = 0x514e999d; @@ -19050,7 +19079,9 @@ public class TLRPC { stream.writeString(offset); } } + */ + /* public static class TL_messages_sendInlineBotResult extends TLObject { public static int constructor = 0xb16e06fe; @@ -19083,7 +19114,9 @@ public class TLRPC { stream.writeString(id); } } + */ + /* public static class TL_messages_getMessageEditData extends TLObject { public static int constructor = 0xfda68d36; @@ -19100,6 +19133,7 @@ public class TLRPC { stream.writeInt32(id); } } + */ public static class TL_messages_editMessage extends TLObject { public static int constructor = 0xce91e4ca; @@ -19201,6 +19235,7 @@ public class TLRPC { } } + /* public static class TL_messages_editInlineBotMessage extends TLObject { public static int constructor = 0x130c2c85; @@ -19236,7 +19271,9 @@ public class TLRPC { } } } + */ + /* public static class TL_messages_saveDraft extends TLObject { public static int constructor = 0xbc39e14b; @@ -19270,7 +19307,9 @@ public class TLRPC { } } } + */ + /* public static class TL_messages_getAllDrafts extends TLObject { public static int constructor = 0x6a3f8d65; @@ -19283,6 +19322,7 @@ public class TLRPC { stream.writeInt32(constructor); } } + */ public static class TL_help_getAppChangelog extends TLObject { public static int constructor = 0xb921197a; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java index 9446f7ed9..c11cb33b1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java @@ -101,7 +101,7 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler { public void onLocationAcquired(Location location) { if (foundContextBot != null && foundContextBot.bot_inline_geo) { lastKnownLocation = location; - searchForContextBotResults(foundContextBot, searchingContextQuery, ""); + //searchForContextBotResults(foundContextBot, searchingContextQuery, ""); } } @@ -277,7 +277,7 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler { if (noUserName) { return; } - searchForContextBotResults(foundContextBot, query, ""); + //searchForContextBotResults(foundContextBot, query, ""); } else { TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername(); req.username = searchingContextUsername = username; @@ -339,7 +339,7 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler { if (delegate != null) { delegate.onContextSearch(true); } - searchForContextBotResults(foundContextBot, searchingContextQuery, ""); + //searchForContextBotResults(foundContextBot, searchingContextQuery, ""); } } }); @@ -357,7 +357,7 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler { lastKnownLocation = new Location("network"); lastKnownLocation.setLatitude(-1000); lastKnownLocation.setLongitude(-1000); - searchForContextBotResults(foundContextBot, searchingContextQuery, ""); + //searchForContextBotResults(foundContextBot, searchingContextQuery, ""); } } @@ -387,9 +387,10 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler { if (contextQueryReqid != 0 || nextQueryOffset == null || nextQueryOffset.length() == 0 || foundContextBot == null || searchingContextQuery == null) { return; } - searchForContextBotResults(foundContextBot, searchingContextQuery, nextQueryOffset); + //searchForContextBotResults(foundContextBot, searchingContextQuery, nextQueryOffset); } + /* private void searchForContextBotResults(TLRPC.User user, final String query, final String offset) { if (contextQueryReqid != 0) { ConnectionsManager.getInstance().cancelRequest(contextQueryReqid, true); @@ -478,6 +479,7 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler { } }, ConnectionsManager.RequestFlagFailOnServerErrors); } + */ public void searchUsernameOrHashtag(String text, int position, ArrayList messageObjects) { if (text == null || text.length() == 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index fabafbac5..1eb9b0238 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -139,7 +139,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not protected TLRPC.Chat currentChat; protected TLRPC.User currentUser; // originally currentChat<->currentUser was used to differ between normal or group chats - protected TLRPC.EncryptedChat currentEncryptedChat; + private TLRPC.EncryptedChat currentEncryptedChat; // always NULL, not needed private boolean userBlocked = false; @@ -258,7 +258,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private boolean scrollToTopUnReadOnResume; private long dialog_id; private int lastLoadIndex; - private boolean isBroadcast; + private boolean isBroadcast; // always false private HashMap[] selectedMessagesIds = new HashMap[]{new HashMap<>(), new HashMap<>()}; private HashMap[] selectedMessagesCanCopyIds = new HashMap[]{new HashMap<>(), new HashMap<>()}; private int cantDeleteMessagesCount; @@ -328,9 +328,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private final static int edit_done = 20; private final static int report = 21; - private final static int bot_help = 30; - private final static int bot_settings = 31; - private final static int attach_photo = 0; private final static int attach_gallery = 1; private final static int attach_video = 2; @@ -931,17 +928,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } chatAttachAlert.init(ChatActivity.this); showDialog(chatAttachAlert); - } else if (id == bot_help) { - SendMessagesHelper.getInstance().sendMessage("/help", dialog_id, null, null, false, null, null, null); - } else if (id == bot_settings) { - SendMessagesHelper.getInstance().sendMessage("/settings", dialog_id, null, null, false, null, null, null); } else if (id == search) { openSearchWithText(null); } } }); - avatarContainer = new ChatAvatarContainer(context, this, currentEncryptedChat != null); + avatarContainer = new ChatAvatarContainer(context, this); actionBar.addView(avatarContainer, 0, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 56, 0, 40, 0)); if (currentChat != null) { @@ -958,7 +951,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not ActionBarMenu menu = actionBar.createMenu(); - if (currentEncryptedChat == null && !isBroadcast) { + /*if (currentEncryptedChat == null && !isBroadcast)*/ { searchItem = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() { @Override @@ -1937,7 +1930,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not i++; } Object object = mentionsAdapter.getItem(i); - if (object instanceof TLRPC.BotInlineResult) { + /*if (object instanceof TLRPC.BotInlineResult) { TLRPC.BotInlineResult inlineResult = (TLRPC.BotInlineResult) object; if (inlineResult.document != null) { size.width = inlineResult.document.thumb != null ? inlineResult.document.thumb.w : 100; @@ -1954,7 +1947,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not size.width = inlineResult.w; size.height = inlineResult.h; } - } + }*/ return size; } @@ -2160,7 +2153,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } else { chatActivityEnterView.replaceWithText(start, len, object + " "); } - } else if (object instanceof TLRPC.BotInlineResult) { + } /*else if (object instanceof TLRPC.BotInlineResult) { if (chatActivityEnterView.getFieldText() == null) { return; } @@ -2175,7 +2168,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not chatActivityEnterView.setFieldText(""); showReplyPanel(false, null, null, null, false, true); SearchQuery.increaseInlineRaiting(uid); - } + }*/ } }); @@ -3424,6 +3417,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not }); } + /* private void forwardMessages(ArrayList arrayList, boolean fromMyName) { if (arrayList == null || arrayList.isEmpty()) { return; @@ -3436,6 +3430,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } } + */ public void showReplyPanel(boolean show, MessageObject messageObjectToReply, ArrayList messageObjectsToForward, TLRPC.WebPage webPage, boolean cancel, boolean animated) { /* EDIT BY MR @@ -7527,9 +7522,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } switch (option) { case 0: { + /* if (SendMessagesHelper.getInstance().retrySendMessage(selectedObject, false)) { moveScrollToLastMessage(); } + */ break; } case 1: { @@ -8052,9 +8049,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return currentChat; } + /* public TLRPC.EncryptedChat getCurrentEncryptedChat() { return currentEncryptedChat; } + */ public TLRPC.ChatFull getCurrentChatInfo() { return info; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java index bf06128b1..d8c198921 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java @@ -48,7 +48,7 @@ public class ChatAvatarContainer extends FrameLayout { private int onlineCount = -1; - public ChatAvatarContainer(Context context, ChatActivity chatActivity, boolean needTime) { + public ChatAvatarContainer(Context context, ChatActivity chatActivity /*, boolean needTime*/) { super(context); parentFragment = chatActivity; @@ -71,6 +71,7 @@ public class ChatAvatarContainer extends FrameLayout { subtitleTextView.setGravity(Gravity.LEFT); addView(subtitleTextView); + /* if (needTime) { timeItem = new ImageView(context); timeItem.setPadding(AndroidUtilities.dp(10), AndroidUtilities.dp(10), AndroidUtilities.dp(5), AndroidUtilities.dp(5)); @@ -84,6 +85,7 @@ public class ChatAvatarContainer extends FrameLayout { } }); } + */ setOnClickListener(new View.OnClickListener() { @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index ebafd340a..5549ee239 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -2605,7 +2605,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat canShowBottom = false; Object obj = imagesArrLocals.get(index); cropItem.setVisibility(obj instanceof MediaController.PhotoEntry || obj instanceof MediaController.SearchImage && ((MediaController.SearchImage) obj).type == 0 ? View.VISIBLE : View.GONE); - if (parentChatActivity != null && (parentChatActivity.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(parentChatActivity.currentEncryptedChat.layer) >= 46)) { + if (parentChatActivity != null /*&& (parentChatActivity.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(parentChatActivity.currentEncryptedChat.layer) >= 46)*/) { mentionsAdapter.setChatInfo(parentChatActivity.info); mentionsAdapter.setNeedUsernames(parentChatActivity.currentChat != null); mentionsAdapter.setNeedBotContext(false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index e3018408c..e81c1ad69 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -603,7 +603,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. args.putInt("chat_id", (int) (dialog_id >> 32)); presentFragment(new IdenticonActivity(args)); } else if (position == settingsTimerRow) { - showDialog(AndroidUtilities.buildTTLAlert(getParentActivity(), currentEncryptedChat).create()); + //showDialog(AndroidUtilities.buildTTLAlert(getParentActivity(), currentEncryptedChat).create()); } else if (position == settingsNotificationsRow) { Bundle args = new Bundle(); if (user_id != 0) {