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-10-02 19:58:51 +0300
committerV V <vvaltman@aurum>2015-10-02 19:58:51 +0300
commit2bd55aea13866ca1028225d21a76960aeee16a96 (patch)
treeeae7084a14e3dbe221e21bc04baba13c807cc0e9
parent69858c6f2271fed4c8067a447df8d96c927217c4 (diff)
added channel join and leave support
-rw-r--r--queries.c26
-rw-r--r--tgl-queries.h4
2 files changed, 30 insertions, 0 deletions
diff --git a/queries.c b/queries.c
index 817a901..e0ee458 100644
--- a/queries.c
+++ b/queries.c
@@ -2405,6 +2405,32 @@ void tgl_do_rename_channel (struct tgl_state *TLS, tgl_peer_id_t id, const char
}
/* }}} */
+ /* {{{ Join channel */
+
+void tgl_do_join_channel (struct tgl_state *TLS, tgl_peer_id_t id, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success), void *callback_extra) {
+ clear_packet ();
+ out_int (CODE_channels_join_channel);
+ assert (tgl_get_peer_type (id) == TGL_PEER_CHANNEL);
+ out_int (CODE_input_channel);
+ out_int (tgl_get_peer_id (id));
+ out_long (id.access_hash);
+ tglq_send_query (TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &send_msgs_methods, 0, callback, callback_extra);
+}
+/* }}} */
+
+/* {{{ Leave channel */
+
+void tgl_do_leave_channel (struct tgl_state *TLS, tgl_peer_id_t id, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success), void *callback_extra) {
+ clear_packet ();
+ out_int (CODE_channels_leave_channel);
+ assert (tgl_get_peer_type (id) == TGL_PEER_CHANNEL);
+ out_int (CODE_input_channel);
+ out_int (tgl_get_peer_id (id));
+ out_long (id.access_hash);
+ tglq_send_query (TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &send_msgs_methods, 0, callback, callback_extra);
+}
+/* }}} */
+
/* {{{ channel change about */
static int channels_set_about_on_answer (struct tgl_state *TLS, struct query *q, void *D) {
diff --git a/tgl-queries.h b/tgl-queries.h
index 90a0805..f6013a6 100644
--- a/tgl-queries.h
+++ b/tgl-queries.h
@@ -176,6 +176,10 @@ void tgl_do_channel_set_about (struct tgl_state *TLS, tgl_peer_id_t id, const ch
void tgl_do_create_channel (struct tgl_state *TLS, int users_num, tgl_peer_id_t ids[], const char *chat_topic, int chat_topic_len, const char *about, int about_len, unsigned long long flags, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success), void *callback_extra);
void tgl_do_channel_set_username (struct tgl_state *TLS, tgl_peer_id_t id, const char *username, int username_len, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success), void *callback_extra);
+
+void tgl_do_join_channel (struct tgl_state *TLS, tgl_peer_id_t id, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success), void *callback_extra);
+
+void tgl_do_leave_channel (struct tgl_state *TLS, tgl_peer_id_t id, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success), void *callback_extra);
/* }}} */
/* {{{ WORKING WITH DIALOG LIST */