Merge github.com:vysheng/tg

This commit is contained in:
vvaltman 2014-09-07 23:13:13 +04:00
commit 674034a3fc
3 changed files with 31 additions and 6 deletions

View File

@ -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 ()

View File

@ -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

View File

@ -489,8 +489,10 @@ 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) {
int *save = in_ptr; int *save = in_ptr;
@ -506,8 +508,10 @@ 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) {
assert (fetch_int () == (int)CODE_updates_too_long); assert (fetch_int () == (int)CODE_updates_too_long);