ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/branches/newio/modules/m_stats.c
(Generate patch)

Comparing ircd-hybrid-8/modules/m_stats.c (file contents):
Revision 1203 by michael, Tue Aug 23 20:06:08 2011 UTC vs.
Revision 1219 by michael, Sun Sep 18 09:02:38 2011 UTC

# Line 189 | Line 189 | do_stats(struct Client *source_p, int pa
189      if (tab->letter == statchar)
190      {
191        /* The stats table says what privs are needed, so check --fl_ */
192 <      if ((tab->need_admin && !IsAdmin(source_p)) ||
193 <          (tab->need_oper && !IsOper(source_p)))
192 >      if ((tab->need_admin && !HasUMode(source_p, UMODE_ADMIN)) ||
193 >          (tab->need_oper && !HasUMode(source_p, UMODE_OPER)))
194        {
195          sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
196                     from, to);
# Line 927 | Line 927 | static void
927   stats_auth(struct Client *source_p)
928   {
929    /* Oper only, if unopered, return ERR_NOPRIVILEGES */
930 <  if ((ConfigFileEntry.stats_i_oper_only == 2) && !IsOper(source_p))
930 >  if ((ConfigFileEntry.stats_i_oper_only == 2) && !HasUMode(source_p, UMODE_OPER))
931      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
932                 from, to);
933  
934    /* If unopered, Only return matching auth blocks */
935 <  else if ((ConfigFileEntry.stats_i_oper_only == 1) && !IsOper(source_p))
935 >  else if ((ConfigFileEntry.stats_i_oper_only == 1) && !HasUMode(source_p, UMODE_OPER))
936    {
937      struct ConfItem *conf;
938      struct AccessItem *aconf;
# Line 969 | Line 969 | stats_tklines(struct Client *source_p)
969   {
970    struct ConfItem *conf;
971    /* Oper only, if unopered, return ERR_NOPRIVILEGES */
972 <  if ((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper(source_p))
972 >  if ((ConfigFileEntry.stats_k_oper_only == 2) && !HasUMode(source_p, UMODE_OPER))
973      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
974                 from, to);
975  
976    /* If unopered, Only return matching klines */
977 <  else if ((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper(source_p))
977 >  else if ((ConfigFileEntry.stats_k_oper_only == 1) && !HasUMode(source_p, UMODE_OPER))
978    {
979      struct AccessItem *aconf;
980  
# Line 1011 | Line 1011 | static void
1011   stats_klines(struct Client *source_p)
1012   {
1013    /* Oper only, if unopered, return ERR_NOPRIVILEGES */
1014 <  if ((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper(source_p))
1014 >  if ((ConfigFileEntry.stats_k_oper_only == 2) && !HasUMode(source_p, UMODE_OPER))
1015      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
1016                 from, to);
1017  
1018    /* If unopered, Only return matching klines */
1019 <  else if ((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper(source_p))
1019 >  else if ((ConfigFileEntry.stats_k_oper_only == 1) && !HasUMode(source_p, UMODE_OPER))
1020    {
1021      struct AccessItem *aconf;
1022  
# Line 1058 | Line 1058 | stats_messages(struct Client *source_p)
1058   static void
1059   stats_oper(struct Client *source_p)
1060   {
1061 <  if (!IsOper(source_p) && ConfigFileEntry.stats_o_oper_only)
1061 >  if (!HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.stats_o_oper_only)
1062      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
1063                 from, to);
1064    else
# Line 1080 | Line 1080 | stats_operedup(struct Client *source_p)
1080    {
1081      const struct Client *target_p = ptr->data;
1082  
1083 <    if (IsOperHidden(target_p) && !IsOper(source_p))
1083 >    if (HasOFlag(target_p, OPER_FLAG_HIDDEN_OPER) && !HasUMode(source_p, UMODE_OPER))
1084        continue;
1085  
1086 <    if (MyClient(source_p) && IsOper(source_p))
1086 >    if (MyClient(source_p) && HasUMode(source_p, UMODE_OPER))
1087        sendto_one(source_p, ":%s %d %s p :[%c][%s] %s (%s@%s) Idle: %d",
1088                   from, RPL_STATSDEBUG, to,
1089 <                 IsAdmin(target_p) ?
1090 <                 (IsOperHiddenAdmin(target_p) ? 'O' : 'A') : 'O',
1089 >                 HasUMode(target_p, UMODE_ADMIN) ?
1090 >                 (HasOFlag(target_p, OPER_FLAG_HIDDEN_ADMIN) ? 'O' : 'A') : 'O',
1091                   oper_privs_as_string(target_p->localClient->operflags),
1092                   target_p->name, target_p->username, target_p->host,
1093                   (int)(CurrentTime - target_p->localClient->last_privmsg));
1094      else
1095        sendto_one(source_p, ":%s %d %s p :[%c] %s (%s@%s) Idle: %d",
1096                   from, RPL_STATSDEBUG, to,
1097 <                 IsAdmin(target_p) ?
1098 <                 (IsOperHiddenAdmin(target_p) ? 'O' : 'A') : 'O',
1097 >                 HasUMode(target_p, UMODE_ADMIN) ?
1098 >                 (HasOFlag(target_p, OPER_FLAG_HIDDEN_ADMIN) ? 'O' : 'A') : 'O',
1099                   target_p->name, target_p->username, target_p->host,
1100                   (int)(CurrentTime - target_p->localClient->last_privmsg));
1101    }
# Line 1107 | Line 1107 | stats_operedup(struct Client *source_p)
1107   static void
1108   stats_ports(struct Client *source_p)
1109   {
1110 <  if (!IsOper(source_p) && ConfigFileEntry.stats_P_oper_only)
1110 >  if (!HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.stats_P_oper_only)
1111      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
1112                 from, to);
1113    else
# Line 1211 | Line 1211 | stats_uptime(struct Client *source_p)
1211    sendto_one(source_p, form_str(RPL_STATSUPTIME), from, to,
1212               now / 86400, (now / 3600) % 24, (now / 60) % 60, now % 60);
1213  
1214 <  if (!ConfigFileEntry.disable_remote || IsOper(source_p))
1214 >  if (!ConfigFileEntry.disable_remote || HasUMode(source_p, UMODE_OPER))
1215       sendto_one(source_p, form_str(RPL_STATSCONN), from, to,
1216                  Count.max_loc_con, Count.max_loc_cli, Count.totalrestartcount);
1217   }
# Line 1307 | Line 1307 | stats_servlinks(struct Client *source_p)
1307    time_t uptime = 0;
1308    dlink_node *ptr = NULL;
1309  
1310 <  if (ConfigServerHide.flatten_links && !IsOper(source_p))
1310 >  if (ConfigServerHide.flatten_links && !HasUMode(source_p, UMODE_OPER))
1311    {
1312      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
1313                 from, to);
# Line 1324 | Line 1324 | stats_servlinks(struct Client *source_p)
1324      /* ":%s 211 %s %s %u %u %llu %u %llu :%u %u %s" */
1325      sendto_one(source_p, form_str(RPL_STATSLINKINFO),
1326                 from, to,
1327 <               get_client_name(target_p, IsAdmin(source_p) ? SHOW_IP : MASK_IP),
1327 >               get_client_name(target_p, HasUMode(source_p, UMODE_ADMIN) ? SHOW_IP : MASK_IP),
1328                 dbuf_length(&target_p->localClient->buf_sendq),
1329                 target_p->localClient->send.messages,
1330                 target_p->localClient->send.bytes >> 10,
# Line 1332 | Line 1332 | stats_servlinks(struct Client *source_p)
1332                 target_p->localClient->recv.bytes >> 10,
1333                 (unsigned)(CurrentTime - target_p->firsttime),
1334                 (CurrentTime > target_p->since) ? (unsigned)(CurrentTime - target_p->since): 0,
1335 <               IsOper(source_p) ? show_capabilities(target_p) : "TS");
1335 >               HasUMode(source_p, UMODE_OPER) ? show_capabilities(target_p) : "TS");
1336    }
1337  
1338    sendB >>= 10;
# Line 1417 | Line 1417 | stats_L_list(struct Client *source_p,cha
1417    {
1418      target_p = ptr->data;
1419  
1420 <    if (IsInvisible(target_p) && (doall || wilds) &&
1421 <        !(MyConnect(source_p) && IsOper(source_p)) &&
1422 <        !IsOper(target_p) && (target_p != source_p))
1420 >    if (HasUMode(target_p, UMODE_INVISIBLE) && (doall || wilds) &&
1421 >        !(MyConnect(source_p) && HasUMode(source_p, UMODE_OPER)) &&
1422 >        !HasUMode(target_p, UMODE_OPER) && (target_p != source_p))
1423        continue;
1424      if (!doall && wilds && !match(name, target_p->name))
1425        continue;
# Line 1428 | Line 1428 | stats_L_list(struct Client *source_p,cha
1428  
1429      /* This basically shows ips for our opers if its not a server/admin, or
1430       * its one of our admins.  */
1431 <    if(MyClient(source_p) && IsOper(source_p) &&
1432 <       (IsAdmin(source_p) ||
1433 <       (!IsServer(target_p) && !IsAdmin(target_p) &&
1431 >    if(MyClient(source_p) && HasUMode(source_p, UMODE_OPER) &&
1432 >       (HasUMode(source_p, UMODE_ADMIN) ||
1433 >       (!IsServer(target_p) && !HasUMode(target_p, UMODE_ADMIN) &&
1434         !IsHandshake(target_p) && !IsConnecting(target_p))))
1435      {
1436        sendto_one(source_p, form_str(RPL_STATSLINKINFO),
# Line 1450 | Line 1450 | stats_L_list(struct Client *source_p,cha
1450      else
1451      {
1452        /* If its a hidden ip, an admin, or a server, mask the real IP */
1453 <      if(IsIPSpoof(target_p) || IsServer(target_p) || IsAdmin(target_p)
1453 >      if(IsIPSpoof(target_p) || IsServer(target_p) || HasUMode(target_p, UMODE_ADMIN)
1454           || IsHandshake(target_p) || IsConnecting(target_p))
1455          sendto_one(source_p, form_str(RPL_STATSLINKINFO),
1456                     from, to,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines