Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/tgl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV V <vvaltman@aurum>2015-09-30 19:49:11 +0300
committerV V <vvaltman@aurum>2015-09-30 19:49:11 +0300
commit23ff689b27ba19f8beb37467ce00c9e062d9e688 (patch)
tree18342fcf0296a330b743d38156d337e973a5ee93 /tgl-structures.h
parent1cdaac625b8af7312b909d8cbb655ec2807543c5 (diff)
some fixes
Diffstat (limited to 'tgl-structures.h')
-rw-r--r--tgl-structures.h37
1 files changed, 34 insertions, 3 deletions
diff --git a/tgl-structures.h b/tgl-structures.h
index f5476fa..4bfe587 100644
--- a/tgl-structures.h
+++ b/tgl-structures.h
@@ -35,7 +35,7 @@ void tgls_free_message (struct tgl_state *TLS, struct tgl_message *M);
void tgls_free_bot_info (struct tgl_state *TLS, struct tgl_bot_info *B);
void tgls_clear_message (struct tgl_state *TLS, struct tgl_message *M);
-struct tgl_message *tglm_message_alloc (struct tgl_state *TLS, long long id);
+struct tgl_message *tglm_message_alloc (struct tgl_state *TLS, tgl_message_id_t *id);
void tglm_message_insert_tree (struct tgl_state *TLS, struct tgl_message *M);
void tglm_update_message_id (struct tgl_state *TLS, struct tgl_message *M, long long id);
void tglm_message_insert (struct tgl_state *TLS, struct tgl_message *M);
@@ -57,8 +57,14 @@ void tglp_insert_channel (struct tgl_state *TLS, tgl_peer_t *P);
//enum tgl_typing_status tglf_fetch_typing_buf (void);
void tgls_messages_mark_read (struct tgl_state *TLS, struct tgl_message *M, int out, int seq);
-void tgls_insert_random2local (struct tgl_state *TLS, long long random_id, int local_id);
-int tgls_get_local_by_random (struct tgl_state *TLS, long long random_id);
+//void tgls_insert_random2local (struct tgl_state *TLS, long long random_id, tgl_message_id_t *local_id);
+//void tgls_insert_temp2local (struct tgl_state *TLS, int temp_id, tgl_message_id_t *local_id);
+tgl_message_id_t *tgls_get_local_by_random (struct tgl_state *TLS, long long random_id);
+tgl_message_id_t *tgls_get_local_by_temp (struct tgl_state *TLS, int temp_id);
+
+
+void tgls_message_change_temp_id (struct tgl_state *TLS, struct tgl_message *M, int temp_id);
+void tgls_message_change_random_id (struct tgl_state *TLS, struct tgl_message *M, long long random_id);
void tgl_photo_insert (struct tgl_state *TLS, struct tgl_photo *P);
@@ -67,4 +73,29 @@ struct tgl_document *tgl_document_get (struct tgl_state *TLS, long long id);
void tgl_document_insert (struct tgl_state *TLS, struct tgl_document *P);
struct tgl_webpage *tgl_webpage_get (struct tgl_state *TLS, long long id);
void tgl_webpage_insert (struct tgl_state *TLS, struct tgl_webpage *P);
+
+tgl_message_id_t tgl_convert_temp_msg_id (struct tgl_state *TLS, tgl_message_id_t msg_id);
+
+static inline tgl_peer_id_t tgl_msg_id_to_peer_id (tgl_message_id_t msg_id) {
+ tgl_peer_id_t id;
+ id.peer_type = msg_id.peer_type;
+ id.peer_id = msg_id.peer_id;
+ id.access_hash = msg_id.access_hash;
+ return id;
+}
+
+static inline tgl_message_id_t tgl_peer_id_to_msg_id (tgl_peer_id_t peer_id, long long msg_id) {
+ tgl_message_id_t id;
+ id.peer_type = peer_id.peer_type;
+ id.peer_id = peer_id.peer_id;
+ id.access_hash = peer_id.access_hash;
+ id.id = msg_id;
+ return id;
+}
+
+static inline tgl_message_id_t tgl_peer_id_to_random_msg_id (tgl_peer_id_t peer_id) {
+ long long id;
+ tglt_secure_random (&id, 8);
+ return tgl_peer_id_to_msg_id (peer_id, id);
+}
#endif