Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
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
tg
Commits
5064b17d
Commit
5064b17d
authored
Aug 22, 2014
by
vvaltman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated unread notification
parent
4ee5af1e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
137 additions
and
32 deletions
+137
-32
binlog.c
binlog.c
+29
-12
binlog.h
binlog.h
+6
-6
binlog.tl
binlog.tl
+6
-6
interface.c
interface.c
+89
-2
loop.c
loop.c
+1
-0
structures.c
structures.c
+6
-6
No files found.
binlog.c
View file @
5064b17d
...
@@ -702,6 +702,7 @@ static int fetch_comb_binlog_create_message_text (void *extra) {
...
@@ -702,6 +702,7 @@ static int fetch_comb_binlog_create_message_text (void *extra) {
M
->
to_id
=
tgl_set_peer_id
(
t
,
fetch_int
());
M
->
to_id
=
tgl_set_peer_id
(
t
,
fetch_int
());
M
->
date
=
fetch_int
();
M
->
date
=
fetch_int
();
M
->
unread
=
fetch_int
();
int
l
=
prefetch_strlen
();
int
l
=
prefetch_strlen
();
M
->
message
=
talloc
(
l
+
1
);
M
->
message
=
talloc
(
l
+
1
);
...
@@ -715,7 +716,7 @@ static int fetch_comb_binlog_create_message_text (void *extra) {
...
@@ -715,7 +716,7 @@ static int fetch_comb_binlog_create_message_text (void *extra) {
M
->
media
.
type
=
tgl_message_media_none
;
M
->
media
.
type
=
tgl_message_media_none
;
}
}
M
->
unread
=
1
;
//
M->unread = 1;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
tglm_message_insert
(
M
);
tglm_message_insert
(
M
);
...
@@ -816,6 +817,8 @@ static int fetch_comb_binlog_create_message_text_fwd (void *extra) {
...
@@ -816,6 +817,8 @@ static int fetch_comb_binlog_create_message_text_fwd (void *extra) {
M
->
fwd_from_id
=
TGL_MK_USER
(
fetch_int
());
M
->
fwd_from_id
=
TGL_MK_USER
(
fetch_int
());
M
->
fwd_date
=
fetch_int
();
M
->
fwd_date
=
fetch_int
();
M
->
unread
=
fetch_int
();
int
l
=
prefetch_strlen
();
int
l
=
prefetch_strlen
();
M
->
message
=
talloc
(
l
+
1
);
M
->
message
=
talloc
(
l
+
1
);
memcpy
(
M
->
message
,
fetch_str
(
l
),
l
);
memcpy
(
M
->
message
,
fetch_str
(
l
),
l
);
...
@@ -828,7 +831,7 @@ static int fetch_comb_binlog_create_message_text_fwd (void *extra) {
...
@@ -828,7 +831,7 @@ static int fetch_comb_binlog_create_message_text_fwd (void *extra) {
M
->
media
.
type
=
tgl_message_media_none
;
M
->
media
.
type
=
tgl_message_media_none
;
}
}
M
->
unread
=
1
;
//
M->unread = 1;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
tglm_message_insert
(
M
);
tglm_message_insert
(
M
);
...
@@ -850,6 +853,8 @@ static int fetch_comb_binlog_create_message_media (void *extra) {
...
@@ -850,6 +853,8 @@ static int fetch_comb_binlog_create_message_media (void *extra) {
M
->
to_id
=
tgl_set_peer_id
(
t
,
fetch_int
());
M
->
to_id
=
tgl_set_peer_id
(
t
,
fetch_int
());
M
->
date
=
fetch_int
();
M
->
date
=
fetch_int
();
M
->
unread
=
fetch_int
();
int
l
=
prefetch_strlen
();
int
l
=
prefetch_strlen
();
M
->
message
=
talloc
(
l
+
1
);
M
->
message
=
talloc
(
l
+
1
);
memcpy
(
M
->
message
,
fetch_str
(
l
),
l
);
memcpy
(
M
->
message
,
fetch_str
(
l
),
l
);
...
@@ -857,7 +862,7 @@ static int fetch_comb_binlog_create_message_media (void *extra) {
...
@@ -857,7 +862,7 @@ static int fetch_comb_binlog_create_message_media (void *extra) {
M
->
message_len
=
l
;
M
->
message_len
=
l
;
tglf_fetch_message_media
(
&
M
->
media
);
tglf_fetch_message_media
(
&
M
->
media
);
M
->
unread
=
1
;
//
M->unread = 1;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
tglm_message_insert
(
M
);
tglm_message_insert
(
M
);
...
@@ -910,6 +915,8 @@ static int fetch_comb_binlog_create_message_media_fwd (void *extra) {
...
@@ -910,6 +915,8 @@ static int fetch_comb_binlog_create_message_media_fwd (void *extra) {
M
->
fwd_from_id
=
TGL_MK_USER
(
fetch_int
());
M
->
fwd_from_id
=
TGL_MK_USER
(
fetch_int
());
M
->
fwd_date
=
fetch_int
();
M
->
fwd_date
=
fetch_int
();
M
->
unread
=
fetch_int
();
int
l
=
prefetch_strlen
();
int
l
=
prefetch_strlen
();
M
->
message
=
talloc
(
l
+
1
);
M
->
message
=
talloc
(
l
+
1
);
memcpy
(
M
->
message
,
fetch_str
(
l
),
l
);
memcpy
(
M
->
message
,
fetch_str
(
l
),
l
);
...
@@ -917,7 +924,7 @@ static int fetch_comb_binlog_create_message_media_fwd (void *extra) {
...
@@ -917,7 +924,7 @@ static int fetch_comb_binlog_create_message_media_fwd (void *extra) {
M
->
message_len
=
l
;
M
->
message_len
=
l
;
tglf_fetch_message_media
(
&
M
->
media
);
tglf_fetch_message_media
(
&
M
->
media
);
M
->
unread
=
1
;
//
M->unread = 1;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
tglm_message_insert
(
M
);
tglm_message_insert
(
M
);
...
@@ -938,8 +945,10 @@ static int fetch_comb_binlog_create_message_service (void *extra) {
...
@@ -938,8 +945,10 @@ static int fetch_comb_binlog_create_message_service (void *extra) {
M
->
to_id
=
tgl_set_peer_id
(
t
,
fetch_int
());
M
->
to_id
=
tgl_set_peer_id
(
t
,
fetch_int
());
M
->
date
=
fetch_int
();
M
->
date
=
fetch_int
();
M
->
unread
=
fetch_int
();
tglf_fetch_message_action
(
&
M
->
action
);
tglf_fetch_message_action
(
&
M
->
action
);
M
->
unread
=
1
;
//
M->unread = 1;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
M
->
service
=
1
;
M
->
service
=
1
;
...
@@ -995,8 +1004,10 @@ static int fetch_comb_binlog_create_message_service_fwd (void *extra) {
...
@@ -995,8 +1004,10 @@ static int fetch_comb_binlog_create_message_service_fwd (void *extra) {
M
->
fwd_from_id
=
TGL_MK_USER
(
fetch_int
());
M
->
fwd_from_id
=
TGL_MK_USER
(
fetch_int
());
M
->
fwd_date
=
fetch_int
();
M
->
fwd_date
=
fetch_int
();
M
->
unread
=
fetch_int
();
tglf_fetch_message_action
(
&
M
->
action
);
tglf_fetch_message_action
(
&
M
->
action
);
M
->
unread
=
1
;
//
M->unread = 1;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
M
->
out
=
tgl_get_peer_id
(
M
->
from_id
)
==
tgl_state
.
our_id
;
M
->
service
=
1
;
M
->
service
=
1
;
...
@@ -1735,7 +1746,7 @@ void bl_do_chat_del_user (struct tgl_chat *C, int version, int user) {
...
@@ -1735,7 +1746,7 @@ void bl_do_chat_del_user (struct tgl_chat *C, int version, int user) {
add_log_event
(
ev
,
16
);
add_log_event
(
ev
,
16
);
}
}
void
bl_do_create_message_text
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
l
,
const
char
*
s
)
{
void
bl_do_create_message_text
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
unread
,
int
l
,
const
char
*
s
)
{
clear_packet
();
clear_packet
();
out_int
(
CODE_binlog_create_message_text
);
out_int
(
CODE_binlog_create_message_text
);
out_int
(
msg_id
);
out_int
(
msg_id
);
...
@@ -1743,6 +1754,7 @@ void bl_do_create_message_text (int msg_id, int from_id, int to_type, int to_id,
...
@@ -1743,6 +1754,7 @@ void bl_do_create_message_text (int msg_id, int from_id, int to_type, int to_id,
out_int
(
to_type
);
out_int
(
to_type
);
out_int
(
to_id
);
out_int
(
to_id
);
out_int
(
date
);
out_int
(
date
);
out_int
(
unread
);
out_cstring
(
s
,
l
);
out_cstring
(
s
,
l
);
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
}
}
...
@@ -1771,7 +1783,7 @@ void bl_do_send_message_action_encr (long long msg_id, int from_id, int to_type,
...
@@ -1771,7 +1783,7 @@ void bl_do_send_message_action_encr (long long msg_id, int from_id, int to_type,
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
}
}
void
bl_do_create_message_text_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
int
l
,
const
char
*
s
)
{
void
bl_do_create_message_text_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
int
unread
,
int
l
,
const
char
*
s
)
{
clear_packet
();
clear_packet
();
out_int
(
CODE_binlog_create_message_text_fwd
);
out_int
(
CODE_binlog_create_message_text_fwd
);
out_int
(
msg_id
);
out_int
(
msg_id
);
...
@@ -1781,11 +1793,12 @@ void bl_do_create_message_text_fwd (int msg_id, int from_id, int to_type, int to
...
@@ -1781,11 +1793,12 @@ void bl_do_create_message_text_fwd (int msg_id, int from_id, int to_type, int to
out_int
(
date
);
out_int
(
date
);
out_int
(
fwd
);
out_int
(
fwd
);
out_int
(
fwd_date
);
out_int
(
fwd_date
);
out_int
(
unread
);
out_cstring
(
s
,
l
);
out_cstring
(
s
,
l
);
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
}
}
void
bl_do_create_message_media
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
l
,
const
char
*
s
,
const
int
*
data
,
int
len
)
{
void
bl_do_create_message_media
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
unread
,
int
l
,
const
char
*
s
,
const
int
*
data
,
int
len
)
{
clear_packet
();
clear_packet
();
out_int
(
CODE_binlog_create_message_media
);
out_int
(
CODE_binlog_create_message_media
);
out_int
(
msg_id
);
out_int
(
msg_id
);
...
@@ -1793,6 +1806,7 @@ void bl_do_create_message_media (int msg_id, int from_id, int to_type, int to_id
...
@@ -1793,6 +1806,7 @@ void bl_do_create_message_media (int msg_id, int from_id, int to_type, int to_id
out_int
(
to_type
);
out_int
(
to_type
);
out_int
(
to_id
);
out_int
(
to_id
);
out_int
(
date
);
out_int
(
date
);
out_int
(
unread
);
out_cstring
(
s
,
l
);
out_cstring
(
s
,
l
);
out_ints
(
data
,
len
);
out_ints
(
data
,
len
);
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
...
@@ -1812,7 +1826,7 @@ void bl_do_create_message_media_encr (long long msg_id, int from_id, int to_type
...
@@ -1812,7 +1826,7 @@ void bl_do_create_message_media_encr (long long msg_id, int from_id, int to_type
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
}
}
void
bl_do_create_message_media_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
int
l
,
const
char
*
s
,
const
int
*
data
,
int
len
)
{
void
bl_do_create_message_media_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
int
unread
,
int
l
,
const
char
*
s
,
const
int
*
data
,
int
len
)
{
clear_packet
();
clear_packet
();
out_int
(
CODE_binlog_create_message_media_fwd
);
out_int
(
CODE_binlog_create_message_media_fwd
);
out_int
(
msg_id
);
out_int
(
msg_id
);
...
@@ -1822,12 +1836,13 @@ void bl_do_create_message_media_fwd (int msg_id, int from_id, int to_type, int t
...
@@ -1822,12 +1836,13 @@ void bl_do_create_message_media_fwd (int msg_id, int from_id, int to_type, int t
out_int
(
date
);
out_int
(
date
);
out_int
(
fwd
);
out_int
(
fwd
);
out_int
(
fwd_date
);
out_int
(
fwd_date
);
out_int
(
unread
);
out_cstring
(
s
,
l
);
out_cstring
(
s
,
l
);
out_ints
(
data
,
len
);
out_ints
(
data
,
len
);
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
}
}
void
bl_do_create_message_service
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
const
int
*
data
,
int
len
)
{
void
bl_do_create_message_service
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
unread
,
const
int
*
data
,
int
len
)
{
clear_packet
();
clear_packet
();
out_int
(
CODE_binlog_create_message_service
);
out_int
(
CODE_binlog_create_message_service
);
out_int
(
msg_id
);
out_int
(
msg_id
);
...
@@ -1835,6 +1850,7 @@ void bl_do_create_message_service (int msg_id, int from_id, int to_type, int to_
...
@@ -1835,6 +1850,7 @@ void bl_do_create_message_service (int msg_id, int from_id, int to_type, int to_
out_int
(
to_type
);
out_int
(
to_type
);
out_int
(
to_id
);
out_int
(
to_id
);
out_int
(
date
);
out_int
(
date
);
out_int
(
unread
);
out_ints
(
data
,
len
);
out_ints
(
data
,
len
);
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
}
}
...
@@ -1851,7 +1867,7 @@ void bl_do_create_message_service_encr (long long msg_id, int from_id, int to_ty
...
@@ -1851,7 +1867,7 @@ void bl_do_create_message_service_encr (long long msg_id, int from_id, int to_ty
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
}
}
void
bl_do_create_message_service_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
const
int
*
data
,
int
len
)
{
void
bl_do_create_message_service_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
int
unread
,
const
int
*
data
,
int
len
)
{
clear_packet
();
clear_packet
();
out_int
(
CODE_binlog_create_message_service_fwd
);
out_int
(
CODE_binlog_create_message_service_fwd
);
out_int
(
msg_id
);
out_int
(
msg_id
);
...
@@ -1861,6 +1877,7 @@ void bl_do_create_message_service_fwd (int msg_id, int from_id, int to_type, int
...
@@ -1861,6 +1877,7 @@ void bl_do_create_message_service_fwd (int msg_id, int from_id, int to_type, int
out_int
(
date
);
out_int
(
date
);
out_int
(
fwd
);
out_int
(
fwd
);
out_int
(
fwd_date
);
out_int
(
fwd_date
);
out_int
(
unread
);
out_ints
(
data
,
len
);
out_ints
(
data
,
len
);
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
add_log_event
(
packet_buffer
,
4
*
(
packet_ptr
-
packet_buffer
));
}
}
...
...
binlog.h
View file @
5064b17d
...
@@ -69,12 +69,12 @@ void bl_do_chat_set_full_photo (struct tgl_chat *U, const int *start, int len);
...
@@ -69,12 +69,12 @@ void bl_do_chat_set_full_photo (struct tgl_chat *U, const int *start, int len);
void
bl_do_chat_add_user
(
struct
tgl_chat
*
C
,
int
version
,
int
user
,
int
inviter
,
int
date
);
void
bl_do_chat_add_user
(
struct
tgl_chat
*
C
,
int
version
,
int
user
,
int
inviter
,
int
date
);
void
bl_do_chat_del_user
(
struct
tgl_chat
*
C
,
int
version
,
int
user
);
void
bl_do_chat_del_user
(
struct
tgl_chat
*
C
,
int
version
,
int
user
);
void
bl_do_create_message_text
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
l
,
const
char
*
s
);
void
bl_do_create_message_text
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
unread
,
int
l
,
const
char
*
s
);
void
bl_do_create_message_text_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
int
l
,
const
char
*
s
);
void
bl_do_create_message_text_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
int
unread
,
int
l
,
const
char
*
s
);
void
bl_do_create_message_service
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
const
int
*
data
,
int
len
);
void
bl_do_create_message_service
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
unread
,
const
int
*
data
,
int
len
);
void
bl_do_create_message_service_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
const
int
*
data
,
int
len
);
void
bl_do_create_message_service_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
int
unread
,
const
int
*
data
,
int
len
);
void
bl_do_create_message_media
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
l
,
const
char
*
s
,
const
int
*
data
,
int
len
);
void
bl_do_create_message_media
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
unread
,
int
l
,
const
char
*
s
,
const
int
*
data
,
int
len
);
void
bl_do_create_message_media_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
int
l
,
const
char
*
s
,
const
int
*
data
,
int
len
);
void
bl_do_create_message_media_fwd
(
int
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
fwd
,
int
fwd_date
,
int
unread
,
int
l
,
const
char
*
s
,
const
int
*
data
,
int
len
);
void
bl_do_create_message_media_encr
(
long
long
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
l
,
const
char
*
s
,
const
int
*
data
,
int
len
,
const
int
*
data2
,
int
len2
);
void
bl_do_create_message_media_encr
(
long
long
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
l
,
const
char
*
s
,
const
int
*
data
,
int
len
,
const
int
*
data2
,
int
len2
);
void
bl_do_create_message_service_encr
(
long
long
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
const
int
*
data
,
int
len
);
void
bl_do_create_message_service_encr
(
long
long
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
const
int
*
data
,
int
len
);
void
bl_do_send_message_text
(
long
long
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
l
,
const
char
*
s
);
void
bl_do_send_message_text
(
long
long
msg_id
,
int
from_id
,
int
to_type
,
int
to_id
,
int
date
,
int
l
,
const
char
*
s
);
...
...
binlog.tl
View file @
5064b17d
...
@@ -50,16 +50,16 @@ binlog.chatSetFullPhoto id:int photo:Photo = binlog.Update;
...
@@ -50,16 +50,16 @@ binlog.chatSetFullPhoto id:int photo:Photo = binlog.Update;
binlog.chatAddParticipant id:int version:int user:%binlog.ChatParticipant = binlog.Update;
binlog.chatAddParticipant id:int version:int user:%binlog.ChatParticipant = binlog.Update;
binlog.chatDelParticipant id:int version:int user:int = binlog.Update;
binlog.chatDelParticipant id:int version:int user:int = binlog.Update;
binlog.createMessageText id:int from_id:int to_type:int to_id:int date:int text:string = binlog.Update;
binlog.createMessageText id:int from_id:int to_type:int to_id:int date:int
unread:int
text:string = binlog.Update;
binlog.sendMessageText id:long from_id:int to_type:int to_id:int date:int text:string = binlog.Update;
binlog.sendMessageText id:long from_id:int to_type:int to_id:int date:int text:string = binlog.Update;
binlog.sendMessageActionEncr id:long from_id:int to_type:int to_id:int date:int action:DecryptedMessageAction = binlog.Update;
binlog.sendMessageActionEncr id:long from_id:int to_type:int to_id:int date:int action:DecryptedMessageAction = binlog.Update;
binlog.createMessageTextFwd id:int from_id:int to_type:int to_id:int date:int fwd_from_id:int fwd_date:int text:string = binlog.Update;
binlog.createMessageTextFwd id:int from_id:int to_type:int to_id:int date:int fwd_from_id:int fwd_date:int
unread:int
text:string = binlog.Update;
binlog.createMessageMedia id:int from_id:int to_type:int to_id:int date:int text:string media:MessageMedia = binlog.Update;
binlog.createMessageMedia id:int from_id:int to_type:int to_id:int date:int
unread:int
text:string media:MessageMedia = binlog.Update;
binlog.createMessageMediaEncr id:long from_id:int to_type:int to_id:int date:int text:string media:DecryptedMessageMedia file:EncryptedFile = binlog.Update;
binlog.createMessageMediaEncr id:long from_id:int to_type:int to_id:int date:int text:string media:DecryptedMessageMedia file:EncryptedFile = binlog.Update;
binlog.createMessageMediaFwd id:int from_id:int to_type:int to_id:int date:int fwd_from_id:int fwd_date:int text:string media:MessageMedia = binlog.Update;
binlog.createMessageMediaFwd id:int from_id:int to_type:int to_id:int date:int fwd_from_id:int fwd_date:int
unread:int
text:string media:MessageMedia = binlog.Update;
binlog.createMessageService id:int from_id:int to_type:int to_id:int date:int action:MessageAction = binlog.Update;
binlog.createMessageService id:int from_id:int to_type:int to_id:int date:int
unread:int
action:MessageAction = binlog.Update;
binlog.createMessageServiceEncr id:long from_id:int to_type:int to_id:int date:int action:DecryptedMessageAction = binlog.Update;
binlog.createMessageServiceEncr id:long from_id:int to_type:int to_id:int date:int action:DecryptedMessageAction = binlog.Update;
binlog.createMessageServiceFwd id:int from_id:int to_type:int to_id:int date:int fwd_from_id:int fwd_date:int action:MessageAction = binlog.Update;
binlog.createMessageServiceFwd id:int from_id:int to_type:int to_id:int date:int fwd_from_id:int fwd_date:int
unread:int
action:MessageAction = binlog.Update;
binlog.messageSetUnread id:int = binlog.Update;
binlog.messageSetUnread id:int = binlog.Update;
binlog.messageSetUnreadLong id:long = binlog.Update;
binlog.messageSetUnreadLong id:long = binlog.Update;
binlog.setMessageSent id:long = binlog.Update;
binlog.setMessageSent id:long = binlog.Update;
...
...
interface.c
View file @
5064b17d
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include "interface.h"
#include "interface.h"
#include "telegram.h"
#include "telegram.h"
#include <event2/event.h>
//#include "auto/constants.h"
//#include "auto/constants.h"
//#include "tools.h"
//#include "tools.h"
//#include "structures.h"
//#include "structures.h"
...
@@ -260,6 +261,7 @@ char *get_default_prompt (void) {
...
@@ -260,6 +261,7 @@ char *get_default_prompt (void) {
l
+=
snprintf
(
buf
+
l
,
999
-
l
,
"%lld%%Down"
,
100
*
tgl_state
.
cur_downloaded_bytes
/
tgl_state
.
cur_downloading_bytes
);
l
+=
snprintf
(
buf
+
l
,
999
-
l
,
"%lld%%Down"
,
100
*
tgl_state
.
cur_downloaded_bytes
/
tgl_state
.
cur_downloading_bytes
);
}
}
l
+=
snprintf
(
buf
+
l
,
999
-
l
,
"]"
COLOR_NORMAL
);
l
+=
snprintf
(
buf
+
l
,
999
-
l
,
"]"
COLOR_NORMAL
);
l
+=
snprintf
(
buf
+
l
,
999
-
l
,
"%s"
,
default_prompt
);
return
buf
;
return
buf
;
}
}
l
+=
snprintf
(
buf
+
l
,
999
-
l
,
"%s"
,
default_prompt
);
l
+=
snprintf
(
buf
+
l
,
999
-
l
,
"%s"
,
default_prompt
);
...
@@ -689,11 +691,96 @@ void interpreter_chat_mode (char *line) {
...
@@ -689,11 +691,96 @@ void interpreter_chat_mode (char *line) {
}
}
}
}
#define MAX_UNREAD_MESSAGE_COUNT 10000
struct
tgl_message
*
unread_message_list
[
MAX_UNREAD_MESSAGE_COUNT
];
int
unread_message_count
;
struct
event
*
unread_message_event
;
void
print_read_list
(
int
num
,
struct
tgl_message
*
list
[])
{
int
i
;
print_start
();
for
(
i
=
0
;
i
<
num
;
i
++
)
if
(
list
[
i
])
{
tgl_peer_id_t
to_id
;
if
(
tgl_get_peer_type
(
list
[
i
]
->
to_id
)
==
TGL_PEER_USER
&&
tgl_get_peer_id
(
list
[
i
]
->
to_id
)
==
tgl_state
.
our_id
)
{
to_id
=
list
[
i
]
->
from_id
;
}
else
{
to_id
=
list
[
i
]
->
to_id
;
}
int
j
;
int
c1
=
0
;
int
c2
=
0
;
for
(
j
=
i
;
j
<
num
;
j
++
)
if
(
list
[
j
])
{
tgl_peer_id_t
end_id
;
if
(
tgl_get_peer_type
(
list
[
j
]
->
to_id
)
==
TGL_PEER_USER
&&
tgl_get_peer_id
(
list
[
j
]
->
to_id
)
==
tgl_state
.
our_id
)
{
end_id
=
list
[
j
]
->
from_id
;
}
else
{
end_id
=
list
[
j
]
->
to_id
;
}
if
(
!
tgl_cmp_peer_id
(
to_id
,
end_id
))
{
if
(
list
[
j
]
->
out
)
{
c1
++
;
}
else
{
c2
++
;
}
list
[
j
]
=
0
;
}
}
assert
(
c1
+
c2
>
0
);
push_color
(
COLOR_YELLOW
);
switch
(
tgl_get_peer_type
(
to_id
))
{
case
TGL_PEER_USER
:
printf
(
"User "
);
print_user_name
(
to_id
,
tgl_peer_get
(
to_id
));
break
;
case
TGL_PEER_CHAT
:
printf
(
"Chat "
);
print_chat_name
(
to_id
,
tgl_peer_get
(
to_id
));
break
;
case
TGL_PEER_ENCR_CHAT
:
printf
(
"Secret chat "
);
print_chat_name
(
to_id
,
tgl_peer_get
(
to_id
));
break
;
default:
assert
(
0
);
}
printf
(
" marked read %d outbox and %d inbox messages
\n
"
,
c1
,
c2
);
pop_color
();
}
print_end
();
}
void
unread_message_alarm
(
evutil_socket_t
fd
,
short
what
,
void
*
arg
)
{
print_read_list
(
unread_message_count
,
unread_message_list
);
unread_message_count
=
0
;
event_free
(
unread_message_event
);
unread_message_event
=
0
;
}
void
mark_read_upd
(
int
num
,
struct
tgl_message
*
list
[])
{
void
mark_read_upd
(
int
num
,
struct
tgl_message
*
list
[])
{
if
(
!
binlog_read
)
{
return
;
}
if
(
!
binlog_read
)
{
return
;
}
if
(
log_level
<
1
)
{
return
;
}
if
(
log_level
<
1
)
{
return
;
}
tgl_peer_id_t
to_id
=
list
[
0
]
->
from_id
;
if
(
unread_message_count
+
num
<=
MAX_UNREAD_MESSAGE_COUNT
)
{
memcpy
(
unread_message_list
+
unread_message_count
,
list
,
num
*
sizeof
(
void
*
));
unread_message_count
+=
num
;
if
(
!
unread_message_event
)
{
unread_message_event
=
evtimer_new
(
tgl_state
.
ev_base
,
unread_message_alarm
,
0
);
static
struct
timeval
ptimeout
=
{
1
,
0
};
event_add
(
unread_message_event
,
&
ptimeout
);
}
}
else
{
print_read_list
(
unread_message_count
,
unread_message_list
);
print_read_list
(
num
,
list
);
unread_message_count
=
0
;
if
(
unread_message_event
)
{
event_free
(
unread_message_event
);
unread_message_event
=
0
;
}
}
/*
tgl_peer_id_t to_id = list[0]->to_id;
int ok = 1;
int ok = 1;
int i;
int i;
for (i = 1; i < num; i++) {
for (i = 1; i < num; i++) {
...
@@ -724,7 +811,7 @@ void mark_read_upd (int num, struct tgl_message *list[]) {
...
@@ -724,7 +811,7 @@ void mark_read_upd (int num, struct tgl_message *list[]) {
printf ("\n");
printf ("\n");
}
}
pop_color ();
pop_color ();
print_end
();
print_end ();
*/
}
}
void
type_notification_upd
(
struct
tgl_user
*
U
)
{
void
type_notification_upd
(
struct
tgl_user
*
U
)
{
...
...
loop.c
View file @
5064b17d
...
@@ -101,6 +101,7 @@ void net_loop (int flags, int (*is_end)(void)) {
...
@@ -101,6 +101,7 @@ void net_loop (int flags, int (*is_end)(void)) {
exit
(
0
);
exit
(
0
);
}
}
write_state_file
();
write_state_file
();
update_prompt
();
if
(
unknown_user_list_pos
)
{
if
(
unknown_user_list_pos
)
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
unknown_user_list_pos
;
i
++
)
{
for
(
i
=
0
;
i
<
unknown_user_list_pos
;
i
++
)
{
...
...
structures.c
View file @
5064b17d
...
@@ -645,7 +645,7 @@ void tglf_fetch_message_short (struct tgl_message *M) {
...
@@ -645,7 +645,7 @@ void tglf_fetch_message_short (struct tgl_message *M) {
//tglu_fetch_seq ();
//tglu_fetch_seq ();
fetch_int
();
fetch_int
();
bl_do_create_message_text
(
id
,
from_id
,
TGL_PEER_USER
,
to_id
,
date
,
l
,
s
);
bl_do_create_message_text
(
id
,
from_id
,
TGL_PEER_USER
,
to_id
,
date
,
0
,
l
,
s
);
}
else
{
}
else
{
fetch_int
();
// id
fetch_int
();
// id
fetch_int
();
// from_id
fetch_int
();
// from_id
...
@@ -675,7 +675,7 @@ void tglf_fetch_message_short_chat (struct tgl_message *M) {
...
@@ -675,7 +675,7 @@ void tglf_fetch_message_short_chat (struct tgl_message *M) {
//tglu_fetch_seq ();
//tglu_fetch_seq ();
fetch_int
();
fetch_int
();
bl_do_create_message_text
(
id
,
from_id
,
TGL_PEER_CHAT
,
to_id
,
date
,
l
,
s
);
bl_do_create_message_text
(
id
,
from_id
,
TGL_PEER_CHAT
,
to_id
,
date
,
0
,
l
,
s
);
}
else
{
}
else
{
fetch_int
();
// id
fetch_int
();
// id
fetch_int
();
// from_id
fetch_int
();
// from_id
...
@@ -998,9 +998,9 @@ void tglf_fetch_message (struct tgl_message *M) {
...
@@ -998,9 +998,9 @@ void tglf_fetch_message (struct tgl_message *M) {
if
(
new
)
{
if
(
new
)
{
if
(
fwd_from_id
)
{
if
(
fwd_from_id
)
{
bl_do_create_message_service_fwd
(
id
,
from_id
,
tgl_get_peer_type
(
to_id
),
tgl_get_peer_id
(
to_id
),
date
,
fwd_from_id
,
fwd_date
,
start
,
(
in_ptr
-
start
));
bl_do_create_message_service_fwd
(
id
,
from_id
,
tgl_get_peer_type
(
to_id
),
tgl_get_peer_id
(
to_id
),
date
,
fwd_from_id
,
fwd_date
,
unread
,
start
,
(
in_ptr
-
start
));
}
else
{
}
else
{
bl_do_create_message_service
(
id
,
from_id
,
tgl_get_peer_type
(
to_id
),
tgl_get_peer_id
(
to_id
),
date
,
start
,
(
in_ptr
-
start
));
bl_do_create_message_service
(
id
,
from_id
,
tgl_get_peer_type
(
to_id
),
tgl_get_peer_id
(
to_id
),
date
,
unread
,
start
,
(
in_ptr
-
start
));
}
}
}
}
}
else
{
}
else
{
...
@@ -1012,9 +1012,9 @@ void tglf_fetch_message (struct tgl_message *M) {
...
@@ -1012,9 +1012,9 @@ void tglf_fetch_message (struct tgl_message *M) {
if
(
new
)
{
if
(
new
)
{
if
(
fwd_from_id
)
{
if
(
fwd_from_id
)
{
bl_do_create_message_media_fwd
(
id
,
from_id
,
tgl_get_peer_type
(
to_id
),
tgl_get_peer_id
(
to_id
),
date
,
fwd_from_id
,
fwd_date
,
l
,
s
,
start
,
in_ptr
-
start
);
bl_do_create_message_media_fwd
(
id
,
from_id
,
tgl_get_peer_type
(
to_id
),
tgl_get_peer_id
(
to_id
),
date
,
fwd_from_id
,
fwd_date
,
unread
,
l
,
s
,
start
,
in_ptr
-
start
);
}
else
{
}
else
{
bl_do_create_message_media
(
id
,
from_id
,
tgl_get_peer_type
(
to_id
),
tgl_get_peer_id
(
to_id
),
date
,
l
,
s
,
start
,
in_ptr
-
start
);
bl_do_create_message_media
(
id
,
from_id
,
tgl_get_peer_type
(
to_id
),
tgl_get_peer_id
(
to_id
),
date
,
unread
,
l
,
s
,
start
,
in_ptr
-
start
);
}
}
}
}
}
}
...
...
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