sas             Sun Feb 25 13:53:20 2001 EDT

  Modified files:              
    /php4/ext/ircg      ircg.c 
  Log:
  Provide improved means for mass joins
  
  
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.37 php4/ext/ircg/ircg.c:1.38
--- php4/ext/ircg/ircg.c:1.37   Sun Feb 25 10:16:42 2001
+++ php4/ext/ircg/ircg.c        Sun Feb 25 13:53:19 2001
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ircg.c,v 1.37 2001/02/25 18:16:42 sas Exp $ */
+/* $Id: ircg.c,v 1.38 2001/02/25 21:53:19 sas Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -52,6 +52,9 @@
        FMT_MSG_SELF_PART,
        FMT_MSG_NICK,
        FMT_MSG_QUIT,
+       FMT_MSG_MASS_JOIN_BEGIN,
+       FMT_MSG_MASS_JOIN_ELEMENT,
+       FMT_MSG_MASS_JOIN_END,
        NO_FMTS
 };
 
@@ -106,7 +109,10 @@
        "",
        "",
        "%f changes nick to %t<br />",
-       "%f quits (%m)<br />"
+       "%f quits (%m)<br />",
+       "Welcome",
+       " %f",
+       " in this very fine channel"
 };
 
 #define MSG(conn, type) \
@@ -180,7 +186,6 @@
        int mode = 0;
        smart_str encoded_msg = {0};
 
-       result->len = 0;
        if (fmt[0] == '\0') {
                return;
        }
@@ -367,16 +372,25 @@
        int i;
        static smart_str m;
 
-       for (i = 0; i < nr; i++) {
+       if (nr > 1) {
                m.len = 0;
-               format_msg(MSG(conn, FMT_MSG_JOIN), channel, NULL, users[i].c,
+               
+               format_msg(MSG(conn, FMT_MSG_MASS_JOIN_BEGIN), channel, NULL, NULL,
                                "", &m);
-               msg_send(conn, &m);
-       }
-
-       m.len = 0;
-       format_msg(MSG(conn, FMT_MSG_JOIN_LIST_END), channel, NULL, NULL,
+               for (i = 0; i < nr; i++) {
+                       format_msg(MSG(conn, FMT_MSG_MASS_JOIN_ELEMENT), channel, NULL,
+                                       users[i].c, "", &m);
+               }
+       
+               format_msg(MSG(conn, FMT_MSG_MASS_JOIN_END), channel, NULL, NULL,
+                               "", &m);
+       } else {
+               m.len = 0;
+               format_msg(MSG(conn, FMT_MSG_JOIN), channel, NULL, users[0].c,
+                               "", &m);
+               format_msg(MSG(conn, FMT_MSG_JOIN_LIST_END), channel, NULL, NULL,
                        "", &m);
+       }
        msg_send(conn, &m);
 }
 
@@ -395,6 +409,7 @@
        php_irconn_t *conn = dummy;
        static smart_str m;
 
+       m.len = 0;
        format_msg(MSG(conn, FMT_MSG_SELF_PART), channel, NULL, conn->conn.username, 
"", &m);
        msg_send(conn, &m);
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to