Changeset 0ef1c92 for irc_commands.c


Ignore:
Timestamp:
2015-09-11T02:31:10Z (4 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
dc96e6e
Parents:
34d16d5
git-author:
dequis <dx@…> (27-07-15 05:14:09)
git-committer:
dequis <dx@…> (11-09-15 02:31:10)
Message:

Initial implementation of ircv3 capability negotiation

Mostly no-op for now. Puts registration on hold, supports the basic
commands, and NAKs everything

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_commands.c

    r34d16d5 r0ef1c92  
    2828#include "help.h"
    2929#include "ipc.h"
     30
     31static void irc_cmd_cap(irc_t *irc, char **cmd)
     32{
     33        if (!(irc->status & USTATUS_LOGGED_IN)) {
     34                /* Put registration on hold until CAP END */
     35                irc->status |= USTATUS_CAP_PENDING;
     36        }
     37
     38        if (g_strcasecmp(cmd[1], "LS") == 0) {
     39                /* gboolean irc302 = (g_strcmp0(cmd[2], "302") == 0); */
     40                irc_send_cap(irc, "LS", "");
     41
     42        } else if (g_strcasecmp(cmd[1], "LIST") == 0) {
     43                irc_send_cap(irc, "LIST", "");
     44
     45        } else if (g_strcasecmp(cmd[1], "REQ") == 0) {
     46                irc_send_cap(irc, "NAK", cmd[2] ? : "");
     47
     48        } else if (g_strcasecmp(cmd[1], "END") == 0) {
     49                irc->status &= ~USTATUS_CAP_PENDING;
     50                irc_check_login(irc);
     51
     52        } else {
     53                irc_send_num(irc, 410, "%s :Invalid CAP command", cmd[1]);
     54        }
     55
     56}
    3057
    3158static void irc_cmd_pass(irc_t *irc, char **cmd)
     
    685712
    686713static const command_t irc_commands[] = {
     714        { "cap",         1, irc_cmd_cap,         0 },
    687715        { "pass",        1, irc_cmd_pass,        0 },
    688716        { "user",        4, irc_cmd_user,        IRC_CMD_PRE_LOGIN },
Note: See TracChangeset for help on using the changeset viewer.