src/irc_conn.c
changeset 49 96e0f703a58c
parent 48 4841f4398fd2
child 75 ff6272398d2e
equal deleted inserted replaced
48:4841f4398fd2 49:96e0f703a58c
   136 {
   136 {
   137     struct irc_conn *conn = arg;
   137     struct irc_conn *conn = arg;
   138 
   138 
   139     // EOF after quit?
   139     // EOF after quit?
   140     if (ERROR_CODE(err) == ERR_READ_EOF && conn->quitting) {
   140     if (ERROR_CODE(err) == ERR_READ_EOF && conn->quitting) {
       
   141         // udpate states
       
   142         conn->registered = false;
       
   143         conn->quitting = false;
       
   144         conn->quit = true;
       
   145 
   141         // callback
   146         // callback
   142         if (conn->callbacks.on_quit)
   147         if (conn->callbacks.on_quit)
   143             conn->callbacks.on_quit(conn, conn->cb_arg);
   148             conn->callbacks.on_quit(conn, conn->cb_arg);
   144 
   149 
   145     } else {
   150     } else {
   304     struct irc_line line = {
   309     struct irc_line line = {
   305         NULL, "QUIT", { message, NULL }
   310         NULL, "QUIT", { message, NULL }
   306     };
   311     };
   307     
   312     
   308     // state check
   313     // state check
   309     if (conn->quitting)
   314     if (conn->quitting || conn->quit)
   310         return ERR_IRC_CONN_QUIT_STATE;
   315         return ERR_IRC_CONN_QUIT_STATE;
   311     
   316     
   312     // try and send
   317     // try and send
   313     if ((err = irc_conn_send(conn, &line)))
   318     if ((err = irc_conn_send(conn, &line)))
   314         return err;
   319         return err;