cvs: php4 /ext/ircg ircg.c php_ircg.h
| From: | Sascha Schumann | Date: | Fri, 10 Aug 2001 14:42:01 +0000 |
| Subject: | cvs: php4 /ext/ircg ircg.c php_ircg.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6711@lists.php.net to get a copy of this message | ||
sas Fri Aug 10 10:42:01 2001 EDT
Modified files:
/php4/ext/ircg ircg.c php_ircg.h
Log:
ircg_get_username retrieves the connection's username.
ircg will update the username, when/if the server truncates it, so this
provides a facility to get hold of that updated view.
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.98 php4/ext/ircg/ircg.c:1.99
--- php4/ext/ircg/ircg.c:1.98 Mon Aug 6 02:19:52 2001
+++ php4/ext/ircg/ircg.c Fri Aug 10 10:42:00 2001
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ircg.c,v 1.98 2001/08/06 06:19:52 sas Exp $ */
+/* $Id: ircg.c,v 1.99 2001/08/10 14:42:00 sas Exp $ */
#include <time.h>
@@ -101,6 +101,7 @@
PHP_FE(ircg_is_conn_alive, NULL)
PHP_FE(ircg_lookup_format_messages, NULL)
PHP_FE(ircg_register_format_messages, NULL)
+ PHP_FE(ircg_get_username, NULL)
{NULL, NULL, NULL} /* Must be the last line in ircg_functions[] */
};
/* }}} */
@@ -984,6 +985,23 @@
zend_hash_index_del(&h_fd2irconn, fd);
zend_hash_index_del(&h_irconn, stored_id);
+}
+
+PHP_FUNCTION(ircg_get_username)
+{
+ zval **p1;
+ php_irconn_t *conn;
+
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &p1) == FAILURE)
+ WRONG_PARAM_COUNT;
+
+ convert_to_long_ex(p1);
+
+ conn = lookup_irconn(Z_LVAL_PP(p1));
+
+ if (!conn) RETURN_FALSE;
+
+ RETVAL_STRINGL(conn->conn.username, conn->conn.username_len, 1);
}
PHP_FUNCTION(ircg_set_current)
Index: php4/ext/ircg/php_ircg.h
diff -u php4/ext/ircg/php_ircg.h:1.14 php4/ext/ircg/php_ircg.h:1.15
--- php4/ext/ircg/php_ircg.h:1.14 Sun Jul 29 15:02:50 2001
+++ php4/ext/ircg/php_ircg.h Fri Aug 10 10:42:01 2001
@@ -51,6 +51,7 @@
PHP_FUNCTION(ircg_register_format_messages);
PHP_FUNCTION(ircg_nickname_escape);
PHP_FUNCTION(ircg_nickname_unescape);
+PHP_FUNCTION(ircg_get_username);
PHP_MINIT_FUNCTION(ircg);
PHP_MSHUTDOWN_FUNCTION(ircg);