diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2014-02-18 11:21:53 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2014-02-18 11:21:53 +0000 |
commit | 5740380472747d4468a1df80eebf38414f487287 (patch) | |
tree | 10de6264d1869eb1e79ab89c6584b9bad2659ec5 /modules | |
parent | 9539cad87f3a507d92e2c1051f478a24fc0b2402 (diff) |
- Stole recent /map changes from p4. Network map looks much better now.
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2990 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules')
-rw-r--r-- | modules/m_map.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/modules/m_map.c b/modules/m_map.c index 36f0648..fb1981c 100644 --- a/modules/m_map.c +++ b/modules/m_map.c @@ -44,8 +44,10 @@ static void dump_map(struct Client *client, dlink_node *ptr = NULL; struct Client *target_p = NULL; static char prompt[64]; + static char buf[IRCD_BUFSIZE]; char *p = prompt + prompt_length; int cnt = 0; + int bufpos = 0; *p = '\0'; @@ -54,15 +56,26 @@ static void dump_map(struct Client *client, client->name, prompt, server->name); else { - char buf[IRC_MAXSID + 3] = ""; /* +3 for [, ], \0 */ + int dashes; - if (HasUMode(client, UMODE_OPER) && server->id[0]) - snprintf(buf, sizeof(buf), "[%s]", server->id); + bufpos += snprintf(buf + bufpos, sizeof(buf) - bufpos, "%s", server->name); + if (HasUMode(client, UMODE_OPER) && server->id[0]) + bufpos += snprintf(buf + bufpos, sizeof(buf) - bufpos, "[%s]", server->id); + + buf[bufpos++] = ' '; + dashes = 50 - bufpos - prompt_length; + for (; dashes > 0; --dashes) + buf[bufpos++] = '-'; + buf[bufpos++] = ' '; + buf[bufpos++] = '|'; + + bufpos += snprintf(buf + bufpos, sizeof(buf) - bufpos, " Users %5d (%1.2f%%)", + dlink_list_length(&server->serv->client_list), 100 * + (float)dlink_list_length(&server->serv->client_list) / + (float)Count.total); sendto_one(client, form_str(RPL_MAP), me.name, client->name, - prompt, server->name, buf, - dlink_list_length(&server->serv->client_list), - dlink_list_length(&server->serv->client_list) * 100 / Count.total); + prompt, buf); } if (prompt_length > 0) |