Mark read messages from not peers
This commit is contained in:
parent
f2734e5925
commit
ed2be5498b
12
binlog.c
12
binlog.c
@ -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) {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
13
queries.c
13
queries.c
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user