return c;
}
-int chancount(void)
+long chancount(void)
{
return chanlist.size();
}
-int servercount(void)
+long count_servs(void)
{
- return 1;
+ int c = 0;
+ for (int j = 0; j < 255; j++)
+ {
+ if (servers[j] != NULL)
+ c++;
+ }
+ return c;
}
+long servercount(void)
+{
+ return count_servs()+1;
+}
+
+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_lusers(char **parameters, int pcnt, userrec *user)
{
WriteServ(user->fd,"251 %s :There are %d users and %d invisible on %d servers",user->nick,usercnt()-usercount_invisible(),usercount_invisible(),servercount());
WriteServ(user->fd,"252 %s %d :operator(s) online",user->nick,usercount_opers());
WriteServ(user->fd,"253 %s %d :unknown connections",user->nick,usercount_unknown());
WriteServ(user->fd,"254 %s %d :channels formed",user->nick,chancount());
- WriteServ(user->fd,"254 %s :I have %d clients and 0 servers",user->nick,usercnt());
+ WriteServ(user->fd,"254 %s :I have %d clients and %d servers",user->nick,local_count(),count_servs());
}
void handle_admin(char **parameters, int pcnt, userrec *user)
LinkPort = atoi(Link_Port);
if (match(Link_ServerName,parameters[0])) {
found = true;
+ break;
}
}
for (int j = 0; j < 255; j++) {
if (servers[j] == NULL) {
servers[j] = new serverrec;
+ //servers[j]->initiator = true;
strcpy(servers[j]->internal_addr,Link_IPAddr);
servers[j]->internal_port = LinkPort;
strcpy(servers[j]->name,Link_ServerName);
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,s->name))) c++;
- }
- 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++;
+ if ((i->second->fd) && (isnick(i->second->nick)) && (!strcasecmp(i->second->server,s->name))) c++;
}
return c;
}
{
char line[MAXBUF];
snprintf(line,MAXBUF,"006 %s :%s",user->nick,ServerName);
- while (strlen(line) < 40)
+ while (strlen(line) < 50)
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)
{
snprintf(line,MAXBUF,"006 %s :%c-%s",user->nick,islast(servers[j]),servers[j]->name);
- while (strlen(line) < 40)
+ while (strlen(line) < 50)
strcat(line," ");
WriteServ(user->fd,"%s%d (%.2f%%)",line,map_count(servers[j]),(float)(((float)map_count(servers[j])/(float)usercnt())*100));
}
strcpy(servers[j]->description,serverdesc);
servers[j]->internal_port = udp_port;
// create a server record for this server
+ WriteOpers("Server %s authenticated, exchanging server keys...",servername);
snprintf(response,10240,"O %d",MyKey);
serv->SendPacket(response,udp_host,udp_port,0);
return;
{
fd_set sfd;
- struct timeval tval;
+ timeval tval;
FD_ZERO(&sfd);
user_hash::iterator count2 = clientlist.begin();