"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/channel.c" between
bahamut-2.1.4.tar.gz and bahamut-2.1.5.tar.gz

About: Bahamut is an Internet Relay Chat Daemon (IRCd) designed for DALnet, one of the major IRC networks in the world.

channel.c  (bahamut-2.1.4):channel.c  (bahamut-2.1.5)
skipping to change at line 37 skipping to change at line 37
#include "userban.h" #include "userban.h"
#include "memcount.h" #include "memcount.h"
#include "hooks.h" #include "hooks.h"
#include "spamfilter.h" #include "spamfilter.h"
int server_was_split = YES; int server_was_split = YES;
aChannel *channel = NullChn; aChannel *channel = NullChn;
#ifdef USER_HOSTMASKING #ifdef USER_HOSTMASKING
#define GET_USER_HOST IsUmodeH(cptr)?cptr->user->mhost:cptr->user->host #define GET_USER_HOST(cptr) IsUmodeH(cptr)?cptr->user->mhost:cptr->user->host
#else #else
#define GET_USER_HOST cptr->user->host #define GET_USER_HOST(cptr) cptr->user->host
#endif #endif
#ifdef INVITE_LISTS #ifdef INVITE_LISTS
/* +I list functions */ /* +I list functions */
int add_invite_id(aClient*, aChannel*, char*); int add_invite_id(aClient*, aChannel*, char*);
int del_invite_id(aChannel*, char*); int del_invite_id(aChannel*, char*);
anInvite* is_invited(aClient*, aChannel*); anInvite* is_invited(aClient*, aChannel*);
#endif #endif
#ifdef EXEMPT_LISTS #ifdef EXEMPT_LISTS
skipping to change at line 286 skipping to change at line 286
strcpy(exempt->banstr, exempt_id); strcpy(exempt->banstr, exempt_id);
exempt->when = timeofday; exempt->when = timeofday;
exempt->next = chptr->banexempt_list; exempt->next = chptr->banexempt_list;
chptr->banexempt_list = exempt; chptr->banexempt_list = exempt;
chptr->banserial++; chptr->banserial++;
if (IsPerson(cptr)) if (IsPerson(cptr))
{ {
exempt->who = (char *) MyMalloc(strlen(cptr->name) + exempt->who = (char *) MyMalloc(strlen(cptr->name) +
strlen(cptr->user->username) + strlen(cptr->user->username) +
strlen(GET_USER_HOST) + 3); strlen(GET_USER_HOST(cptr)) + 3);
(void) ircsprintf(exempt->who, "%s!%s@%s", (void) ircsprintf(exempt->who, "%s!%s@%s",
cptr->name, cptr->user->username, GET_USER_HOST); cptr->name, cptr->user->username, GET_USER_HOST(cptr)) ;
} }
else else
{ {
exempt->who = (char *) MyMalloc(strlen(cptr->name) + 1); exempt->who = (char *) MyMalloc(strlen(cptr->name) + 1);
(void) strcpy(exempt->who, cptr->name); (void) strcpy(exempt->who, cptr->name);
} }
/* determine type for less matching later */ /* determine type for less matching later */
if(exempt_id[0] == '*' && exempt_id[1] == '!') if(exempt_id[0] == '*' && exempt_id[1] == '!')
{ {
skipping to change at line 374 skipping to change at line 374
invite->invstr = (char*)MyMalloc(strlen(invite_id)+1); invite->invstr = (char*)MyMalloc(strlen(invite_id)+1);
strcpy(invite->invstr, invite_id); strcpy(invite->invstr, invite_id);
invite->when = timeofday; invite->when = timeofday;
invite->next = chptr->invite_list; invite->next = chptr->invite_list;
chptr->invite_list = invite; chptr->invite_list = invite;
if (IsPerson(cptr)) if (IsPerson(cptr))
{ {
invite->who = (char *) MyMalloc(strlen(cptr->name) + invite->who = (char *) MyMalloc(strlen(cptr->name) +
strlen(cptr->user->username) + strlen(cptr->user->username) +
strlen(GET_USER_HOST) + 3); strlen(GET_USER_HOST(cptr)) + 3);
(void) ircsprintf(invite->who, "%s!%s@%s", (void) ircsprintf(invite->who, "%s!%s@%s",
cptr->name, cptr->user->username, GET_USER_HOST); cptr->name, cptr->user->username, GET_USER_HOST(cptr)) ;
} }
else else
{ {
invite->who = (char *) MyMalloc(strlen(cptr->name) + 1); invite->who = (char *) MyMalloc(strlen(cptr->name) + 1);
(void) strcpy(invite->who, cptr->name); (void) strcpy(invite->who, cptr->name);
} }
return 0; return 0;
} }
int del_invite_id(aChannel* chptr, char* invite_id) int del_invite_id(aChannel* chptr, char* invite_id)
skipping to change at line 480 skipping to change at line 480
ban = (aBan *) MyMalloc(sizeof(aBan)); ban = (aBan *) MyMalloc(sizeof(aBan));
ban->banstr = (char *) MyMalloc(strlen(banid) + 1); ban->banstr = (char *) MyMalloc(strlen(banid) + 1);
(void) strcpy(ban->banstr, banid); (void) strcpy(ban->banstr, banid);
ban->next = chptr->banlist; ban->next = chptr->banlist;
if (IsPerson(cptr)) if (IsPerson(cptr))
{ {
ban->who = (char *) MyMalloc(strlen(cptr->name) + ban->who = (char *) MyMalloc(strlen(cptr->name) +
strlen(cptr->user->username) + strlen(cptr->user->username) +
strlen(GET_USER_HOST) + 3); strlen(GET_USER_HOST(cptr)) + 3);
(void) ircsprintf(ban->who, "%s!%s@%s", (void) ircsprintf(ban->who, "%s!%s@%s",
cptr->name, cptr->user->username, GET_USER_HOST); cptr->name, cptr->user->username, GET_USER_HOST(cptr)) ;
} }
else else
{ {
ban->who = (char *) MyMalloc(strlen(cptr->name) + 1); ban->who = (char *) MyMalloc(strlen(cptr->name) + 1);
(void) strcpy(ban->who, cptr->name); (void) strcpy(ban->who, cptr->name);
} }
/* determine what 'type' of mask this is, for less matching later */ /* determine what 'type' of mask this is, for less matching later */
if(banid[0] == '*' && banid[1] == '!') if(banid[0] == '*' && banid[1] == '!')
skipping to change at line 1156 skipping to change at line 1156
#endif #endif
if (who->user) if (who->user)
{ {
cm = make_chanmember(); cm = make_chanmember();
cm->flags = flags; cm->flags = flags;
cm->cptr = who; cm->cptr = who;
cm->next = chptr->members; cm->next = chptr->members;
cm->banserial = chptr->banserial; cm->banserial = chptr->banserial;
cm->when = NOW; cm->when = NOW;
cm->last_message_number = 0;
cm->last_message_time = 0;
chptr->members = cm; chptr->members = cm;
chptr->users++; chptr->users++;
ptr = make_link(); ptr = make_link();
ptr->value.chptr = chptr; ptr->value.chptr = chptr;
ptr->next = who->user->channel; ptr->next = who->user->channel;
who->user->channel = ptr; who->user->channel = ptr;
who->user->joined++; who->user->joined++;
} }
skipping to change at line 1203 skipping to change at line 1205
{ {
chanMember *cm; chanMember *cm;
if (chptr) if (chptr)
if ((cm = find_user_member(chptr->members, cptr))) if ((cm = find_user_member(chptr->members, cptr)))
return (cm->flags & CHFL_CHANOP); return (cm->flags & CHFL_CHANOP);
return 0; return 0;
} }
int is_chan_halfop(aClient *cptr, aChannel *chptr)
{
chanMember *cm;
if (chptr)
if ((cm = find_user_member(chptr->members, cptr)))
return (cm->flags & CHFL_HALFOP);
return 0;
}
/* A function to check if a user can use the kick command
Returns:
2 - user is an op (@)
1 - user is an half-op (%)
0 - user is not an op or half-op
*/
inline int is_chan_cankick(aClient *cptr, aChannel *chptr)
{
chanMember *cm;
if (chptr)
if ((cm = find_user_member(chptr->members, cptr)))
{
if(cm->flags & CHFL_CHANOP)
return 2;
else if(cm->flags & CHFL_HALFOP)
return 1;
else return 0;
}
return 0;
}
int is_chan_opvoice(aClient *cptr, aChannel *chptr) int is_chan_opvoice(aClient *cptr, aChannel *chptr)
{ {
chanMember *cm; chanMember *cm;
if (chptr) if (chptr)
if ((cm = find_user_member(chptr->members, cptr))) if ((cm = find_user_member(chptr->members, cptr)))
return ((cm->flags & CHFL_CHANOP) || (cm->flags & CHFL_VOICE)); return ((cm->flags & CHFL_CHANOP) || (cm->flags & CHFL_HALFOP) || (c m->flags & CHFL_VOICE));
return 0; return 0;
} }
int is_deopped(aClient *cptr, aChannel *chptr) int is_deopped(aClient *cptr, aChannel *chptr)
{ {
chanMember *cm; chanMember *cm;
if (chptr) if (chptr)
if ((cm = find_user_member(chptr->members, cptr))) if ((cm = find_user_member(chptr->members, cptr)))
skipping to change at line 1247 skipping to change at line 1283
{ {
chanMember *cm; chanMember *cm;
if (chptr) if (chptr)
if ((cm = find_user_member(chptr->members, cptr))) if ((cm = find_user_member(chptr->members, cptr)))
return cm->when; return cm->when;
return 0; return 0;
} }
time_t get_user_lastmsgtime(aClient *cptr, aChannel *chptr)
{
chanMember *cm;
if (chptr)
if ((cm = find_user_member(chptr->members, cptr)))
return cm->last_message_time;
return 0;
}
/* is_xflags_exempted - Check if a user is exempted from the channel's xflags */ /* is_xflags_exempted - Check if a user is exempted from the channel's xflags */
int is_xflags_exempted(aClient *sptr, aChannel *chptr) int is_xflags_exempted(aClient *sptr, aChannel *chptr)
{ {
if(IsAnOper(sptr)) return 1; /* IRC Operators are always exempted */ if(IsAnOper(sptr)) return 1; /* IRC Operators are always exempted */
if((chptr->xflags & XFLAG_EXEMPT_OPPED) && (chptr->xflags & XFLAG_EXEMPT_VOI CED)) if((chptr->xflags & XFLAG_EXEMPT_OPPED) && (chptr->xflags & XFLAG_EXEMPT_VOI CED))
{ {
if(is_chan_opvoice(sptr,chptr)) return 1; if(is_chan_opvoice(sptr,chptr)) return 1;
} }
else else
{ {
if((chptr->xflags & XFLAG_EXEMPT_OPPED) && is_chan_op(sptr,chptr)) return 1; if((chptr->xflags & XFLAG_EXEMPT_OPPED) && is_chan_op(sptr,chptr)) return 1;
if((chptr->xflags & XFLAG_EXEMPT_VOICED) && has_voice(sptr,chptr)) return 1; if((chptr->xflags & XFLAG_EXEMPT_VOICED) && has_voice(sptr,chptr)) return 1;
} }
if((chptr->xflags & XFLAG_EXEMPT_REGISTERED) && IsRegNick(sptr)) return 1; if((chptr->xflags & XFLAG_EXEMPT_REGISTERED) && IsRegNick(sptr)) return 1;
if((chptr->xflags & XFLAG_EXEMPT_IDENTD) && sptr->user && sptr->user->userna me[0]!='~') return 1; if((chptr->xflags & XFLAG_EXEMPT_IDENTD) && sptr->user && sptr->user->userna me[0]!='~') return 1;
if((chptr->xflags & XFLAG_EXEMPT_WEBIRC) && MyClient(sptr) && sptr->webirc_i p) return 1;
return 0; return 0;
} }
/* A function to send a (verbose) message to the relay channel if it exists /* A function to send a (verbose) message to the relay channel if it exists
(and isn't moderated)... */ (and isn't moderated)... */
int verbose_to_relaychan(aClient *sptr, aChannel *chptr, char *cmd, char *reason ) int verbose_to_relaychan(aClient *sptr, aChannel *chptr, char *cmd, char *reason )
{ {
aChannel *relaychan_ptr; aChannel *relaychan_ptr;
char relaychan_name[CHANNELLEN + 1]; char relaychan_name[CHANNELLEN + 1];
skipping to change at line 1350 skipping to change at line 1398
if (is_banned(cptr, chptr, NULL)) if (is_banned(cptr, chptr, NULL))
return (MODE_BAN); /* return (MODE_BAN); /*
* channel is -n and user is not there; * channel is -n and user is not there;
* we need to bquiet them if we can * we need to bquiet them if we can
*/ */
} }
} }
else else
{ {
/* ops and voices can talk through everything except NOCTRL */ /* ops and voices can talk through everything except NOCTRL */
if (!(cm->flags & (CHFL_CHANOP | CHFL_VOICE))) if (!(cm->flags & (CHFL_CHANOP | CHFL_HALFOP | CHFL_VOICE)))
{ {
if (chptr->mode.mode & MODE_MODERATED) if (chptr->mode.mode & MODE_MODERATED)
return (MODE_MODERATED); return (MODE_MODERATED);
if (is_banned(cptr, chptr, cm)) if (is_banned(cptr, chptr, cm))
return (MODE_BAN); return (MODE_BAN);
if ((chptr->mode.mode & MODE_MODREG) && !IsRegNick(cptr)) if ((chptr->mode.mode & MODE_MODREG) && !IsRegNick(cptr))
return (ERR_NEEDREGGEDNICK); return (ERR_NEEDREGGEDNICK);
} }
if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(msg)) if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(msg))
return (ERR_NOCTRLSONCHAN); return (ERR_NOCTRLSONCHAN);
if(ismine) if(ismine)
{ {
if (chptr->talk_connect_time && (cptr->firsttime + chptr->talk_conne ct_time > NOW) && !is_xflags_exempted(cptr,chptr)) if (chptr->talk_connect_time && (cptr->firsttime + chptr->talk_conne ct_time > NOW) && !is_xflags_exempted(cptr,chptr))
return (ERR_NEEDTOWAIT); return (ERR_NEEDTOWAIT);
if (chptr->talk_join_time && (cm->when + chptr->talk_join_time > NOW ) && !is_xflags_exempted(cptr,chptr)) if (chptr->talk_join_time && (cm->when + chptr->talk_join_time > NOW ) && !is_xflags_exempted(cptr,chptr))
return (ERR_NEEDTOWAIT); return (ERR_NEEDTOWAIT);
if (chptr->max_messages && chptr->max_messages_time && !is_xflags_ex
empted(cptr,chptr))
{
if ((NOW - cm->last_message_time) < chptr->max_messages_time)
{
if (cm->last_message_number > chptr->max_messages)
return (ERR_MAXMSGSENT);
else
cm->last_message_number++;
}
else
cm->last_message_number = 1;
cm->last_message_time = NOW;
}
} }
} }
return 0; return 0;
} }
/* /*
* write the "simple" list of channel modes for channel chptr onto * write the "simple" list of channel modes for channel chptr onto
* buffer mbuf with the parameters in pbuf. * buffer mbuf with the parameters in pbuf.
*/ */
skipping to change at line 1632 skipping to change at line 1694
l = chptr->members; l = chptr->members;
else else
l = l->next; l = l->next;
if (l && l == skip) if (l && l == skip)
l = l->next; l = l->next;
if (l == NULL) if (l == NULL)
break; break;
} }
if (l->flags & MODE_CHANOP) if (l->flags & MODE_CHANOP)
*t++ = '@'; *t++ = '@';
#ifdef USE_HALFOPS
if (l->flags & CHFL_HALFOP)
*t++ = '%';
#endif
if (l->flags & MODE_VOICE) if (l->flags & MODE_VOICE)
*t++ = '+'; *t++ = '+';
strcpy(t, l->cptr->name); strcpy(t, l->cptr->name);
t += strlen(t); t += strlen(t);
*t++ = ' '; *t++ = ' ';
n++; n++;
if (t - buf > BUFSIZE - 80) if (t - buf > BUFSIZE - 80)
{ {
*t++ = '\0'; *t++ = '\0';
if (t[-1] == ' ') if (t[-1] == ' ')
skipping to change at line 1882 skipping to change at line 1948
{ {
if (change=='+') if (change=='+')
chptr->mode.mode|=MODE_OPERONLY; chptr->mode.mode|=MODE_OPERONLY;
else else
chptr->mode.mode&=~MODE_OPERONLY; chptr->mode.mode&=~MODE_OPERONLY;
*mbuf++ = *modes; *mbuf++ = *modes;
nmodes++; nmodes++;
} }
break; break;
case 'o': case 'o':
#ifdef USE_HALFOPS
case 'h':
#endif
case 'v': case 'v':
if(level<1) if(level<1)
{ {
errors |= SM_ERR_NOPRIVS; errors |= SM_ERR_NOPRIVS;
break; break;
} }
if(parv[args]==NULL) if(parv[args]==NULL)
{ {
/* silently drop the spare +o/v's */ /* silently drop the spare +o/v's */
break; break;
skipping to change at line 1919 skipping to change at line 1988
} }
/* if we're going to overflow our mode buffer, /* if we're going to overflow our mode buffer,
* drop the change instead */ * drop the change instead */
if((prelen + (mbuf - morig) + pidx + NICKLEN + 1) > if((prelen + (mbuf - morig) + pidx + NICKLEN + 1) >
REALMODEBUFLEN) REALMODEBUFLEN)
{ {
args++; args++;
break; break;
} }
#ifdef NO_LOCAL_CMODE_h
if(*modes=='h' && MyClient(sptr))
{
sendto_one(sptr,":%s NOTICE %s :*** Notice -- Half-ops are not f
ully supported yet.",
me.name, sptr->name);
args++;
break;
}
#endif
/* if we have the user, set them +/-[vo] */ /* if we have the user, set them +/-[vo] */
if(change=='+') if(change=='+')
{ {
int resend_nicklist = (chptr->mode.mode & MODE_AUDITORIUM) && My int resend_nicklist = (chptr->mode.mode & MODE_AUDITORIUM) && My
Client(who) && !((cm->flags & CHFL_CHANOP) || (cm->flags & CHFL_VOICE)); Client(who) && !((cm->flags & CHFL_CHANOP) || (cm->flags & CHFL_HALFOP) || (cm->
cm->flags|=(*modes=='o' ? CHFL_CHANOP : CHFL_VOICE); flags & CHFL_VOICE));
switch(*modes)
{
case 'o': cm->flags|= CHFL_CHANOP; break;
#ifdef USE_HALFOPS
case 'h': cm->flags|= CHFL_HALFOP; break;
#endif
case 'v': cm->flags|= CHFL_VOICE; break;
}
if (resend_nicklist) if (resend_nicklist)
{ {
char *fake_parv[3]; char *fake_parv[3];
sendto_one(who, ":%s KICK %s %s :%s", sendto_one(who, ":%s KICK %s %s :%s",
me.name, chptr->chname, who->name, "Resending nic klist..."); me.name, chptr->chname, who->name, "Resending nic klist...");
sendto_prefix_one(who, who, ":%s JOIN :%s", who->name, chptr ->chname); sendto_prefix_one(who, who, ":%s JOIN :%s", who->name, chptr ->chname);
if(chptr->topic[0] != '\0') if(chptr->topic[0] != '\0')
{ {
skipping to change at line 1950 skipping to change at line 2036
fake_parv[0] = who->name; fake_parv[0] = who->name;
fake_parv[1] = chptr->chname; fake_parv[1] = chptr->chname;
fake_parv[2] = NULL; fake_parv[2] = NULL;
m_names(who, who, 2, fake_parv); m_names(who, who, 2, fake_parv);
} }
if(chptr->mode.mode & MODE_AUDITORIUM) sendto_channel_butserv_no opvoice(chptr, who, ":%s JOIN :%s", who->name, chptr->chname); if(chptr->mode.mode & MODE_AUDITORIUM) sendto_channel_butserv_no opvoice(chptr, who, ":%s JOIN :%s", who->name, chptr->chname);
} }
else else
{ {
cm->flags&=~((*modes=='o' ? CHFL_CHANOP : CHFL_VOICE)); switch(*modes)
{
case 'o': cm->flags&=~CHFL_CHANOP; break;
#ifdef USE_HALFOPS
case 'h': cm->flags&=~CHFL_HALFOP; break;
#endif
case 'v': cm->flags&=~CHFL_VOICE; break;
}
if(chptr->mode.mode & MODE_AUDITORIUM) sendto_channel_butserv_no opvoice(chptr, who, PartFmt, who->name, chptr->chname); if(chptr->mode.mode & MODE_AUDITORIUM) sendto_channel_butserv_no opvoice(chptr, who, PartFmt, who->name, chptr->chname);
} }
/* we've decided their mode was okay, cool */ /* we've decided their mode was okay, cool */
*mbuf++ = *modes; *mbuf++ = *modes;
ADD_PARA(cm->cptr->name) ADD_PARA(cm->cptr->name)
args++; args++;
nmodes++; nmodes++;
if (IsServer(sptr) && *modes == 'o' && change=='+') if (IsServer(sptr) && *modes == 'o' && change=='+')
{ {
skipping to change at line 2759 skipping to change at line 2852
verbose_to_opers(sptr, chptr, "join", "xflag_join_connect_time") ; verbose_to_opers(sptr, chptr, "join", "xflag_join_connect_time") ;
} }
else else
{ {
if(chptr->xflags & XFLAG_USER_VERBOSE) verbose_to_relaychan(sptr, ch ptr, "join", r); if(chptr->xflags & XFLAG_USER_VERBOSE) verbose_to_relaychan(sptr, ch ptr, "join", r);
if(!jrl && (chptr->xflags & XFLAG_OPER_VERBOSE)) verbose_to_opers(sp tr, chptr, "join", r); if(!jrl && (chptr->xflags & XFLAG_OPER_VERBOSE)) verbose_to_opers(sp tr, chptr, "join", r);
} }
if (error==ERR_NEEDREGGEDNICK) if (error==ERR_NEEDREGGEDNICK)
sendto_one(sptr, getreply(ERR_NEEDREGGEDNICK), me.name, sptr->name, sendto_one(sptr, getreply(ERR_NEEDREGGEDNICK), me.name, sptr->name,
chptr->chname, "join", aliastab[AII_NS].nick, chptr->chname, "join", chptr->chname, aliastab[AII_NS].ni ck,
aliastab[AII_NS].server, NS_Register_URL); aliastab[AII_NS].server, NS_Register_URL);
else else
sendto_one(sptr, getreply(error), me.name, sptr->name, sendto_one(sptr, getreply(error), me.name, sptr->name,
chptr->chname, r); chptr->chname, r);
return 0; return 0;
} }
return 1; return 1;
} }
skipping to change at line 3590 skipping to change at line 3683
* parv[2] = client to kick * parv[2] = client to kick
* parv[3] = kick comment * parv[3] = kick comment
*/ */
int m_kick(aClient *cptr, aClient *sptr, int parc, char *parv[]) int m_kick(aClient *cptr, aClient *sptr, int parc, char *parv[])
{ {
aClient *who; aClient *who;
aChannel *chptr; aChannel *chptr;
int chasing = 0; int chasing = 0;
int user_count; /* count nicks being kicked, only allow 4 */ int user_count; /* count nicks being kicked, only allow 4 */
char *comment, *name, *p = NULL, *user, *p2 = NULL; char *comment, *name, *p = NULL, *user, *p2 = NULL;
int cankick = 0;
if (parc < 3 || *parv[1] == '\0') if (parc < 3 || *parv[1] == '\0')
{ {
sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
me.name, parv[0], "KICK"); me.name, parv[0], "KICK");
return 0; return 0;
} }
if (IsServer(sptr) && !IsULine(sptr)) if (IsServer(sptr) && !IsULine(sptr))
sendto_ops("KICK from %s for %s %s", sendto_ops("KICK from %s for %s %s",
parv[0], parv[1], parv[2]); parv[0], parv[1], parv[2]);
skipping to change at line 3626 skipping to change at line 3720
} }
/* /*
* You either have chan op privs, or you don't -Dianora * You either have chan op privs, or you don't -Dianora
* *
* orabidoo and I discussed this one for a while... I hope he * orabidoo and I discussed this one for a while... I hope he
* approves of this code, users can get quite confused... * approves of this code, users can get quite confused...
* -Dianora * -Dianora
*/ */
if (!IsServer(sptr) && !is_chan_op(sptr, chptr) && !IsULine(sptr)) if (!IsServer(sptr) && !(cankick = is_chan_cankick(sptr, chptr)) && !IsU Line(sptr))
{ {
/* was a user, not a server and user isn't seen as a chanop here */ /* was a user, not a server and user isn't seen as a chanop here */
if (MyConnect(sptr)) if (MyConnect(sptr))
{ {
/* user on _my_ server, with no chanops.. so go away */ /* user on _my_ server, with no chanops.. so go away */
sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED),
me.name, parv[0], chptr->chname); me.name, parv[0], chptr->chname);
name = strtoken(&p, (char *) NULL, ","); name = strtoken(&p, (char *) NULL, ",");
skipping to change at line 3697 skipping to change at line 3791
{ {
user_count--; user_count--;
if (!(who = find_chasing(sptr, user, &chasing))) if (!(who = find_chasing(sptr, user, &chasing)))
{ {
user = strtoken(&p2, (char *) NULL, ","); user = strtoken(&p2, (char *) NULL, ",");
continue; /* No such user left! */ continue; /* No such user left! */
} }
if (IsMember(who, chptr)) if (IsMember(who, chptr))
{ {
#ifdef SPAMFILTER
if(MyClient(sptr)) if(MyClient(sptr))
{ {
#ifdef SPAMFILTER
if(!(chptr->mode.mode & MODE_PRIVACY) && check_sf(sptr, comm ent, "kick", SF_CMD_KICK, chptr->chname)) if(!(chptr->mode.mode & MODE_PRIVACY) && check_sf(sptr, comm ent, "kick", SF_CMD_KICK, chptr->chname))
return FLUSH_BUFFER; return FLUSH_BUFFER;
}
#endif #endif
#ifdef USE_HALFOPS
if(cankick != 2)
{
chanMember *cm = find_user_member(chptr->members, who);
if(cm)
{
/* Don't allow half-ops to kick ops, other half-ops
or voiced users */
if(cm->flags & (CHFL_CHANOP | CHFL_HALFOP | CHFL_VOI
CE))
{
sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED),
me.name, parv[0], chptr->chname);
return 0;
}
}
}
#endif
}
if((chptr->mode.mode & MODE_AUDITORIUM) && !is_chan_opvoice(who, chptr)) if((chptr->mode.mode & MODE_AUDITORIUM) && !is_chan_opvoice(who, chptr))
{ {
sendto_channelopvoice_butserv_me(chptr, sptr, sendto_channelopvoice_butserv_me(chptr, sptr,
":%s KICK %s %s :%s", parv[ 0], ":%s KICK %s %s :%s", parv[ 0],
name, who->name, comment); name, who->name, comment);
sendto_one(who, ":%s KICK %s %s :%s", parv[0], name, who->na me, comment); sendto_one(who, ":%s KICK %s %s :%s", parv[0], name, who->na me, comment);
} }
else else
sendto_channel_butserv(chptr, sptr, sendto_channel_butserv(chptr, sptr,
":%s KICK %s %s :%s", parv[0], ":%s KICK %s %s :%s", parv[0],
skipping to change at line 3775 skipping to change at line 3885
tnick[len++] = *(tmpptr++); tnick[len++] = *(tmpptr++);
tnick[len] = '\0'; tnick[len] = '\0';
sendto_one(cptr, ":%s TOPIC %s %s %ld :%s", me.name, chptr-> chname, sendto_one(cptr, ":%s TOPIC %s %s %ld :%s", me.name, chptr-> chname,
tnick, (long)chptr->topic_time, tnick, (long)chptr->topic_time,
chptr->topic); chptr->topic);
} }
} }
if(chptr->xflags & XFLAG_SET) if(chptr->xflags & XFLAG_SET)
{ {
/* Not very optimized but we'll survive... -Kobi. */ /* Not very optimized but we'll survive... -Kobi. */
sendto_one(cptr, ":%s SVSXCF %s JOIN_CONNECT_TIME:%d TALK_CONNEC T_TIME:%d TALK_JOIN_TIME:%d", me.name, chptr->chname, chptr->join_connect_time, chptr->talk_connect_time, chptr->talk_join_time); sendto_one(cptr, ":%s SVSXCF %s JOIN_CONNECT_TIME:%d MAX_MSG_TIM E:%d:%d TALK_CONNECT_TIME:%d TALK_JOIN_TIME:%d", me.name, chptr->chname, chptr-> join_connect_time, chptr->max_messages, chptr->max_messages_time, chptr->talk_co nnect_time, chptr->talk_join_time);
for(xflag = xflags_list; xflag->option; xflag++) for(xflag = xflags_list; xflag->option; xflag++)
{ {
if(!strcmp(xflag->option,"USER_VERBOSE") || !strcmp(xflag->o ption,"OPER_VERBOSE")) continue; if(!strcmp(xflag->option,"USER_VERBOSE") || !strcmp(xflag->o ption,"OPER_VERBOSE")) continue;
sendto_one(cptr, ":%s SVSXCF %s %s:%d", me.name, chptr->chna me, xflag->option, (chptr->xflags & xflag->flag)?1:0); sendto_one(cptr, ":%s SVSXCF %s %s:%d", me.name, chptr->chna me, xflag->option, (chptr->xflags & xflag->flag)?1:0);
} }
if(chptr->greetmsg && (chptr->max_bans != MAXBANS)) if(chptr->greetmsg && (chptr->max_bans != MAXBANS))
sendto_one(cptr, ":%s SVSXCF %s MAX_BANS:%d GREETMSG :%s", m e.name, chptr->chname, chptr->max_bans, chptr->greetmsg); sendto_one(cptr, ":%s SVSXCF %s MAX_BANS:%d GREETMSG :%s", m e.name, chptr->chname, chptr->max_bans, chptr->greetmsg);
else if(chptr->greetmsg) else if(chptr->greetmsg)
sendto_one(cptr, ":%s SVSXCF %s GREETMSG :%s", me.name, chpt r->chname, chptr->greetmsg); sendto_one(cptr, ":%s SVSXCF %s GREETMSG :%s", me.name, chpt r->chname, chptr->greetmsg);
else if(chptr->max_bans != MAXBANS) else if(chptr->max_bans != MAXBANS)
skipping to change at line 3875 skipping to change at line 3985
topic = parv[2]; topic = parv[2];
if (MyClient(sptr)) if (MyClient(sptr))
{ {
if (!member) if (!member)
{ {
sendto_one(sptr, err_str(ERR_NOTONCHANNEL), me.name, parv[0],name); sendto_one(sptr, err_str(ERR_NOTONCHANNEL), me.name, parv[0],name);
return 0; return 0;
} }
#ifdef USE_HALFOPS
if ((chptr->mode.mode & MODE_TOPICLIMIT) && !is_chan_cankick(sptr, chptr
))
#else
if ((chptr->mode.mode & MODE_TOPICLIMIT) && !is_chan_op(sptr, chptr)) if ((chptr->mode.mode & MODE_TOPICLIMIT) && !is_chan_op(sptr, chptr))
#endif
{ {
sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), me.name, parv[0], sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), me.name, parv[0],
chptr->chname); chptr->chname);
return 0; return 0;
} }
#ifdef SPAMFILTER #ifdef SPAMFILTER
if(!(chptr->mode.mode & MODE_PRIVACY) && check_sf(sptr, topic, "topic", SF_CMD_TOPIC, chptr->chname)) if(!(chptr->mode.mode & MODE_PRIVACY) && check_sf(sptr, topic, "topic", SF_CMD_TOPIC, chptr->chname))
return FLUSH_BUFFER; return FLUSH_BUFFER;
#endif #endif
/* if -t and banned, you can't change the topic */ /* if -t and banned, you can't change the topic */
if (!(chptr->mode.mode & MODE_TOPICLIMIT) && !is_chan_op(sptr, chptr) && is_banned(sptr, chptr, NULL)) if (!(chptr->mode.mode & MODE_TOPICLIMIT) && !is_chan_op(sptr, chptr) && is_banned(sptr, chptr, NULL))
{ {
sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), me.name, parv[0], ch ptr->chname); sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), me.name, parv[0], ch ptr->chname);
return 0; return 0;
} }
tnick = make_nick_user_host(sptr->name, sptr->user->username, sptr->user ->host); tnick = make_nick_user_host(sptr->name, sptr->user->username, GET_USER_H OST(sptr));
} }
else else
{ {
/* extended info */ /* extended info */
if (parc > 3) if (parc > 3)
{ {
topic = (parc > 4 ? parv[4] : ""); topic = (parc > 4 ? parv[4] : "");
tnick = parv[2]; tnick = parv[2];
ts = atoi(parv[3]); ts = atoi(parv[3]);
} }
skipping to change at line 4487 skipping to change at line 4601
spos = idx; /* starting point in buffer for names!*/ spos = idx; /* starting point in buffer for names!*/
for (cm = chptr->members; cm; cm = cm->next) for (cm = chptr->members; cm; cm = cm->next)
{ {
acptr = cm->cptr; acptr = cm->cptr;
if(IsInvisible(acptr) && !member) if(IsInvisible(acptr) && !member)
continue; continue;
if(cm->flags & CHFL_CHANOP) if(cm->flags & CHFL_CHANOP)
buf[idx++] = '@'; buf[idx++] = '@';
#ifdef USE_HALFOPS
else if(cm->flags & CHFL_HALFOP)
buf[idx++] = '%';
#endif
else if(cm->flags & CHFL_VOICE) else if(cm->flags & CHFL_VOICE)
buf[idx++] = '+'; buf[idx++] = '+';
else if((chptr->mode.mode & MODE_AUDITORIUM) && (sptr != acptr) && !is_c han_opvoice(sptr, chptr) && !IsAnOper(sptr)) continue; else if((chptr->mode.mode & MODE_AUDITORIUM) && (sptr != acptr) && !is_c han_opvoice(sptr, chptr) && !IsAnOper(sptr)) continue;
for(s = acptr->name; *s; s++) for(s = acptr->name; *s; s++)
buf[idx++] = *s; buf[idx++] = *s;
buf[idx++] = ' '; buf[idx++] = ' ';
buf[idx] = '\0'; buf[idx] = '\0';
flag = 1; flag = 1;
if(mlen + idx + NICKLEN > BUFSIZE - 3) if(mlen + idx + NICKLEN > BUFSIZE - 3)
{ {
skipping to change at line 5286 skipping to change at line 5404
sjbufpos = 0; sjbufpos = 0;
mbuf = modebuf; mbuf = modebuf;
pbpos = 0; pbpos = 0;
pargs = 0; pargs = 0;
*mbuf++ = '+'; *mbuf++ = '+';
for (s = s0 = strtoken(&p, parv[args + 4], " "); s; for (s = s0 = strtoken(&p, parv[args + 4], " "); s;
s = s0 = strtoken(&p, (char *) NULL, " ")) s = s0 = strtoken(&p, (char *) NULL, " "))
{ {
fl = 0; fl = 0;
if (*s == '@' || s[1] == '@') while(*s == '@' || *s == '%' || *s == '+')
fl |= MODE_CHANOP; {
if (*s == '+' || s[1] == '+') if (*s == '@')
fl |= MODE_VOICE; fl |= MODE_CHANOP;
#ifdef USE_HALFOPS
else if (*s == '%')
fl |= CHFL_HALFOP;
#endif
else if (*s == '+')
fl |= MODE_VOICE;
s++;
}
if (!keepnewmodes) if (!keepnewmodes)
{ {
if (fl & MODE_CHANOP) if (fl & MODE_CHANOP)
fl = MODE_DEOPPED; fl = MODE_DEOPPED;
else else
fl = 0; fl = 0;
} }
while (*s == '@' || *s == '+')
s++;
if (!(acptr = find_chasing(sptr, s, NULL))) if (!(acptr = find_chasing(sptr, s, NULL)))
continue; continue;
if (acptr->from != cptr) if (acptr->from != cptr)
continue; continue;
people++; people++;
if (!IsMember(acptr, chptr)) if (!IsMember(acptr, chptr))
{ {
add_user_to_channel(chptr, acptr, fl); add_user_to_channel(chptr, acptr, fl);
sendto_channel_butserv(chptr, acptr, ":%s JOIN :%s", s, parv[2]); sendto_channel_butserv(chptr, acptr, ":%s JOIN :%s", s, parv[2]);
} }
skipping to change at line 5332 skipping to change at line 5456
if (pargs >= MAXMODEPARAMS) if (pargs >= MAXMODEPARAMS)
{ {
*mbuf = '\0'; *mbuf = '\0';
parabuf[pbpos] = '\0'; parabuf[pbpos] = '\0';
sjoin_sendit(cptr, sptr, chptr, parv[0]); sjoin_sendit(cptr, sptr, chptr, parv[0]);
mbuf = modebuf; mbuf = modebuf;
*mbuf++ = '+'; *mbuf++ = '+';
pargs = pbpos = 0; pargs = pbpos = 0;
} }
} }
#ifdef USE_HALFOPS
if (fl & CHFL_HALFOP)
{
*mbuf++ = 'h';
ADD_PARA(s)
pargs++;
if (pargs >= MAXMODEPARAMS)
{
*mbuf = '\0';
parabuf[pbpos] = '\0';
sjoin_sendit(cptr, sptr, chptr, parv[0]);
mbuf = modebuf;
*mbuf++ = '+';
pargs = pbpos = 0;
}
}
#endif
if (fl & MODE_VOICE) if (fl & MODE_VOICE)
{ {
*mbuf++ = 'v'; *mbuf++ = 'v';
ADD_PARA(s) ADD_PARA(s)
pargs++; pargs++;
if (pargs >= MAXMODEPARAMS) if (pargs >= MAXMODEPARAMS)
{ {
*mbuf = '\0'; *mbuf = '\0';
parabuf[pbpos] = '\0'; parabuf[pbpos] = '\0';
sjoin_sendit(cptr, sptr, chptr, parv[0]); sjoin_sendit(cptr, sptr, chptr, parv[0]);
 End of changes. 35 change blocks. 
26 lines changed or deleted 173 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)