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
Expand all
Hide 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 {
defaultConfig
{
minSdkVersion
8
targetSdkVersion
19
versionCode
29
2
versionCode
29
3
versionName
"1.7.0"
}
}
TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java
View file @
755446e9
...
...
@@ -221,4 +221,8 @@ public class AndroidUtilities {
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
This diff is collapsed.
Click to expand it.
TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java
View file @
755446e9
...
...
@@ -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
(!
user
sToLoad
.
contains
(
lower_id
))
{
user
sToLoad
.
add
(
lower_id
);
if
(
high_id
==
1
)
{
if
(!
chat
sToLoad
.
contains
(
lower_id
))
{
chat
sToLoad
.
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
(!
user
sToLoad
.
contains
(
lower_id
))
{
user
sToLoad
.
add
(
lower_id
);
if
(
high_id
==
1
)
{
if
(!
chat
sToLoad
.
contains
(
lower_id
))
{
chat
sToLoad
.
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
);
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
View file @
755446e9
...
...
@@ -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
);
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
755446e9
...
...
@@ -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
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java
View file @
755446e9
...
...
@@ -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
);
}
}
else
{
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
high_id
>
0
)
{
args
.
putInt
(
"enc_id"
,
high_id
);
if
(
high_id
==
1
)
{
args
.
putInt
(
"chat_id"
,
lower_part
);
}
else
{
args
.
putInt
(
"chat_id"
,
high_id
);
if
(
lower_part
>
0
)
{
args
.
putInt
(
"user_id"
,
lower_part
);
}
else
if
(
lower_part
<
0
)
{
args
.
putInt
(
"chat_id"
,
-
lower_part
);
}
}
}
else
{
args
.
putInt
(
"enc_id"
,
high_id
);
}
ChatActivity
fragment
=
new
ChatActivity
(
args
);
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
}
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
);
}
}
else
{
int
high_id
=
(
int
)(
dialog_id
>>
32
);
if
(
high_id
>
0
)
{
args
.
putInt
(
"enc_id"
,
high_id
);
if
(
high_id
==
1
)
{
args
.
putInt
(
"chat_id"
,
lower_part
);
}
else
{
args
.
putInt
(
"chat_id"
,
high_id
);
if
(
lower_part
>
0
)
{
args
.
putInt
(
"user_id"
,
lower_part
);
}
else
if
(
lower_part
<
0
)
{
args
.
putInt
(
"chat_id"
,
-
lower_part
);
}
}
}
else
{
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
{
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
;
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
));
}
builder
.
setMessage
(
LocaleController
.
formatStringSimple
(
selectAlertString
,
chat
.
title
));
}
}
else
{
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) {
...
...
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