src/irc_conn.h
changeset 48 4841f4398fd2
parent 45 71e65564afd2
child 49 96e0f703a58c
--- a/src/irc_conn.h	Thu Mar 12 23:15:57 2009 +0200
+++ b/src/irc_conn.h	Thu Mar 12 23:54:03 2009 +0200
@@ -44,8 +44,17 @@
     /**
      * The connection has failed in some way, and can not be considered useable anymore. Sending messages won't work,
      * and no more messages will be received. The connection should be destroyed, probably from this callback.
+     *
+     * NOTE: Implementing this callback is mandatory
      */
     void (*on_error) (struct irc_conn *conn, struct error_info *err, void *arg);
+
+    /**
+     * The connection was closed cleanly after irc_conn_QUIT.
+     *
+     * You probably want to destroy the irc_conn now to clean up
+     */
+    void (*on_quit) (struct irc_conn *conn, void *arg);
 };
 
 /*
@@ -67,6 +76,9 @@
 
     /** Registered (as in, we have a working nickname)? */
     bool registered;
+
+    /** Quit message sent, waiting for server to close connection */
+    bool quitting;
     
     // @}
     
@@ -144,7 +156,7 @@
  */
 err_t irc_conn_NICK (struct irc_conn *conn, const char *nickname);
 
-/*
+/**
  * Send a USER message
  *
  * @param username the username to register with, may be replaced with ident reply
@@ -152,14 +164,14 @@
  */
 err_t irc_conn_USER (struct irc_conn *conn, const char *username, const char *realname);
 
-/*
+/**
  * Send a PONG message to the given target
  *
  * @param target the PING source, aka. the target to send the PONG reply to
  */
 err_t irc_conn_PONG (struct irc_conn *conn, const char *target);
 
-/*
+/**
  * Send a JOIN message for the given channel
  *
  * XXX: this doesn't implement the full command options
@@ -168,6 +180,13 @@
  */
 err_t irc_conn_JOIN (struct irc_conn *conn, const char *channel);
 
+/**
+ * Send a QUIT message to the server.
+ *
+ * This updates our state as disconnecting, and waits for the server to close the connection cleanly.
+ */
+err_t irc_conn_QUIT (struct irc_conn *conn, const char *message);
+
 // @}
 
 #endif /* IRC_CONN_H */