"Fossies" - the Fresh Open Source Software Archive  

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

m_who.c  (bahamut-2.1.4):m_who.c  (bahamut-2.1.5)
skipping to change at line 48 skipping to change at line 48
/* Externally defined stuffs */ /* Externally defined stuffs */
extern int user_modes[]; extern int user_modes[];
extern Link *find_channel_link(Link *, aChannel *); extern Link *find_channel_link(Link *, aChannel *);
int build_searchopts(aClient *sptr, int parc, char *parv[]) int build_searchopts(aClient *sptr, int parc, char *parv[])
{ {
static char *who_oper_help[] = static char *who_oper_help[] =
{ {
"/WHO [+|-][acghilmnstuCM] [args]", #ifdef USER_HOSTMASKING
"/WHO [+|-][acghilmnstuCHIMR] [args]",
#else
"/WHO [+|-][acghilmnstuCIM] [args]",
#endif
"Flags are specified like channel modes,", "Flags are specified like channel modes,",
"The flags cghimnsu all have arguments", "The flags cghimnsu all have arguments",
"Flags are set to a positive check by +, a negative check by -", "Flags are set to a positive check by +, a negative check by -",
"The flags work as follows:", "The flags work as follows:",
"Flag a: user is away", "Flag a: user is away",
"Flag c <channel>: user is on <channel>,", "Flag c <channel>: user is on <channel>,",
" no wildcards accepted", " no wildcards accepted",
"Flag g <gcos/realname>: user has string <gcos> in their GCOS,", "Flag g <gcos/realname>: user has string <gcos> in their GCOS,",
" wildcards accepted, oper only", " wildcards accepted, oper only",
"Flag h <host>: user has string <host> in their hostname,", "Flag h <host>: user has string <host> in their hostname,",
skipping to change at line 77 skipping to change at line 81
" (-t) show nicks in use for less than <seconds> seconds" , " (-t) show nicks in use for less than <seconds> seconds" ,
"Flag u <user>: user has string <user> in their username,", "Flag u <user>: user has string <user> in their username,",
" wildcards accepted", " wildcards accepted",
"Flag T <type>: user is of type <type>, where type is assigned", "Flag T <type>: user is of type <type>, where type is assigned",
" by services.", " by services.",
"Behavior flags:", "Behavior flags:",
"Flag C: show first visible channel user is in", "Flag C: show first visible channel user is in",
"Flag M: check for user in channels I am a member of", "Flag M: check for user in channels I am a member of",
"Flag I: always show IPs instead of hosts", "Flag I: always show IPs instead of hosts",
#ifdef USER_HOSTMASKING #ifdef USER_HOSTMASKING
"Flag H: show the masked host even if the user's host is not masked (umode -H)",
"Flag R: show the real host even if the user's host is masked (umode +H)", "Flag R: show the real host even if the user's host is masked (umode +H)",
#endif #endif
NULL NULL
}; };
static char *who_user_help[] = static char *who_user_help[] =
{ {
"/WHO [+|-][achmnsuCM] [args]", "/WHO [+|-][achmnsuCM] [args]",
"Flags are specified like channel modes,", "Flags are specified like channel modes,",
"The flags cghimnsu all have arguments", "The flags cghimnsu all have arguments",
skipping to change at line 353 skipping to change at line 358
break; break;
case 'I': case 'I':
if(!IsAnOper(sptr)) if(!IsAnOper(sptr))
{ {
sendto_one(sptr, getreply(ERR_NOPRIVILEGES), me.name, parv[0]); sendto_one(sptr, getreply(ERR_NOPRIVILEGES), me.name, parv[0]);
return 0; return 0;
} }
wsopts.ip_show = change; wsopts.ip_show = change;
break; break;
#ifdef USER_HOSTMASKING #ifdef USER_HOSTMASKING
case 'H':
if(!IsAnOper(sptr))
{
sendto_one(sptr, getreply(ERR_NOPRIVILEGES), me.name, parv[0]);
return 0;
}
wsopts.maskhost_show = change;
break;
case 'R': case 'R':
if(!IsAnOper(sptr)) if(!IsAnOper(sptr))
{ {
sendto_one(sptr, getreply(ERR_NOPRIVILEGES), me.name, parv[0]); sendto_one(sptr, getreply(ERR_NOPRIVILEGES), me.name, parv[0]);
return 0; return 0;
} }
wsopts.realhost_show = change; wsopts.realhost_show = change;
break; break;
#endif #endif
case 'i': case 'i':
skipping to change at line 618 skipping to change at line 631
return 0; return 0;
} }
/* we only call match once, since if the first condition /* we only call match once, since if the first condition
* isn't true, most (all?) compilers will never try the * isn't true, most (all?) compilers will never try the
* second...phew :) */ * second...phew :) */
if(wsopts.user!=NULL) if(wsopts.user!=NULL)
if((wsopts.user_plus && uchkfn(wsopts.user, ac->user->username)) || if((wsopts.user_plus && uchkfn(wsopts.user, ac->user->username)) ||
(!wsopts.user_plus && !uchkfn(wsopts.user, ac->user->username))) (!wsopts.user_plus && !uchkfn(wsopts.user, ac->user->username)))
return 0; return 0;
if(wsopts.nick!=NULL) if(wsopts.host!=NULL)
if((wsopts.nick_plus && nchkfn(wsopts.nick, ac->name)) || {
(!wsopts.nick_plus && !nchkfn(wsopts.nick, ac->name))) #ifdef USER_HOSTMASKING
return 0; if(IsAnOper(sptr))
{
if((wsopts.host_plus && hchkfn(wsopts.host, ac->user->host) && hchkfn
(wsopts.host, ac->user->mhost)) ||
(!wsopts.host_plus && (!hchkfn(wsopts.host, ac->user->host) || !hc
hkfn(wsopts.host, ac->user->mhost))))
return 0;
}
else
{
if((wsopts.host_plus && hchkfn(wsopts.host, IsUmodeH(ac)?ac->user->mh
ost:ac->user->host)) ||
(!wsopts.host_plus && !hchkfn(wsopts.host, IsUmodeH(ac)?ac->user->
mhost:ac->user->host)))
return 0;
}
#else
if((wsopts.host_plus && hchkfn(wsopts.host, ac->user->host)) ||
(!wsopts.host_plus && !hchkfn(wsopts.host, ac->user->host)))
return 0;
#endif
}
if(wsopts.host!=NULL) if(wsopts.host!=NULL)
if((wsopts.host_plus && hchkfn(wsopts.host, ac->user->host)) || if((wsopts.host_plus && hchkfn(wsopts.host, ac->user->host)) ||
(!wsopts.host_plus && !hchkfn(wsopts.host, ac->user->host))) (!wsopts.host_plus && !hchkfn(wsopts.host, ac->user->host)))
return 0; return 0;
if(wsopts.cidr_plus) if(wsopts.cidr_plus)
if(ac->ip_family != wsopts.cidr_family || if(ac->ip_family != wsopts.cidr_family ||
bitncmp(&ac->ip, &wsopts.cidr_ip, wsopts.cidr_bits) != 0) bitncmp(&ac->ip, &wsopts.cidr_ip, wsopts.cidr_bits) != 0)
return 0; return 0;
skipping to change at line 645 skipping to change at line 675
return 0; return 0;
if(wsopts.gcos!=NULL) if(wsopts.gcos!=NULL)
if((wsopts.gcos_plus && gchkfn(wsopts.gcos, ac->info)) || if((wsopts.gcos_plus && gchkfn(wsopts.gcos, ac->info)) ||
(!wsopts.gcos_plus && !gchkfn(wsopts.gcos, ac->info))) (!wsopts.gcos_plus && !gchkfn(wsopts.gcos, ac->info)))
return 0; return 0;
/* /*
* For the below options, a value of two means '+', * For the below options, a value of two means '+',
* a value of 1 means '-', and a value of 0 means * a value of 1 means '-', and a value of 0 means
* not speficied. * not specified.
*/ */
if(wsopts.ts_value == 2 && /* +t */ if(wsopts.ts_value == 2 && /* +t */
NOW - ac->tsinfo < wsopts.ts) NOW - ac->tsinfo < wsopts.ts)
return 0; return 0;
else if(wsopts.ts_value == 1 && /* -t */ else if(wsopts.ts_value == 1 && /* -t */
NOW - ac->tsinfo >= wsopts.ts) NOW - ac->tsinfo >= wsopts.ts)
return 0; return 0;
return 1; return 1;
skipping to change at line 700 skipping to change at line 730
} }
} }
return "*"; return "*";
} }
/* allow lusers only 200 replies from /who */ /* allow lusers only 200 replies from /who */
#define MAXWHOREPLIES 200 #define MAXWHOREPLIES 200
#define WHO_HOPCOUNT(s, a) ( ( (IsULine((a)) || IsUmodeI((a))) && !IsAnOper((s)) ) ? 0 : a->hopcount) #define WHO_HOPCOUNT(s, a) ( ( (IsULine((a)) || IsUmodeI((a))) && !IsAnOper((s)) ) ? 0 : a->hopcount)
#define WHO_SERVER(s ,a) ((IsUmodeI((a)) && !IsAnOper((s))) ? HIDDEN_SERVER_NAME : a->user->server) #define WHO_SERVER(s ,a) ((IsUmodeI((a)) && !IsAnOper((s))) ? HIDDEN_SERVER_NAME : a->user->server)
#ifdef USER_HOSTMASKING #ifdef USER_HOSTMASKING
#define WHO_HOST(s, a) ((wsopts.ip_show) ? (a)->hostip : (IsUmodeH((a)) && !wsop ts.realhost_show) ? (a)->user->mhost : (a)->user->host) #define WHO_HOST(s, a) ((wsopts.ip_show) ? (a)->hostip : ((IsUmodeH((a)) && !wso pts.realhost_show) || wsopts.maskhost_show) ? (a)->user->mhost : (a)->user->host )
#else #else
#define WHO_HOST(s, a) ((wsopts.ip_show) ? (a)->hostip : (a)->user->host) #define WHO_HOST(s, a) ((wsopts.ip_show) ? (a)->hostip : (a)->user->host)
#endif #endif
int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[]) int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])
{ {
aClient *ac; aClient *ac;
chanMember *cm; chanMember *cm;
Link *lp; Link *lp;
int shown=0, i=0, showall=IsAnOper(sptr); int shown=0, i=0, showall=IsAnOper(sptr);
char status[4]; char status[4];
 End of changes. 6 change blocks. 
7 lines changed or deleted 41 lines changed or added

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