--- a/src/irc_net.c Thu Mar 12 23:15:57 2009 +0200
+++ b/src/irc_net.c Thu Mar 12 23:54:03 2009 +0200
@@ -58,11 +58,26 @@
}
/**
+ * Our irc_conn has quit succesfully
+ */
+static void irc_net_conn_quit (struct irc_conn *conn, void *arg)
+{
+ struct irc_net *net = arg;
+
+ // clean up the conn
+ irc_conn_destroy(conn);
+ net->conn = NULL;
+
+ // XXX: notify user
+}
+
+/**
* Our irc_conn_callbacks list
*/
struct irc_conn_callbacks _conn_callbacks = {
.on_registered = &irc_net_conn_registered,
.on_error = &irc_net_conn_error,
+ .on_quit = &irc_net_conn_quit,
};
/**
@@ -244,3 +259,11 @@
return NULL;
}
+err_t irc_net_quit (struct irc_net *net, const char *message)
+{
+ if (!net->conn)
+ return ERR_IRC_NET_QUIT_STATE;
+
+ // send the QUIT message, and then we can wait for the reply
+ return irc_conn_QUIT(net->conn, message);
+}