sas             Sun Feb 18 00:30:12 2001 EDT

  Modified files:              
    /php4/ext/ircg      ircg.c 
  Log:
  Add a new format string identifier 'r' which inserts the raw message.
  
  Also port the ctcp copy function to the hash_ex API as per Andi's
  suggestion.
  
  
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.27 php4/ext/ircg/ircg.c:1.28
--- php4/ext/ircg/ircg.c:1.27   Sat Feb 17 09:36:44 2001
+++ php4/ext/ircg/ircg.c        Sun Feb 18 00:30:12 2001
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ircg.c,v 1.27 2001/02/17 17:36:44 sas Exp $ */
+/* $Id: ircg.c,v 1.28 2001/02/18 08:30:12 sas Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -209,6 +209,9 @@
                        case 'm':
                                smart_str_append_ex(result, &encoded_msg, 1);
                                break;
+                       case 'r':
+                               smart_str_appends_ex(result, msg, 1);
+                               break;
                        default:
                                smart_str_appendc_ex(result, '%', 1);
                                smart_str_appendc_ex(result, c, 1);
@@ -581,16 +584,18 @@
        zval **val;
        char *str;
        ulong num;
+       ulong str_len;
+       HashPosition pos;
 
-       zend_hash_internal_pointer_reset(Z_ARRVAL_PP(array));
+       zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(array), &pos);
 
-       while (zend_hash_get_current_key(Z_ARRVAL_PP(array), &str, &num, 0) == 
HASH_KEY_IS_STRING) {
-               zend_hash_get_current_data(Z_ARRVAL_PP(array), (void **) &val);
+       while (zend_hash_get_current_key_ex(Z_ARRVAL_PP(array), &str, &str_len, &num, 
+0, &pos) == HASH_KEY_IS_STRING) {
+               zend_hash_get_current_data_ex(Z_ARRVAL_PP(array), (void **) &val, 
+&pos);
                convert_to_string_ex(val);
-               zend_hash_add(&conn->ctcp_msgs, str, strlen(str), Z_STRVAL_PP(val),
+               zend_hash_add(&conn->ctcp_msgs, str, str_len - 1, Z_STRVAL_PP(val),
                                Z_STRLEN_PP(val) + 1, NULL);
                
-               zend_hash_move_forward(Z_ARRVAL_PP(array));
+               zend_hash_move_forward_ex(Z_ARRVAL_PP(array), &pos);
        }
        
        return 0;



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