src/irc_net.c
changeset 48 4841f4398fd2
parent 47 7d4094eb3117
child 53 12d806823775
equal deleted inserted replaced
47:7d4094eb3117 48:4841f4398fd2
    56     
    56     
    57     irc_net_error(net, err);
    57     irc_net_error(net, err);
    58 }
    58 }
    59 
    59 
    60 /**
    60 /**
       
    61  * Our irc_conn has quit succesfully
       
    62  */
       
    63 static void irc_net_conn_quit (struct irc_conn *conn, void *arg)
       
    64 {
       
    65     struct irc_net *net = arg;
       
    66 
       
    67     // clean up the conn
       
    68     irc_conn_destroy(conn);
       
    69     net->conn = NULL;
       
    70 
       
    71     // XXX: notify user
       
    72 }
       
    73 
       
    74 /**
    61  * Our irc_conn_callbacks list
    75  * Our irc_conn_callbacks list
    62  */
    76  */
    63 struct irc_conn_callbacks _conn_callbacks = {
    77 struct irc_conn_callbacks _conn_callbacks = {
    64     .on_registered  = &irc_net_conn_registered,
    78     .on_registered  = &irc_net_conn_registered,
    65     .on_error       = &irc_net_conn_error,
    79     .on_error       = &irc_net_conn_error,
       
    80     .on_quit        = &irc_net_conn_quit,
    66 };
    81 };
    67 
    82 
    68 /**
    83 /**
    69  * Propagate the command to the appropriate irc_chan based on the given name
    84  * Propagate the command to the appropriate irc_chan based on the given name
    70  */
    85  */
   242 
   257 
   243     // no such channel
   258     // no such channel
   244     return NULL;
   259     return NULL;
   245 }
   260 }
   246 
   261 
       
   262 err_t irc_net_quit (struct irc_net *net, const char *message)
       
   263 {
       
   264    if (!net->conn)
       
   265        return ERR_IRC_NET_QUIT_STATE;
       
   266     
       
   267     // send the QUIT message, and then we can wait for the reply
       
   268     return irc_conn_QUIT(net->conn, message);
       
   269 }