Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
apk
Commits
755446e9
Commit
755446e9
authored
Jul 27, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed broadcast lists ids
old broadcast lists will be broken
parent
2eb84e23
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
204 additions
and
184 deletions
+204
-184
build.gradle
TMessagesProj/build.gradle
+1
-1
AndroidUtilities.java
.../src/main/java/org/telegram/android/AndroidUtilities.java
+4
-0
MessagesController.java
...rc/main/java/org/telegram/android/MessagesController.java
+100
-97
MessagesStorage.java
...j/src/main/java/org/telegram/android/MessagesStorage.java
+39
-28
DialogCell.java
...sProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
+11
-11
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+7
-5
LaunchActivity.java
...gesProj/src/main/java/org/telegram/ui/LaunchActivity.java
+10
-10
MessagesActivity.java
...sProj/src/main/java/org/telegram/ui/MessagesActivity.java
+32
-32
No files found.
TMessagesProj/build.gradle
View file @
755446e9
...
@@ -83,7 +83,7 @@ android {
...
@@ -83,7 +83,7 @@ android {
defaultConfig
{
defaultConfig
{
minSdkVersion
8
minSdkVersion
8
targetSdkVersion
19
targetSdkVersion
19
versionCode
29
2
versionCode
29
3
versionName
"1.7.0"
versionName
"1.7.0"
}
}
}
}
TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java
View file @
755446e9
...
@@ -221,4 +221,8 @@ public class AndroidUtilities {
...
@@ -221,4 +221,8 @@ public class AndroidUtilities {
FileLog
.
e
(
"tmessages"
,
e
);
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
}
public
static
long
makeBroadcastId
(
int
id
)
{
return
0x0000000100000000
L
|
((
long
)
id
&
0x00000000FFFFFFFF
L
);
}
}
}
TMessagesProj/src/main/java/org/telegram/android/MessagesController.java
View file @
755446e9
...
@@ -765,6 +765,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -765,6 +765,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
TLRPC
.
TL_dialog
dialog
=
dialogs_dict
.
get
(
did
);
TLRPC
.
TL_dialog
dialog
=
dialogs_dict
.
get
(
did
);
if
(
dialog
!=
null
)
{
if
(
dialog
!=
null
)
{
int
lower_part
=
(
int
)
did
;
int
lower_part
=
(
int
)
did
;
int
high_id
=
(
int
)(
did
>>
32
);
if
(
offset
==
0
)
{
if
(
offset
==
0
)
{
if
(!
onlyHistory
)
{
if
(!
onlyHistory
)
{
...
@@ -785,6 +786,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -785,6 +786,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
}
}
if
(
high_id
==
1
)
{
return
;
}
if
(
lower_part
!=
0
)
{
if
(
lower_part
!=
0
)
{
TLRPC
.
TL_messages_deleteHistory
req
=
new
TLRPC
.
TL_messages_deleteHistory
();
TLRPC
.
TL_messages_deleteHistory
req
=
new
TLRPC
.
TL_messages_deleteHistory
();
req
.
offset
=
offset
;
req
.
offset
=
offset
;
...
@@ -831,8 +836,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -831,8 +836,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
});
});
}
else
{
}
else
{
int
high_id
=
(
int
)(
did
>>
32
);
if
(
high_id
>
0
)
{
if
(
onlyHistory
)
{
if
(
onlyHistory
)
{
TLRPC
.
EncryptedChat
encryptedChat
=
encryptedChats
.
get
(
high_id
);
TLRPC
.
EncryptedChat
encryptedChat
=
encryptedChats
.
get
(
high_id
);
sendClearHistoryMessage
(
encryptedChat
);
sendClearHistoryMessage
(
encryptedChat
);
...
@@ -842,7 +845,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -842,7 +845,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
}
}
}
}
}
public
void
loadChatInfo
(
final
int
chat_id
)
{
public
void
loadChatInfo
(
final
int
chat_id
)
{
currentChatInfo
=
null
;
currentChatInfo
=
null
;
...
@@ -1046,7 +1048,12 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1046,7 +1048,12 @@ public class MessagesController implements NotificationCenter.NotificationCenter
return
;
return
;
}
}
int
lower_part
=
(
int
)
dialog_id
;
int
lower_part
=
(
int
)
dialog_id
;
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
lower_part
!=
0
)
{
if
(
lower_part
!=
0
)
{
if
(
high_id
==
1
)
{
return
;
}
TLRPC
.
TL_messages_setTyping
req
=
new
TLRPC
.
TL_messages_setTyping
();
TLRPC
.
TL_messages_setTyping
req
=
new
TLRPC
.
TL_messages_setTyping
();
if
(
lower_part
<
0
)
{
if
(
lower_part
<
0
)
{
req
.
peer
=
new
TLRPC
.
TL_inputPeerChat
();
req
.
peer
=
new
TLRPC
.
TL_inputPeerChat
();
...
@@ -1075,8 +1082,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1075,8 +1082,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
},
true
,
RPCRequest
.
RPCRequestClassGeneric
|
RPCRequest
.
RPCRequestClassFailOnServerErrors
);
},
true
,
RPCRequest
.
RPCRequestClassGeneric
|
RPCRequest
.
RPCRequestClassFailOnServerErrors
);
ConnectionsManager
.
getInstance
().
bindRequestToGuid
(
reqId
,
classGuid
);
ConnectionsManager
.
getInstance
().
bindRequestToGuid
(
reqId
,
classGuid
);
}
else
{
}
else
{
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
high_id
>
0
)
{
TLRPC
.
EncryptedChat
chat
=
encryptedChats
.
get
(
high_id
);
TLRPC
.
EncryptedChat
chat
=
encryptedChats
.
get
(
high_id
);
if
(
chat
.
auth_key
!=
null
&&
chat
.
auth_key
.
length
>
1
&&
chat
instanceof
TLRPC
.
TL_encryptedChat
)
{
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
();
TLRPC
.
TL_messages_setEncryptedTyping
req
=
new
TLRPC
.
TL_messages_setEncryptedTyping
();
...
@@ -1094,7 +1099,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1094,7 +1099,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
}
}
}
}
}
public
void
loadMessages
(
final
long
dialog_id
,
final
int
offset
,
final
int
count
,
final
int
max_id
,
boolean
fromCache
,
int
midDate
,
final
int
classGuid
,
boolean
from_unread
,
boolean
forward
)
{
public
void
loadMessages
(
final
long
dialog_id
,
final
int
offset
,
final
int
count
,
final
int
max_id
,
boolean
fromCache
,
int
midDate
,
final
int
classGuid
,
boolean
from_unread
,
boolean
forward
)
{
int
lower_part
=
(
int
)
dialog_id
;
int
lower_part
=
(
int
)
dialog_id
;
...
@@ -1555,8 +1559,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -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
)
{
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
lower_part
=
(
int
)
dialog_id
;
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
lower_part
!=
0
)
{
if
(
lower_part
!=
0
)
{
if
(
max_id
==
0
&&
offset
==
0
)
{
if
(
max_id
==
0
&&
offset
==
0
||
high_id
==
1
)
{
return
;
return
;
}
}
TLRPC
.
TL_messages_readHistory
req
=
new
TLRPC
.
TL_messages_readHistory
();
TLRPC
.
TL_messages_readHistory
req
=
new
TLRPC
.
TL_messages_readHistory
();
...
@@ -1646,8 +1652,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1646,8 +1652,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if
(
max_date
==
0
)
{
if
(
max_date
==
0
)
{
return
;
return
;
}
}
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
high_id
>
0
)
{
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
dialog_id
,
max_date
,
0
);
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
dialog_id
,
max_date
,
0
);
TLRPC
.
EncryptedChat
chat
=
encryptedChats
.
get
(
high_id
);
TLRPC
.
EncryptedChat
chat
=
encryptedChats
.
get
(
high_id
);
if
(
chat
.
auth_key
!=
null
&&
chat
.
auth_key
.
length
>
1
&&
chat
instanceof
TLRPC
.
TL_encryptedChat
)
{
if
(
chat
.
auth_key
!=
null
&&
chat
.
auth_key
.
length
>
1
&&
chat
instanceof
TLRPC
.
TL_encryptedChat
)
{
...
@@ -1691,7 +1695,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1691,7 +1695,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
}
}
}
}
}
public
void
cancelSendingMessage
(
MessageObject
object
)
{
public
void
cancelSendingMessage
(
MessageObject
object
)
{
String
keyToRemvoe
=
null
;
String
keyToRemvoe
=
null
;
...
@@ -1975,10 +1978,26 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1975,10 +1978,26 @@ public class MessagesController implements NotificationCenter.NotificationCenter
newMsg
.
unread
=
true
;
newMsg
.
unread
=
true
;
newMsg
.
dialog_id
=
peer
;
newMsg
.
dialog_id
=
peer
;
int
lower_id
=
(
int
)
peer
;
int
lower_id
=
(
int
)
peer
;
int
high_id
=
(
int
)(
peer
>>
32
);
TLRPC
.
EncryptedChat
encryptedChat
=
null
;
TLRPC
.
EncryptedChat
encryptedChat
=
null
;
TLRPC
.
InputPeer
sendToPeer
=
null
;
TLRPC
.
InputPeer
sendToPeer
=
null
;
ArrayList
<
TLRPC
.
InputUser
>
sendToPeers
=
null
;
ArrayList
<
TLRPC
.
InputUser
>
sendToPeers
=
null
;
if
(
lower_id
!=
0
)
{
if
(
lower_id
!=
0
)
{
if
(
high_id
==
1
)
{
if
(
currentChatInfo
==
null
)
{
return
;
}
sendToPeers
=
new
ArrayList
<
TLRPC
.
InputUser
>();
for
(
TLRPC
.
TL_chatParticipant
participant
:
currentChatInfo
.
participants
)
{
TLRPC
.
User
sendToUser
=
users
.
get
(
participant
.
user_id
);
TLRPC
.
InputUser
peerUser
=
getInputUser
(
sendToUser
);
if
(
peerUser
!=
null
)
{
sendToPeers
.
add
(
peerUser
);
}
}
newMsg
.
to_id
=
new
TLRPC
.
TL_peerChat
();
newMsg
.
to_id
.
chat_id
=
high_id
;
}
else
{
if
(
lower_id
<
0
)
{
if
(
lower_id
<
0
)
{
newMsg
.
to_id
=
new
TLRPC
.
TL_peerChat
();
newMsg
.
to_id
=
new
TLRPC
.
TL_peerChat
();
newMsg
.
to_id
.
chat_id
=
-
lower_id
;
newMsg
.
to_id
.
chat_id
=
-
lower_id
;
...
@@ -2001,9 +2020,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -2001,9 +2020,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
sendToPeer
.
user_id
=
sendToUser
.
id
;
sendToPeer
.
user_id
=
sendToUser
.
id
;
}
}
}
}
}
}
else
{
}
else
{
int
high_id
=
(
int
)(
peer
>>
32
);
if
(
high_id
>
0
)
{
encryptedChat
=
encryptedChats
.
get
(
high_id
);
encryptedChat
=
encryptedChats
.
get
(
high_id
);
newMsg
.
to_id
=
new
TLRPC
.
TL_peerUser
();
newMsg
.
to_id
=
new
TLRPC
.
TL_peerUser
();
if
(
encryptedChat
.
participant_id
==
UserConfig
.
getClientUserId
())
{
if
(
encryptedChat
.
participant_id
==
UserConfig
.
getClientUserId
())
{
...
@@ -2012,21 +2030,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -2012,21 +2030,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
newMsg
.
to_id
.
user_id
=
encryptedChat
.
participant_id
;
newMsg
.
to_id
.
user_id
=
encryptedChat
.
participant_id
;
}
}
newMsg
.
ttl
=
encryptedChat
.
ttl
;
newMsg
.
ttl
=
encryptedChat
.
ttl
;
}
else
{
if
(
currentChatInfo
==
null
)
{
return
;
}
sendToPeers
=
new
ArrayList
<
TLRPC
.
InputUser
>();
for
(
TLRPC
.
TL_chatParticipant
participant
:
currentChatInfo
.
participants
)
{
TLRPC
.
User
sendToUser
=
users
.
get
(
participant
.
user_id
);
TLRPC
.
InputUser
peerUser
=
getInputUser
(
sendToUser
);
if
(
peerUser
!=
null
)
{
sendToPeers
.
add
(
peerUser
);
}
}
newMsg
.
to_id
=
new
TLRPC
.
TL_peerChat
();
newMsg
.
to_id
.
chat_id
=
high_id
;
}
}
}
newMsg
.
out
=
true
;
newMsg
.
out
=
true
;
newMsg
.
date
=
ConnectionsManager
.
getInstance
().
getCurrentTime
();
newMsg
.
date
=
ConnectionsManager
.
getInstance
().
getCurrentTime
();
...
@@ -2886,7 +2889,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -2886,7 +2889,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
newMsg
.
local_id
=
newMsg
.
id
=
UserConfig
.
getNewMessageId
();
newMsg
.
local_id
=
newMsg
.
id
=
UserConfig
.
getNewMessageId
();
newMsg
.
from_id
=
UserConfig
.
getClientUserId
();
newMsg
.
from_id
=
UserConfig
.
getClientUserId
();
newMsg
.
unread
=
false
;
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
=
new
TLRPC
.
TL_peerChat
();
newMsg
.
to_id
.
chat_id
=
chat
.
id
;
newMsg
.
to_id
.
chat_id
=
chat
.
id
;
newMsg
.
out
=
false
;
newMsg
.
out
=
false
;
...
...
TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java
View file @
755446e9
...
@@ -366,6 +366,17 @@ public class MessagesStorage {
...
@@ -366,6 +366,17 @@ public class MessagesStorage {
if
(!
messagesOnly
)
{
if
(!
messagesOnly
)
{
database
.
executeFast
(
"DELETE FROM dialogs WHERE did = "
+
did
).
stepThis
().
dispose
();
database
.
executeFast
(
"DELETE FROM dialogs WHERE did = "
+
did
).
stepThis
().
dispose
();
database
.
executeFast
(
"DELETE FROM chat_settings WHERE uid = "
+
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
(
"UPDATE dialogs SET unread_count = 0 WHERE did = "
+
did
).
stepThis
().
dispose
();
database
.
executeFast
(
"DELETE FROM media_counts WHERE uid = "
+
did
).
stepThis
().
dispose
();
database
.
executeFast
(
"DELETE FROM media_counts WHERE uid = "
+
did
).
stepThis
().
dispose
();
...
@@ -2429,7 +2440,13 @@ public class MessagesStorage {
...
@@ -2429,7 +2440,13 @@ public class MessagesStorage {
buffersStorage
.
reuseFreeBuffer
(
data
);
buffersStorage
.
reuseFreeBuffer
(
data
);
int
lower_id
=
(
int
)
dialog
.
id
;
int
lower_id
=
(
int
)
dialog
.
id
;
int
high_id
=
(
int
)(
dialog
.
id
>>
32
);
if
(
lower_id
!=
0
)
{
if
(
lower_id
!=
0
)
{
if
(
high_id
==
1
)
{
if
(!
chatsToLoad
.
contains
(
lower_id
))
{
chatsToLoad
.
add
(
lower_id
);
}
}
else
{
if
(
lower_id
>
0
)
{
if
(
lower_id
>
0
)
{
if
(!
usersToLoad
.
contains
(
lower_id
))
{
if
(!
usersToLoad
.
contains
(
lower_id
))
{
usersToLoad
.
add
(
lower_id
);
usersToLoad
.
add
(
lower_id
);
...
@@ -2439,17 +2456,11 @@ public class MessagesStorage {
...
@@ -2439,17 +2456,11 @@ public class MessagesStorage {
chatsToLoad
.
add
(-
lower_id
);
chatsToLoad
.
add
(-
lower_id
);
}
}
}
}
}
}
else
{
}
else
{
int
high_id
=
(
int
)(
dialog
.
id
>>
32
);
if
(
high_id
>
0
)
{
if
(!
encryptedToLoad
.
contains
(
high_id
))
{
if
(!
encryptedToLoad
.
contains
(
high_id
))
{
encryptedToLoad
.
add
(
high_id
);
encryptedToLoad
.
add
(
high_id
);
}
}
}
else
{
if
(!
chatsToLoad
.
contains
(
high_id
))
{
chatsToLoad
.
add
(
high_id
);
}
}
}
}
}
}
cursor
.
dispose
();
cursor
.
dispose
();
...
@@ -2702,7 +2713,13 @@ public class MessagesStorage {
...
@@ -2702,7 +2713,13 @@ public class MessagesStorage {
buffersStorage
.
reuseFreeBuffer
(
data
);
buffersStorage
.
reuseFreeBuffer
(
data
);
int
lower_id
=
(
int
)
dialog
.
id
;
int
lower_id
=
(
int
)
dialog
.
id
;
int
high_id
=
(
int
)(
dialog
.
id
>>
32
);
if
(
lower_id
!=
0
)
{
if
(
lower_id
!=
0
)
{
if
(
high_id
==
1
)
{
if
(!
chatsToLoad
.
contains
(
lower_id
))
{
chatsToLoad
.
add
(
lower_id
);
}
}
else
{
if
(
lower_id
>
0
)
{
if
(
lower_id
>
0
)
{
if
(!
usersToLoad
.
contains
(
lower_id
))
{
if
(!
usersToLoad
.
contains
(
lower_id
))
{
usersToLoad
.
add
(
lower_id
);
usersToLoad
.
add
(
lower_id
);
...
@@ -2712,17 +2729,11 @@ public class MessagesStorage {
...
@@ -2712,17 +2729,11 @@ public class MessagesStorage {
chatsToLoad
.
add
(-
lower_id
);
chatsToLoad
.
add
(-
lower_id
);
}
}
}
}
}
}
else
{
}
else
{
int
high_id
=
(
int
)(
dialog
.
id
>>
32
);
if
(
high_id
>
0
)
{
if
(!
encryptedToLoad
.
contains
(
high_id
))
{
if
(!
encryptedToLoad
.
contains
(
high_id
))
{
encryptedToLoad
.
add
(
high_id
);
encryptedToLoad
.
add
(
high_id
);
}
}
}
else
{
if
(!
chatsToLoad
.
contains
(
high_id
))
{
chatsToLoad
.
add
(
high_id
);
}
}
}
}
}
}
cursor
.
dispose
();
cursor
.
dispose
();
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
View file @
755446e9
...
@@ -225,22 +225,22 @@ public class DialogCell extends BaseCell {
...
@@ -225,22 +225,22 @@ public class DialogCell extends BaseCell {
encryptedChat
=
null
;
encryptedChat
=
null
;
int
lower_id
=
(
int
)
currentDialog
.
id
;
int
lower_id
=
(
int
)
currentDialog
.
id
;
int
high_id
=
(
int
)(
currentDialog
.
id
>>
32
);
if
(
lower_id
!=
0
)
{
if
(
lower_id
!=
0
)
{
if
(
high_id
==
1
)
{
chat
=
MessagesController
.
getInstance
().
chats
.
get
(
lower_id
);
}
else
{
if
(
lower_id
<
0
)
{
if
(
lower_id
<
0
)
{
chat
=
MessagesController
.
getInstance
().
chats
.
get
(-
lower_id
);
chat
=
MessagesController
.
getInstance
().
chats
.
get
(-
lower_id
);
}
else
{
}
else
{
user
=
MessagesController
.
getInstance
().
users
.
get
(
lower_id
);
user
=
MessagesController
.
getInstance
().
users
.
get
(
lower_id
);
}
}
}
}
else
{
}
else
{
int
high_id
=
(
int
)(
currentDialog
.
id
>>
32
);
if
(
high_id
>
0
)
{
encryptedChat
=
MessagesController
.
getInstance
().
encryptedChats
.
get
(
high_id
);
encryptedChat
=
MessagesController
.
getInstance
().
encryptedChats
.
get
(
high_id
);
if
(
encryptedChat
!=
null
)
{
if
(
encryptedChat
!=
null
)
{
user
=
MessagesController
.
getInstance
().
users
.
get
(
encryptedChat
.
user_id
);
user
=
MessagesController
.
getInstance
().
users
.
get
(
encryptedChat
.
user_id
);
}
}
}
else
{
chat
=
MessagesController
.
getInstance
().
chats
.
get
(
high_id
);
}
}
}
int
placeHolderId
=
0
;
int
placeHolderId
=
0
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
755446e9
...
@@ -129,6 +129,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -129,6 +129,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private
View
pagedownButton
;
private
View
pagedownButton
;
private
TextView
topPanelText
;
private
TextView
topPanelText
;
private
long
dialog_id
;
private
long
dialog_id
;
private
boolean
isBraodcast
=
false
;
private
HashMap
<
Integer
,
MessageObject
>
selectedMessagesIds
=
new
HashMap
<
Integer
,
MessageObject
>();
private
HashMap
<
Integer
,
MessageObject
>
selectedMessagesIds
=
new
HashMap
<
Integer
,
MessageObject
>();
private
HashMap
<
Integer
,
MessageObject
>
selectedMessagesCanCopyIds
=
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
...
@@ -215,7 +216,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if
(
chatId
>
0
)
{
if
(
chatId
>
0
)
{
dialog_id
=
-
chatId
;
dialog_id
=
-
chatId
;
}
else
{
}
else
{
dialog_id
=
((
long
)
chatId
)
<<
32
;
isBraodcast
=
true
;
dialog_id
=
AndroidUtilities
.
makeBroadcastId
(
chatId
);
}
}
}
else
if
(
userId
!=
0
)
{
}
else
if
(
userId
!=
0
)
{
currentUser
=
MessagesController
.
getInstance
().
users
.
get
(
userId
);
currentUser
=
MessagesController
.
getInstance
().
users
.
get
(
userId
);
...
@@ -1051,8 +1053,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -1051,8 +1053,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private
int
getMessageType
(
MessageObject
messageObject
)
{
private
int
getMessageType
(
MessageObject
messageObject
)
{
if
(
currentEncryptedChat
==
null
)
{
if
(
currentEncryptedChat
==
null
)
{
boolean
isBroadcastError
=
(
int
)
dialog_id
==
0
&&
messageObject
.
messageOwner
.
id
<=
0
&&
messageObject
.
messageOwner
.
send_state
==
MessagesController
.
MESSAGE_SEND_STATE_SEND_ERROR
;
boolean
isBroadcastError
=
isBraodcast
&&
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
)
{
if
(
!
isBraodcast
&&
messageObject
.
messageOwner
.
id
<=
0
&&
messageObject
.
isOut
()
||
isBroadcastError
)
{
if
(
messageObject
.
messageOwner
.
send_state
==
MessagesController
.
MESSAGE_SEND_STATE_SEND_ERROR
)
{
if
(
messageObject
.
messageOwner
.
send_state
==
MessagesController
.
MESSAGE_SEND_STATE_SEND_ERROR
)
{
if
(!(
messageObject
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaEmpty
))
{
if
(!(
messageObject
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaEmpty
))
{
return
0
;
return
0
;
...
@@ -1778,7 +1780,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -1778,7 +1780,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if
(
messArr
.
size
()
!=
count
)
{
if
(
messArr
.
size
()
!=
count
)
{
if
(
isCache
)
{
if
(
isCache
)
{
cacheEndReaced
=
true
;
cacheEndReaced
=
true
;
if
(
(
int
)
dialog_id
==
0
)
{
if
(
currentEncryptedChat
!=
null
||
isBraodcast
)
{
endReached
=
true
;
endReached
=
true
;
}
}
}
else
{
}
else
{
...
@@ -2932,7 +2934,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -2932,7 +2934,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
@Override
public
void
didSelectDialog
(
MessagesActivity
activity
,
long
did
,
boolean
param
)
{
public
void
didSelectDialog
(
MessagesActivity
activity
,
long
did
,
boolean
param
)
{
if
(
dialog_id
!=
0
&&
(
forwaringMessage
!=
null
||
!
selectedMessagesIds
.
isEmpty
()))
{
if
(
dialog_id
!=
0
&&
(
forwaringMessage
!=
null
||
!
selectedMessagesIds
.
isEmpty
()))
{
if
(
(
int
)
dialog_id
==
0
&&
currentEncryptedChat
==
null
)
{
if
(
isBraodcast
)
{
param
=
true
;
param
=
true
;
}
}
if
(
did
!=
dialog_id
)
{
if
(
did
!=
dialog_id
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java
View file @
755446e9
...
@@ -447,23 +447,23 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
...
@@ -447,23 +447,23 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
public
void
didSelectDialog
(
MessagesActivity
messageFragment
,
long
dialog_id
,
boolean
param
)
{
public
void
didSelectDialog
(
MessagesActivity
messageFragment
,
long
dialog_id
,
boolean
param
)
{
if
(
dialog_id
!=
0
)
{
if
(
dialog_id
!=
0
)
{
int
lower_part
=
(
int
)
dialog_id
;
int
lower_part
=
(
int
)
dialog_id
;
int
high_id
=
(
int
)(
dialog_id
>>
32
);
Bundle
args
=
new
Bundle
();
Bundle
args
=
new
Bundle
();
args
.
putBoolean
(
"scrollToTopOnResume"
,
true
);
args
.
putBoolean
(
"scrollToTopOnResume"
,
true
);
NotificationCenter
.
getInstance
().
postNotificationName
(
MessagesController
.
closeChats
);
NotificationCenter
.
getInstance
().
postNotificationName
(
MessagesController
.
closeChats
);
if
(
lower_part
!=
0
)
{
if
(
lower_part
!=
0
)
{
if
(
high_id
==
1
)
{
args
.
putInt
(
"chat_id"
,
lower_part
);
}
else
{
if
(
lower_part
>
0
)
{
if
(
lower_part
>
0
)
{
args
.
putInt
(
"user_id"
,
lower_part
);
args
.
putInt
(
"user_id"
,
lower_part
);
}
else
if
(
lower_part
<
0
)
{
}
else
if
(
lower_part
<
0
)
{
args
.
putInt
(
"chat_id"
,
-
lower_part
);
args
.
putInt
(
"chat_id"
,
-
lower_part
);
}
}
}
}
else
{
}
else
{
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
high_id
>
0
)
{
args
.
putInt
(
"enc_id"
,
high_id
);
args
.
putInt
(
"enc_id"
,
high_id
);
}
else
{
args
.
putInt
(
"chat_id"
,
high_id
);
}
}
}
ChatActivity
fragment
=
new
ChatActivity
(
args
);
ChatActivity
fragment
=
new
ChatActivity
(
args
);
presentFragment
(
fragment
,
true
);
presentFragment
(
fragment
,
true
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java
View file @
755446e9
...
@@ -288,19 +288,19 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
...
@@ -288,19 +288,19 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
}
else
{
}
else
{
Bundle
args
=
new
Bundle
();
Bundle
args
=
new
Bundle
();
int
lower_part
=
(
int
)
dialog_id
;
int
lower_part
=
(
int
)
dialog_id
;
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
lower_part
!=
0
)
{
if
(
lower_part
!=
0
)
{
if
(
high_id
==
1
)
{
args
.
putInt
(
"chat_id"
,
lower_part
);
}
else
{
if
(
lower_part
>
0
)
{
if
(
lower_part
>
0
)
{
args
.
putInt
(
"user_id"
,
lower_part
);
args
.
putInt
(
"user_id"
,
lower_part
);
}
else
if
(
lower_part
<
0
)
{
}
else
if
(
lower_part
<
0
)
{
args
.
putInt
(
"chat_id"
,
-
lower_part
);
args
.
putInt
(
"chat_id"
,
-
lower_part
);
}
}
}
}
else
{
}
else
{
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
high_id
>
0
)
{
args
.
putInt
(
"enc_id"
,
high_id
);
args
.
putInt
(
"enc_id"
,
high_id
);
}
else
{
args
.
putInt
(
"chat_id"
,
high_id
);
}
}
}
presentFragment
(
new
ChatActivity
(
args
));
presentFragment
(
new
ChatActivity
(
args
));
}
}
...
@@ -493,7 +493,15 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
...
@@ -493,7 +493,15 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getParentActivity
());
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getParentActivity
());
builder
.
setTitle
(
LocaleController
.
getString
(
"AppName"
,
R
.
string
.
AppName
));
builder
.
setTitle
(
LocaleController
.
getString
(
"AppName"
,
R
.
string
.
AppName
));
int
lower_part
=
(
int
)
dialog_id
;
int
lower_part
=
(
int
)
dialog_id
;
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
lower_part
!=
0
)
{
if
(
lower_part
!=
0
)
{
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
)
{
if
(
lower_part
>
0
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
users
.
get
(
lower_part
);
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
users
.
get
(
lower_part
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
...
@@ -507,22 +515,14 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
...
@@ -507,22 +515,14 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
}
}
builder
.
setMessage
(
LocaleController
.
formatStringSimple
(
selectAlertString
,
chat
.
title
));
builder
.
setMessage
(
LocaleController
.
formatStringSimple
(
selectAlertString
,
chat
.
title
));
}
}
}
}
else
{
}
else
{
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
high_id
>
0
)
{
TLRPC
.
EncryptedChat
chat
=
MessagesController
.
getInstance
().
encryptedChats
.
get
(
high_id
);
TLRPC
.
EncryptedChat
chat
=
MessagesController
.
getInstance
().
encryptedChats
.
get
(
high_id
);
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
users
.
get
(
chat
.
user_id
);
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
users
.
get
(
chat
.
user_id
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
;
return
;
}
}
builder
.
setMessage
(
LocaleController
.
formatStringSimple
(
selectAlertString
,
Utilities
.
formatName
(
user
.
first_name
,
user
.
last_name
)));
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
));
}
}
}
CheckBox
checkBox
=
null
;
CheckBox
checkBox
=
null
;
/*if (delegate instanceof ChatActivity) {
/*if (delegate instanceof ChatActivity) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment