From 1a26adbd1b67786493433dc1aa9342e6fb981264 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 11 Apr 2004 13:45:10 +0000 Subject: Changed /map to show % users on each server git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@525 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/InspIRCd.layout | 16 ++++++++-------- src/inspircd.cpp | 19 ++++++++++++++++--- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 20f417d4d..3922b449d 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,6 +1,6 @@ [Editors] -Focused=-1 -Order=1,2,-1,4,6,3,7,25,5 +Focused=1 +Order=1,2,-1,4,6,3,7,25,5,24 [Editor_0] Open=0 @@ -12,10 +12,10 @@ LeftChar=1 [Editor_1] Open=1 -Top=0 -CursorCol=25 -CursorRow=5168 -TopLine=5141 +Top=1 +CursorCol=95 +CursorRow=5399 +TopLine=5377 LeftChar=1 [Editor_2] @@ -116,7 +116,7 @@ LeftChar=1 [Editor_14] Open=1 -Top=1 +Top=0 CursorCol=1 CursorRow=45 TopLine=1 @@ -195,7 +195,7 @@ TopLine=1 LeftChar=1 [Editor_24] -Open=0 +Open=1 Top=0 CursorCol=1 CursorRow=1 diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 1b1da19ad..f44160abb 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -5391,6 +5391,16 @@ long map_count(serverrec* s) return c; } +long local_count() +{ + int c = 0; + for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) + { + if ((i->second->fd) && (isnick(i->second->nick)) && (strcasecmp(i->second->server,ServerName))) c++; + } + return c; +} + void handle_links(char **parameters, int pcnt, userrec *user) { WriteServ(user->fd,"364 %s %s %s :0 %s",user->nick,ServerName,ServerName,ServerDesc); @@ -5406,16 +5416,19 @@ void handle_links(char **parameters, int pcnt, userrec *user) void handle_map(char **parameters, int pcnt, userrec *user) { - WriteServ(user->fd,"006 %s :%s",user->nick,ServerName); + char line[MAXBUF]; + snprintf(line,MAXBUF,"006 %s :%s",user->nick,ServerName); + while (strlen(line) < 40) + strcat(line," "); + WriteServ(user->fd,"%s%d (%.2f%%)",line,local_count(),(float)(((float)local_count()/(float)usercnt())*100)); for (int j = 0; j < 255; j++) { if (servers[j] != NULL) { - char line[MAXBUF]; snprintf(line,MAXBUF,"006 %s :%c-%s",user->nick,islast(servers[j]),servers[j]->name); while (strlen(line) < 40) strcat(line," "); - WriteServ(user->fd,"%s%d",line,map_count(servers[j])); + WriteServ(user->fd,"%s%d (%.2f%%)",line,map_count(servers[j]),(float)(((float)map_count(servers[j])/(float)usercnt())*100)); } } WriteServ(user->fd,"007 %s :End of /MAP",user->nick); -- cgit v1.2.3