Commit bbf26928 authored by V V's avatar V V

added channel join and leave support

parent a21c8f87
...@@ -1253,7 +1253,7 @@ void do_create_secret_chat (struct command *command, int arg_num, struct arg arg ...@@ -1253,7 +1253,7 @@ void do_create_secret_chat (struct command *command, int arg_num, struct arg arg
/* }}} */ /* }}} */
/* WORING WITH CHANNELS {{{ */ /* WORKING WITH CHANNELS {{{ */
void do_rename_channel (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) { void do_rename_channel (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) {
assert (arg_num == 2); assert (arg_num == 2);
...@@ -1290,6 +1290,18 @@ void do_create_channel (struct command *command, int arg_num, struct arg args[], ...@@ -1290,6 +1290,18 @@ void do_create_channel (struct command *command, int arg_num, struct arg args[],
if (ev) { ev->refcnt ++; } if (ev) { ev->refcnt ++; }
tgl_do_create_channel (TLS, arg_num - 2, ids, ARG2STR (0), ARG2STR (1), 1, print_success_gw, ev); tgl_do_create_channel (TLS, arg_num - 2, ids, ARG2STR (0), ARG2STR (1), 1, print_success_gw, ev);
} }
void do_join_channel (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) {
assert (arg_num == 1);
if (ev) { ev->refcnt ++; }
tgl_do_join_channel (TLS, args[0].peer_id, print_success_gw, ev);
}
void do_leave_channel (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) {
assert (arg_num == 1);
if (ev) { ev->refcnt ++; }
tgl_do_leave_channel (TLS, args[0].peer_id, print_success_gw, ev);
}
/* }}} */ /* }}} */
/* {{{ WORKING WITH DIALOG LIST */ /* {{{ WORKING WITH DIALOG LIST */
...@@ -1538,6 +1550,8 @@ struct command commands[MAX_COMMANDS_SIZE] = { ...@@ -1538,6 +1550,8 @@ struct command commands[MAX_COMMANDS_SIZE] = {
{"block_user", {ca_user, ca_none}, do_block_user, "block_user <user>\tBlocks user", NULL}, {"block_user", {ca_user, ca_none}, do_block_user, "block_user <user>\tBlocks user", NULL},
{"broadcast", {ca_user, ca_period, ca_string_end, ca_none}, do_broadcast, "broadcast <user>+ <text>\tSends text to several users at once", NULL}, {"broadcast", {ca_user, ca_period, ca_string_end, ca_none}, do_broadcast, "broadcast <user>+ <text>\tSends text to several users at once", NULL},
{"channel_info", {ca_channel, ca_none}, do_channel_info, "channel_info <channel>\tPrints info about channel (id, members, admin, etc.)", NULL}, {"channel_info", {ca_channel, ca_none}, do_channel_info, "channel_info <channel>\tPrints info about channel (id, members, admin, etc.)", NULL},
{"channel_join", {ca_channel, ca_none}, do_join_channel, "channel_join <channel>\tJoins to channel", NULL},
{"channel_leave", {ca_channel, ca_none}, do_leave_channel, "channel_leave <channel>\tLeaves from channel", NULL},
{"channel_list", {ca_number | ca_optional, ca_number | ca_optional, ca_none}, do_channel_list, "channel_list [limit=100] [offset=0]\tList of last channels", NULL}, {"channel_list", {ca_number | ca_optional, ca_number | ca_optional, ca_none}, do_channel_list, "channel_list [limit=100] [offset=0]\tList of last channels", NULL},
{"channel_set_about", {ca_channel, ca_string, ca_none}, do_channel_set_about, "channel_set_about <channel> <about>\tSets channel about info.", NULL}, {"channel_set_about", {ca_channel, ca_string, ca_none}, do_channel_set_about, "channel_set_about <channel> <about>\tSets channel about info.", NULL},
{"channel_set_username", {ca_channel, ca_string, ca_none}, do_channel_set_username, "channel_set_username <channel> <username>\tSets channel username info.", NULL}, {"channel_set_username", {ca_channel, ca_string, ca_none}, do_channel_set_username, "channel_set_username <channel> <username>\tSets channel username info.", NULL},
......
Subproject commit 69858c6f2271fed4c8067a447df8d96c927217c4 Subproject commit 2bd55aea13866ca1028225d21a76960aeee16a96
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment