mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
Changed broadcast lists ids
old broadcast lists will be broken
This commit is contained in:
parent
2eb84e23f6
commit
755446e9bb
8 changed files with 204 additions and 184 deletions
|
@ -83,7 +83,7 @@ android {
|
|||
defaultConfig {
|
||||
minSdkVersion 8
|
||||
targetSdkVersion 19
|
||||
versionCode 292
|
||||
versionCode 293
|
||||
versionName "1.7.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,4 +221,8 @@ public class AndroidUtilities {
|
|||
FileLog.e("tmessages", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static long makeBroadcastId(int id) {
|
||||
return 0x0000000100000000L | ((long)id & 0x00000000FFFFFFFFL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -765,6 +765,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
TLRPC.TL_dialog dialog = dialogs_dict.get(did);
|
||||
if (dialog != null) {
|
||||
int lower_part = (int)did;
|
||||
int high_id = (int)(did >> 32);
|
||||
|
||||
if (offset == 0) {
|
||||
if (!onlyHistory) {
|
||||
|
@ -785,6 +786,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
}
|
||||
|
||||
if (high_id == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (lower_part != 0) {
|
||||
TLRPC.TL_messages_deleteHistory req = new TLRPC.TL_messages_deleteHistory();
|
||||
req.offset = offset;
|
||||
|
@ -831,14 +836,11 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
}
|
||||
});
|
||||
} else {
|
||||
int high_id = (int)(did >> 32);
|
||||
if (high_id > 0) {
|
||||
if (onlyHistory) {
|
||||
TLRPC.EncryptedChat encryptedChat = encryptedChats.get(high_id);
|
||||
sendClearHistoryMessage(encryptedChat);
|
||||
} else {
|
||||
declineSecretChat(high_id);
|
||||
}
|
||||
if (onlyHistory) {
|
||||
TLRPC.EncryptedChat encryptedChat = encryptedChats.get(high_id);
|
||||
sendClearHistoryMessage(encryptedChat);
|
||||
} else {
|
||||
declineSecretChat(high_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1046,7 +1048,12 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
return;
|
||||
}
|
||||
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();
|
||||
if (lower_part < 0) {
|
||||
req.peer = new TLRPC.TL_inputPeerChat();
|
||||
|
@ -1075,23 +1082,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors);
|
||||
ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid);
|
||||
} else {
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (high_id > 0) {
|
||||
TLRPC.EncryptedChat chat = encryptedChats.get(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;
|
||||
long reqId = ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||
@Override
|
||||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
TLRPC.EncryptedChat chat = encryptedChats.get(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;
|
||||
long reqId = ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||
@Override
|
||||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
|
||||
}
|
||||
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors);
|
||||
ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid);
|
||||
}
|
||||
}
|
||||
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors);
|
||||
ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1555,8 +1559,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
|
||||
public void markDialogAsRead(final long dialog_id, final int max_id, final int max_positive_id, final int offset, final int max_date, final boolean was) {
|
||||
int lower_part = (int)dialog_id;
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
|
||||
if (lower_part != 0) {
|
||||
if (max_id == 0 && offset == 0) {
|
||||
if (max_id == 0 && offset == 0 || high_id == 1) {
|
||||
return;
|
||||
}
|
||||
TLRPC.TL_messages_readHistory req = new TLRPC.TL_messages_readHistory();
|
||||
|
@ -1646,49 +1652,46 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
if (max_date == 0) {
|
||||
return;
|
||||
}
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (high_id > 0) {
|
||||
NotificationsController.getInstance().processReadMessages(null, dialog_id, max_date, 0);
|
||||
TLRPC.EncryptedChat chat = encryptedChats.get(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;
|
||||
NotificationsController.getInstance().processReadMessages(null, dialog_id, max_date, 0);
|
||||
TLRPC.EncryptedChat chat = encryptedChats.get(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().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||
@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, false);
|
||||
|
||||
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Utilities.RunOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
//MessagesStorage.getInstance().processPendingRead(dialog_id, max_id, max_date, true);
|
||||
public void run() {
|
||||
TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id);
|
||||
if (dialog != null) {
|
||||
dialog.unread_count = 0;
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
}
|
||||
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
|
||||
dialogsToUpdate.put(dialog_id, 0);
|
||||
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
MessagesStorage.getInstance().processPendingRead(dialog_id, max_id, max_date, false);
|
||||
});
|
||||
|
||||
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Utilities.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(dialogsNeedReload);
|
||||
}
|
||||
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
|
||||
dialogsToUpdate.put(dialog_id, 0);
|
||||
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (chat.ttl > 0 && was) {
|
||||
int serverTime = Math.max(ConnectionsManager.getInstance().getCurrentTime(), max_date);
|
||||
MessagesStorage.getInstance().createTaskForDate(chat.id, serverTime, serverTime, 0);
|
||||
}
|
||||
if (chat.ttl > 0 && was) {
|
||||
int serverTime = Math.max(ConnectionsManager.getInstance().getCurrentTime(), max_date);
|
||||
MessagesStorage.getInstance().createTaskForDate(chat.id, serverTime, serverTime, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1975,44 +1978,12 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
newMsg.unread = true;
|
||||
newMsg.dialog_id = peer;
|
||||
int lower_id = (int)peer;
|
||||
int high_id = (int)(peer >> 32);
|
||||
TLRPC.EncryptedChat encryptedChat = null;
|
||||
TLRPC.InputPeer sendToPeer = null;
|
||||
ArrayList<TLRPC.InputUser> sendToPeers = null;
|
||||
if (lower_id != 0) {
|
||||
if (lower_id < 0) {
|
||||
newMsg.to_id = new TLRPC.TL_peerChat();
|
||||
newMsg.to_id.chat_id = -lower_id;
|
||||
sendToPeer = new TLRPC.TL_inputPeerChat();
|
||||
sendToPeer.chat_id = -lower_id;
|
||||
} else {
|
||||
newMsg.to_id = new TLRPC.TL_peerUser();
|
||||
newMsg.to_id.user_id = lower_id;
|
||||
|
||||
TLRPC.User sendToUser = users.get(lower_id);
|
||||
if (sendToUser == null) {
|
||||
return;
|
||||
}
|
||||
if (sendToUser instanceof TLRPC.TL_userForeign || sendToUser instanceof TLRPC.TL_userRequest) {
|
||||
sendToPeer = new TLRPC.TL_inputPeerForeign();
|
||||
sendToPeer.user_id = sendToUser.id;
|
||||
sendToPeer.access_hash = sendToUser.access_hash;
|
||||
} else {
|
||||
sendToPeer = new TLRPC.TL_inputPeerContact();
|
||||
sendToPeer.user_id = sendToUser.id;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int high_id = (int)(peer >> 32);
|
||||
if (high_id > 0) {
|
||||
encryptedChat = encryptedChats.get(high_id);
|
||||
newMsg.to_id = new TLRPC.TL_peerUser();
|
||||
if (encryptedChat.participant_id == UserConfig.getClientUserId()) {
|
||||
newMsg.to_id.user_id = encryptedChat.admin_id;
|
||||
} else {
|
||||
newMsg.to_id.user_id = encryptedChat.participant_id;
|
||||
}
|
||||
newMsg.ttl = encryptedChat.ttl;
|
||||
} else {
|
||||
if (high_id == 1) {
|
||||
if (currentChatInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -2026,7 +1997,39 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
}
|
||||
newMsg.to_id = new TLRPC.TL_peerChat();
|
||||
newMsg.to_id.chat_id = high_id;
|
||||
} else {
|
||||
if (lower_id < 0) {
|
||||
newMsg.to_id = new TLRPC.TL_peerChat();
|
||||
newMsg.to_id.chat_id = -lower_id;
|
||||
sendToPeer = new TLRPC.TL_inputPeerChat();
|
||||
sendToPeer.chat_id = -lower_id;
|
||||
} else {
|
||||
newMsg.to_id = new TLRPC.TL_peerUser();
|
||||
newMsg.to_id.user_id = lower_id;
|
||||
|
||||
TLRPC.User sendToUser = users.get(lower_id);
|
||||
if (sendToUser == null) {
|
||||
return;
|
||||
}
|
||||
if (sendToUser instanceof TLRPC.TL_userForeign || sendToUser instanceof TLRPC.TL_userRequest) {
|
||||
sendToPeer = new TLRPC.TL_inputPeerForeign();
|
||||
sendToPeer.user_id = sendToUser.id;
|
||||
sendToPeer.access_hash = sendToUser.access_hash;
|
||||
} else {
|
||||
sendToPeer = new TLRPC.TL_inputPeerContact();
|
||||
sendToPeer.user_id = sendToUser.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
encryptedChat = encryptedChats.get(high_id);
|
||||
newMsg.to_id = new TLRPC.TL_peerUser();
|
||||
if (encryptedChat.participant_id == UserConfig.getClientUserId()) {
|
||||
newMsg.to_id.user_id = encryptedChat.admin_id;
|
||||
} else {
|
||||
newMsg.to_id.user_id = encryptedChat.participant_id;
|
||||
}
|
||||
newMsg.ttl = encryptedChat.ttl;
|
||||
}
|
||||
newMsg.out = true;
|
||||
newMsg.date = ConnectionsManager.getInstance().getCurrentTime();
|
||||
|
@ -2886,7 +2889,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
newMsg.local_id = newMsg.id = UserConfig.getNewMessageId();
|
||||
newMsg.from_id = UserConfig.getClientUserId();
|
||||
newMsg.unread = false;
|
||||
newMsg.dialog_id = ((long)chat.id) << 32;
|
||||
newMsg.dialog_id = AndroidUtilities.makeBroadcastId(chat.id);
|
||||
newMsg.to_id = new TLRPC.TL_peerChat();
|
||||
newMsg.to_id.chat_id = chat.id;
|
||||
newMsg.out = false;
|
||||
|
|
|
@ -366,6 +366,17 @@ public class MessagesStorage {
|
|||
if (!messagesOnly) {
|
||||
database.executeFast("DELETE FROM dialogs WHERE did = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM chat_settings WHERE uid = " + did).stepThis().dispose();
|
||||
int lower_id = (int)did;
|
||||
int high_id = (int)(did >> 32);
|
||||
if (lower_id != 0) {
|
||||
if (high_id == 1) {
|
||||
database.executeFast("DELETE FROM chats WHERE uid = " + lower_id).stepThis().dispose();
|
||||
} else if (lower_id < 0) {
|
||||
database.executeFast("DELETE FROM chats WHERE uid = " + (-lower_id)).stepThis().dispose();
|
||||
}
|
||||
} else {
|
||||
database.executeFast("DELETE FROM enc_chats WHERE uid = " + high_id).stepThis().dispose();
|
||||
}
|
||||
}
|
||||
database.executeFast("UPDATE dialogs SET unread_count = 0 WHERE did = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_counts WHERE uid = " + did).stepThis().dispose();
|
||||
|
@ -2429,26 +2440,26 @@ public class MessagesStorage {
|
|||
buffersStorage.reuseFreeBuffer(data);
|
||||
|
||||
int lower_id = (int)dialog.id;
|
||||
int high_id = (int)(dialog.id >> 32);
|
||||
if (lower_id != 0) {
|
||||
if (lower_id > 0) {
|
||||
if (!usersToLoad.contains(lower_id)) {
|
||||
usersToLoad.add(lower_id);
|
||||
if (high_id == 1) {
|
||||
if (!chatsToLoad.contains(lower_id)) {
|
||||
chatsToLoad.add(lower_id);
|
||||
}
|
||||
} else {
|
||||
if (!chatsToLoad.contains(-lower_id)) {
|
||||
chatsToLoad.add(-lower_id);
|
||||
if (lower_id > 0) {
|
||||
if (!usersToLoad.contains(lower_id)) {
|
||||
usersToLoad.add(lower_id);
|
||||
}
|
||||
} else {
|
||||
if (!chatsToLoad.contains(-lower_id)) {
|
||||
chatsToLoad.add(-lower_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int high_id = (int)(dialog.id >> 32);
|
||||
if (high_id > 0) {
|
||||
if (!encryptedToLoad.contains(high_id)) {
|
||||
encryptedToLoad.add(high_id);
|
||||
}
|
||||
} else {
|
||||
if (!chatsToLoad.contains(high_id)) {
|
||||
chatsToLoad.add(high_id);
|
||||
}
|
||||
if (!encryptedToLoad.contains(high_id)) {
|
||||
encryptedToLoad.add(high_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2702,26 +2713,26 @@ public class MessagesStorage {
|
|||
buffersStorage.reuseFreeBuffer(data);
|
||||
|
||||
int lower_id = (int)dialog.id;
|
||||
int high_id = (int)(dialog.id >> 32);
|
||||
if (lower_id != 0) {
|
||||
if (lower_id > 0) {
|
||||
if (!usersToLoad.contains(lower_id)) {
|
||||
usersToLoad.add(lower_id);
|
||||
if (high_id == 1) {
|
||||
if (!chatsToLoad.contains(lower_id)) {
|
||||
chatsToLoad.add(lower_id);
|
||||
}
|
||||
} else {
|
||||
if (!chatsToLoad.contains(-lower_id)) {
|
||||
chatsToLoad.add(-lower_id);
|
||||
if (lower_id > 0) {
|
||||
if (!usersToLoad.contains(lower_id)) {
|
||||
usersToLoad.add(lower_id);
|
||||
}
|
||||
} else {
|
||||
if (!chatsToLoad.contains(-lower_id)) {
|
||||
chatsToLoad.add(-lower_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int high_id = (int)(dialog.id >> 32);
|
||||
if (high_id > 0) {
|
||||
if (!encryptedToLoad.contains(high_id)) {
|
||||
encryptedToLoad.add(high_id);
|
||||
}
|
||||
} else {
|
||||
if (!chatsToLoad.contains(high_id)) {
|
||||
chatsToLoad.add(high_id);
|
||||
}
|
||||
if (!encryptedToLoad.contains(high_id)) {
|
||||
encryptedToLoad.add(high_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,21 +225,21 @@ public class DialogCell extends BaseCell {
|
|||
encryptedChat = null;
|
||||
|
||||
int lower_id = (int)currentDialog.id;
|
||||
int high_id = (int)(currentDialog.id >> 32);
|
||||
if (lower_id != 0) {
|
||||
if (lower_id < 0) {
|
||||
chat = MessagesController.getInstance().chats.get(-lower_id);
|
||||
if (high_id == 1) {
|
||||
chat = MessagesController.getInstance().chats.get(lower_id);
|
||||
} else {
|
||||
user = MessagesController.getInstance().users.get(lower_id);
|
||||
if (lower_id < 0) {
|
||||
chat = MessagesController.getInstance().chats.get(-lower_id);
|
||||
} else {
|
||||
user = MessagesController.getInstance().users.get(lower_id);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int high_id = (int)(currentDialog.id >> 32);
|
||||
if (high_id > 0) {
|
||||
encryptedChat = MessagesController.getInstance().encryptedChats.get(high_id);
|
||||
if (encryptedChat != null) {
|
||||
user = MessagesController.getInstance().users.get(encryptedChat.user_id);
|
||||
}
|
||||
} else {
|
||||
chat = MessagesController.getInstance().chats.get(high_id);
|
||||
encryptedChat = MessagesController.getInstance().encryptedChats.get(high_id);
|
||||
if (encryptedChat != null) {
|
||||
user = MessagesController.getInstance().users.get(encryptedChat.user_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
private View pagedownButton;
|
||||
private TextView topPanelText;
|
||||
private long dialog_id;
|
||||
private boolean isBraodcast = false;
|
||||
private HashMap<Integer, MessageObject> selectedMessagesIds = new HashMap<Integer, MessageObject>();
|
||||
private HashMap<Integer, MessageObject> selectedMessagesCanCopyIds = new HashMap<Integer, MessageObject>();
|
||||
|
||||
|
@ -215,7 +216,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (chatId > 0) {
|
||||
dialog_id = -chatId;
|
||||
} else {
|
||||
dialog_id = ((long)chatId) << 32;
|
||||
isBraodcast = true;
|
||||
dialog_id = AndroidUtilities.makeBroadcastId(chatId);
|
||||
}
|
||||
} else if (userId != 0) {
|
||||
currentUser = MessagesController.getInstance().users.get(userId);
|
||||
|
@ -1051,8 +1053,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
|
||||
private int getMessageType(MessageObject messageObject) {
|
||||
if (currentEncryptedChat == null) {
|
||||
boolean isBroadcastError = (int)dialog_id == 0 && messageObject.messageOwner.id <= 0 && messageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SEND_ERROR;
|
||||
if ((int)dialog_id != 0 && messageObject.messageOwner.id <= 0 && messageObject.isOut() || isBroadcastError) {
|
||||
boolean isBroadcastError = isBraodcast && messageObject.messageOwner.id <= 0 && messageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SEND_ERROR;
|
||||
if (!isBraodcast && messageObject.messageOwner.id <= 0 && messageObject.isOut() || isBroadcastError) {
|
||||
if (messageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SEND_ERROR) {
|
||||
if (!(messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty)) {
|
||||
return 0;
|
||||
|
@ -1778,7 +1780,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (messArr.size() != count) {
|
||||
if (isCache) {
|
||||
cacheEndReaced = true;
|
||||
if ((int)dialog_id == 0) {
|
||||
if (currentEncryptedChat != null || isBraodcast) {
|
||||
endReached = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -2932,7 +2934,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
@Override
|
||||
public void didSelectDialog(MessagesActivity activity, long did, boolean param) {
|
||||
if (dialog_id != 0 && (forwaringMessage != null || !selectedMessagesIds.isEmpty())) {
|
||||
if ((int)dialog_id == 0 && currentEncryptedChat == null) {
|
||||
if (isBraodcast) {
|
||||
param = true;
|
||||
}
|
||||
if (did != dialog_id) {
|
||||
|
|
|
@ -447,23 +447,23 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
|
|||
public void didSelectDialog(MessagesActivity messageFragment, long dialog_id, boolean param) {
|
||||
if (dialog_id != 0) {
|
||||
int lower_part = (int)dialog_id;
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("scrollToTopOnResume", true);
|
||||
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
|
||||
if (lower_part != 0) {
|
||||
if (lower_part > 0) {
|
||||
args.putInt("user_id", lower_part);
|
||||
} else if (lower_part < 0) {
|
||||
args.putInt("chat_id", -lower_part);
|
||||
if (high_id == 1) {
|
||||
args.putInt("chat_id", lower_part);
|
||||
} else {
|
||||
if (lower_part > 0) {
|
||||
args.putInt("user_id", lower_part);
|
||||
} else if (lower_part < 0) {
|
||||
args.putInt("chat_id", -lower_part);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (high_id > 0) {
|
||||
args.putInt("enc_id", high_id);
|
||||
} else {
|
||||
args.putInt("chat_id", high_id);
|
||||
}
|
||||
args.putInt("enc_id", high_id);
|
||||
}
|
||||
ChatActivity fragment = new ChatActivity(args);
|
||||
presentFragment(fragment, true);
|
||||
|
|
|
@ -288,19 +288,19 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
|||
} else {
|
||||
Bundle args = new Bundle();
|
||||
int lower_part = (int)dialog_id;
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (lower_part != 0) {
|
||||
if (lower_part > 0) {
|
||||
args.putInt("user_id", lower_part);
|
||||
} else if (lower_part < 0) {
|
||||
args.putInt("chat_id", -lower_part);
|
||||
if (high_id == 1) {
|
||||
args.putInt("chat_id", lower_part);
|
||||
} else {
|
||||
if (lower_part > 0) {
|
||||
args.putInt("user_id", lower_part);
|
||||
} else if (lower_part < 0) {
|
||||
args.putInt("chat_id", -lower_part);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (high_id > 0) {
|
||||
args.putInt("enc_id", high_id);
|
||||
} else {
|
||||
args.putInt("chat_id", high_id);
|
||||
}
|
||||
args.putInt("enc_id", high_id);
|
||||
}
|
||||
presentFragment(new ChatActivity(args));
|
||||
}
|
||||
|
@ -493,36 +493,36 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
int lower_part = (int)dialog_id;
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (lower_part != 0) {
|
||||
if (lower_part > 0) {
|
||||
TLRPC.User user = MessagesController.getInstance().users.get(lower_part);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, Utilities.formatName(user.first_name, user.last_name)));
|
||||
} else if (lower_part < 0) {
|
||||
TLRPC.Chat chat = MessagesController.getInstance().chats.get(-lower_part);
|
||||
if (high_id == 1) {
|
||||
TLRPC.Chat chat = MessagesController.getInstance().chats.get(lower_part);
|
||||
if (chat == null) {
|
||||
return;
|
||||
}
|
||||
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, chat.title));
|
||||
} else {
|
||||
if (lower_part > 0) {
|
||||
TLRPC.User user = MessagesController.getInstance().users.get(lower_part);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, Utilities.formatName(user.first_name, user.last_name)));
|
||||
} else if (lower_part < 0) {
|
||||
TLRPC.Chat chat = MessagesController.getInstance().chats.get(-lower_part);
|
||||
if (chat == null) {
|
||||
return;
|
||||
}
|
||||
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, chat.title));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (high_id > 0) {
|
||||
TLRPC.EncryptedChat chat = MessagesController.getInstance().encryptedChats.get(high_id);
|
||||
TLRPC.User user = MessagesController.getInstance().users.get(chat.user_id);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, Utilities.formatName(user.first_name, user.last_name)));
|
||||
} else {
|
||||
TLRPC.Chat chat = MessagesController.getInstance().chats.get(high_id);
|
||||
if (chat == null) {
|
||||
return;
|
||||
}
|
||||
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, chat.title));
|
||||
TLRPC.EncryptedChat chat = MessagesController.getInstance().encryptedChats.get(high_id);
|
||||
TLRPC.User user = MessagesController.getInstance().users.get(chat.user_id);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, Utilities.formatName(user.first_name, user.last_name)));
|
||||
}
|
||||
CheckBox checkBox = null;
|
||||
/*if (delegate instanceof ChatActivity) {
|
||||
|
|
Loading…
Reference in a new issue