Fixed updates
This commit is contained in:
parent
d7f9fcc614
commit
4aeb0ebb20
@ -21,7 +21,8 @@ These functions may return false immidiately if something is bad with args, or r
|
|||||||
cb_function would have two or three arguments: first cb_extra, second success (1 or 0), third result (if applicable).
|
cb_function would have two or three arguments: first cb_extra, second success (1 or 0), third result (if applicable).
|
||||||
|
|
||||||
If you want to pass msg to function, you should pass it's id.
|
If you want to pass msg to function, you should pass it's id.
|
||||||
If you want to pass peer to function, you should pass it's print_name
|
If you want to pass peer to function, you should pass it's print_name.
|
||||||
|
Or, you can pass string user#id<id> chat#id<id> and secret_chat#id<id> as peer. It is in some cases better. For example if you want to postpone and you are afraid, that print_name would be changed in the meantime.
|
||||||
|
|
||||||
Function_list (arguments are listed aside from cb_function and cb_extra, :
|
Function_list (arguments are listed aside from cb_function and cb_extra, :
|
||||||
get_contact_list ()
|
get_contact_list ()
|
||||||
|
26
structures.c
26
structures.c
@ -646,7 +646,7 @@ void tglf_fetch_message_short (struct tgl_message *M) {
|
|||||||
int l = prefetch_strlen ();
|
int l = prefetch_strlen ();
|
||||||
char *s = fetch_str (l);
|
char *s = fetch_str (l);
|
||||||
|
|
||||||
tglu_fetch_pts ();
|
int pts = fetch_int ();
|
||||||
|
|
||||||
int date = fetch_int ();
|
int date = fetch_int ();
|
||||||
//tglu_fetch_seq ();
|
//tglu_fetch_seq ();
|
||||||
@ -654,6 +654,14 @@ void tglf_fetch_message_short (struct tgl_message *M) {
|
|||||||
assert (seq == tgl_state.seq + 1);
|
assert (seq == tgl_state.seq + 1);
|
||||||
|
|
||||||
bl_do_create_message_text (id, from_id, TGL_PEER_USER, to_id, date, 1, l, s);
|
bl_do_create_message_text (id, from_id, TGL_PEER_USER, to_id, date, 1, l, s);
|
||||||
|
|
||||||
|
tgl_peer_t *P = tgl_peer_get (TGL_MK_USER (from_id));
|
||||||
|
if (!P || !(P->flags & FLAG_CREATED)) {
|
||||||
|
tgl_do_get_difference (0, 0, 0);
|
||||||
|
} else {
|
||||||
|
bl_do_set_pts (pts);
|
||||||
|
bl_do_set_date (date);
|
||||||
|
}
|
||||||
//bl_do_msg_seq_update (id);
|
//bl_do_msg_seq_update (id);
|
||||||
} else {
|
} else {
|
||||||
fetch_int (); // id
|
fetch_int (); // id
|
||||||
@ -680,14 +688,26 @@ void tglf_fetch_message_short_chat (struct tgl_message *M) {
|
|||||||
int l = prefetch_strlen ();
|
int l = prefetch_strlen ();
|
||||||
char *s = fetch_str (l);
|
char *s = fetch_str (l);
|
||||||
|
|
||||||
tglu_fetch_pts ();
|
int pts = fetch_int ();
|
||||||
|
|
||||||
int date = fetch_int ();
|
int date = fetch_int ();
|
||||||
//tglu_fetch_seq ();
|
//tglu_fetch_seq ();
|
||||||
|
|
||||||
int seq = fetch_int ();
|
int seq = fetch_int ();
|
||||||
assert (seq == tgl_state.seq + 1);
|
assert (seq == tgl_state.seq + 1);
|
||||||
bl_do_create_message_text (id, from_id, TGL_PEER_CHAT, to_id, date, 1, l, s);
|
bl_do_create_message_text (id, from_id, TGL_PEER_CHAT, to_id, date, 1, l, s);
|
||||||
|
|
||||||
|
tgl_peer_t *P = tgl_peer_get (TGL_MK_CHAT (to_id));
|
||||||
|
if (!P || !(P->flags & FLAG_CREATED)) {
|
||||||
|
tgl_do_get_difference (0, 0, 0);
|
||||||
|
} else {
|
||||||
|
P = tgl_peer_get (TGL_MK_USER (from_id));
|
||||||
|
if (!P || !(P->flags & FLAG_CREATED)) {
|
||||||
|
tgl_do_get_difference (0, 0, 0);
|
||||||
|
} else {
|
||||||
|
bl_do_set_pts (pts);
|
||||||
|
bl_do_set_date (date);
|
||||||
|
}
|
||||||
|
}
|
||||||
//bl_do_msg_seq_update (id);
|
//bl_do_msg_seq_update (id);
|
||||||
} else {
|
} else {
|
||||||
fetch_int (); // id
|
fetch_int (); // id
|
||||||
|
@ -489,7 +489,9 @@ void tglu_work_update_short_message (struct connection *c, long long msg_id) {
|
|||||||
assert (M);
|
assert (M);
|
||||||
|
|
||||||
assert (save_end == in_ptr);
|
assert (save_end == in_ptr);
|
||||||
|
if (!(tgl_state.locks & TGL_LOCK_DIFF)) {
|
||||||
bl_do_msg_seq_update (M->id);
|
bl_do_msg_seq_update (M->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tglu_work_update_short_chat_message (struct connection *c, long long msg_id) {
|
void tglu_work_update_short_chat_message (struct connection *c, long long msg_id) {
|
||||||
@ -506,7 +508,9 @@ void tglu_work_update_short_chat_message (struct connection *c, long long msg_id
|
|||||||
assert (M);
|
assert (M);
|
||||||
assert (save_end == in_ptr);
|
assert (save_end == in_ptr);
|
||||||
|
|
||||||
|
if (!(tgl_state.locks & TGL_LOCK_DIFF)) {
|
||||||
bl_do_msg_seq_update (M->id);
|
bl_do_msg_seq_update (M->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tglu_work_updates_to_long (struct connection *c, long long msg_id) {
|
void tglu_work_updates_to_long (struct connection *c, long long msg_id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user