- // this lusers command shows one server at all times because
- // a protocol module must override it to show those stats.
- user->WriteNumeric(251, "%s :There are %d users and %d invisible on 1 server",user->nick.c_str(),ServerInstance->Users->UserCount()-ServerInstance->Users->ModeCount('i'),ServerInstance->Users->ModeCount('i'));
+ unsigned int n_users = ServerInstance->Users->UserCount();
+ unsigned int n_invis = ServerInstance->Users->ModeCount('i');
+ ProtoServerList serverlist;
+ ServerInstance->PI->GetServerList(serverlist);
+ int n_serv = 0;
+ int n_local_servs = 0;
+ for(ProtoServerList::iterator i = serverlist.begin(); i != serverlist.end(); ++i)
+ {
+ n_serv++;
+ if (i->parentname == ServerInstance->Config->ServerName)
+ n_local_servs++;
+ }
+ // fix for default GetServerList not returning us
+ if (!n_serv)
+ n_serv = 1;
+
+ // these are updated on every connect (or /lusers invocation), which is good enough
+ if (ServerInstance->Users->LocalUserCount() > max_local)
+ max_local = ServerInstance->Users->LocalUserCount();
+ if (n_users > max_global)
+ max_global = n_users;
+
+ user->WriteNumeric(251, "%s :There are %d users and %d invisible on %d servers",user->nick.c_str(),
+ n_users-n_invis, n_invis, n_serv);
+