From: Michael Wallner Date: Tue, 6 Dec 2011 12:03:45 +0000 (+0100) Subject: add Session::doRaw(string msg) X-Git-Tag: RELEASE_0_1_2~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=c490e5a4e66c0e00b2a91db244f44545c576c15b;p=m6w6%2Fext-ircclient add Session::doRaw(string msg) --- diff --git a/php_ircclient.c b/php_ircclient.c index d4cdbbc..6613a72 100644 --- a/php_ircclient.c +++ b/php_ircclient.c @@ -832,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) {} @@ -888,6 +903,8 @@ zend_function_entry php_ircclient_session_method_entry[] = { ME(doCtcpReply) ME(doCtcpRequest) + ME(doRaw) + ME(onConnect) ME(onNick) ME(onQuit)