src/irc_conn.c
changeset 21 0911d0b828d4
parent 20 d9c4c2980a0d
child 22 c339c020fd33
equal deleted inserted replaced
20:d9c4c2980a0d 21:0911d0b828d4
     1 
     1 
     2 #include "irc_conn.h"
     2 #include "irc_conn.h"
       
     3 #include "irc_cmd.h"
     3 
     4 
     4 #include <stdlib.h>
     5 #include <stdlib.h>
     5 #include <string.h>
     6 #include <string.h>
       
     7 
       
     8 /*
       
     9  * "Welcome to the Internet Relay Network <nick>!<user>@<host>"
       
    10  */
       
    11 static void on_RPL_WELCOME (struct irc_conn *conn, const struct irc_line *line)
       
    12 {
       
    13     // update state
       
    14     conn->registered = true;
       
    15 }
     6 
    16 
     7 /*
    17 /*
     8  * PING <server1> [ <server2> ]
    18  * PING <server1> [ <server2> ]
     9  *
    19  *
    10  * Send a 'PONG <server1>` reply right away.
    20  * Send a 'PONG <server1>` reply right away.
    24 
    34 
    25     /* The handler function */
    35     /* The handler function */
    26     void (*func) (struct irc_conn *conn, const struct irc_line *line);
    36     void (*func) (struct irc_conn *conn, const struct irc_line *line);
    27 
    37 
    28 } _cmd_handlers[] = {
    38 } _cmd_handlers[] = {
       
    39     { IRC_RPL_WELCOME,  on_RPL_WELCOME      },
    29     { "PING",           on_PING             },
    40     { "PING",           on_PING             },
    30     { NULL,             NULL,               },
    41     { NULL,             NULL,               },
    31 };
    42 };
    32 
    43 
    33 void irc_conn_on_line (char *line_buf, void *arg) 
    44 void irc_conn_on_line (char *line_buf, void *arg)