ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_stats.c
(Generate patch)

Comparing ircd-hybrid/trunk/modules/m_stats.c (file contents):
Revision 1832 by michael, Fri Apr 19 19:16:09 2013 UTC vs.
Revision 1834 by michael, Fri Apr 19 19:50:27 2013 UTC

# Line 411 | Line 411 | stats_deny(struct Client *source_p, int
411        if (conf->until)
412          continue;
413  
414 <      sendto_one(source_p, RPL_STATSDLINE,
414 >      sendto_one(source_p, form_str(RPL_STATSDLINE),
415                   from, to, 'D', conf->host, conf->reason);
416      }
417    }
# Line 446 | Line 446 | stats_tdeny(struct Client *source_p, int
446        if (!conf->until)
447          continue;
448  
449 <      sendto_one(source_p, RPL_STATSDLINE,
449 >      sendto_one(source_p, form_str(RPL_STATSDLINE),
450                   from, to, 'd', conf->host, conf->reason);
451      }
452    }
# Line 467 | Line 467 | stats_exempt(struct Client *source_p, in
467  
468    if (ConfigFileEntry.stats_e_disabled)
469    {
470 <    sendto_one(source_p, ERR_NOPRIVILEGES,
470 >    sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
471                 from, to);
472      return;
473    }
474  
475 +
476    for (i = 0; i < ATABLE_SIZE; ++i)
477    {
478      DLINK_FOREACH(ptr, atable[i].head)
# Line 483 | Line 484 | stats_exempt(struct Client *source_p, in
484  
485        conf = arec->conf;
486  
487 <      sendto_one(source_p, RPL_STATSDLINE,
487 >      sendto_one(source_p, form_str(RPL_STATSDLINE),
488                   from, to, 'e', conf->host, conf->reason /* XXX */);
489      }
490    }
# Line 613 | Line 614 | stats_glines(struct Client *source_p, in
614        {
615          const struct MaskItem *conf = arec->conf;
616  
617 <        sendto_one(source_p, RPL_STATSKLINE,
617 >        sendto_one(source_p, form_str(RPL_STATSKLINE),
618                     from, to, "G",
619                     conf->host ? conf->host : "*",
620                     conf->user ? conf->user : "*",
# Line 700 | Line 701 | report_auth(struct Client *client_p, int
701         * sender, so prepare the strings for comparing --fl_
702         */
703        if (ConfigFileEntry.hide_spoof_ips)
704 <        sendto_one(client_p, RPL_STATSILINE, me.name,
704 >        sendto_one(client_p, form_str(RPL_STATSILINE), me.name,
705                     client_p->name, 'I',
706                     conf->name == NULL ? "*" : conf->name,
707                     show_iline_prefix(client_p, conf),
# Line 709 | Line 710 | report_auth(struct Client *client_p, int
710                     conf->class ? conf->class->name : "<default>");
711  
712        else
713 <        sendto_one(client_p, RPL_STATSILINE, me.name,
713 >        sendto_one(client_p, form_str(RPL_STATSILINE), me.name,
714                     client_p->name, 'I',
715                     conf->name == NULL ? "*" : conf->name,
716                     show_iline_prefix(client_p, conf),
# Line 724 | Line 725 | stats_auth(struct Client *source_p, int
725   {
726    /* Oper only, if unopered, return ERR_NOPRIVILEGES */
727    if ((ConfigFileEntry.stats_i_oper_only == 2) && !HasUMode(source_p, UMODE_OPER))
728 <    sendto_one(source_p, ERR_NOPRIVILEGES,
728 >    sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
729                 from, to);
730  
731    /* If unopered, Only return matching auth blocks */
# Line 746 | Line 747 | stats_auth(struct Client *source_p, int
747      if (conf == NULL)
748        return;
749  
750 <    sendto_one(source_p, RPL_STATSILINE, from,
750 >    sendto_one(source_p, form_str(RPL_STATSILINE), from,
751                 to, 'I',
752                 "*", show_iline_prefix(source_p, conf),
753                 conf->host, conf->port,
# Line 793 | Line 794 | report_Klines(struct Client *client_p, i
794          continue;
795  
796        if (HasUMode(client_p, UMODE_OPER))
797 <        sendto_one(client_p, RPL_STATSKLINE, me.name,
797 >        sendto_one(client_p, form_str(RPL_STATSKLINE), me.name,
798                     client_p->name, p, conf->host, conf->user,
799                     conf->reason);
800        else
801 <        sendto_one(client_p, RPL_STATSKLINE, me.name,
801 >        sendto_one(client_p, form_str(RPL_STATSKLINE), me.name,
802                     client_p->name, p, conf->host, conf->user,
803                     conf->reason);
804      }
# Line 809 | Line 810 | stats_tklines(struct Client *source_p, i
810   {
811    /* Oper only, if unopered, return ERR_NOPRIVILEGES */
812    if ((ConfigFileEntry.stats_k_oper_only == 2) && !HasUMode(source_p, UMODE_OPER))
813 <    sendto_one(source_p, ERR_NOPRIVILEGES,
813 >    sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
814                 from, to);
815  
816    /* If unopered, Only return matching klines */
# Line 834 | Line 835 | stats_tklines(struct Client *source_p, i
835      if (!conf->until)
836        return;
837  
838 <    sendto_one(source_p, RPL_STATSKLINE, from,
838 >    sendto_one(source_p, form_str(RPL_STATSKLINE), from,
839                 to, "k", conf->host, conf->user, conf->reason);
840    }
841    /* Theyre opered, or allowed to see all klines */
# Line 848 | Line 849 | stats_klines(struct Client *source_p, in
849   {
850    /* Oper only, if unopered, return ERR_NOPRIVILEGES */
851    if ((ConfigFileEntry.stats_k_oper_only == 2) && !HasUMode(source_p, UMODE_OPER))
852 <    sendto_one(source_p, ERR_NOPRIVILEGES,
852 >    sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
853                 from, to);
854  
855    /* If unopered, Only return matching klines */
# Line 874 | Line 875 | stats_klines(struct Client *source_p, in
875      if (conf->until)
876        return;
877        
878 <    sendto_one(source_p, RPL_STATSKLINE, from,
878 >    sendto_one(source_p, form_str(RPL_STATSKLINE), from,
879                 to, "K", conf->host, conf->user, conf->reason);
880    }
881    /* Theyre opered, or allowed to see all klines */
# Line 894 | Line 895 | static void
895   stats_oper(struct Client *source_p, int parc, char *parv[])
896   {
897    if (!HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.stats_o_oper_only)
898 <    sendto_one(source_p, ERR_NOPRIVILEGES,
898 >    sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
899                 from, to);
900    else
901      report_confitem_types(source_p, CONF_OPER);
# Line 941 | Line 942 | static void
942   stats_ports(struct Client *source_p, int parc, char *parv[])
943   {
944    if (!HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.stats_P_oper_only)
945 <    sendto_one(source_p, ERR_NOPRIVILEGES,
945 >    sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
946                 from, to);
947    else
948      show_ports(source_p);
# Line 1035 | Line 1036 | stats_uptime(struct Client *source_p, in
1036   {
1037    time_t now = CurrentTime - me.localClient->since;
1038  
1039 <  sendto_one(source_p, RPL_STATSUPTIME, from, to,
1039 >  sendto_one(source_p, form_str(RPL_STATSUPTIME), from, to,
1040               now / 86400, (now / 3600) % 24, (now / 60) % 60, now % 60);
1041  
1042    if (!ConfigFileEntry.disable_remote || HasUMode(source_p, UMODE_OPER))
1043 <     sendto_one(source_p, RPL_STATSCONN, from, to,
1043 >     sendto_one(source_p, form_str(RPL_STATSCONN), from, to,
1044                  Count.max_loc_con, Count.max_loc_cli, Count.totalrestartcount);
1045   }
1046  
# Line 1096 | Line 1097 | stats_servlinks(struct Client *source_p,
1097  
1098    if (ConfigServerHide.flatten_links && !HasUMode(source_p, UMODE_OPER))
1099    {
1100 <    sendto_one(source_p, ERR_NOPRIVILEGES,
1100 >    sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
1101                 from, to);
1102      return;
1103    }
# Line 1109 | Line 1110 | stats_servlinks(struct Client *source_p,
1110      recvB += target_p->localClient->recv.bytes;
1111  
1112      /* ":%s 211 %s %s %u %u %llu %u %llu :%u %u %s" */
1113 <    sendto_one(source_p, RPL_STATSLINKINFO,
1113 >    sendto_one(source_p, form_str(RPL_STATSLINKINFO),
1114                 from, to,
1115                 get_client_name(target_p, HasUMode(source_p, UMODE_ADMIN) ? SHOW_IP : MASK_IP),
1116                 dbuf_length(&target_p->localClient->buf_sendq),
# Line 1216 | Line 1217 | stats_L_list(struct Client *source_p,cha
1217         (!IsServer(target_p) && !HasUMode(target_p, UMODE_ADMIN) &&
1218         !IsHandshake(target_p) && !IsConnecting(target_p))))
1219      {
1220 <      sendto_one(source_p, RPL_STATSLINKINFO,
1220 >      sendto_one(source_p, form_str(RPL_STATSLINKINFO),
1221                   from, to,
1222                   (IsUpper(statchar)) ?
1223                   get_client_name(target_p, SHOW_IP) :
# Line 1235 | Line 1236 | stats_L_list(struct Client *source_p,cha
1236        /* If its a hidden ip, an admin, or a server, mask the real IP */
1237        if(IsIPSpoof(target_p) || IsServer(target_p) || HasUMode(target_p, UMODE_ADMIN)
1238           || IsHandshake(target_p) || IsConnecting(target_p))
1239 <        sendto_one(source_p, RPL_STATSLINKINFO,
1239 >        sendto_one(source_p, form_str(RPL_STATSLINKINFO),
1240                     from, to,
1241                     get_client_name(target_p, MASK_IP),
1242                     dbuf_length(&target_p->localClient->buf_sendq),
# Line 1247 | Line 1248 | stats_L_list(struct Client *source_p,cha
1248                     (CurrentTime > target_p->localClient->since) ? (unsigned)(CurrentTime - target_p->localClient->since):0,
1249                     IsServer(target_p) ? show_capabilities(target_p) : "-");
1250        else /* show the real IP */
1251 <        sendto_one(source_p, RPL_STATSLINKINFO,
1251 >        sendto_one(source_p, form_str(RPL_STATSLINKINFO),
1252                     from, to,
1253                     (IsUpper(statchar)) ?
1254                     get_client_name(target_p, SHOW_IP) :
# Line 1297 | Line 1298 | stats_ltrace(struct Client *source_p, in
1298      stats_L(source_p, name, doall, wilds, statchar);
1299    }
1300    else
1301 <    sendto_one(source_p, ERR_NEEDMOREPARAMS,
1301 >    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
1302                 from, to, "STATS");
1303   }
1304  
# Line 1362 | Line 1363 | do_stats(struct Client *source_p, int pa
1363  
1364    if (statchar == '\0')
1365    {
1366 <    sendto_one(source_p, RPL_ENDOFSTATS,
1366 >    sendto_one(source_p, form_str(RPL_ENDOFSTATS),
1367                 from, to, '*');
1368      return;
1369    }
# Line 1375 | Line 1376 | do_stats(struct Client *source_p, int pa
1376        if ((tab->need_admin && !HasUMode(source_p, UMODE_ADMIN)) ||
1377            (tab->need_oper && !HasUMode(source_p, UMODE_OPER)))
1378        {
1379 <        sendto_one(source_p, ERR_NOPRIVILEGES,
1379 >        sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
1380                     from, to);
1381          break;
1382        }
# Line 1389 | Line 1390 | do_stats(struct Client *source_p, int pa
1390      }
1391    }
1392  
1393 <  sendto_one(source_p, RPL_ENDOFSTATS,
1393 >  sendto_one(source_p, form_str(RPL_ENDOFSTATS),
1394               from, to, statchar);
1395   }
1396  
# Line 1428 | Line 1429 | m_stats(struct Client *client_p, struct
1429    /* Check the user is actually allowed to do /stats, and isnt flooding */
1430    if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
1431    {
1432 <    sendto_one(source_p, RPL_LOAD2HI,
1432 >    sendto_one(source_p,form_str(RPL_LOAD2HI),
1433                 from, to);
1434      return;
1435    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines