sas             Sat Mar 10 15:15:22 2001 EDT

  Modified files:              
    /php4/ext/ircg      ircg.c 
  Log:
  Add 1 modifier which causes a JS-encoded string to be inserted
  
  
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.50 php4/ext/ircg/ircg.c:1.51
--- php4/ext/ircg/ircg.c:1.50   Fri Mar  9 10:13:29 2001
+++ php4/ext/ircg/ircg.c        Sat Mar 10 15:15:21 2001
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ircg.c,v 1.50 2001/03/09 18:13:29 sas Exp $ */
+/* $Id: ircg.c,v 1.51 2001/03/10 23:15:21 sas Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -222,6 +222,7 @@
        int encoded = 0;
        int js_encoded = 0;
        unsigned long len;
+       int mod_encode;
        
        if (fmt[0] == '\0') {
                return;
@@ -235,17 +236,35 @@
                
                c = q[1];
                
+               mod_encode = 0;
+
+
+#define IRCG_APPEND(what) \
+               if (mod_encode) { \
+                       smart_str tmp = {0}; \
+                       ircg_js_escape(what, &tmp); \
+                       smart_str_append_ex(result, &tmp, 1); \
+                       smart_str_free(&tmp); \
+               } else { \
+                       smart_str_append_ex(result, what, 1); \
+               }
+               
+again:
                switch (c) {
+               case '1':
+                       mod_encode = 1;
+                       goto again;
                case 'c':
-                       smart_str_append_ex(result, channel, 1);
+                       IRCG_APPEND(channel);
                        break;
                case 't':
-                       smart_str_append_ex(result, to, 1);
+                       IRCG_APPEND(to);
                        break;
                case 'f':
-                       smart_str_append_ex(result, from, 1);
+                       IRCG_APPEND(from);
                        break;
                case 'j':
+append_js_encoded_msg:
                        if (!encoded) {
                                ircg_mirc_color(msg->c, &encoded_msg, msg->len);
                                encoded = 1;
@@ -257,6 +276,7 @@
                        smart_str_append_ex(result, &js_encoded_msg, 1);
                        break;
                case 'm':
+                       if (mod_encode) goto append_js_encoded_msg;
                        if (!encoded) {
                                ircg_mirc_color(msg->c, &encoded_msg, msg->len);
                                encoded = 1;
@@ -267,7 +287,7 @@
                        smart_str_appendc_ex(result, c, 1);
                        break;
                case 'r':
-                       smart_str_append_ex(result, msg, 1);
+                       IRCG_APPEND(msg);
                        break;
                case 0:
                        goto finish_loop;



-- 
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