sas             Wed Sep 25 15:20:23 2002 EDT

  Modified files:              
    /php4/ext/ircg      ircg.c 
  Log:
  Add support for LIST
  
  
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.135 php4/ext/ircg/ircg.c:1.136
--- php4/ext/ircg/ircg.c:1.135  Sat Sep 21 16:14:18 2002
+++ php4/ext/ircg/ircg.c        Wed Sep 25 15:20:23 2002
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ircg.c,v 1.135 2002/09/21 20:14:18 sas Exp $ */
+/* $Id: ircg.c,v 1.136 2002/09/25 19:20:23 sas Exp $ */
 
 /* {{{ includes */
 
@@ -99,6 +99,8 @@
        FMT_MSG_BANLIST,
        FMT_MSG_BANLIST_END,
        FMT_MSG_DISCONNECTED,
+       FMT_MSG_LIST,
+       FMT_MSG_LISTEND,
        NO_FMTS
 };
 /* }}} */
@@ -252,7 +254,9 @@
        "%f sets channel operator flag of %t to %m on %c<br />",
        "banned from %c: %m<br />",
        "end of ban list for %c<br />",
-       "You have been disconnected<br />"
+       "You have been disconnected<br />",
+       "Channel %c has %t users and the topic is '%m'<br />",
+       "End of LIST<br />"
 };
 
 /* }}} */
@@ -948,6 +952,27 @@
        msg_send(conn, &m);
 }
 
+static void list_handler(irconn_t *c, smart_str *channel, smart_str *visible,
+               smart_str *topic, void *dummy)
+{
+       php_irconn_t *conn = dummy;
+       smart_str m = {0};
+
+       FORMAT_MSG(conn, FMT_MSG_LIST, channel, visible, NULL, topic, &m, 
+                       conn->conn.username, conn->conn.username_len);
+       msg_send(conn, &m);
+}
+
+static void listend_handler(irconn_t *c, void *dummy)
+{
+       php_irconn_t *conn = dummy;
+       smart_str m = {0};
+
+       FORMAT_MSG(conn, FMT_MSG_LISTEND, NULL, NULL, NULL, NULL, &m,
+                       conn->conn.username, conn->conn.username_len);
+       msg_send(conn, &m);
+}
+
 /* }}} */
 
 /* {{{ Post-connection error-storage */
@@ -956,8 +981,8 @@
  * This is an internal API which serves the purpose to store the reason
  * for terminating a connection.  The termination will cause the
  * connection id to become invalid.  A script can then use a
- * function to retrieve the last error message which was received
- * from the IRC server, and will usually present a nicely formatted
+ * function to retrieve the last error message associated with that id
+ * and will usually present a nicely formatted
  * error message to the end-user.
  *
  * We automatically garbage-collect every GC_INTVL seconds, so there is
@@ -1811,6 +1836,13 @@
        irc_register_hook(conn, IRCG_BANLIST, banlist_handler);
        irc_register_hook(conn, IRCG_ENDOFBANLIST, end_of_banlist_handler);
 #endif
+
+#if IRCG_API_VERSION >= 20020922
+       /* RPL_LIST/RPL_LISTEND */
+       irc_register_hook(conn, IRCG_LIST, list_handler);
+       irc_register_hook(conn, IRCG_LISTEND, listend_handler);
+#endif
+       
 }
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to