"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/m_rwho.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_rwho.c  (bahamut-2.1.4):m_rwho.c  (bahamut-2.1.5)
skipping to change at line 84 skipping to change at line 84
#define RWO_SERVER 0x0040 #define RWO_SERVER 0x0040
#define RWO_TS 0x0080 #define RWO_TS 0x0080
#define RWO_STYPE 0x0100 #define RWO_STYPE 0x0100
#define RWO_GCOS 0x0200 #define RWO_GCOS 0x0200
#define RWO_AWAY 0x0400 #define RWO_AWAY 0x0400
#define RWO_JOINS 0x0800 #define RWO_JOINS 0x0800
#define RWO_CLONES 0x1000 #define RWO_CLONES 0x1000
#define RWO_MATCHES 0x2000 #define RWO_MATCHES 0x2000
#define RWO_CHANNEL 0x4000 #define RWO_CHANNEL 0x4000
#define RWO_PROB 0x8000 #define RWO_PROB 0x8000
#define RWO_MASKED_HOST 0x10000
#define RWO_UNMASKED_HOST 0x20000
/* miscellaneous flags */ /* miscellaneous flags */
#define RWC_SHOWIP 0x0001 /* WHO compatibility */ #define RWC_SHOWIP 0x0001 /* WHO compatibility */
#define RWC_CHANNEL 0x0002 /* WHO compatibility */ #define RWC_CHANNEL 0x0002 /* WHO compatibility */
#define RWC_TIME 0x0004 /* show timing stats */ #define RWC_TIME 0x0004 /* show timing stats */
#ifdef USER_HOSTMASKING
#define RWHO_HOST(cptr) IsUmodeH(cptr)?cptr->user->mhost:cptr->user->host
#else
#define RWHO_HOST(cptr) cptr->user->host
#endif
static const char *rwho_help[] = { static const char *rwho_help[] = {
"RWHO <[+|-]matchflags>[/<outputflags>[:<cookie>]] <args>", "RWHO <[+|-]matchflags>[/<outputflags>[:<cookie>]] <args>",
"Match flags are specified like channel modes,", "Match flags are specified like channel modes,",
"'+' being a positive match and '-' being a negative one:", "'+' being a positive match and '-' being a negative one:",
" a - user is (not) away", " a - user is (not) away",
" c <channel> - user is on channel <channel> (+ only)", " c <channel> - user is on channel <channel> (+ only)",
#ifdef THROTTLE_ENABLE #ifdef THROTTLE_ENABLE
" d <clones> - there are N or more (less) users per host", " d <clones> - there are N or more (less) users per host",
" D <matches> - there are N or more (less) matching users per host", " D <matches> - there are N or more (less) matching users per host",
#endif #endif
skipping to change at line 126 skipping to change at line 134
" A <away> - user's away reason matches regexp pattern (implies +a)", " A <away> - user's away reason matches regexp pattern (implies +a)",
" g <gcos/name> - user's real name matches regexp pattern", " g <gcos/name> - user's real name matches regexp pattern",
" n <nick> - user's nick matches regexp pattern", " n <nick> - user's nick matches regexp pattern",
" u <username> - user's username matches regexp pattern", " u <username> - user's username matches regexp pattern",
"The regular expression flags do not support negative matches.", "The regular expression flags do not support negative matches.",
"The optional output flags cause replies to be sent using numeric 354 and", "The optional output flags cause replies to be sent using numeric 354 and",
"contain only the fields associated with the flags in the order below:", "contain only the fields associated with the flags in the order below:",
" :<cookie> - supplied cookie (useful for scripts)", " :<cookie> - supplied cookie (useful for scripts)",
" n - user's nick", " n - user's nick",
" u - user's username", " u - user's username",
#ifdef USER_HOSTMASKING
" h - user's current host",
" H - user's masked host",
" R - user's real/unmasked host",
#else
" h - user's host", " h - user's host",
#endif
" i - user's IP", " i - user's IP",
" s - user's server", " s - user's server",
" f - standard WHO flags (GH*%@+)", " f - standard WHO flags (GH*%@+)",
" c - user's most recently joined channel", " c - user's most recently joined channel",
" j - number of joined channels", " j - number of joined channels",
#ifdef THROTTLE_ENABLE #ifdef THROTTLE_ENABLE
" d - number of clones on user's IP", " d - number of clones on user's IP",
" D - number of matches on user's IP (see below)", " D - number of matches on user's IP (see below)",
#endif #endif
" t - nick's start-of-use timestamp", " t - nick's start-of-use timestamp",
skipping to change at line 191 skipping to change at line 205
int thisclones; /* number of clones on this host */ int thisclones; /* number of clones on this host */
int thismatches; /* number of matches on this host */ int thismatches; /* number of matches on this host */
#endif #endif
#ifdef RWHO_PROBABILITY #ifdef RWHO_PROBABILITY
int nickprob[2]; /* min/max nick probability */ int nickprob[2]; /* min/max nick probability */
int userprob[2]; /* min/max username probability */ int userprob[2]; /* min/max username probability */
int gcosprob[2]; /* min/max real name probability */ int gcosprob[2]; /* min/max real name probability */
#endif #endif
} rwho_opts; } rwho_opts;
static char rwhobuf[1024]; static char rwhobuf[2048];
static char scratch[1024]; static char scratch[1024];
/* /*
* Send a syntax error message. * Send a syntax error message.
*/ */
static void rwho_synerr(aClient *sptr, char *msg) static void rwho_synerr(aClient *sptr, char *msg)
{ {
sendto_one(sptr, getreply(ERR_WHOSYNTAX), me.name, sptr->name, "RWHO", sendto_one(sptr, getreply(ERR_WHOSYNTAX), me.name, sptr->name, "RWHO",
"rwho"); "rwho");
if (msg) if (msg)
skipping to change at line 768 skipping to change at line 782
} }
rwho_opts.rplcookie = sfl; rwho_opts.rplcookie = sfl;
break; break;
} }
switch (*sfl) switch (*sfl)
{ {
case 'n': rwho_opts.rplfields |= RWO_NICK; sfl++; break; case 'n': rwho_opts.rplfields |= RWO_NICK; sfl++; break;
case 'u': rwho_opts.rplfields |= RWO_USER; sfl++; break; case 'u': rwho_opts.rplfields |= RWO_USER; sfl++; break;
case 'h': rwho_opts.rplfields |= RWO_HOST; sfl++; break; case 'h': rwho_opts.rplfields |= RWO_HOST; sfl++; break;
#ifdef USER_HOSTMASKING
case 'H': rwho_opts.rplfields |= RWO_MASKED_HOST; sfl++; break;
case 'R': rwho_opts.rplfields |= RWO_UNMASKED_HOST; sfl++; break;
#endif
case 'i': rwho_opts.rplfields |= RWO_IP; sfl++; break; case 'i': rwho_opts.rplfields |= RWO_IP; sfl++; break;
case 's': rwho_opts.rplfields |= RWO_SERVER; sfl++; break; case 's': rwho_opts.rplfields |= RWO_SERVER; sfl++; break;
case 'f': rwho_opts.rplfields |= RWO_FLAGS; sfl++; break; case 'f': rwho_opts.rplfields |= RWO_FLAGS; sfl++; break;
case 'c': rwho_opts.rplfields |= RWO_CHANNEL; sfl++; break; case 'c': rwho_opts.rplfields |= RWO_CHANNEL; sfl++; break;
case 'j': rwho_opts.rplfields |= RWO_JOINS; sfl++; break; case 'j': rwho_opts.rplfields |= RWO_JOINS; sfl++; break;
#ifdef THROTTLE_ENABLE #ifdef THROTTLE_ENABLE
case 'd': rwho_opts.rplfields |= RWO_CLONES; sfl++; break; case 'd': rwho_opts.rplfields |= RWO_CLONES; sfl++; break;
case 'D': rwho_opts.rplfields |= RWO_MATCHES; sfl++; break; case 'D': rwho_opts.rplfields |= RWO_MATCHES; sfl++; break;
#endif #endif
case 't': rwho_opts.rplfields |= RWO_TS; sfl++; break; case 't': rwho_opts.rplfields |= RWO_TS; sfl++; break;
skipping to change at line 973 skipping to change at line 991
{ {
if (bitncmp(&cptr->ip, &rwho_opts.ip_addr[1], if (bitncmp(&cptr->ip, &rwho_opts.ip_addr[1],
rwho_opts.ip_cidr_bits[1]) == 0) rwho_opts.ip_cidr_bits[1]) == 0)
return 0; return 0;
} }
else else
return 0; return 0;
} }
if ((rwho_opts.check[0] & RWM_HOST) && if ((rwho_opts.check[0] & RWM_HOST) &&
rwho_opts.host_func[0](rwho_opts.host_pat[0], cptr->user->host)) rwho_opts.host_func[0](rwho_opts.host_pat[0], cptr->user->host) && rwho_ opts.host_func[0](rwho_opts.host_pat[0], cptr->user->mhost))
return 0; return 0;
if ((rwho_opts.check[1] & RWM_HOST) && if ((rwho_opts.check[1] & RWM_HOST) &&
!rwho_opts.host_func[1](rwho_opts.host_pat[1], cptr->user->host)) !rwho_opts.host_func[1](rwho_opts.host_pat[1], cptr->user->host) && !rwh o_opts.host_func[1](rwho_opts.host_pat[1], cptr->user->mhost))
return 0; return 0;
#ifdef RWHO_PROBABILITY #ifdef RWHO_PROBABILITY
if ((rwho_opts.check[0] | rwho_opts.check[1]) & if ((rwho_opts.check[0] | rwho_opts.check[1]) &
(RWM_NPROB|RWM_UPROB|RWM_GPROB)) (RWM_NPROB|RWM_UPROB|RWM_GPROB))
{ {
int np, up, gp; int np, up, gp;
get_probabilities(cptr, &np, &up, &gp); get_probabilities(cptr, &np, &up, &gp);
if ((rwho_opts.check[0] & RWM_NPROB) && np < rwho_opts.nickprob[0]) if ((rwho_opts.check[0] & RWM_NPROB) && np < rwho_opts.nickprob[0])
return 0; return 0;
skipping to change at line 1125 skipping to change at line 1143
dst = chname; dst = chname;
if (!PubChannel(chptr)) if (!PubChannel(chptr))
*dst++ = '%'; *dst++ = '%';
if (PubChannel(chptr) || IsAdmin(cptr)) if (PubChannel(chptr) || IsAdmin(cptr))
strcpy(dst, chptr->chname); strcpy(dst, chptr->chname);
} }
if (rwho_opts.misc & RWC_SHOWIP) if (rwho_opts.misc & RWC_SHOWIP)
src = ac->hostip; src = ac->hostip;
else else
src = ac->user->host; src = RWHO_HOST(ac);
ircsprintf(buf, getreply(RPL_WHOREPLY), me.name, cptr->name, ircsprintf(buf, getreply(RPL_WHOREPLY), me.name, cptr->name,
rwho_opts.chptr ? rwho_opts.chptr->chname : chname, rwho_opts.chptr ? rwho_opts.chptr->chname : chname,
ac->user->username, src, ac->user->server, ac->user->username, src, ac->user->server,
ac->name, status, ac->hopcount, ac->info); ac->name, status, ac->hopcount, ac->info);
return; return;
} }
if (rwho_opts.rplfields & RWO_NICK) if (rwho_opts.rplfields & RWO_NICK)
{ {
skipping to change at line 1152 skipping to change at line 1170
if (rwho_opts.rplfields & RWO_USER) if (rwho_opts.rplfields & RWO_USER)
{ {
src = ac->user->username; src = ac->user->username;
*dst++ = ' '; *dst++ = ' ';
while (*src) while (*src)
*dst++ = *src++; *dst++ = *src++;
} }
if (rwho_opts.rplfields & RWO_HOST) if (rwho_opts.rplfields & RWO_HOST)
{ {
src = RWHO_HOST(ac);
*dst++ = ' ';
while (*src)
*dst++ = *src++;
}
#ifdef USER_HOSTMASKING
if (rwho_opts.rplfields & RWO_MASKED_HOST)
{
src = ac->user->mhost;
*dst++ = ' ';
while (*src)
*dst++ = *src++;
}
if (rwho_opts.rplfields & RWO_UNMASKED_HOST)
{
src = ac->user->host; src = ac->user->host;
*dst++ = ' '; *dst++ = ' ';
while (*src) while (*src)
*dst++ = *src++; *dst++ = *src++;
} }
#endif
if (rwho_opts.rplfields & RWO_IP) if (rwho_opts.rplfields & RWO_IP)
{ {
src = ac->hostip; src = ac->hostip;
*dst++ = ' '; *dst++ = ' ';
while (*src) while (*src)
*dst++ = *src++; *dst++ = *src++;
} }
if (rwho_opts.rplfields & RWO_SERVER) if (rwho_opts.rplfields & RWO_SERVER)
 End of changes. 11 change blocks. 
4 lines changed or deleted 39 lines changed or added

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