Thread: [srvx-commits] CVS: services/src chanserv.c,1.295,1.296 hash.c,1.164,1.165 hash.h,1.93,1.94 helpserv
Brought to you by:
entrope
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv24315/src
Modified Files:
chanserv.c hash.c hash.h helpserv.c mod-snoop.c opserv.c
proto-bahamut.c proto-p10.c
Log Message:
do not reference a channel or modeNode if a join_func() handler kicked the user
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.295
retrieving revision 1.296
diff -C2 -r1.295 -r1.296
*** chanserv.c 21 Oct 2002 03:55:19 -0000 1.295
--- chanserv.c 23 Oct 2002 12:37:53 -0000 1.296
***************
*** 211,214 ****
--- 211,215 ----
#define CSMSG_INFO_LINE "Your info line is: %s."
#define CSMSG_NO_INFO_LINE "You don't have an info line set."
+ #define CSMSG_WIPED_INFO_LINE "Removed $b%s$b's infoline in $b%s$b."
#define CSMSG_TOPIC_SET "Topic is now '%s'."
***************
*** 4275,4278 ****
--- 4276,4298 ----
}
+ static MODCMD_FUNC(cmd_wipeinfo)
+ {
+ /* TODO */
+ struct handle_info *victim;
+ struct userData *ud;
+
+ REQUIRE_PARAMS(2);
+ if(!(victim = chanserv_get_handle_info(user, argv[1]))) return 0;
+ if(!(ud = GetTrueChannelAccess(channel->channel_info, victim)))
+ {
+ reply(CSMSG_NO_CHAN_USER, argv[1], channel->name);
+ return 0;
+ }
+ if (ud->info) free(ud->info);
+ ud->info = NULL;
+ reply(CSMSG_WIPED_INFO_LINE, argv[1], channel->name);
+ return 1;
+ }
+
static CHANSERV_FUNC(cmd_seen)
{
***************
*** 5888,5894 ****
/* Welcome to my worst nightmare. Warning: Read (or modify)
the code below at your own risk. */
! static void
! handle_join(struct userNode *user, struct chanNode *channel)
{
struct chanData *cData;
struct userData *uData;
--- 5908,5916 ----
/* Welcome to my worst nightmare. Warning: Read (or modify)
the code below at your own risk. */
! static int
! handle_join(struct modeNode *mNode)
{
+ struct userNode *user = mNode->user;
+ struct chanNode *channel = mNode->channel;
struct chanData *cData;
struct userData *uData;
***************
*** 5896,5900 ****
struct handle_info *handle;
unsigned int ii, modes;
! char *greeting = NULL, info[MAXLEN];
/* Reinitialize the channel if it has become active. */
--- 5918,5923 ----
struct handle_info *handle;
unsigned int ii, modes;
! char *greeting;
! char info[MAXLEN];
/* Reinitialize the channel if it has become active. */
***************
*** 5902,5906 ****
{
struct suspended *suspended = dict_find(sChannels, channel->name, NULL);
! if(!suspended) return;
channel->channel_info = suspended->cData;
suspended->cData->channel = channel;
--- 5925,5929 ----
{
struct suspended *suspended = dict_find(sChannels, channel->name, NULL);
! if(!suspended) return 0;
channel->channel_info = suspended->cData;
suspended->cData->channel = channel;
***************
*** 5909,5913 ****
if(IsLocal(user) || !channel->channel_info || IsSuspended(channel->channel_info))
{
! return;
}
--- 5932,5936 ----
if(IsLocal(user) || !channel->channel_info || IsSuspended(channel->channel_info))
{
! return 0;
}
***************
*** 5946,5950 ****
/* Riding a netburst. Naughty. */
KickChannelUser(user, channel, chanserv, CSMSG_NETRIDE_DETECTED);
! return;
}
else if(channel->banlist.used < MAXBANS)
--- 5969,5973 ----
/* Riding a netburst. Naughty. */
KickChannelUser(user, channel, chanserv, CSMSG_NETRIDE_DETECTED);
! return 1;
}
else if(channel->banlist.used < MAXBANS)
***************
*** 5981,5985 ****
AddChannelBan(1, (const char **)&ban, channel, chanserv, now, 1);
KickChannelUser(user, channel, chanserv, kick_reason);
! return;
}
}
--- 6004,6008 ----
AddChannelBan(1, (const char **)&ban, channel, chanserv, now, 1);
KickChannelUser(user, channel, chanserv, kick_reason);
! return 1;
}
}
***************
*** 6006,6010 ****
modes = 0;
info[0] = 0;
- greeting = NULL;
if(validate_auto_op(user, channel))
{
--- 6029,6032 ----
***************
*** 6016,6020 ****
}
! /* Everything below here depends on the user being authed. */
if(user->handle_info)
{
--- 6038,6042 ----
}
! greeting = NULL;
if(user->handle_info)
{
***************
*** 6069,6073 ****
AddChannelOp(1, &user, channel, chanserv, 1);
}
! if(modes & MODE_VOICE)
{
AddChannelVoice(1, &user, channel, chanserv, 1);
--- 6091,6095 ----
AddChannelOp(1, &user, channel, chanserv, 1);
}
! else if(modes & MODE_VOICE)
{
AddChannelVoice(1, &user, channel, chanserv, 1);
***************
*** 6081,6084 ****
--- 6103,6107 ----
irc_privmsg(chanserv, channel->name, info);
}
+ return 0;
}
***************
*** 7114,7117 ****
--- 7137,7141 ----
DEFINE_COMMAND(set, 1, MODCMD_REQUIRE_CHANUSER, "access", "op", NULL);
DEFINE_COMMAND(setinfo, 1, MODCMD_REQUIRE_CHANUSER, "flags", "+nolog", NULL);
+ DEFINE_COMMAND(wipeinfo, 2, MODCMD_REQUIRE_CHANUSER, "access", "coowner", NULL);
DEFINE_COMMAND(events, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+nolog", "access", "coowner", NULL);
Index: hash.c
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -C2 -r1.164 -r1.165
*** hash.c 23 Aug 2002 04:49:38 -0000 1.164
--- hash.c 23 Oct 2002 12:37:53 -0000 1.165
***************
*** 471,483 ****
mNode->idle_since = now;
! /* add modeNode to channel and to user */
modeList_append(&channel->members, mNode);
modeList_append(&user->channels, mNode);
- if (IsLocal(user)) irc_join(user, channel);
-
for (n=0; n<jf_used; n++) {
! jf_list[n](user, channel);
}
return mNode;
--- 471,491 ----
mNode->idle_since = now;
! /* Add modeNode to channel and to user.
! * We have to do this before calling join funcs in case the
! * modeNode is manipulated (e.g. chanserv ops the user).
! */
modeList_append(&channel->members, mNode);
modeList_append(&user->channels, mNode);
for (n=0; n<jf_used; n++) {
! if (jf_list[n](mNode)) {
! /* If we're here, somebody already kicked or killed
! * the user, so we don't need to remove modeNode from
! * the lists. */
! return NULL;
! }
}
+
+ if (IsLocal(user)) irc_join(user, channel);
return mNode;
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.93
retrieving revision 1.94
diff -C2 -r1.93 -r1.94
*** hash.h 14 Sep 2002 03:48:58 -0000 1.93
--- hash.h 23 Oct 2002 12:37:53 -0000 1.94
***************
*** 206,210 ****
typedef void (*new_channel_func_t) (struct chanNode *chan);
void reg_new_channel_func(new_channel_func_t handler);
! typedef void (*join_func_t) (struct userNode *user, struct chanNode *chan);
void reg_join_func(join_func_t handler);
typedef void (*del_channel_func_t) (struct chanNode *chan);
--- 206,210 ----
typedef void (*new_channel_func_t) (struct chanNode *chan);
void reg_new_channel_func(new_channel_func_t handler);
! typedef int (*join_func_t) (struct modeNode *mNode);
void reg_join_func(join_func_t handler);
typedef void (*del_channel_func_t) (struct chanNode *chan);
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** helpserv.c 11 Oct 2002 03:07:09 -0000 1.39
--- helpserv.c 23 Oct 2002 12:37:53 -0000 1.40
***************
*** 3357,3370 ****
* req->user to the user joining for all requests owned by the user's handle
* (if any) with a req->user == NULL */
! static void handle_join(struct userNode *user, struct chanNode *chan) {
struct helpserv_botlist *botlist;
unsigned int i;
const int from_opserv = 0; /* for helpserv_notice */
! if (IsLocal(user) || self->uplink->burst) {
! return;
! }
! if (!(botlist = dict_find(helpserv_bots_bychan_dict, chan->name, NULL))) return;
for (i=0; i < botlist->used; i++) {
--- 3357,3370 ----
* req->user to the user joining for all requests owned by the user's handle
* (if any) with a req->user == NULL */
! static int handle_join(struct modeNode *mNode) {
! struct userNode *user = mNode->user;
! struct chanNode *chan = mNode->channel;
struct helpserv_botlist *botlist;
unsigned int i;
const int from_opserv = 0; /* for helpserv_notice */
! if (IsLocal(user) || self->uplink->burst) return 0;
! if (!(botlist = dict_find(helpserv_bots_bychan_dict, chan->name, NULL))) return 0;
for (i=0; i < botlist->used; i++) {
***************
*** 3402,3405 ****
--- 3402,3406 ----
}
}
+ return 0;
}
Index: mod-snoop.c
===================================================================
RCS file: /cvsroot/srvx/services/src/mod-snoop.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** mod-snoop.c 7 Oct 2002 20:09:15 -0000 1.4
--- mod-snoop.c 23 Oct 2002 12:37:54 -0000 1.5
***************
*** 53,58 ****
static void
snoop_join(struct userNode *user, struct chanNode *chan) {
! if (!snoop_cfg.enabled) return;
! if (user->uplink->burst && !snoop_cfg.show_bursts) return;
if (chan->members.used == 1) {
SNOOP("CREATE %s by %s", chan->name, user->nick);
--- 53,58 ----
static void
snoop_join(struct userNode *user, struct chanNode *chan) {
! 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);
***************
*** 60,63 ****
--- 60,64 ----
SNOOP("JOIN %s by %s", chan->name, user->nick);
}
+ return 0;
}
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.282
retrieving revision 1.283
diff -C2 -r1.282 -r1.283
*** opserv.c 21 Oct 2002 03:49:13 -0000 1.282
--- opserv.c 23 Oct 2002 12:37:54 -0000 1.283
***************
*** 1864,1873 ****
}
! static void
! opserv_join_check(struct userNode *user, struct chanNode *channel)
{
! if(IsService(user)) {
! return;
! }
if (channel->bad_channel) {
--- 1864,1874 ----
}
! static int
! opserv_join_check(struct modeNode *mNode)
{
! struct userNode *user = mNode->user;
! struct chanNode *channel = mNode->channel;
!
! if (IsService(user)) return 0;
if (channel->bad_channel) {
***************
*** 1882,1914 ****
DelUser(user, opserv, 1, OSMSG_ILLEGAL_KILL_REASON);
}
}
! if (!user->uplink->burst && !policer_conforms(channel->join_policer, now, 1.0)) {
! /* Don't moderate the channel unless it is activated and
! the number of users in the channel is over the threshold. */
! if(opserv_conf.join_flood_moderate && (channel->members.used > opserv_conf.join_flood_moderate_threshold)) {
! if(!GetUserMode(channel, opserv)) {
! /* If we aren't in the channel, join it. */
! AddChannelUser(opserv, channel);
! AddChannelOp(1, &opserv, channel, opserv, 1);
! }
! if(!(channel->modes | MODE_MODERATED)) {
! /* If the channel isn't moderated, moderate it and
! warn the channel (we also warn IRC operators of
! the fact sporadically). */
! channel->modes |= MODE_MODERATED;
! irc_mode(opserv, channel, "+m");
!
! send_channel_notice(channel, opserv, OSMSG_FLOOD_MODERATE);
! }
}
! if (!channel->join_flooded) {
! channel->join_flooded = 1;
! opserv_alert(OSMSG_JOIN_FLOOD, channel->name, channel->members.used, channel->modes & MODE_MODERATED ? "; channel moderated" : "");
}
- log(OS_LOG, LOG_INFO, "Join to %s during flood: "IDENT_FORMAT"\n", channel->name, IDENT_DATA(user));
- } else {
- channel->join_flooded = 0;
}
}
--- 1883,1917 ----
DelUser(user, opserv, 1, OSMSG_ILLEGAL_KILL_REASON);
}
+ return 1;
}
! if (user->uplink->burst) return 0;
! if (policer_conforms(channel->join_policer, now, 1.0)) {
! channel->join_flooded = 0;
! return 0;
! }
! /* Don't moderate the channel unless it is activated and
! the number of users in the channel is over the threshold. */
! if (opserv_conf.join_flood_moderate && (channel->members.used > opserv_conf.join_flood_moderate_threshold)) {
! if (!GetUserMode(channel, opserv)) {
! /* If we aren't in the channel, join it. */
! AddChannelUser(opserv, channel);
! AddChannelOp(1, &opserv, channel, opserv, 1);
}
! if (!(channel->modes & MODE_MODERATED)) {
! /* If the channel isn't moderated, moderate it and
! warn the channel (we also warn IRC operators of
! the fact sporadically). */
! channel->modes |= MODE_MODERATED;
! irc_mode(opserv, channel, "+m");
! send_channel_notice(channel, opserv, OSMSG_FLOOD_MODERATE);
}
}
+ if (!channel->join_flooded) {
+ channel->join_flooded = 1;
+ opserv_alert(OSMSG_JOIN_FLOOD, channel->name, channel->members.used, channel->modes & MODE_MODERATED ? "; channel moderated" : "");
+ }
+ log(OS_LOG, LOG_INFO, "Join to %s during flood: "IDENT_FORMAT"\n", channel->name, IDENT_DATA(user));
+ return 0;
}
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** proto-bahamut.c 21 Oct 2002 03:49:14 -0000 1.25
--- proto-bahamut.c 23 Oct 2002 12:37:54 -0000 1.26
***************
*** 724,727 ****
--- 724,728 ----
struct chanNode *cNode;
struct userNode *uNode;
+ struct modeNode *mNode;
unsigned int next = 4, last;
unsigned char *nick, *nickend;
***************
*** 762,767 ****
if (*nick == '@') { mode |= MODE_CHANOP; nick++; }
if (*nick == '+') { mode |= MODE_VOICE; nick++; }
! if ((uNode = GetUserH(nick))) {
! AddChannelUser(uNode, cNode)->modes = mode;
}
}
--- 763,768 ----
if (*nick == '@') { mode |= MODE_CHANOP; nick++; }
if (*nick == '+') { mode |= MODE_VOICE; nick++; }
! if ((uNode = GetUserH(nick)) && (mNode = AddChannelUser(uNode, cNode))) {
! mNode->modes = mode;
}
}
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** proto-p10.c 21 Oct 2002 03:49:14 -0000 1.39
--- proto-p10.c 23 Oct 2002 12:37:54 -0000 1.40
***************
*** 947,950 ****
--- 947,951 ----
struct chanNode *cNode;
struct userNode *un;
+ struct modeNode *mNode;
long mode;
char *user, *end, sep;
***************
*** 991,995 ****
continue;
}
! AddChannelUser(un, cNode)->modes = mode;
}
--- 992,998 ----
continue;
}
! if ((mNode = AddChannelUser(un, cNode))) {
! mNode->modes = mode;
! }
}
|