"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/s_user.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.

s_user.c  (bahamut-2.1.4):s_user.c  (bahamut-2.1.5)
skipping to change at line 64 skipping to change at line 64
extern void send_topic_burst(aClient *); extern void send_topic_burst(aClient *);
extern void outofmemory(void); /* defined in list.c */ extern void outofmemory(void); /* defined in list.c */
#ifdef MAXBUFFERS #ifdef MAXBUFFERS
extern void reset_sock_opts(); extern void reset_sock_opts();
extern int send_lusers(aClient *,aClient *,int, char **); extern int send_lusers(aClient *,aClient *,int, char **);
#endif #endif
extern int is_xflags_exempted(aClient *sptr, aChannel *chptr); /* for m_message( ) */ extern int is_xflags_exempted(aClient *sptr, aChannel *chptr); /* for m_message( ) */
extern int verbose_to_relaychan(aClient *sptr, aChannel *chptr, char *cmd, char *reason); /* for m_message() */ extern int verbose_to_relaychan(aClient *sptr, aChannel *chptr, char *cmd, char *reason); /* for m_message() */
extern inline void verbose_to_opers(aClient *sptr, aChannel *chptr, char *cmd, c har *reason); /* for m_message() */ extern inline void verbose_to_opers(aClient *sptr, aChannel *chptr, char *cmd, c har *reason); /* for m_message() */
extern time_t get_user_jointime(aClient *cptr, aChannel *chptr); /* for send_msg _error() */ extern time_t get_user_jointime(aClient *cptr, aChannel *chptr); /* for send_msg _error() */
extern time_t get_user_lastmsgtime(aClient *cptr, aChannel *chptr); /* also for send_msg_error() -Holbrook */
extern int server_was_split; extern int server_was_split;
extern int svspanic; extern int svspanic;
extern int svsnoop; extern int svsnoop;
extern int uhm_type; extern int uhm_type;
extern int uhm_umodeh;
static char buf[BUFSIZE], buf2[BUFSIZE]; static char buf[BUFSIZE], buf2[BUFSIZE];
int user_modes[] = int user_modes[] =
{ {
UMODE_o, 'o', UMODE_o, 'o',
UMODE_O, 'O', UMODE_O, 'O',
UMODE_i, 'i', UMODE_i, 'i',
UMODE_w, 'w', UMODE_w, 'w',
UMODE_s, 's', UMODE_s, 's',
UMODE_c, 'c', UMODE_c, 'c',
skipping to change at line 1529 skipping to change at line 1531
if(ret == ERR_NOCTRLSONCHAN) if(ret == ERR_NOCTRLSONCHAN)
sendto_one(sptr, err_str(ERR_NOCTRLSONCHAN), me.name, sendto_one(sptr, err_str(ERR_NOCTRLSONCHAN), me.name,
parv[0], nick, parv[2]); parv[0], nick, parv[2]);
else if(ret == ERR_NEEDTOWAIT) else if(ret == ERR_NEEDTOWAIT)
{ {
sendto_one(sptr, err_str(ERR_NEEDTOWAIT), me.name, sendto_one(sptr, err_str(ERR_NEEDTOWAIT), me.name,
parv[0], get_highest((sptr->firsttime + chptr->talk_connect_t ime - NOW), get_user_jointime(sptr, chptr) + chptr->talk_join_time - NOW), chptr ->chname); parv[0], get_highest((sptr->firsttime + chptr->talk_connect_t ime - NOW), get_user_jointime(sptr, chptr) + chptr->talk_join_time - NOW), chptr ->chname);
} }
else if(ret == ERR_NEEDREGGEDNICK) else if(ret == ERR_NEEDREGGEDNICK)
sendto_one(sptr, err_str(ERR_NEEDREGGEDNICK), me.name, sendto_one(sptr, err_str(ERR_NEEDREGGEDNICK), me.name,
parv[0], nick, "speak in", aliastab[AII_NS].nick, parv[0], nick, "speak in", chptr->chname, aliastab[AII_NS].ni ck,
aliastab[AII_NS].server, NS_Register_URL); aliastab[AII_NS].server, NS_Register_URL);
else if(ret == ERR_MAXMSGSENT)
sendto_one(sptr, err_str(ERR_MAXMSGSENT), me.name,
parv[0], (chptr->max_messages_time + get_user_lastmsgtime(spt
r, chptr) - NOW + 1), chptr->chname);
else else
sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN), me.name, sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN), me.name,
parv[0], nick); parv[0], nick);
} }
/* /*
* Check if the recipient we are sending to is one of the services or stats addr
esses.
*/
static int is_aliastab_recipient(char *recipient)
{
AliasInfo *ai;
char full_target[NICKLEN + HOSTLEN + 2];
for(ai = aliastab; ai->nick; ai++)
{
ircsprintf(full_target, "%s@%s", ai->nick, ai->server);
if(!mycmp(recipient, full_target))
return 1;
}
return 0;
}
/*
* m_message (used in m_private() and m_notice()) the general * m_message (used in m_private() and m_notice()) the general
* function to deliver MSG's between users/channels * function to deliver MSG's between users/channels
* *
* parv[0] = sender prefix * parv[0] = sender prefix
* parv[1] = receiver list * parv[1] = receiver list
* parv[2] = message text * parv[2] = message text
* *
* massive cleanup * rev argv 6/91 * massive cleanup * rev argv 6/91
* again -Quension [Jul 2004] * again -Quension [Jul 2004]
* *
skipping to change at line 1580 skipping to change at line 1603
} }
if (parc < 3 || *parv[2] == 0) if (parc < 3 || *parv[2] == 0)
{ {
sendto_one(sptr, err_str(ERR_NOTEXTTOSEND), me.name, parv[0]); sendto_one(sptr, err_str(ERR_NOTEXTTOSEND), me.name, parv[0]);
return -1; return -1;
} }
if (ismine) if (ismine)
{ {
/* if squelched or spamming, allow only messages to self */ /* if squelched or spamming, allow only messages to self or to the servi ces and stats addresses */
if ((IsSquelch(sptr) if ((IsSquelch(sptr)
#if defined(ANTI_SPAMBOT) && !defined(ANTI_SPAMBOT_WARN_ONLY) #if defined(ANTI_SPAMBOT) && !defined(ANTI_SPAMBOT_WARN_ONLY)
|| (sptr->join_leave_count >= MAX_JOIN_LEAVE_COUNT) || (sptr->join_leave_count >= MAX_JOIN_LEAVE_COUNT)
#endif #endif
) && mycmp(parv[0], parv[1])) ) && mycmp(parv[0], parv[1]) && !is_aliastab_recipient(parv[1]))
{ {
if (IsWSquelch(sptr) && !notice) if (IsWSquelch(sptr) && !notice)
sendto_one(sptr, ":%s NOTICE %s :You are currently squelched." sendto_one(sptr, ":%s NOTICE %s :You are currently squelched."
" Message not sent.", me.name, parv[0]); " Message not sent.", me.name, parv[0]);
return 0; return 0;
} }
if (call_hooks(CHOOK_MSG, sptr, notice, parv[2]) == FLUSH_BUFFER) if (call_hooks(CHOOK_MSG, sptr, notice, parv[2]) == FLUSH_BUFFER)
return FLUSH_BUFFER; return FLUSH_BUFFER;
skipping to change at line 1619 skipping to change at line 1642
if (!IsAnOper(sptr)) if (!IsAnOper(sptr))
#endif #endif
sptr->since += 4; sptr->since += 4;
/* [@][+]#channel preprocessing */ /* [@][+]#channel preprocessing */
s = target; s = target;
while (1) while (1)
{ {
if (*s == '@') if (*s == '@')
chflags |= CHFL_CHANOP; chflags |= CHFL_CHANOP;
#ifdef USE_HALFOPS
else if (*s == '%')
chflags |= CHFL_HALFOP;
#endif
else if (*s == '+') else if (*s == '+')
chflags |= CHFL_VOICE; chflags |= CHFL_VOICE;
else else
break; break;
s++; s++;
} }
/* target is a channel */ /* target is a channel */
if (IsChannelName(s)) if (IsChannelName(s))
{ {
skipping to change at line 1739 skipping to change at line 1766
} }
} }
} }
} }
if (chflags) if (chflags)
{ {
/* don't let clients do stuff like @+@@+++@+@@@#channel */ /* don't let clients do stuff like @+@@+++@+@@@#channel */
if (chflags & CHFL_VOICE) if (chflags & CHFL_VOICE)
*--s = '+'; *--s = '+';
#ifdef USE_HALFOPS
if (chflags & CHFL_HALFOP)
*--s = '%';
#endif
if (chflags & CHFL_CHANOP) if (chflags & CHFL_CHANOP)
*--s = '@'; *--s = '@';
sendto_channelflags_butone(cptr, sptr, chptr, chflags, sendto_channelflags_butone(cptr, sptr, chptr, chflags,
":%s %s %s :%s", parv[0], cmd, s, ":%s %s %s :%s", parv[0], cmd, s,
parv[2]); parv[2]);
} }
else else
sendto_channel_butone(cptr, sptr, chptr, ":%s %s %s :%s", sendto_channel_butone(cptr, sptr, chptr, ":%s %s %s :%s",
parv[0], cmd, target, parv[2]); parv[0], cmd, target, parv[2]);
skipping to change at line 2116 skipping to change at line 2147
user->real_oper_ip); user->real_oper_ip);
#endif #endif
#if (RIDICULOUS_PARANOIA_LEVEL==2) #if (RIDICULOUS_PARANOIA_LEVEL==2)
if(MyConnect(acptr) && user->real_oper_host && if(MyConnect(acptr) && user->real_oper_host &&
(IsAdmin(sptr) || (sptr == acptr)) && MyConnect(sptr)) (IsAdmin(sptr) || (sptr == acptr)) && MyConnect(sptr))
sendto_one(sptr, rpl_str(RPL_WHOISACTUALLY), me.name, sptr->name, sendto_one(sptr, rpl_str(RPL_WHOISACTUALLY), me.name, sptr->name,
name, user->real_oper_username, user->real_oper_host, name, user->real_oper_username, user->real_oper_host,
user->real_oper_ip); user->real_oper_ip);
#endif #endif
#endif #endif
mlen = strlen(me.name) + strlen(parv[0]) + 6 + strlen(name); mlen = strlen(me.name) + strlen(parv[0]) + 9 + strlen(name);
for (len = 0, *buf = '\0', lp = user->channel; lp; lp = lp->next) for (len = 0, *buf = '\0', lp = user->channel; lp; lp = lp->next)
{ {
chptr = lp->value.chptr; chptr = lp->value.chptr;
showchan=ShowChannel(sptr,chptr); showchan=ShowChannel(sptr,chptr);
if (showchan || IsAdmin(sptr)) if (showchan || IsAdmin(sptr))
{ {
if (len + strlen(chptr->chname) > (size_t) BUFSIZE - 4 - mlen) if (len + strlen(chptr->chname) > (size_t) BUFSIZE - 4 - mlen)
{ {
sendto_one(sptr, ":%s %d %s %s :%s", me.name, sendto_one(sptr, rpl_str(RPL_WHOISCHANNELS), me.name, parv[0
RPL_WHOISCHANNELS, parv[0], name, buf); ], name, buf);
*buf = '\0'; *buf = '\0';
len = 0; len = 0;
} }
if(!showchan) /* if we're not really supposed to show the chan if(!showchan) /* if we're not really supposed to show the chan
* but do it anyways, mark it as such! */ * but do it anyways, mark it as such! */
#ifdef USE_HALFOPS
*(buf + len++) = '~';
#else
*(buf + len++) = '%'; *(buf + len++) = '%';
#endif
if (is_chan_op(acptr, chptr)) if (is_chan_op(acptr, chptr))
*(buf + len++) = '@'; *(buf + len++) = '@';
#ifdef USE_HALFOPS
else if (is_chan_halfop(acptr, chptr))
*(buf + len++) = '%';
#endif
else if (has_voice(acptr, chptr)) else if (has_voice(acptr, chptr))
*(buf + len++) = '+'; *(buf + len++) = '+';
if (len) if (len)
*(buf + len) = '\0'; *(buf + len) = '\0';
strcpy(buf + len, chptr->chname); strcpy(buf + len, chptr->chname);
len += strlen(chptr->chname); len += strlen(chptr->chname);
strcat(buf + len, " "); strcat(buf + len, " ");
len++; len++;
} }
} }
skipping to change at line 2324 skipping to change at line 2362
sptr->umode |= UMODE_S; sptr->umode |= UMODE_S;
#endif #endif
#ifdef NO_USER_SERVERKILLS #ifdef NO_USER_SERVERKILLS
sptr->umode &= ~UMODE_k; sptr->umode &= ~UMODE_k;
#endif #endif
#ifdef NO_USER_OPERKILLS #ifdef NO_USER_OPERKILLS
sptr->umode &= ~UMODE_s; sptr->umode &= ~UMODE_s;
#endif #endif
strncpyzt(user->host, host, sizeof(user->host)); strncpyzt(user->host, host, sizeof(user->host));
#ifdef USER_HOSTMASKING #ifdef USER_HOSTMASKING
if(uhm_type > 0) sptr->umode |= UMODE_H; if((uhm_type > 0) && (uhm_umodeh == 1)) sptr->umode |= UMODE_H;
else sptr->umode &= ~UMODE_H; else sptr->umode &= ~UMODE_H;
#endif #endif
user->server = me.name; user->server = me.name;
} }
strncpyzt(sptr->info, realname, sizeof(sptr->info)); strncpyzt(sptr->info, realname, sizeof(sptr->info));
sptr->user->servicestamp = serviceid; sptr->user->servicestamp = serviceid;
if (!MyConnect(sptr)) if (!MyConnect(sptr))
{ {
if (inet_pton(AF_INET, ip, &sptr->ip.ip4) == 1) if (inet_pton(AF_INET, ip, &sptr->ip.ip4) == 1)
skipping to change at line 2406 skipping to change at line 2444
Link *lp, *lpn; Link *lp, *lpn;
sptr->flags |= FLAGS_NORMALEX; sptr->flags |= FLAGS_NORMALEX;
if (!IsServer(cptr)) if (!IsServer(cptr))
{ {
if(IsSquelch(sptr)) if(IsSquelch(sptr))
reason = cptr->name; reason = cptr->name;
strcpy(comment, "Quit: "); strcpy(comment, "Quit: ");
strncpy(comment + 6, reason, TOPICLEN - 6); strncpy(comment + 6, reason, TOPICLEN - 6);
comment[TOPICLEN] = 0; comment[TOPICLEN] = 0;
#ifdef SPAMFILTER
if(IsPerson(sptr)) if(IsPerson(sptr))
{ {
if((blocked = check_sf(sptr, reason, "quit", SF_CMD_QUIT, sptr->name #ifdef SPAMFILTER
))) blocked = check_sf(sptr, reason, "quit", SF_CMD_QUIT, sptr->name);
#endif
for(lp = sptr->user->channel; lp; lp = lpn)
{ {
for(lp = sptr->user->channel; lp; lp = lpn) lpn = lp->next;
chptr = lp->value.chptr;
#ifdef SPAMFILTER
if(blocked && !(chptr->mode.mode & MODE_PRIVACY))
{ {
lpn = lp->next; sendto_serv_butone(cptr, ":%s PART %s", parv[0], chptr->chna
chptr = lp->value.chptr; me);
if(!(chptr->mode.mode & MODE_PRIVACY)) sendto_channel_butserv(chptr, sptr, ":%s PART %s", parv[0],
{ chptr->chname);
sendto_serv_butone(cptr, ":%s PART %s", parv[0], chptr-> remove_user_from_channel(sptr, chptr);
chname); continue; /* If we already parted, there is no need to check
sendto_channel_butserv(chptr, sptr, ":%s PART %s", parv[ the xflags... -Kobi. */
0], chptr->chname);
remove_user_from_channel(sptr, chptr);
}
} }
} #endif
else if((chptr->xflags & XFLAG_NO_QUIT_MSG) && !is_xflags_exempted(sp
{ tr,chptr))
for(lp = sptr->user->channel; lp; lp = lpn)
{ {
lpn = lp->next; if(chptr->xflags & XFLAG_USER_VERBOSE)
chptr = lp->value.chptr; verbose_to_relaychan(cptr, chptr, "quit_msg", comment);
if((chptr->xflags & XFLAG_NO_QUIT_MSG) && !is_xflags_exempte if(chptr->xflags & XFLAG_OPER_VERBOSE)
d(sptr,chptr)) verbose_to_opers(cptr, chptr, "quit_msg", comment);
{ sendto_serv_butone(cptr, ":%s PART %s", parv[0], chptr->chna
if(chptr->xflags & XFLAG_USER_VERBOSE) me);
verbose_to_relaychan(cptr, chptr, "quit_msg", commen sendto_channel_butserv(chptr, sptr, ":%s PART %s", parv[0],
t); chptr->chname);
if(chptr->xflags & XFLAG_OPER_VERBOSE) remove_user_from_channel(sptr, chptr);
verbose_to_opers(cptr, chptr, "quit_msg", comment);
sendto_serv_butone(cptr, ":%s PART %s", parv[0], chptr->
chname);
sendto_channel_butserv(chptr, sptr, ":%s PART %s", parv[
0], chptr->chname);
remove_user_from_channel(sptr, chptr);
}
} }
} }
} }
#endif
return exit_client(cptr, sptr, sptr, comment); return exit_client(cptr, sptr, sptr, comment);
} }
else else
return exit_client(cptr, sptr, sptr, reason); return exit_client(cptr, sptr, sptr, reason);
} }
/* /*
* m_kill * m_kill
* parv[0] = sender prefix * parv[0] = sender prefix
skipping to change at line 3317 skipping to change at line 3348
case '\r': case '\r':
case '\n': case '\n':
case '\t': case '\t':
break; break;
case 'r': case 'r':
case 'x': case 'x':
case 'X': case 'X':
case 'S': case 'S':
break; /* users can't set themselves +r,+x,+X or +S! */ break; /* users can't set themselves +r,+x,+X or +S! */
case 'H': case 'H':
if ((uhm_type > 0) && (what == MODE_ADD)) if ((uhm_type > 0) && (uhm_umodeh > 0) && (what == MODE_ADD) )
sptr->umode |= UMODE_H; sptr->umode |= UMODE_H;
else else
sptr->umode &= ~UMODE_H; sptr->umode &= ~UMODE_H;
break; break;
case 'A': case 'A':
/* set auto +a if user is setting +A */ /* set auto +a if user is setting +A */
if (MyClient(sptr) && (what == MODE_ADD)) if (MyClient(sptr) && (what == MODE_ADD))
sptr->umode |= UMODE_a; sptr->umode |= UMODE_a;
default: default:
for (s = user_modes; (flag = *s); s += 2) for (s = user_modes; (flag = *s); s += 2)
 End of changes. 23 change blocks. 
43 lines changed or deleted 76 lines changed or added

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