[srvx-commits] CVS: services/src chanserv.c,1.306,1.307 hash.c,1.165,1.166 hash.h,1.94,1.95 helpserv
Brought to you by:
entrope
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv24537/src
Modified Files:
chanserv.c hash.c hash.h helpserv.c mod-snoop.c nickserv.c
opserv.c proto-bahamut.c proto-p10.c
Log Message:
make PART and QUIT/KILL messages available to callbacks
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.306
retrieving revision 1.307
diff -C2 -r1.306 -r1.307
*** chanserv.c 11 Nov 2002 04:55:29 -0000 1.306
--- chanserv.c 12 Nov 2002 02:28:41 -0000 1.307
***************
*** 6206,6210 ****
static void
! handle_part(struct userNode *user, struct chanNode *channel)
{
struct chanData *cData;
--- 6206,6210 ----
static void
! handle_part(struct userNode *user, struct chanNode *channel, const char *reason)
{
struct chanData *cData;
***************
*** 6212,6215 ****
--- 6212,6216 ----
struct handle_info *handle;
+ (void)reason;
cData = channel->channel_info;
if(!cData || IsSuspended(cData) || IsLocal(user)) return;
Index: hash.c
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.c,v
retrieving revision 1.165
retrieving revision 1.166
diff -C2 -r1.165 -r1.166
*** hash.c 23 Oct 2002 12:37:53 -0000 1.165
--- hash.c 12 Nov 2002 02:28:41 -0000 1.166
***************
*** 542,548 ****
free(mNode);
! for (n=0; n<pf_used; n++) pf_list[n](user, channel);
! if (!deleting && channel->members.used == 0) DelChannel(channel);
}
--- 542,548 ----
free(mNode);
! for (n=0; n<pf_used; n++) pf_list[n](user, channel, reason);
! if (!deleting && !channel->members.used) DelChannel(channel);
}
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.94
retrieving revision 1.95
diff -C2 -r1.94 -r1.95
*** hash.h 23 Oct 2002 12:37:53 -0000 1.94
--- hash.h 12 Nov 2002 02:28:41 -0000 1.95
***************
*** 25,30 ****
#include "dict.h"
! #define MODE_CHANOP 0x0001 /* +o */
! #define MODE_VOICE 0x0002 /* +v */
#define MODE_PRIVATE 0x0004 /* +p */
#define MODE_SECRET 0x0008 /* +s */
--- 25,30 ----
#include "dict.h"
! #define MODE_CHANOP 0x0001 /* +o USER */
! #define MODE_VOICE 0x0002 /* +v USER */
#define MODE_PRIVATE 0x0004 /* +p */
#define MODE_SECRET 0x0008 /* +s */
***************
*** 191,195 ****
typedef int (*new_user_func_t) (struct userNode *user);
void reg_new_user_func(new_user_func_t handler);
! typedef void (*del_user_func_t) (struct userNode *user);
void reg_del_user_func(del_user_func_t handler);
void unreg_del_user_func(del_user_func_t handler);
--- 191,195 ----
typedef int (*new_user_func_t) (struct userNode *user);
void reg_new_user_func(new_user_func_t handler);
! typedef void (*del_user_func_t) (struct userNode *user, struct userNode *killer, const char *why);
void reg_del_user_func(del_user_func_t handler);
void unreg_del_user_func(del_user_func_t handler);
***************
*** 217,221 ****
struct modeNode* AddChannelUser(struct userNode* user, struct chanNode* channel);
! typedef void (*part_func_t) (struct userNode *user, struct chanNode *chan);
void reg_part_func(part_func_t handler);
void unreg_part_func(part_func_t handler);
--- 217,221 ----
struct modeNode* AddChannelUser(struct userNode* user, struct chanNode* channel);
! typedef void (*part_func_t) (struct userNode *user, struct chanNode *chan, const char *reason);
void reg_part_func(part_func_t handler);
void unreg_part_func(part_func_t handler);
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -r1.50 -r1.51
*** helpserv.c 11 Nov 2002 05:31:07 -0000 1.50
--- helpserv.c 12 Nov 2002 02:28:41 -0000 1.51
***************
*** 3253,3257 ****
/* Drop requests that persist until part when a user leaves the chan */
! static void handle_part(struct userNode *user, struct chanNode *chan) {
struct helpserv_botlist *botlist;
struct helpserv_userlist *userlist;
--- 3253,3257 ----
/* Drop requests that persist until part when a user leaves the chan */
! static void handle_part(struct userNode *user, struct chanNode *chan, const char *reason) {
struct helpserv_botlist *botlist;
struct helpserv_userlist *userlist;
***************
*** 3259,3262 ****
--- 3259,3263 ----
unsigned int i;
+ (void)reason;
if ((botlist = dict_find(helpserv_bots_bychan_dict, chan->name, NULL))) {
for (i=0; i < botlist->used; i++) {
***************
*** 3341,3349 ****
* Unassign requests where req->helper persists until the helper parts or
* quits. */
! static void handle_quit(struct userNode *user) {
struct helpserv_reqlist *reqlist;
struct helpserv_userlist *userlist;
unsigned int i, n;
if (IsLocal(user)) {
struct helpserv_bot *hs;
--- 3342,3351 ----
* Unassign requests where req->helper persists until the helper parts or
* quits. */
! static void handle_quit(struct userNode *user, struct userNode *killer, const char *why) {
struct helpserv_reqlist *reqlist;
struct helpserv_userlist *userlist;
unsigned int i, n;
+ (void)killer; (void)why;
if (IsLocal(user)) {
struct helpserv_bot *hs;
Index: mod-snoop.c
===================================================================
RCS file: /cvsroot/srvx/services/src/mod-snoop.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** mod-snoop.c 7 Nov 2002 01:41:17 -0000 1.6
--- mod-snoop.c 12 Nov 2002 02:28:41 -0000 1.7
***************
*** 36,39 ****
--- 36,40 ----
#include "nickserv.h"
+ extern time_t now;
static struct {
struct chanNode *channel;
***************
*** 42,52 ****
unsigned int enabled : 1;
} snoop_cfg;
! #define SNOOP(FORMAT...) send_channel_message(snoop_cfg.channel, snoop_cfg.bot, FORMAT)
static void
snoop_nick_change(struct userNode *user, const char *new_nick) {
if (!snoop_cfg.enabled) return;
! SNOOP("NICK change %s -> %s", user->nick, new_nick);
}
--- 43,55 ----
unsigned int enabled : 1;
} snoop_cfg;
+ static char timestamp[16];
! #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);
}
***************
*** 57,64 ****
if (!snoop_cfg.enabled) return 0;
if (user->uplink->burst && !snoop_cfg.show_bursts) return 0;
if (chan->members.used == 1) {
! SNOOP("CREATE %s by %s", chan->name, user->nick);
} else {
! SNOOP("JOIN %s by %s", chan->name, user->nick);
}
return 0;
--- 60,68 ----
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);
} else {
! SNOOP("$bJOIN$b %s by %s", chan->name, user->nick);
}
return 0;
***************
*** 66,72 ****
static void
! snoop_part(struct userNode *user, struct chanNode *chan) {
if (!snoop_cfg.enabled) return;
! SNOOP("PART %s by %s", chan->name, user->nick);
}
--- 70,77 ----
static void
! 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 : "");
}
***************
*** 74,78 ****
snoop_kick(struct userNode *kicker, struct userNode *victim, struct chanNode *chan) {
if (!snoop_cfg.enabled) return;
! SNOOP("KICK %s from %s by %s", victim->nick, chan->name, kicker->nick);
}
--- 79,84 ----
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 ****
if (!snoop_cfg.enabled) return 0;
if (user->uplink->burst && !snoop_cfg.show_bursts) return 0;
! SNOOP("NICK %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,
user->uplink->name);
--- 87,92 ----
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,
user->uplink->name);
***************
*** 88,94 ****
static void
! snoop_del_user(struct userNode *user) {
if (!snoop_cfg.enabled) return;
! SNOOP("QUIT %s %s@%s from %s", user->nick, user->ident, user->hostname, user->uplink->name);
}
--- 95,106 ----
static void
! 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);
! } else {
! SNOOP("$bQUIT$b %s (%s@%s, on %s) (%s)", user->nick, user->ident, user->hostname, user->uplink->name, why);
! }
}
***************
*** 98,102 ****
if (!snoop_cfg.enabled) return;
if (user->handle_info) {
! SNOOP("AUTH %s as %s", user->nick, user->handle_info->handle);
}
}
--- 110,115 ----
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);
}
}
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.215
retrieving revision 1.216
diff -C2 -r1.215 -r1.216
*** nickserv.c 11 Nov 2002 05:31:07 -0000 1.215
--- nickserv.c 12 Nov 2002 02:28:41 -0000 1.216
***************
*** 3214,3219 ****
void
! nickserv_remove_user(struct userNode *user)
{
if (user->auth_policer) policer_delete(user->auth_policer);
dict_remove(nickserv_allow_auth_dict, user->nick);
--- 3214,3220 ----
void
! nickserv_remove_user(struct userNode *user, struct userNode *killer, const char *why)
{
+ (void)killer; (void)why;
if (user->auth_policer) policer_delete(user->auth_policer);
dict_remove(nickserv_allow_auth_dict, user->nick);
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.288
retrieving revision 1.289
diff -C2 -r1.288 -r1.289
*** opserv.c 7 Nov 2002 00:30:17 -0000 1.288
--- opserv.c 12 Nov 2002 02:28:42 -0000 1.289
***************
*** 1776,1783 ****
static void
! opserv_user_cleanup(struct userNode *user)
{
struct opserv_hostinfo *ohi;
if (IsLocal(user)) {
/* Try to remove it from the reserved nick dict without
--- 1776,1784 ----
static void
! opserv_user_cleanup(struct userNode *user, struct userNode *killer, const char *why)
{
struct opserv_hostinfo *ohi;
+ (void)killer; (void)why;
if (IsLocal(user)) {
/* Try to remove it from the reserved nick dict without
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** proto-bahamut.c 23 Oct 2002 12:37:54 -0000 1.26
--- proto-bahamut.c 12 Nov 2002 02:28:42 -0000 1.27
***************
*** 186,190 ****
DelChannelUser(user, user->channels.list[--nn]->channel, false, 0);
}
! for (nn=duf_used; nn>0; ) duf_list[--nn](user);
user->uplink->clients--;
dict_remove(user->uplink->users, user->nick);
--- 186,190 ----
DelChannelUser(user, user->channels.list[--nn]->channel, false, 0);
}
! for (nn=duf_used; nn>0; ) duf_list[--nn](user, killer, why);
user->uplink->clients--;
dict_remove(user->uplink->users, user->nick);
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -r1.43 -r1.44
*** proto-p10.c 31 Oct 2002 03:43:02 -0000 1.43
--- proto-p10.c 12 Nov 2002 02:28:42 -0000 1.44
***************
*** 1812,1822 ****
unsigned int n;
/* remove user from all channels */
for (n=user->channels.used; n>0;) {
DelChannelUser(user, user->channels.list[--n]->channel, false, 0);
}
/* Call these in reverse order so ChanServ can update presence
information before NickServ nukes the handle_info. */
! for (n = duf_used; n > 0; ) duf_list[--n](user);
user->uplink->clients--;
--- 1812,1828 ----
unsigned int n;
+ /* mark them as dead, in case anybody cares */
+ user->dead = 1;
+
/* remove user from all channels */
for (n=user->channels.used; n>0;) {
DelChannelUser(user, user->channels.list[--n]->channel, false, 0);
}
+
/* Call these in reverse order so ChanServ can update presence
information before NickServ nukes the handle_info. */
! for (n = duf_used; n > 0; ) {
! duf_list[--n](user, killer, why);
! }
user->uplink->clients--;
***************
*** 1844,1848 ****
* a list of clients that get freed after processing each line.
*/
- user->dead = 1;
userList_append(&dead_users, user);
}
--- 1850,1853 ----
|