]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_who.c
Some fixes to .depend generation.
[irc/rqf/shadowircd.git] / modules / m_who.c
index 2bec0964ddebacd14293358f0357ce9772e2b879..b0b76f56d5b13452729e22ff4cd714e8c7a30e6b 100644 (file)
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: m_who.c 3283 2007-03-28 13:11:30Z jilles $
+ *  $Id: m_who.c 3350 2007-04-02 22:03:08Z jilles $
  */
 #include "stdinc.h"
-#include "tools.h"
 #include "common.h"
 #include "client.h"
 #include "channel.h"
 #include "numeric.h"
 #include "s_serv.h"
 #include "send.h"
-#include "irc_string.h"
-#include "sprintf_irc.h"
+#include "match.h"
 #include "s_conf.h"
-#include "s_log.h"
+#include "logger.h"
 #include "msg.h"
 #include "parse.h"
 #include "modules.h"
@@ -51,7 +49,7 @@ struct Message who_msgtab = {
 };
 
 mapi_clist_av1 who_clist[] = { &who_msgtab, NULL };
-DECLARE_MODULE_AV1(who, NULL, NULL, who_clist, NULL, NULL, "$Revision: 3283 $");
+DECLARE_MODULE_AV1(who, NULL, NULL, who_clist, NULL, NULL, "$Revision: 3350 $");
 
 static void do_who_on_channel(struct Client *source_p, struct Channel *chptr,
                              int server_oper, int member);
@@ -75,7 +73,7 @@ m_who(struct Client *client_p, struct Client *source_p, int parc, const char *pa
        struct Client *target_p;
        struct membership *msptr;
        char *mask;
-       dlink_node *lp;
+       rb_dlink_node *lp;
        struct Channel *chptr = NULL;
        int server_oper = parc > 2 ? (*parv[2] == 'o') : 0;     /* Show OPERS only */
        int member;
@@ -119,7 +117,7 @@ m_who(struct Client *client_p, struct Client *source_p, int parc, const char *pa
        if(IsChannelName(mask))
        {
                /* List all users on a given channel */
-               chptr = find_channel(parv[1]);
+               chptr = find_channel(parv[1] + operspy);
                if(chptr != NULL)
                {
                        if(operspy)
@@ -131,7 +129,7 @@ m_who(struct Client *client_p, struct Client *source_p, int parc, const char *pa
                                do_who_on_channel(source_p, chptr, server_oper, NO);
                }
                sendto_one(source_p, form_str(RPL_ENDOFWHO),
-                          me.name, source_p->name, parv[1]);
+                          me.name, source_p->name, parv[1] + operspy);
                return 0;
        }
 
@@ -143,7 +141,7 @@ m_who(struct Client *client_p, struct Client *source_p, int parc, const char *pa
                int isinvis = 0;
 
                isinvis = IsInvisible(target_p);
-               DLINK_FOREACH(lp, target_p->user->channel.head)
+               RB_DLINK_FOREACH(lp, target_p->user->channel.head)
                {
                        msptr = lp->data;
                        chptr = msptr->chptr;
@@ -177,7 +175,7 @@ m_who(struct Client *client_p, struct Client *source_p, int parc, const char *pa
        /* it has to be a global who at this point, limit it */
        if(!IsOper(source_p))
        {
-               if((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
+               if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
                {
                        sendto_one(source_p, form_str(RPL_LOAD2HI),
                                        me.name, source_p->name, "WHO");
@@ -186,7 +184,7 @@ m_who(struct Client *client_p, struct Client *source_p, int parc, const char *pa
                        return 0;
                }
                else
-                       last_used = CurrentTime;
+                       last_used = rb_current_time();
        }
 
        /* Note: operspy_dont_care_user_info does not apply to
@@ -225,9 +223,9 @@ who_common_channel(struct Client *source_p, struct Channel *chptr,
 {
        struct membership *msptr;
        struct Client *target_p;
-       dlink_node *ptr;
+       rb_dlink_node *ptr;
 
-       DLINK_FOREACH(ptr, chptr->members.head)
+       RB_DLINK_FOREACH(ptr, chptr->members.head)
        {
                msptr = ptr->data;
                target_p = msptr->client_p;
@@ -244,7 +242,7 @@ who_common_channel(struct Client *source_p, struct Channel *chptr,
                {
                        if((mask == NULL) ||
                                        match(mask, target_p->name) || match(mask, target_p->username) ||
-                                       match(mask, target_p->host) || match(mask, target_p->user->server) ||
+                                       match(mask, target_p->host) || match(mask, target_p->servptr->name) ||
                                        (IsOper(source_p) && match(mask, target_p->orighost)) ||
                                        match(mask, target_p->info))
                        {
@@ -272,7 +270,7 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers
 {
        struct membership *msptr;
        struct Client *target_p;
-       dlink_node *lp, *ptr;
+       rb_dlink_node *lp, *ptr;
        int maxmatches = 500;
 
        /* first, list all matching INvisible clients on common channels
@@ -280,7 +278,7 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers
         */
        if(!operspy)
        {
-               DLINK_FOREACH(lp, source_p->user->channel.head)
+               RB_DLINK_FOREACH(lp, source_p->user->channel.head)
                {
                        msptr = lp->data;
                        who_common_channel(source_p, msptr->chptr, mask, server_oper, &maxmatches);
@@ -294,7 +292,7 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers
         * if this is an operspy who, list all matching clients, no need
         * to clear marks
         */
-       DLINK_FOREACH(ptr, global_client_list.head)
+       RB_DLINK_FOREACH(ptr, global_client_list.head)
        {
                target_p = ptr->data;
                if(!IsPerson(target_p))
@@ -313,7 +311,7 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers
                {
                        if(!mask ||
                                        match(mask, target_p->name) || match(mask, target_p->username) ||
-                                       match(mask, target_p->host) || match(mask, target_p->user->server) ||
+                                       match(mask, target_p->host) || match(mask, target_p->servptr->name) ||
                                        (IsOper(source_p) && match(mask, target_p->orighost)) ||
                                        match(mask, target_p->info))
                        {
@@ -346,10 +344,10 @@ do_who_on_channel(struct Client *source_p, struct Channel *chptr,
 {
        struct Client *target_p;
        struct membership *msptr;
-       dlink_node *ptr;
+       rb_dlink_node *ptr;
        int combine = IsCapable(source_p, CLICAP_MULTI_PREFIX);
 
-       DLINK_FOREACH(ptr, chptr->members.head)
+       RB_DLINK_FOREACH(ptr, chptr->members.head)
        {
                msptr = ptr->data;
                target_p = msptr->client_p;
@@ -379,13 +377,13 @@ do_who(struct Client *source_p, struct Client *target_p, const char *chname, con
 {
        char status[5];
 
-       ircsprintf(status, "%c%s%s",
+       rb_sprintf(status, "%c%s%s",
                   target_p->user->away ? 'G' : 'H', IsOper(target_p) ? "*" : "", op_flags);
 
        sendto_one(source_p, form_str(RPL_WHOREPLY), me.name, source_p->name,
                   (chname) ? (chname) : "*",
                   target_p->username,
-                  target_p->host, target_p->user->server, target_p->name,
+                  target_p->host, target_p->servptr->name, target_p->name,
                   status, 
                   ConfigServerHide.flatten_links ? 0 : target_p->hopcount, 
                   target_p->info);