diff options
Diffstat (limited to 'root_commands.c')
-rw-r--r-- | root_commands.c | 80 |
1 files changed, 5 insertions, 75 deletions
diff --git a/root_commands.c b/root_commands.c index 59974026..add9bceb 100644 --- a/root_commands.c +++ b/root_commands.c @@ -1234,10 +1234,8 @@ static void cmd_chat(irc_t *irc, char **cmd) account_t *acc; if (g_strcasecmp(cmd[1], "add") == 0) { - bee_chat_info_t *ci; - char *channel, *room, *s; + char *channel, *s; struct irc_channel *ic; - guint i; MIN_ARGS(3); @@ -1249,22 +1247,8 @@ static void cmd_chat(irc_t *irc, char **cmd) return; } - if (cmd[3][0] == '!') { - i = g_ascii_strtoull(cmd[3] + 1, NULL, 10); - ci = g_slist_nth_data(acc->ic->chatlist, i - 1); - - if (ci == NULL) { - irc_rootmsg(irc, "Invalid chatroom index"); - return; - } - - room = ci->title; - } else { - room = cmd[3]; - } - if (cmd[4] == NULL) { - channel = g_strdup(room); + channel = g_strdup(cmd[3]); if ((s = strchr(channel, '@'))) { *s = 0; } @@ -1284,7 +1268,7 @@ static void cmd_chat(irc_t *irc, char **cmd) set_setstr(&ic->set, "type", "chat") && set_setstr(&ic->set, "chat_type", "room") && set_setstr(&ic->set, "account", cmd[2]) && - set_setstr(&ic->set, "room", room)) { + set_setstr(&ic->set, "room", cmd[3])) { irc_rootmsg(irc, "Chatroom successfully added."); } else { if (ic) { @@ -1294,18 +1278,6 @@ static void cmd_chat(irc_t *irc, char **cmd) irc_rootmsg(irc, "Could not add chatroom."); } g_free(channel); - } else if (g_strcasecmp(cmd[1], "list") == 0) { - MIN_ARGS(2); - - if (!(acc = account_get(irc->b, cmd[2]))) { - irc_rootmsg(irc, "Invalid account"); - return; - } else if (!acc->prpl->chat_list) { - irc_rootmsg(irc, "Existing chatrooms not supported on that account."); - return; - } - - acc->prpl->chat_list(acc->ic, cmd[3]); } else if (g_strcasecmp(cmd[1], "with") == 0) { irc_user_t *iu; @@ -1320,7 +1292,8 @@ static void cmd_chat(irc_t *irc, char **cmd) } else { irc_rootmsg(irc, "Can't open a groupchat with %s.", cmd[2]); } - } else if (g_strcasecmp(cmd[1], "set") == 0 || + } else if (g_strcasecmp(cmd[1], "list") == 0 || + g_strcasecmp(cmd[1], "set") == 0 || g_strcasecmp(cmd[1], "del") == 0) { irc_rootmsg(irc, "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command."); @@ -1332,49 +1305,6 @@ static void cmd_chat(irc_t *irc, char **cmd) } } -void cmd_chat_list_finish(struct im_connection *ic) -{ - account_t *acc = ic->acc; - bee_chat_info_t *ci; - char *hformat, *iformat, *topic; - GSList *l; - GString *userc; - guint i = 0; - irc_t *irc = ic->bee->ui_data; - - if (ic->chatlist == NULL) { - irc_rootmsg(irc, "No existing chatrooms"); - return; - } - - if (strchr(irc->umode, 'b') != NULL) { - hformat = "%s\t%s\t%s\t%s"; - iformat = "%u\t%s\t%s\t%s"; - } else { - hformat = "%s %-20s %s %s"; - iformat = "%5u %-20.20s %5s %s"; - } - - irc_rootmsg(irc, hformat, "Index", "Title", "Users", "Topic"); - userc = g_string_new(NULL); - - for (l = ic->chatlist; l; l = l->next) { - ci = l->data; - topic = ci->topic ? ci->topic : ""; - - if (ci->userc >= 0) { - g_string_printf(userc, "%d", ci->userc); - } else { - g_string_assign(userc, "-"); - } - - irc_rootmsg(irc, iformat, ++i, ci->title, userc->str, topic); - } - - irc_rootmsg(irc, "%u %s chatrooms", i, acc->tag); - g_string_free(userc, TRUE); -} - static void cmd_group(irc_t *irc, char **cmd) { GSList *l; |