src/irc_conn.c
changeset 33 e5139b339b18
parent 32 ae66e9ae4afb
child 37 4fe4a3c4496e
equal deleted inserted replaced
32:ae66e9ae4afb 33:e5139b339b18
    42     { IRC_RPL_WELCOME,  on_RPL_WELCOME      },
    42     { IRC_RPL_WELCOME,  on_RPL_WELCOME      },
    43     { "PING",           on_PING             },
    43     { "PING",           on_PING             },
    44     { NULL,             NULL,               },
    44     { NULL,             NULL,               },
    45 };
    45 };
    46 
    46 
    47 /*
    47 /**
    48  * Incoming line handler
    48  * Incoming line handler
    49  */
    49  */
    50 void irc_conn_on_line (char *line_buf, void *arg) 
    50 void irc_conn_on_line (char *line_buf, void *arg) 
    51 {
    51 {
    52     struct irc_conn *conn = arg;
    52     struct irc_conn *conn = arg;
    78             }
    78             }
    79         }
    79         }
    80     }
    80     }
    81 }
    81 }
    82 
    82 
       
    83 /**
       
    84  * Transport failed
       
    85  */
       
    86 void irc_conn_on_error (struct error_info *err, void *arg)
       
    87 {
       
    88     struct irc_conn *conn = arg;
       
    89 
       
    90     // log
       
    91     log_err_info(err, "line_proto error");
       
    92 
       
    93     // XXX: notify user
       
    94 }
       
    95 
    83 static struct line_proto_callbacks _lp_callbacks = {
    96 static struct line_proto_callbacks _lp_callbacks = {
    84     .on_line        = &irc_conn_on_line,
    97     .on_line        = &irc_conn_on_line,
       
    98     .on_error       = &irc_conn_on_error,
    85 };
    99 };
    86 
   100 
    87 err_t irc_conn_create (struct irc_conn **conn_ptr, struct sock_stream *sock, const struct irc_conn_callbacks *callbacks, 
   101 err_t irc_conn_create (struct irc_conn **conn_ptr, struct sock_stream *sock, const struct irc_conn_callbacks *callbacks, 
    88         void *cb_arg, struct error_info *err)
   102         void *cb_arg, struct error_info *err)
    89 {
   103 {