fix typo
[m6w6/ext-ircclient] / php_ircclient.c
index 86eb96ae7d4f4f6e31b48c3638cebd6cfd762a19..2ffa331e25ca8f272e8aed67c6406ff9bbdebbca 100644 (file)
@@ -1,22 +1,3 @@
-/*
-  +----------------------------------------------------------------------+
-  | PHP Version 5                                                        |
-  +----------------------------------------------------------------------+
-  | Copyright (c) 1997-2011 The PHP Group                                |
-  +----------------------------------------------------------------------+
-  | This source file is subject to version 3.01 of the PHP license,      |
-  | that is bundled with this package in the file LICENSE, and is        |
-  | available through the world-wide-web at the following url:           |
-  | http://www.php.net/license/3_01.txt                                  |
-  | If you did not receive a copy of the PHP license and are unable to   |
-  | obtain it through the world-wide-web, please send a note to          |
-  | license@php.net so we can mail you a copy immediately.               |
-  +----------------------------------------------------------------------+
-  | Author:                                                              |
-  +----------------------------------------------------------------------+
-*/
-
-/* $Id: header 310447 2011-04-23 21:14:10Z bjori $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -79,7 +60,7 @@ done:
 
 const zend_function_entry php_ircclient_function_entry[] = {
        ZEND_NS_FENTRY("irc\\client", parse_origin, ZEND_FN(parse_origin), NULL, 0)
-       PHP_FE_END
+       {0}
 };
 
 zend_module_entry ircclient_module_entry = {
@@ -161,10 +142,10 @@ zend_object_value php_ircclient_session_object_create(zend_class_entry *ce TSRML
        zend_object_std_init((zend_object *) obj, ce TSRMLS_CC);
        object_properties_init((zend_object *) obj, ce);
 #else
-    obj->zo.ce = ce;
-    ALLOC_HASHTABLE(obj->zo.properties);
-    zend_hash_init(obj->zo.properties, zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
-    zend_hash_copy(obj->zo.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+       obj->zo.ce = ce;
+       ALLOC_HASHTABLE(obj->zo.properties);
+       zend_hash_init(obj->zo.properties, zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
+       zend_hash_copy(obj->zo.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
 #endif
 
        obj->sess = irc_create_session(&php_ircclient_callbacks);
@@ -672,7 +653,7 @@ PHP_METHOD(Session, doChannelMode)
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &chan_str, &chan_len, &mode_str, &mode_len)) {
                php_ircclient_session_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
 
-               if (0 != irc_cmd_topic(obj->sess, chan_str, mode_str)) {
+               if (0 != irc_cmd_channel_mode(obj->sess, chan_str, mode_str)) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", irc_strerror(irc_errno(obj->sess)));
                        RETVAL_FALSE;
                } else {
@@ -851,7 +832,22 @@ PHP_METHOD(Session, doCtcpRequest)
        }
 }
 
+PHP_METHOD(Session, doRaw)
+{
+       char *msg_str;
+       int msg_len;
 
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &msg_str, &msg_len)) {
+               php_ircclient_session_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+
+               if (0 != irc_send_raw(obj->sess, "%.*s", msg_len, msg_str)) {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", irc_strerror(irc_errno(obj->sess)));
+                       RETVAL_FALSE;
+               } else {
+                       RETVAL_TRUE;
+               }
+       }
+}
 
 PHP_METHOD(Session, onConnect) {}
 PHP_METHOD(Session, onNick) {}
@@ -907,6 +903,8 @@ zend_function_entry php_ircclient_session_method_entry[] = {
        ME(doCtcpReply)
        ME(doCtcpRequest)
 
+       ME(doRaw)
+
        ME(onConnect)
        ME(onNick)
        ME(onQuit)
@@ -929,7 +927,7 @@ zend_function_entry php_ircclient_session_method_entry[] = {
        ME(onDccChatReq)
        ME(onDccSendReq)
        ME(onError)
-       PHP_FE_END
+       {0}
 };
 
 PHP_MINIT_FUNCTION(ircclient)