sas Mon Jul 7 10:39:03 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/ext/ircg ircg.c php_ircg.h
Log:
Add support for who/invite/notice/lusers
Add ircg_names/ircg_invite/ircg_lusers/ircg_oper/ircg_who/ircg_list
# feature patch applied to PHP_4_3 due to won't be released status
# of PHP_4 and HEAD being IRCG 3 incompatible.
Index: php-src/ext/ircg/ircg.c
diff -u php-src/ext/ircg/ircg.c:1.137.2.11 php-src/ext/ircg/ircg.c:1.137.2.12
--- php-src/ext/ircg/ircg.c:1.137.2.11 Thu Jul 3 02:59:43 2003
+++ php-src/ext/ircg/ircg.c Mon Jul 7 10:39:03 2003
@@ -16,7 +16,7 @@
+--+
*/
-/* $Id: ircg.c,v 1.137.2.11 2003/07/03 06:59:43 sas Exp $ */
+/* $Id: ircg.c,v 1.137.2.12 2003/07/07 14:39:03 sas Exp $ */
/* {{{ includes */
@@ -105,6 +105,18 @@
FMT_MSG_DISCONNECTED,
FMT_MSG_LIST,
FMT_MSG_LISTEND,
+ FMT_MSG_WHOREPLY1,
+ FMT_MSG_WHOREPLY2,
+ FMT_MSG_ENDOFWHO,
+ FMT_MSG_INVITE,
+ FMT_MSG_NOTICE_CHAN,
+ FMT_MSG_NOTICE_TO_ME,
+ FMT_MSG_NOTICE_FROM_ME,
+ FMT_MSG_LUSERCLIENT,
+ FMT_MSG_LUSEROP,
+ FMT_MSG_LUSERUNKNOWN,
+ FMT_MSG_LUSERCHANNELS,
+ FMT_MSG_LUSERME,
NO_FMTS
};
/* }}} */
@@ -136,6 +148,12 @@
PHP_FE(ircg_register_format_messages, NULL)
PHP_FE(ircg_get_username, NULL)
PHP_FE(ircg_eval_ecmascript_params, NULL)
+ PHP_FE(ircg_names, NULL)
+ PHP_FE(ircg_invite, NULL)
+ PHP_FE(ircg_lusers, NULL)
+ PHP_FE(ircg_oper, NULL)
+ PHP_FE(ircg_who, NULL)
+ PHP_FE(ircg_list, NULL)
{NULL, NULL, NULL} /* Must be the last line in ircg_functions[] */
};
/* }}} */
@@ -260,7 +278,19 @@
end of ban list for %cbr /,
You have been disconnectedbr /,
Channel %c has %t users and the topic is '%m'br /,
- End of LISTbr /
+ End of LISTbr /,
+ Nickname %t has ident %f, realname '%m', hostname %c, ,
+ is on server %t, has flag %f, hopcount %m, and channel %c.br /,
+ end of whobr /,
+ %f is inviting %t to %cbr /,
+ [notice %c] %f: %mbr /,
+ notice from %f: %mbr /,
+ notice to %t: %mbr /,
+ %t users, %f services, %r serversbr /,
+ %r operatorsbr /,
+ %r unknown connectionsbr /,
+ %r formed channelsbr /,
+ I have %t clients and %r serversbr /,
};
/* }}} */
@@ -885,6 +915,27 @@
msg_send(conn, m);
}
+static void notice_handler(irconn_t *ircc, smart_str *chan, smart_str *from,
+smart_str *msg, void *conn_data, void *chan_data)
+{
+php_irconn_t *conn = conn_data;
+smart_str m = {0};
+smart_str s_username;
+
+smart_str_setl(s_username, ircc-username, ircc-username_len);
+
+if (msg-c[0] == '\001') {
+handle_ctcp(conn, chan, from, chan?chan:s_username, msg, m);
+} else if (chan) {
+FORMAT_MSG(conn, FMT_MSG_NOTICE_CHAN, chan, s_username, from, msg, m,
conn-conn.username, conn-conn.username_len);
+} else {
+FORMAT_MSG(conn, FMT_MSG_NOTICE_TO_ME, NULL, s_username, from,
+msg, m, conn-conn.username, conn-conn.username_len);
+}
+
+msg_send(conn, m);
+}
+
static void nick_handler(irconn_t *c, smart_str *oldnick, smart_str *newnick,
void *dummy)
{
@@ -976,6 +1027,104 @@
msg_send(conn, m);
}
+static void whoreply_handler(irconn_t *c, smart_str *chan, smart_str *user,
+smart_str *host, smart_str *server, smart_str *nick, smart_str *flag,
+smart_str *hopcount, smart_str *realname, void *dummy,
+void *chan_data)
+{
+php_irconn_t *conn = dummy;
+smart_str m = {0};
+
+FORMAT_MSG(conn, FMT_MSG_WHOREPLY1, host, nick, user, realname, m,
+conn-conn.username, conn-conn.username_len);
+
+FORMAT_MSG(conn, FMT_MSG_WHOREPLY2, chan, server, flag, hopcount, m,
+conn-conn.username, conn-conn.username_len);
+msg_send(conn, m);
+}
+
+static void endofwho_handler(irconn_t *c, void *dummy)
+{
+php_irconn_t *conn = dummy;
+smart_str m = {0};
+
+FORMAT_MSG(conn, FMT_MSG_ENDOFWHO, NULL, NULL, NULL, NULL, m,
+conn-conn.username, conn-conn.username_len);
+
+msg_send(conn, m);
+}
+
+static void invite_handler(irconn_t *c, smart_str *nick, smart_str *chan, int mode,
void *dummy)
+{
+php_irconn_t *conn = dummy;
+smart_str m = {0};
+smart_str *from, *to, tmp = {0};
+
+smart_str_setl(tmp, conn-conn.username, conn-conn.username_len);
+if (mode == 1) {
+from = tmp;
+to = nick;
+} else {
+from = nick;
+to = tmp;
+}
+
+FORMAT_MSG(conn, FMT_MSG_INVITE, chan, to, from, NULL, m,
+conn-conn.username, conn-conn.username_len);
+msg_send(conn, m);
+}
+
+
+static void luserclient_handler(irconn_t *c, smart_str *users, smart_str *services,
smart_str *servers)
+{
+ php_irconn_t