aboutsummaryrefslogtreecommitdiffstats
path: root/irc_commands.c
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-08-18 01:46:34 -0300
committerdequis <dx@dxzone.com.ar>2015-09-10 23:31:10 -0300
commitb57fed05ddf3eb05dee41c0b33fac72fdb57d6f4 (patch)
treea49365aa16e5dff26a8b6d7260e2c950bb291bc1 /irc_commands.c
parentdc96e6e002f5f1cc415ff5fb5b073f4e4cd35bb0 (diff)
CAP LS
Diffstat (limited to 'irc_commands.c')
-rw-r--r--irc_commands.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/irc_commands.c b/irc_commands.c
index 32fea023..820674e5 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -109,6 +109,23 @@ static gboolean irc_cmd_cap_req(irc_t *irc, char *caps)
return TRUE;
}
+/* version can be "302" or NULL, but we don't need cap-3.2 for anything yet */
+static void irc_cmd_cap_ls(irc_t *irc, char *version) {
+ int i;
+ GString *str = g_string_sized_new(256);
+
+ for (i = 0; supported_caps[i].name; i++) {
+ if (i != 0) {
+ g_string_append_c(str, ' ');
+ }
+ g_string_append(str, supported_caps[i].name);
+ }
+
+ irc_send_cap(irc, "LS", str->str);
+
+ g_string_free(str, TRUE);
+}
+
static void irc_cmd_cap(irc_t *irc, char **cmd)
{
if (!(irc->status & USTATUS_LOGGED_IN)) {
@@ -117,12 +134,7 @@ static void irc_cmd_cap(irc_t *irc, char **cmd)
}
if (g_strcasecmp(cmd[1], "LS") == 0) {
- /* gboolean irc302 = (g_strcmp0(cmd[2], "302") == 0); */
- //char *ls = g_strjoinv(" ", (char **) supported_caps);
-
- irc_send_cap(irc, "LS", "foo bar");
-
- //g_free(ls);
+ irc_cmd_cap_ls(irc, cmd[2]);
} else if (g_strcasecmp(cmd[1], "LIST") == 0) {
irc_send_cap(irc, "LIST", "");