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

Comparing ircd-hybrid/trunk/modules/m_map.c (file contents):
Revision 2820 by michael, Wed Jan 15 23:10:26 2014 UTC vs.
Revision 2989 by michael, Tue Feb 18 11:21:42 2014 UTC

# Line 44 | Line 44 | static void dump_map(struct Client *clie
44    dlink_node *ptr = NULL;
45    struct Client *target_p = NULL;
46    static char prompt[64];
47 +  static char buf[IRCD_BUFSIZE];
48    char *p = prompt + prompt_length;
49    int cnt = 0;
50 +  int bufpos = 0;
51  
52    *p = '\0';
53  
# Line 54 | Line 56 | static void dump_map(struct Client *clie
56                 client->name, prompt, server->name);
57    else
58    {
59 <    char buf[IRC_MAXSID + 3] = ""; /* +3 for [, ], \0 */
59 >    int dashes;
60 >
61 >    bufpos += snprintf(buf + bufpos, sizeof(buf) - bufpos, "%s", server->name);
62  
63      if (HasUMode(client, UMODE_OPER) && server->id[0])
64 <      snprintf(buf, sizeof(buf), "[%s]", server->id);
64 >      bufpos += snprintf(buf + bufpos, sizeof(buf) - bufpos, "[%s]", server->id);
65 >
66 >    buf[bufpos++] = ' ';
67 >    dashes = 50 - bufpos - prompt_length;
68 >    for (; dashes > 0; --dashes)
69 >      buf[bufpos++] = '-';
70 >    buf[bufpos++] = ' ';
71 >    buf[bufpos++] = '|';
72  
73 +    bufpos += snprintf(buf + bufpos, sizeof(buf) - bufpos, " Users %5d (%1.2f%%)",
74 +                       dlink_list_length(&server->serv->client_list), 100 *
75 +                       (float)dlink_list_length(&server->serv->client_list) /
76 +                       (float)Count.total);
77      sendto_one(client, form_str(RPL_MAP), me.name, client->name,
78 <               prompt, server->name, buf,
64 <               dlink_list_length(&server->serv->client_list),
65 <               dlink_list_length(&server->serv->client_list) * 100 / Count.total);
78 >               prompt, buf);
79    }
80  
81    if (prompt_length > 0)

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)