aboutsummaryrefslogtreecommitdiffstats
path: root/irc_commands.c
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-08-18 02:03:39 -0300
committerdequis <dx@dxzone.com.ar>2015-09-10 23:31:10 -0300
commitd797fb45e38b005b25fa043f4d3c427ec7f7fe53 (patch)
tree416e8305dece8cfbcb11d39f4e9198fdbce73e79 /irc_commands.c
parentb57fed05ddf3eb05dee41c0b33fac72fdb57d6f4 (diff)
CAP LIST
Diffstat (limited to 'irc_commands.c')
-rw-r--r--irc_commands.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/irc_commands.c b/irc_commands.c
index 820674e5..ebcc300b 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -126,6 +126,29 @@ static void irc_cmd_cap_ls(irc_t *irc, char *version) {
g_string_free(str, TRUE);
}
+/* this one looks suspiciously similar to cap ls,
+ * but cap-3.2 will make them very different */
+static void irc_cmd_cap_list(irc_t *irc) {
+ int i;
+ gboolean first = TRUE;
+ GString *str = g_string_sized_new(256);
+
+ for (i = 0; supported_caps[i].name; i++) {
+ if (irc->caps & supported_caps[i].flag) {
+ if (!first) {
+ g_string_append_c(str, ' ');
+ }
+ first = FALSE;
+
+ g_string_append(str, supported_caps[i].name);
+ }
+ }
+
+ irc_send_cap(irc, "LIST", str->str);
+
+ g_string_free(str, TRUE);
+}
+
static void irc_cmd_cap(irc_t *irc, char **cmd)
{
if (!(irc->status & USTATUS_LOGGED_IN)) {
@@ -137,7 +160,7 @@ static void irc_cmd_cap(irc_t *irc, char **cmd)
irc_cmd_cap_ls(irc, cmd[2]);
} else if (g_strcasecmp(cmd[1], "LIST") == 0) {
- irc_send_cap(irc, "LIST", "");
+ irc_cmd_cap_list(irc);
} else if (g_strcasecmp(cmd[1], "REQ") == 0) {
gboolean ack = irc_cmd_cap_req(irc, cmd[2]);