src/irc_conn.h
changeset 48 4841f4398fd2
parent 45 71e65564afd2
child 49 96e0f703a58c
equal deleted inserted replaced
47:7d4094eb3117 48:4841f4398fd2
    42     void (*on_registered) (struct irc_conn *conn, void *arg);
    42     void (*on_registered) (struct irc_conn *conn, void *arg);
    43 
    43 
    44     /**
    44     /**
    45      * The connection has failed in some way, and can not be considered useable anymore. Sending messages won't work,
    45      * The connection has failed in some way, and can not be considered useable anymore. Sending messages won't work,
    46      * and no more messages will be received. The connection should be destroyed, probably from this callback.
    46      * and no more messages will be received. The connection should be destroyed, probably from this callback.
       
    47      *
       
    48      * NOTE: Implementing this callback is mandatory
    47      */
    49      */
    48     void (*on_error) (struct irc_conn *conn, struct error_info *err, void *arg);
    50     void (*on_error) (struct irc_conn *conn, struct error_info *err, void *arg);
       
    51 
       
    52     /**
       
    53      * The connection was closed cleanly after irc_conn_QUIT.
       
    54      *
       
    55      * You probably want to destroy the irc_conn now to clean up
       
    56      */
       
    57     void (*on_quit) (struct irc_conn *conn, void *arg);
    49 };
    58 };
    50 
    59 
    51 /*
    60 /*
    52  * Connection state
    61  * Connection state
    53  */
    62  */
    65     /** Registration request sent */
    74     /** Registration request sent */
    66     bool registering;
    75     bool registering;
    67 
    76 
    68     /** Registered (as in, we have a working nickname)? */
    77     /** Registered (as in, we have a working nickname)? */
    69     bool registered;
    78     bool registered;
       
    79 
       
    80     /** Quit message sent, waiting for server to close connection */
       
    81     bool quitting;
    70     
    82     
    71     // @}
    83     // @}
    72     
    84     
    73     /** Our current real nickname */
    85     /** Our current real nickname */
    74     char *nickname;
    86     char *nickname;
   142  *
   154  *
   143  * @param nickname the new nickname to use
   155  * @param nickname the new nickname to use
   144  */
   156  */
   145 err_t irc_conn_NICK (struct irc_conn *conn, const char *nickname);
   157 err_t irc_conn_NICK (struct irc_conn *conn, const char *nickname);
   146 
   158 
   147 /*
   159 /**
   148  * Send a USER message
   160  * Send a USER message
   149  *
   161  *
   150  * @param username the username to register with, may be replaced with ident reply
   162  * @param username the username to register with, may be replaced with ident reply
   151  * @param realname the full-name to register with
   163  * @param realname the full-name to register with
   152  */
   164  */
   153 err_t irc_conn_USER (struct irc_conn *conn, const char *username, const char *realname);
   165 err_t irc_conn_USER (struct irc_conn *conn, const char *username, const char *realname);
   154 
   166 
   155 /*
   167 /**
   156  * Send a PONG message to the given target
   168  * Send a PONG message to the given target
   157  *
   169  *
   158  * @param target the PING source, aka. the target to send the PONG reply to
   170  * @param target the PING source, aka. the target to send the PONG reply to
   159  */
   171  */
   160 err_t irc_conn_PONG (struct irc_conn *conn, const char *target);
   172 err_t irc_conn_PONG (struct irc_conn *conn, const char *target);
   161 
   173 
   162 /*
   174 /**
   163  * Send a JOIN message for the given channel
   175  * Send a JOIN message for the given channel
   164  *
   176  *
   165  * XXX: this doesn't implement the full command options
   177  * XXX: this doesn't implement the full command options
   166  *
   178  *
   167  * @param channel the full channel name to join
   179  * @param channel the full channel name to join
   168  */
   180  */
   169 err_t irc_conn_JOIN (struct irc_conn *conn, const char *channel);
   181 err_t irc_conn_JOIN (struct irc_conn *conn, const char *channel);
   170 
   182 
       
   183 /**
       
   184  * Send a QUIT message to the server.
       
   185  *
       
   186  * This updates our state as disconnecting, and waits for the server to close the connection cleanly.
       
   187  */
       
   188 err_t irc_conn_QUIT (struct irc_conn *conn, const char *message);
       
   189 
   171 // @}
   190 // @}
   172 
   191 
   173 #endif /* IRC_CONN_H */
   192 #endif /* IRC_CONN_H */