From c61fac32bc7559e3d6f7534919f115266eee5917 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 19 Aug 2007 19:23:53 +0000 Subject: Allow changing of an oper's host on oper up using (give it a connect allow or deny line name) - implements bug #367 git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7760 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/users.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index bc8dc51e4..eb676b06a 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -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)) { @@ -1859,21 +1859,32 @@ void userrec::SplitChanList(userrec* dest, const std::string &cl) * then their ip will be taken as 'priority' anyway, so for example, * 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()) { - 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 (explicit_name == i->GetName()) + return &(*i); + } + } + else + { + for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++) + { + 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; -- cgit v1.3.1-10-gc9f91