]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree.cpp
Changed LUSERS to show global current to not include unregistered connections
[user/henk/code/inspircd.git] / src / modules / m_spanningtree.cpp
index c40e99b40aae518ddf5fcf6d3e7a9c2a37d4acfa..24997b93972c2628467e03fc1bb722ea2252ea7f 100644 (file)
@@ -1143,24 +1143,22 @@ class TreeSocket : public InspSocket
                size_t counter = snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age);
                size_t initial = counter;
 
-               std::map<char*,char*> *ulist = c->GetUsers();
+               CUList *ulist = c->GetUsers();
                std::vector<userrec*> specific_halfop;
                std::vector<userrec*> specific_voice;
 
-               for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++)
+               for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
                {
-                       char* o = i->second;
-                       userrec* otheruser = (userrec*)o;
                        charlcat(list,' ',MAXBUF);
                        counter++;
-                       int x = cflags(otheruser,c);
+                       int x = cflags(i->second,c);
                        if ((x & UCMODE_HOP) && (x & UCMODE_OP))
                        {
-                               specific_halfop.push_back(otheruser);
+                               specific_halfop.push_back(i->second);
                        }
                        if (((x & UCMODE_HOP) || (x & UCMODE_OP)) && (x & UCMODE_VOICE))
                        {
-                               specific_voice.push_back(otheruser);
+                               specific_voice.push_back(i->second);
                        }
 
                        char n = 0;
@@ -1183,7 +1181,7 @@ class TreeSocket : public InspSocket
                                counter++;
                        }
 
-                       counter += strlcat(list,otheruser->nick,MAXBUF);
+                       counter += strlcat(list,i->second->nick,MAXBUF);
 
                        if (counter > (480-NICKMAX))
                        {
@@ -2271,13 +2269,21 @@ class TreeSocket : public InspSocket
                                }
                                else if (command == "BURST")
                                {
-                                       time_t THEM = atoi(params[0].c_str());
-                                       long delta = THEM-time(NULL);
-                                       if ((delta < -600) || (delta > 600))
+                                       if (params.size())
                                        {
-                                               WriteOpers("*** \2ERROR\2: Your clocks are out by %d seconds (this is more than ten minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs(delta));
-                                               this->WriteLine("ERROR :Your clocks are out by "+ConvToStr(abs(delta))+" seconds (this is more than ten minutes). Link aborted, PLEASE SYNC YOUR CLOCKS!");
-                                               return false;
+                                               /* If a time stamp is provided, try and check syncronization */
+                                               time_t THEM = atoi(params[0].c_str());
+                                               long delta = THEM-time(NULL);
+                                               if ((delta < -600) || (delta > 600))
+                                               {
+                                                       WriteOpers("*** \2ERROR\2: Your clocks are out by %d seconds (this is more than ten minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs(delta));
+                                                       this->WriteLine("ERROR :Your clocks are out by "+ConvToStr(abs(delta))+" seconds (this is more than ten minutes). Link aborted, PLEASE SYNC YOUR CLOCKS!");
+                                                       return false;
+                                               }
+                                               else if ((delta < -60) || (delta > 60))
+                                               {
+                                                       WriteOpers("*** \2WARNING\2: Your clocks are out by %d seconds, please consider synching your clocks.",abs(delta));
+                                               }
                                        }
                                        this->LinkState = CONNECTED;
                                        Node = new TreeServer(InboundServerName,InboundDescription,TreeRoot,this);
@@ -2652,14 +2658,12 @@ void AddThisServer(TreeServer* server, std::deque<TreeServer*> &list)
 // returns a list of DIRECT servernames for a specific channel
 void GetListOfServersForChannel(chanrec* c, std::deque<TreeServer*> &list)
 {
-       std::map<char*,char*> *ulist = c->GetUsers();
-       for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++)
+       CUList *ulist = c->GetUsers();
+       for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
        {
-               char* o = i->second;
-               userrec* otheruser = (userrec*)o;
-               if (otheruser->fd < 0)
+               if (i->second->fd < 0)
                {
-                       TreeServer* best = BestRouteTo(otheruser->server);
+                       TreeServer* best = BestRouteTo(i->second->server);
                        if (best)
                                AddThisServer(best,list);
                }
@@ -2966,7 +2970,7 @@ class ModuleSpanningTree : public Module
                WriteServ(user->fd,"254 %s %d :channels formed",user->nick,chancount());
                WriteServ(user->fd,"254 %s :I have %d clients and %d servers",user->nick,local_count(),this->CountLocalServs());
                WriteServ(user->fd,"265 %s :Current Local Users: %d  Max: %d",user->nick,local_count(),max_local);
-               WriteServ(user->fd,"266 %s :Current Global Users: %d  Max: %d",user->nick,clientlist.size(),max_global);
+               WriteServ(user->fd,"266 %s :Current Global Users: %d  Max: %d",user->nick,usercnt(),max_global);
                return;
        }