]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Whoops, i left a value out of the array, and gcc didnt warn!
[user/henk/code/inspircd.git] / src / users.cpp
index bc8dc51e436d7a03fc41cdfa071ebe8afde66d4d..4854849ad4925eae5b303ad5f6257c11088237be 100644 (file)
@@ -1011,9 +1011,9 @@ unsigned long userrec::LocalCloneCount()
 /*
  * Check class restrictions
  */
-void userrec::CheckClass()
+void userrec::CheckClass(const std::string &explicit_class)
 {
-       ConnectClass* a = this->GetClass();
+       ConnectClass* a = this->GetClass(explicit_class);
 
        if ((!a) || (a->GetType() == CC_DENY))
        {
@@ -1040,6 +1040,7 @@ void userrec::CheckClass()
        this->threshold = a->GetThreshold();
        this->sendqmax = a->GetSendqMax();
        this->recvqmax = a->GetRecvqMax();
+       this->MaxChans = a->GetMaxChans();
 }
 
 void userrec::FullConnect()
@@ -1853,27 +1854,42 @@ void userrec::SplitChanList(userrec* dest, const std::string &cl)
        }
 }
 
+unsigned int userrec::GetMaxChans()
+{
+       return this->MaxChans;
+}
 
 /* looks up a users password for their connection class (<ALLOW>/<DENY> tags)
  * NOTE: If the <ALLOW> or <DENY> tag specifies an ip, and this user resolves,
  * then their ip will be taken as 'priority' anyway, so for example,
  * <connect allow="127.0.0.1"> will match joe!bloggs@localhost
  */
-ConnectClass* userrec::GetClass()
+ConnectClass* userrec::GetClass(const std::string &explicit_name)
 {
-       for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
+       if (!explicit_name.empty())
+       {
+               for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
+               {
+                       if (explicit_name == i->GetName())
+                               return &(*i);
+               }
+       }
+       else
        {
-               if (((match(this->GetIPString(),i->GetHost().c_str(),true)) || (match(this->host,i->GetHost().c_str()))))
+               for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
                {
-                       if (i->GetPort())
+                       if (((match(this->GetIPString(),i->GetHost().c_str(),true)) || (match(this->host,i->GetHost().c_str()))))
                        {
-                               if (this->GetPort() == i->GetPort())
-                                       return &(*i);
+                               if (i->GetPort())
+                               {
+                                       if (this->GetPort() == i->GetPort())
+                                               return &(*i);
+                                       else
+                                               continue;
+                               }
                                else
-                                       continue;
+                                       return &(*i);
                        }
-                       else
-                               return &(*i);
                }
        }
        return NULL;