sas             Mon Jul  7 11:33:08 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/ircg   ircg.c 
  Log:
  Fixing
  
  
Index: php-src/ext/ircg/ircg.c
diff -u php-src/ext/ircg/ircg.c:1.137.2.12 php-src/ext/ircg/ircg.c:1.137.2.13
--- php-src/ext/ircg/ircg.c:1.137.2.12  Mon Jul  7 10:39:03 2003
+++ php-src/ext/ircg/ircg.c     Mon Jul  7 11:33:08 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ircg.c,v 1.137.2.12 2003/07/07 14:39:03 sas Exp $ */
+/* $Id: ircg.c,v 1.137.2.13 2003/07/07 15:33:08 sas Exp $ */
 
 /* {{{ includes */
 
@@ -1075,7 +1075,7 @@
 }
 
 
-static void luserclient_handler(irconn_t *c, smart_str *users, smart_str *services, 
smart_str *servers)
+static void luserclient_handler(irconn_t *c, smart_str *users, smart_str *services, 
smart_str *servers, void *dummy)
 {
        php_irconn_t *conn = dummy;
        smart_str m = {0};
@@ -1085,7 +1085,7 @@
        msg_send(conn, &m);
 }
 
-static void luserme_handler(irconn_t *c, smart_str *users, smart_str *servers)
+static void luserme_handler(irconn_t *c, smart_str *users, smart_str *servers, void 
*dummy)
 {
        php_irconn_t *conn = dummy;
        smart_str m = {0};
@@ -1095,7 +1095,7 @@
        msg_send(conn, &m);
 }
 
-static void luserop_t(irconn_t *dummy, smart_str *str)
+static void luserop_handler(irconn_t *c, smart_str *str, void *dummy)
 {
        php_irconn_t *conn = dummy;
        smart_str m = {0};
@@ -1105,7 +1105,7 @@
        msg_send(conn, &m);
 }
 
-static void luserunknown_t(irconn_t *dummy, smart_str *str)
+static void luserunknown_handler(irconn_t *c, smart_str *str, void *dummy)
 {
        php_irconn_t *conn = dummy;
        smart_str m = {0};
@@ -1115,7 +1115,7 @@
        msg_send(conn, &m);
 }
 
-static void luserchannels_t(irconn_t *dummy, smart_str *str)
+static void luserchannels_handler(irconn_t *c, smart_str *str, void *dummy)
 {
        php_irconn_t *conn = dummy;
        smart_str m = {0};
@@ -1739,8 +1739,6 @@
 
     irc_handle_command(&conn->conn, "WHO", ops ? 2 : 1, Z_STRVAL_PP(p2), "o");
 
-    put_irconn(conn);
-
     RETVAL_TRUE;
 }
 #endif
@@ -1768,7 +1766,6 @@
 
     irc_handle_command(&conn->conn, "INVITE", 2, Z_STRVAL_PP(p3),
             Z_STRVAL_PP(p2));
-    put_irconn(conn);
 
     RETVAL_TRUE;
 }
@@ -1799,7 +1796,7 @@
 
        if (!conn) RETURN_FALSE;
        
-       irc_handle_command(&conn->conn, "NAMES", ac > 2 ? 2 : 1, Z_STRVAL_PP(p2), 
Z_STRVAL_PP(p3));
+       irc_handle_command(&conn->conn, "NAMES", ac > 2 ? 2 : 1, Z_STRVAL_PP(p2), ac > 
2 ? Z_STRVAL_PP(p3) : NULL);
        RETVAL_TRUE;
 }
 /* }}} */
@@ -2132,8 +2129,10 @@
                irc_set_realname(conn, &m);
        }
 #endif
-       
-#define IFMSG(n, p, q) if (MSG(irconn, n)->ntoken != 0) irc_register_hook(conn, p, q)
+
+#define MSG_NOT_EMPTY(n) (MSG(irconn,n) && MSG(irconn,n)->ntoken != 0)
+
+#define IFMSG(n, p, q) if (MSG_NOT_EMPTY(n)) irc_register_hook(conn, p, q)
        
        irc_register_hook(conn, IRCG_MSG, msg_handler);
        irc_register_hook(conn, IRCG_QUIT, quit_handler);
@@ -2357,8 +2356,8 @@
 }
 /* }}} */
 
-/* {{{ proto bool ircg_nick(void)
-   ??? */
+/* {{{ proto bool ircg_nick(int connection, string newnick)
+   Changes the nickname */
 PHP_FUNCTION(ircg_nick)
 {
        zval **id, **newnick;
@@ -2380,8 +2379,32 @@
 }
 /* }}} */
 
-/* {{{ proto bool ircg_notice(void)
-   ??? */
+/* {{{ proto bool ircg_list(int connection, string channel)
+   List topic/user count of channel(s) */
+PHP_FUNCTION(ircg_list)
+{
+       zval **id, **p2;
+       php_irconn_t *conn;
+       int ac = ZEND_NUM_ARGS();
+       
+       if (ac != 2 || zend_get_parameters_ex(ac, &id, &p2) == FAILURE)
+               WRONG_PARAM_COUNT;
+
+       convert_to_long_ex(id);
+       convert_to_string_ex(p2);
+
+       conn = lookup_irconn(Z_LVAL_PP(id));
+
+       if (!conn) RETURN_FALSE;
+       
+       irc_handle_command(&conn->conn, "LIST", 1, Z_STRVAL_PP(p2));
+       
+       RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto bool ircg_notice(int connection, string recipient, string message)
+   Sends a one-way communication NOTICE to a target */
 PHP_FUNCTION(ircg_notice)
 {
        zval **id, **recipient, **msg;
@@ -2666,9 +2689,9 @@
        php_info_print_table_start();
        php_info_print_table_header(2, "ircg support", "enabled");
        
-       sprintf(buf, "%lu", getdtablesize());
+       sprintf(buf, "%d", getdtablesize());
        php_info_print_table_row(2, "Maximum number of open fds", buf);
-       sprintf(buf, "%lu", highest_fd);
+       sprintf(buf, "%d", highest_fd);
        php_info_print_table_row(2, "Highest encountered fd", buf);
 
        sprintf(buf, "%lu", cache_hits);



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

Reply via email to