[srvx-commits] CVS: services/src mod-snoop.c,1.7,1.8
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2002-11-14 00:49:50
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv17448/src
Modified Files:
mod-snoop.c
Log Message:
have a macro to update "timestamp" instead of lots of different variables
don't show PARTs for a dying user
Index: mod-snoop.c
===================================================================
RCS file: /cvsroot/srvx/services/src/mod-snoop.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** mod-snoop.c 12 Nov 2002 02:28:41 -0000 1.7
--- mod-snoop.c 14 Nov 2002 00:49:47 -0000 1.8
***************
*** 46,54 ****
#define SNOOP(FORMAT, ARGS...) send_channel_message(snoop_cfg.channel, snoop_cfg.bot, "%s "FORMAT, timestamp , ## ARGS)
static void
snoop_nick_change(struct userNode *user, const char *new_nick) {
if (!snoop_cfg.enabled) return;
! strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&now));
SNOOP("$bNICK$b change %s -> %s", user->nick, new_nick);
}
--- 46,55 ----
#define SNOOP(FORMAT, ARGS...) send_channel_message(snoop_cfg.channel, snoop_cfg.bot, "%s "FORMAT, timestamp , ## ARGS)
+ #define UPDATE_TIMESTAMP() strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&now))
static void
snoop_nick_change(struct userNode *user, const char *new_nick) {
if (!snoop_cfg.enabled) return;
! UPDATE_TIMESTAMP();
SNOOP("$bNICK$b change %s -> %s", user->nick, new_nick);
}
***************
*** 60,64 ****
if (!snoop_cfg.enabled) return 0;
if (user->uplink->burst && !snoop_cfg.show_bursts) return 0;
! strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&now));
if (chan->members.used == 1) {
SNOOP("$bCREATE$b %s by %s", chan->name, user->nick);
--- 61,65 ----
if (!snoop_cfg.enabled) return 0;
if (user->uplink->burst && !snoop_cfg.show_bursts) return 0;
! UPDATE_TIMESTAMP();
if (chan->members.used == 1) {
SNOOP("$bCREATE$b %s by %s", chan->name, user->nick);
***************
*** 72,76 ****
snoop_part(struct userNode *user, struct chanNode *chan, const char *reason) {
if (!snoop_cfg.enabled) return;
! strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&now));
SNOOP("$bPART$b %s by %s (%s)", chan->name, user->nick, reason ? reason : "");
}
--- 73,78 ----
snoop_part(struct userNode *user, struct chanNode *chan, const char *reason) {
if (!snoop_cfg.enabled) return;
! if (user->dead) return;
! UPDATE_TIMESTAMP();
SNOOP("$bPART$b %s by %s (%s)", chan->name, user->nick, reason ? reason : "");
}
***************
*** 79,83 ****
snoop_kick(struct userNode *kicker, struct userNode *victim, struct chanNode *chan) {
if (!snoop_cfg.enabled) return;
! strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&now));
SNOOP("$bKICK$b %s from %s by %s", victim->nick, chan->name, kicker->nick);
}
--- 81,85 ----
snoop_kick(struct userNode *kicker, struct userNode *victim, struct chanNode *chan) {
if (!snoop_cfg.enabled) return;
! UPDATE_TIMESTAMP();
SNOOP("$bKICK$b %s from %s by %s", victim->nick, chan->name, kicker->nick);
}
***************
*** 87,91 ****
if (!snoop_cfg.enabled) return 0;
if (user->uplink->burst && !snoop_cfg.show_bursts) return 0;
! strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&now));
SNOOP("$bNICK$b %s %s@%s [%ld.%ld.%ld.%ld] on %s", user->nick, user->ident, user->hostname,
(user->ip >> 24) & 255, (user->ip >> 16) & 255, (user->ip >> 8) & 255, user->ip & 255,
--- 89,93 ----
if (!snoop_cfg.enabled) return 0;
if (user->uplink->burst && !snoop_cfg.show_bursts) return 0;
! UPDATE_TIMESTAMP();
SNOOP("$bNICK$b %s %s@%s [%ld.%ld.%ld.%ld] on %s", user->nick, user->ident, user->hostname,
(user->ip >> 24) & 255, (user->ip >> 16) & 255, (user->ip >> 8) & 255, user->ip & 255,
***************
*** 97,101 ****
snoop_del_user(struct userNode *user, struct userNode *killer, const char *why) {
if (!snoop_cfg.enabled) return;
! strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&now));
if (killer) {
SNOOP("$bKILL$b %s (%s@%s, on %s) by %s (%s)", user->nick, user->ident, user->hostname, user->uplink->name, killer->nick, why);
--- 99,103 ----
snoop_del_user(struct userNode *user, struct userNode *killer, const char *why) {
if (!snoop_cfg.enabled) return;
! UPDATE_TIMESTAMP();
if (killer) {
SNOOP("$bKILL$b %s (%s@%s, on %s) by %s (%s)", user->nick, user->ident, user->hostname, user->uplink->name, killer->nick, why);
***************
*** 110,114 ****
if (!snoop_cfg.enabled) return;
if (user->handle_info) {
! strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&now));
SNOOP("$bAUTH$b %s as %s", user->nick, user->handle_info->handle);
}
--- 112,116 ----
if (!snoop_cfg.enabled) return;
if (user->handle_info) {
! UPDATE_TIMESTAMP();
SNOOP("$bAUTH$b %s as %s", user->nick, user->handle_info->handle);
}
***************
*** 131,138 ****
snoop_cfg.channel = AddChannel(str, now, "+sntim", NULL, 0, NULL);
if (!snoop_cfg.channel) return;
- str = database_get_data(node, "show_bursts", RECDB_QSTRING);
- snoop_cfg.show_bursts = str ? enabled_string(str) : 0;
AddChannelUser(snoop_cfg.bot, snoop_cfg.channel);
AddChannelOp(1, &snoop_cfg.bot, snoop_cfg.channel, snoop_cfg.bot, 1);
snoop_cfg.enabled = 1;
}
--- 133,140 ----
snoop_cfg.channel = AddChannel(str, now, "+sntim", NULL, 0, NULL);
if (!snoop_cfg.channel) return;
AddChannelUser(snoop_cfg.bot, snoop_cfg.channel);
AddChannelOp(1, &snoop_cfg.bot, snoop_cfg.channel, snoop_cfg.bot, 1);
+ str = database_get_data(node, "show_bursts", RECDB_QSTRING);
+ snoop_cfg.show_bursts = str ? enabled_string(str) : 0;
snoop_cfg.enabled = 1;
}
|