From 667d52199d5646f72dd393770c571efe22dcac2a Mon Sep 17 00:00:00 2001 From: stskeeps Date: Sun, 5 Aug 2001 23:38:17 +0000 Subject: [PATCH] +- Using bahamut /who now, this needs some testing.. --- Changes | 1 + autoconf/configure.in | 4 +- configure | 6 +- include/msg.h | 4 +- include/numeric.h | 4 + src/modules/Makefile.in | 9 +- src/modules/l_commands.c | 3 + src/packet.c | 1 - src/s_err.c | 4 +- src/s_user.c | 219 --------------------------------------- 10 files changed, 23 insertions(+), 232 deletions(-) diff --git a/Changes b/Changes index 82faba27a..2f2d6212d 100644 --- a/Changes +++ b/Changes @@ -781,3 +781,4 @@ seen. gmtime warning still there - Updated some documentation to prepar for release - Docs prepare - Fixed a major snomask bug found by narf +- Using bahamut /who now, this needs some testing.. \ No newline at end of file diff --git a/autoconf/configure.in b/autoconf/configure.in index 909aff9b7..e3a52cb4d 100644 --- a/autoconf/configure.in +++ b/autoconf/configure.in @@ -44,10 +44,10 @@ if test "$openssl" = "yes"; then AC_DEFINE(USE_SSL) AC_CACHE_CHECK(what order we should supply the SSL libraries in, ac_cv_ssl_libs, [ save_libs="$LIBS" -LIBS="$LIBS -lcrypto -lssl" +LIBS="$LIBS -lssl -lcrypto -lssl" AC_TRY_LINK([#include ], [ SSL_write(NULL, NULL, NULL); -], ac_cv_ssl_libs="-lcrypto -lssl" LIBS="$save_libs", ac_cv_ssl_libs="-lssl -lcrypto" LIBS="$save_libs")]) +], ac_cv_ssl_libs="-lssl -lcrypto -lssl" LIBS="$save_libs", ac_cv_ssl_libs="-lssl -lcrypto -lssl" LIBS="$save_libs")]) CRYPTOLIB="$ac_cv_ssl_libs" CFLAGS="$CFLAGS -I/usr/local/include -I/usr/local/ssl/include -L/usr/local/lib -L/usr/local/ssl/lib" else diff --git a/configure b/configure index 6c8e32e73..61bbc8836 100755 --- a/configure +++ b/configure @@ -4129,7 +4129,7 @@ if eval "test \"`echo '$''{'ac_cv_ssl_libs'+set}'`\" = set"; then else save_libs="$LIBS" -LIBS="$LIBS -lcrypto -lssl" +LIBS="$LIBS -lssl -lcrypto -lssl" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - ac_cv_ssl_libs="-lcrypto -lssl" LIBS="$save_libs" + ac_cv_ssl_libs="-lssl -lcrypto -lssl" LIBS="$save_libs" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_ssl_libs="-lssl -lcrypto" LIBS="$save_libs" + ac_cv_ssl_libs="-lssl -lcrypto -lssl" LIBS="$save_libs" fi rm -f conftest* fi diff --git a/include/msg.h b/include/msg.h index c28b48d2f..58d443ca2 100644 --- a/include/msg.h +++ b/include/msg.h @@ -26,8 +26,6 @@ #define MSG_PRIVATE "PRIVMSG" /* PRIV */ #define TOK_PRIVATE "!" /* 33 */ -#define MSG_WHO "WHO" /* WHO -> WHOC */ -#define TOK_WHO "\"" /* 34 */ #define MSG_WHOIS "WHOIS" /* WHOI */ #define TOK_WHOIS "#" /* 35 */ #define MSG_WHOWAS "WHOWAS" /* WHOW */ @@ -306,7 +304,7 @@ extern int m_zline(), m_unzline(); extern int m_gnotice(), m_goper(), m_globops(), m_locops(), m_unsqline(), m_chatops(); extern int m_protoctl(); -extern int m_motd(), m_who(), m_whois(), m_user(), m_list(); +extern int m_motd(), m_whois(), m_user(), m_list(); extern int m_server(), m_info(), m_links(), m_summon(), m_stats(); extern int m_users(), m_version(), m_help(); extern int m_nickserv(), m_operserv(), m_chanserv(), m_memoserv(); diff --git a/include/numeric.h b/include/numeric.h index 2da37d7b8..66f20fa18 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -304,6 +304,10 @@ #define RPL_MAPMORE 610 #define RPL_MAPEND 007 + +#define ERR_WHOSYNTAX 522 +#define ERR_WHOLIMEXCEED 523 + #define RPL_SNOMASK 8 /* diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in index b60fc73de..8af66c2b4 100644 --- a/src/modules/Makefile.in +++ b/src/modules/Makefile.in @@ -26,11 +26,12 @@ INCLUDES = ../include/struct.h ../include/config.h \ R_MODULES=m_sethost.so m_chghost.so m_chgident.so m_setname.so \ m_setident.so m_sdesc.so m_svsmode.so m_swhois.so\ - m_svsmotd.so m_svsnline.so \ + m_svsmotd.so m_svsnline.so m_who.so \ scan.so scan_socks.so web/httpd.so COMMANDS=m_sethost.c m_chghost.c m_chgident.c m_setname.c m_setident.c \ - m_sdesc.c m_svsmode.c m_swhois.c m_svsmotd.c m_svsnline.c + m_sdesc.c m_svsmode.c m_swhois.c m_svsmotd.c m_svsnline.c \ + m_who.c MODULES=commands.so $(R_MODULES) MODULEFLAGS=@MODULEFLAGS@ @@ -83,6 +84,10 @@ m_svsnline.so: m_svsnline.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o m_svsnline.so m_svsnline.c +m_who.so: m_who.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o m_who.so m_who.c + scan.so: scan.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o scan.so scan.c diff --git a/src/modules/l_commands.c b/src/modules/l_commands.c index 08a8294f5..bdc301cd6 100644 --- a/src/modules/l_commands.c +++ b/src/modules/l_commands.c @@ -91,6 +91,7 @@ int l_commands_init(int module_load) m_swhois_init(module_load); m_svsmotd_init(module_load); m_svsnline_init(module_load); + m_who_init(module_load); #ifdef SCAN_API module_depend_resolve(&scan_socks_depend[0]); m_scan_init(module_load); @@ -114,6 +115,7 @@ void l_commands_load(int module_load) m_swhois_load(module_load); m_svsmotd_load(module_load); m_svsnline_load(module_load); + m_who_load(module_load); #ifdef SCAN_API m_scan_load(module_load); scan_socks_load(module_load); @@ -136,6 +138,7 @@ void l_commands_unload(void) m_swhois_unload(); m_svsmotd_unload(); m_svsnline_unload(); + m_who_unload(); #ifdef SCAN_API scan_socks_unload(); m_scan_unload(); diff --git a/src/packet.c b/src/packet.c index 3e51baf2e..cb4cedc0c 100644 --- a/src/packet.c +++ b/src/packet.c @@ -161,7 +161,6 @@ void init_CommandHash(void) add_Command(MSG_AWAY, TOK_AWAY, m_away, MAXPARA); add_CommandX(MSG_SERVER, TOK_SERVER, m_server, MAXPARA, M_UNREGISTERED|M_SERVER); add_Command(MSG_SQUIT, TOK_SQUIT, m_squit, MAXPARA); - add_Command(MSG_WHO, TOK_WHO, m_who, MAXPARA); add_Command(MSG_WHOWAS, TOK_WHOWAS, m_whowas, MAXPARA); add_Command(MSG_LIST, TOK_LIST, m_list, MAXPARA); add_Command(MSG_NAMES, TOK_NAMES, m_names, MAXPARA); diff --git a/src/s_err.c b/src/s_err.c index 4d239c2d1..7aff52e18 100644 --- a/src/s_err.c +++ b/src/s_err.c @@ -574,8 +574,8 @@ static char *replies[] = { /* 519 519 */ ":%s 519 %s :Cannot join channel (Admin only)", /* 520 520 */ ":%s 520 %s :Cannot join channel (IRCops only)", /* 521 ERR_LISTSYNTAX */ ":%s 521 %s Bad list syntax, type /quote list ? or /raw list ?", -/* 522 */ NULL, -/* 523 */ NULL, +/* 522 ERR_WHOSYNTAX */ ":%s 522 %s :/WHO Syntax incorrect, use /who ? for help", +/* 523 ERR_WHOLIMEXCEED */ ":%s 523 %s :Error, /who limit of %d exceed. Please narrow your search down and try again", /* 524 */ NULL, /* 525 */ NULL, /* 526 */ NULL, diff --git a/src/s_user.c b/src/s_user.c index 93525306b..eee531ca6 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -2426,225 +2426,6 @@ int m_notice(cptr, sptr, parc, parv) return m_message(cptr, sptr, parc, parv, 1); } -int channelwho = 0; -int operwho = 0; -static void do_who(sptr, acptr, repchan) - aClient *sptr, *acptr; - aChannel *repchan; -{ - char status[8]; - int i = 0; - - /* auditoriums only show @'s */ - if (repchan && (repchan->mode.mode & MODE_AUDITORIUM) && - !is_chan_op(acptr, repchan)) - return; - - if (acptr->user->away) - status[i++] = 'G'; - else - status[i++] = 'H'; - if (IsARegNick(acptr)) - status[i++] = 'r'; - - /* Check for +H here too -- codemastr */ - if (IsAnOper(acptr) && (!IsHideOper(acptr) || sptr == acptr - || IsAnOper(sptr))) - status[i++] = '*'; - else if (IsInvisible(acptr) && sptr != acptr && IsAnOper(sptr)) - status[i++] = '%'; - if (repchan && is_chan_op(acptr, repchan)) - status[i++] = '@'; - else if (repchan && has_voice(acptr, repchan)) - status[i++] = '+'; - status[i] = '\0'; - if (IsWhois(acptr) && channelwho == 0 && sptr != acptr && !operwho) - { - sendto_one(acptr, - ":%s NOTICE %s :*** %s either did a /who or a specific /who on you", - me.name, acptr->name, sptr->name); - } - if (IsHiding(acptr) && sptr != acptr && !IsNetAdmin(sptr) - && !IsTechAdmin(sptr)) - repchan = NULL; - sendto_one(sptr, rpl_str(RPL_WHOREPLY), me.name, sptr->name, - (repchan) ? (repchan->chname) : "*", acptr->user->username, - IsHidden(acptr) ? acptr->user->virthost : acptr->user->realhost, - acptr->user->server, acptr->name, status, acptr->hopcount, - acptr->info); - -} - - -/* -** m_who -** parv[0] = sender prefix -** parv[1] = nickname mask list -** parv[2] = additional selection flag, only 'o' for now. -*/ -int m_who(cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; -{ - aClient *acptr; - char *mask = parc > 1 ? parv[1] : NULL; - Membership *mp; - Member *ms; - aChannel *chptr; - aChannel *mychannel; - char *channame = NULL, *s; - int oper = parc > 2 ? (*parv[2] == 'o') : 0; /* Show OPERS only */ - int member; - - - if (!BadPtr(mask)) - { - if ((s = (char *)index(mask, ','))) - { - parv[1] = ++s; - (void)m_who(cptr, sptr, parc, parv); - } - clean_channelname(mask); - } - channelwho = 0; - operwho = 0; - mychannel = NullChn; - if (oper) - { -#ifdef HELP_WHO - sendto_umode(UMODE_HELPOP, - "*** HelpOp -- from %s: [Did a /who 0 o]", parv[0]); - sendto_serv_butone(&me, ":%s HELP :[Did a /who 0 o]", parv[0]); -#endif - operwho = 1; - } - if (sptr->user) - if ((mp = sptr->user->channel)) - mychannel = mp->chptr; - - /* Allow use of m_who without registering */ - - - /* - ** Following code is some ugly hacking to preserve the - ** functions of the old implementation. (Also, people - ** will complain when they try to use masks like "12tes*" - ** and get people on channel 12 ;) --msa - */ - if (!mask || *mask == '\0') - mask = NULL; - else if (mask[1] == '\0' && mask[0] == '*') - { - mask = NULL; - if (mychannel) - channame = mychannel->chname; - } - else if (mask[1] == '\0' && mask[0] == '0') /* "WHO 0" for irc.el */ - mask = NULL; - else - channame = mask; - (void)collapse(mask); - /* Don't allow masks for non opers */ - if (!IsOper(sptr) && mask && (strchr(mask, '*') || strchr(mask, '?'))) - { - - sendto_one(sptr, rpl_str(RPL_ENDOFWHO), me.name, parv[0], - BadPtr(mask) ? "*" : mask); - } - if (IsChannelName(channame)) - { - /* - * List all users on a given channel - */ - chptr = find_channel(channame, NULL); - if (chptr) - { - member = IsMember(sptr, chptr) || IsOper(sptr); - if (member || !SecretChannel(chptr)) - for (ms = chptr->members; ms; ms = ms->next) - { - acptr = ms->cptr; - if (IsHiding(acptr)) - continue; - if (oper && (!IsAnOper(acptr))) - continue; - if ((acptr != sptr - && IsInvisible(acptr) - && !member) && !IsOper(sptr)) - continue; - channelwho = 1; - do_who(sptr, acptr, chptr); - } - } - } - else - for (acptr = client; acptr; acptr = acptr->next) - { - aChannel *ch2ptr = NULL; - int showsecret, showperson, isinvis; - - if (!IsPerson(acptr)) - continue; - if (oper && (!IsAnOper(acptr) || (IsHideOper(acptr) - && sptr != acptr && !IsAnOper(sptr)))) - continue; - showperson = 0; - showsecret = 0; - /* - * Show user if they are on the same channel, or not - * invisible and on a non secret channel (if any). - * Do this before brute force match on all relevant fields - * since these are less cpu intensive (I hope :-) and should - * provide better/more shortcuts - avalon - */ - isinvis = acptr != sptr && IsInvisible(acptr) - && !IsAnOper(sptr); - for (mp = acptr->user->channel; mp; mp = mp->next) - { - chptr = mp->chptr; - member = IsMember(sptr, chptr) || IsOper(sptr); - if (isinvis && !member) - continue; - if (IsAnOper(sptr)) - showperson = 1; - if (member || (!isinvis && - ShowChannel(sptr, chptr))) - { - ch2ptr = chptr; - showperson = 1; - break; - } - if (HiddenChannel(chptr) - && !SecretChannel(chptr) && !isinvis) - showperson = 1; - } - if (!acptr->user->channel && !isinvis) - showperson = 1; - /* - ** This is brute force solution, not efficient...? ;( - ** Show entry, if no mask or any of the fields match - ** the mask. --msa - */ - if (showperson && - (!mask || - match(mask, acptr->name) == 0 || - match(mask, acptr->user->username) == 0 || - (!IsAnOper(sptr) - || match(mask, acptr->user->realhost)) == 0 - || (!IsHidden(acptr) - || match(mask, acptr->user->virthost)) == 0 - || (IsHidden(acptr) - || match(mask, acptr->user->realhost)) == 0 - || match(mask, acptr->user->server) == 0 - || match(mask, acptr->info) == 0)) - do_who(sptr, acptr, ch2ptr); - } - sendto_one(sptr, rpl_str(RPL_ENDOFWHO), me.name, parv[0], - BadPtr(mask) ? "*" : mask); - return 0; -} - /* ** get_mode_str ** by vmlinuz