cvs: php4 /ext/ircg ircg.c

From: Date: Sun, 18 Feb 2001 10:08:21 +0000
Subject: cvs: php4 /ext/ircg ircg.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-4084@lists.php.net to get a copy of this message
sas Sun Feb 18 02:08:21 2001 EDT Modified files: /php4/ext/ircg ircg.c Log: Add code for user-quit hook Index: php4/ext/ircg/ircg.c diff -u php4/ext/ircg/ircg.c:1.30 php4/ext/ircg/ircg.c:1.31 --- php4/ext/ircg/ircg.c:1.30 Sun Feb 18 01:44:29 2001 +++ php4/ext/ircg/ircg.c Sun Feb 18 02:08:21 2001 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ircg.c,v 1.30 2001/02/18 09:44:29 sas Exp $ */ +/* $Id: ircg.c,v 1.31 2001/02/18 10:08:21 sas Exp $ */ #include "php.h" #include "php_ini.h" @@ -51,6 +51,7 @@ FMT_MSG_JOIN_LIST_END, FMT_MSG_SELF_PART, FMT_MSG_NICK, + FMT_MSG_QUIT, NO_FMTS }; @@ -99,7 +100,8 @@ "Fatal Error: %m<br />", "", "", - "%f changes nick to %t<br />" + "%f changes nick to %t<br />", + "%f quits (%m)<br />" }; #define MSG(conn, type) \ @@ -403,6 +405,16 @@ smart_str_free_ex(&m, 1); } +static void user_quit(irconn_t *ircc, smart_str *user, smart_str *msg, void *dummy) +{ + php_irconn_t *conn = dummy; + smart_str m = {0}; + + format_msg(MSG(conn, FMT_MSG_QUIT), NULL, NULL, user->c, msg->c, &m); + msg_send(conn, &m); + smart_str_free_ex(&m, 1); +} + static void user_kick(irconn_t *ircc, const char *channel, smart_str *who, smart_str *kicked_by, smart_str *reason, void *dummy) { php_irconn_t *conn = dummy; @@ -578,6 +590,7 @@ irc_register_hook(conn, IRCG_USER_ADD, user_add); irc_register_hook(conn, IRCG_USER_LEAVE, user_leave); irc_register_hook(conn, IRCG_USER_KICK, user_kick); + irc_register_hook(conn, IRCG_USER_QUIT, user_quit); irc_register_hook(conn, IRCG_TOPIC, new_topic); }

« previous php.cvs (#4084) next »