Commit ef1e76bf authored by V V's avatar V V

added create_channel

parent 957ad6e3
...@@ -1272,6 +1272,18 @@ void do_channel_set_about (struct command *command, int arg_num, struct arg args ...@@ -1272,6 +1272,18 @@ void do_channel_set_about (struct command *command, int arg_num, struct arg args
if (ev) { ev->refcnt ++; } if (ev) { ev->refcnt ++; }
tgl_do_channel_set_about (TLS, args[0].peer_id, ARG2STR (1), print_success_gw, ev); tgl_do_channel_set_about (TLS, args[0].peer_id, ARG2STR (1), print_success_gw, ev);
} }
void do_create_channel (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) {
assert (arg_num >= 2 && arg_num <= 1000);
static tgl_peer_id_t ids[1000];
int i;
for (i = 0; i < arg_num - 2; i++) {
ids[i] = args[i + 2].peer_id;
}
if (ev) { ev->refcnt ++; }
tgl_do_create_channel (TLS, arg_num - 2, ids, ARG2STR (0), ARG2STR (1), 1, print_success_gw, ev);
}
/* }}} */ /* }}} */
/* {{{ WORKING WITH DIALOG LIST */ /* {{{ WORKING WITH DIALOG LIST */
...@@ -1531,6 +1543,7 @@ struct command commands[MAX_COMMANDS_SIZE] = { ...@@ -1531,6 +1543,7 @@ struct command commands[MAX_COMMANDS_SIZE] = {
{"clear", {ca_none}, do_clear, "clear\tClears all data and exits. For debug.", NULL}, {"clear", {ca_none}, do_clear, "clear\tClears all data and exits. For debug.", NULL},
{"contact_list", {ca_none}, do_contact_list, "contact_list\tPrints contact list", NULL}, {"contact_list", {ca_none}, do_contact_list, "contact_list\tPrints contact list", NULL},
{"contact_search", {ca_string, ca_none}, do_resolve_username, "contact_search username\tSearches user by username", NULL}, {"contact_search", {ca_string, ca_none}, do_resolve_username, "contact_search username\tSearches user by username", NULL},
{"create_channel", {ca_string, ca_string, ca_user | ca_optional, ca_period, ca_none}, do_create_channel, "create_channel <name> <about> <user>+\tCreates channel with users", NULL},
{"create_group_chat", {ca_string, ca_user, ca_period, ca_none}, do_create_group_chat, "create_group_chat <name> <user>+\tCreates group chat with users", NULL}, {"create_group_chat", {ca_string, ca_user, ca_period, ca_none}, do_create_group_chat, "create_group_chat <name> <user>+\tCreates group chat with users", NULL},
{"create_secret_chat", {ca_user, ca_none}, do_create_secret_chat, "create_secret_chat <user>\tStarts creation of secret chat", NULL}, {"create_secret_chat", {ca_user, ca_none}, do_create_secret_chat, "create_secret_chat <user>\tStarts creation of secret chat", NULL},
{"del_contact", {ca_user, ca_none}, do_del_contact, "del_contact <user>\tDeletes contact from contact list", NULL}, {"del_contact", {ca_user, ca_none}, do_del_contact, "del_contact <user>\tDeletes contact from contact list", NULL},
...@@ -3258,6 +3271,8 @@ void interpreter_ex (char *line, void *ex) { ...@@ -3258,6 +3271,8 @@ void interpreter_ex (char *line, void *ex) {
int period = 0; int period = 0;
if (*flags == ca_period) { if (*flags == ca_period) {
flags --; flags --;
}
if (*flags != ca_none && *(flags + 1) == ca_period) {
period = 1; period = 1;
} }
enum command_argument op = (*flags) & 255; enum command_argument op = (*flags) & 255;
...@@ -3390,17 +3405,17 @@ void interpreter_ex (char *line, void *ex) { ...@@ -3390,17 +3405,17 @@ void interpreter_ex (char *line, void *ex) {
assert (0); assert (0);
} }
if (opt && !ok) {
line_ptr = save;
flags ++;
continue;
}
if (period && !ok) { if (period && !ok) {
line_ptr = save; line_ptr = save;
flags += 2; flags += 2;
args_num --; args_num --;
continue; continue;
} }
if (opt && !ok) {
line_ptr = save;
flags ++;
continue;
}
if (!ok) { if (!ok) {
fail_interface (TLS, ex, ENOSYS, "can not parse arg #%d", args_num); fail_interface (TLS, ex, ENOSYS, "can not parse arg #%d", args_num);
break; break;
......
Subproject commit 4d5071bc0da868130620c1dc420c3d358524732a Subproject commit 352c42add860b0f65ee3944a1584c8208ea07df4
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