[srvx-commits] CVS: services/src chanserv.c,1.294,1.295
Brought to you by:
entrope
|
From: Zoot <zo...@us...> - 2002-10-21 03:55:23
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv28691/src
Modified Files:
chanserv.c
Log Message:
Refactor handle_join() so it tries hard to do things it needs to do during burst and skips things it shouldn't do during burst while doing said things in correct order and in an efficient matter. I hope.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.294
retrieving revision 1.295
diff -C2 -r1.294 -r1.295
*** chanserv.c 21 Oct 2002 03:21:05 -0000 1.294
--- chanserv.c 21 Oct 2002 03:55:19 -0000 1.295
***************
*** 608,612 ****
{
struct userData *uData;
! if(value == 'a' && !channel->join_flooded) return 1;
uData = _GetChannelUser(channel->channel_info, user->handle_info, use_override, 0);
if(!uData) return 0;
--- 608,612 ----
{
struct userData *uData;
! if(value == 'a') return 1;
uData = _GetChannelUser(channel->channel_info, user->handle_info, use_override, 0);
if(!uData) return 0;
***************
*** 5886,5891 ****
}
! /* welcome to my worst nightmare. warning: read the code below
! at your own risk. */
static void
handle_join(struct userNode *user, struct chanNode *channel)
--- 5886,5891 ----
}
! /* 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)
***************
*** 5895,5900 ****
struct banData *bData;
struct handle_info *handle;
! unsigned int ii;
if(!channel->channel_info && (channel->members.used < 3))
{
--- 5895,5902 ----
struct banData *bData;
struct handle_info *handle;
! unsigned int ii, modes;
! char *greeting = NULL, info[MAXLEN];
+ /* Reinitialize the channel if it has become active. */
if(!channel->channel_info && (channel->members.used < 3))
{
***************
*** 5905,5912 ****
}
! if(IsLocal(user) || !channel->channel_info || IsSuspended(channel->channel_info)) return;
cData = channel->channel_info;
-
if(channel->members.used > cData->max)
{
--- 5907,5916 ----
}
! if(IsLocal(user) || !channel->channel_info || IsSuspended(channel->channel_info))
! {
! return;
! }
cData = channel->channel_info;
if(channel->members.used > cData->max)
{
***************
*** 5981,5986 ****
}
! /* ChanServ will not modify the limits in join-flooded channels. */
! if(cData->flags & CHANNEL_DYNAMIC_LIMIT && !channel->join_flooded)
{
if((channel->limit - channel->members.used) < chanserv_conf.adjust_threshold)
--- 5985,5993 ----
}
! /* ChanServ will not modify the limits in join-flooded channels.
! It will also skip DynLimit processing when the user (or srvx)
! is bursting in, because there are likely more incoming. */
! if(cData->flags & CHANNEL_DYNAMIC_LIMIT && !channel->join_flooded &&
! !user->uplink->burst)
{
if((channel->limit - channel->members.used) < chanserv_conf.adjust_threshold)
***************
*** 5997,6061 ****
}
! if(validate_auto_op(user, channel) && !channel->join_flooded)
{
! AddChannelOp(1, &user, channel, chanserv, 1);
}
else if((cData->flags & CHANNEL_VOICE_ALL) && !channel->join_flooded)
{
! AddChannelVoice(1, &user, channel, chanserv, 1);
}
/* Everything below here depends on the user being authed. */
! if(!user->handle_info) return;
!
! if((channel == chanserv_conf.support_channel) && IsHelper(user))
{
! HANDLE_SET_FLAG(user->handle_info, HELPING);
! }
! handle = user->handle_info;
! uData = handle ? GetTrueChannelAccess(cData, handle) : NULL;
! if(uData && !IsUserSuspended(uData))
! {
! /* Ops and above were handled by the above case. */
! if((uData->access == ulPeon)
! && IsUserAutoOp(uData)
! && !(cData->flags & CHANNEL_VOICE_ALL))
{
! AddChannelVoice(1, &user, channel, chanserv, 1);
}
! if(uData->access >= ulMaster)
{
! cData->visited = now;
! }
! if(uData->info
! && (cData->flags & CHANNEL_INFO_LINES)
! && ((now - uData->seen) >= chanserv_conf.info_delay)
! && !uData->present)
! {
! char info[MAXLEN];
! sprintf(info, "[%s] %s", user->nick, uData->info);
! irc_privmsg(chanserv, channel->name, info);
! }
! if(cData->user_greeting)
! {
! chanserv_notice(user, "(%s) %s", channel->name, cData->user_greeting);
}
}
! else
{
! /* Not a user, or a suspended user. */
! if(cData->greeting)
! {
! chanserv_notice(user, "(%s) %s", channel->name, cData->greeting);
! }
}
! if(uData)
{
! uData->seen = now;
! uData->present = 1;
}
}
--- 6004,6083 ----
}
! modes = 0;
! info[0] = 0;
! greeting = NULL;
! if(validate_auto_op(user, channel))
{
! modes |= MODE_CHANOP;
}
else if((cData->flags & CHANNEL_VOICE_ALL) && !channel->join_flooded)
{
! modes |= MODE_VOICE;
}
/* Everything below here depends on the user being authed. */
! if(user->handle_info)
{
! handle = user->handle_info;
! if((channel == chanserv_conf.support_channel) && IsHelper(user))
{
! HANDLE_SET_FLAG(user->handle_info, HELPING);
}
! uData = GetTrueChannelAccess(cData, handle);
! if(uData && !IsUserSuspended(uData))
{
! /* Ops and above were handled by the above case. */
! if((uData->access == ulPeon) && IsUserAutoOp(uData))
! {
! modes |= MODE_VOICE;
! }
! if(uData->access >= ulMaster)
! {
! cData->visited = now;
! }
! if(!user->uplink->burst)
! {
! if(uData->info
! && (cData->flags & CHANNEL_INFO_LINES)
! && ((now - uData->seen) >= chanserv_conf.info_delay)
! && !uData->present)
! {
! sprintf(info, "[%s] %s", user->nick, uData->info);
! }
! if(cData->user_greeting)
! {
! greeting = cData->user_greeting;
! }
! }
!
! uData->seen = now;
! uData->present = 1;
}
}
! if(cData->greeting && !greeting && !user->uplink->burst)
{
! /* Not a user, or a suspended user -- greet them. */
! greeting = cData->greeting;
}
!
! if(modes & MODE_CHANOP)
! {
! AddChannelOp(1, &user, channel, chanserv, 1);
! }
! if(modes & MODE_VOICE)
! {
! AddChannelVoice(1, &user, channel, chanserv, 1);
! }
! if(greeting)
! {
! chanserv_notice(user, "(%s) %s", channel->name, greeting);
! }
! if(info[0])
{
! irc_privmsg(chanserv, channel->name, info);
}
}
|