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
ed2be549
Commit
ed2be549
authored
Sep 03, 2014
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark read messages from not peers
parent
f2734e59
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
binlog.c
binlog.c
+12
-0
queries.c
queries.c
+4
-9
tgl.h
tgl.h
+1
-0
No files found.
binlog.c
View file @
ed2be549
...
@@ -1128,6 +1128,12 @@ static int fetch_comb_binlog_msg_seq_update (void *extra) {
...
@@ -1128,6 +1128,12 @@ static int fetch_comb_binlog_msg_seq_update (void *extra) {
tgl_state
.
seq
++
;
tgl_state
.
seq
++
;
vlogprintf
(
E_DEBUG
-
1
+
2
*
in_replay_log
,
"seq %d=>%d
\n
"
,
tgl_state
.
seq
-
1
,
tgl_state
.
seq
);
vlogprintf
(
E_DEBUG
-
1
+
2
*
in_replay_log
,
"seq %d=>%d
\n
"
,
tgl_state
.
seq
-
1
,
tgl_state
.
seq
);
if
(
!
(
M
->
flags
&
FLAG_ENCRYPTED
))
{
if
(
tgl_state
.
max_msg_id
<
M
->
id
)
{
tgl_state
.
max_msg_id
=
M
->
id
;
}
}
if
(
tgl_state
.
callback
.
msg_receive
)
{
if
(
tgl_state
.
callback
.
msg_receive
)
{
tgl_state
.
callback
.
msg_receive
(
M
);
tgl_state
.
callback
.
msg_receive
(
M
);
}
}
...
@@ -1138,6 +1144,12 @@ static int fetch_comb_binlog_msg_update (void *extra) {
...
@@ -1138,6 +1144,12 @@ static int fetch_comb_binlog_msg_update (void *extra) {
struct
tgl_message
*
M
=
tgl_message_get
(
fetch_long
());
struct
tgl_message
*
M
=
tgl_message_get
(
fetch_long
());
assert
(
M
);
assert
(
M
);
if
(
!
(
M
->
flags
&
FLAG_ENCRYPTED
))
{
if
(
tgl_state
.
max_msg_id
<
M
->
id
)
{
tgl_state
.
max_msg_id
=
M
->
id
;
}
}
if
(
tgl_state
.
callback
.
msg_receive
)
{
if
(
tgl_state
.
callback
.
msg_receive
)
{
tgl_state
.
callback
.
msg_receive
(
M
);
tgl_state
.
callback
.
msg_receive
(
M
);
}
}
...
...
queries.c
View file @
ed2be549
...
@@ -1104,21 +1104,16 @@ void tgl_do_messages_mark_read_encr (tgl_peer_id_t id, long long access_hash, in
...
@@ -1104,21 +1104,16 @@ void tgl_do_messages_mark_read_encr (tgl_peer_id_t id, long long access_hash, in
}
}
void
tgl_do_mark_read
(
tgl_peer_id_t
id
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
),
void
*
callback_extra
)
{
void
tgl_do_mark_read
(
tgl_peer_id_t
id
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
),
void
*
callback_extra
)
{
if
(
tgl_get_peer_type
(
id
)
==
TGL_PEER_USER
||
tgl_get_peer_type
(
id
)
==
TGL_PEER_CHAT
)
{
tgl_do_messages_mark_read
(
id
,
tgl_state
.
max_msg_id
,
callback
,
callback_extra
);
return
;
}
tgl_peer_t
*
P
=
tgl_peer_get
(
id
);
tgl_peer_t
*
P
=
tgl_peer_get
(
id
);
if
(
!
P
)
{
if
(
!
P
)
{
vlogprintf
(
E_WARNING
,
"Unknown peer
\n
"
);
vlogprintf
(
E_WARNING
,
"Unknown peer
\n
"
);
callback
(
callback_extra
,
0
);
callback
(
callback_extra
,
0
);
return
;
return
;
}
}
if
(
tgl_get_peer_type
(
id
)
==
TGL_PEER_USER
||
tgl_get_peer_type
(
id
)
==
TGL_PEER_CHAT
)
{
if
(
!
P
->
last
)
{
vlogprintf
(
E_WARNING
,
"Unknown last peer message
\n
"
);
callback
(
callback_extra
,
0
);
return
;
}
tgl_do_messages_mark_read
(
id
,
P
->
last
->
id
,
callback
,
callback_extra
);
return
;
}
assert
(
tgl_get_peer_type
(
id
)
==
TGL_PEER_ENCR_CHAT
);
assert
(
tgl_get_peer_type
(
id
)
==
TGL_PEER_ENCR_CHAT
);
if
(
P
->
last
)
{
if
(
P
->
last
)
{
tgl_do_messages_mark_read_encr
(
id
,
P
->
encr_chat
.
access_hash
,
P
->
last
->
date
,
callback
,
callback_extra
);
tgl_do_messages_mark_read_encr
(
id
,
P
->
encr_chat
.
access_hash
,
P
->
last
->
date
,
callback
,
callback_extra
);
...
...
tgl.h
View file @
ed2be549
...
@@ -132,6 +132,7 @@ struct tgl_state {
...
@@ -132,6 +132,7 @@ struct tgl_state {
int
verbosity
;
int
verbosity
;
int
unread_messages
;
int
unread_messages
;
int
active_queries
;
int
active_queries
;
int
max_msg_id
;
long
long
locks
;
long
long
locks
;
struct
tgl_dc
*
DC_list
[
TGL_MAX_DC_NUM
];
struct
tgl_dc
*
DC_list
[
TGL_MAX_DC_NUM
];
...
...
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