diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-10 20:27:51 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-10 20:27:51 +0000 |
commit | 23a4885701cba4a87a5ae027257fb4207c917572 (patch) | |
tree | cdd4aa7e4260135e444b28182448a14adb4e9a57 /src/users.cpp | |
parent | 51924df0a878f66f83ea5639dcb7a761cfa65772 (diff) |
Move tons more stuff into class InspIRCd*, make signal handler functions static members
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4855 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r-- | src/users.cpp | 104 |
1 files changed, 67 insertions, 37 deletions
diff --git a/src/users.cpp b/src/users.cpp index 8273acc88..7c1409a33 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1051,7 +1051,7 @@ void userrec::FullConnect(CullList* Goners) } } - ShowMOTD(this); + this->ShowMOTD(); /* * fix 3 by brain, move registered = 7 below these so that spurious modes and host @@ -1719,46 +1719,76 @@ void userrec::SplitChanList(userrec* dest, const std::string &cl) */ ConnectClass& userrec::GetClass() { - for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++) - { - if ((match(this->GetIPString(),i->host.c_str(),true)) || (match(this->host,i->host.c_str()))) - return *i; - } + for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++) + { + if ((match(this->GetIPString(),i->host.c_str(),true)) || (match(this->host,i->host.c_str()))) + return *i; + } - return *(ServerInstance->Config->Classes.begin()); + return *(ServerInstance->Config->Classes.begin()); } void userrec::PurgeEmptyChannels() { - std::vector<chanrec*> to_delete; - - // firstly decrement the count on each channel - for (std::vector<ucrec*>::iterator f = this->chans.begin(); f != this->chans.end(); f++) - { - ucrec* uc = *f; - if (uc->channel) - { - if (uc->channel->DelUser(this) == 0) - { - /* No users left in here, mark it for deletion */ - to_delete.push_back(uc->channel); - uc->channel = NULL; - } - } - } - - for (std::vector<chanrec*>::iterator n = to_delete.begin(); n != to_delete.end(); n++) - { - chanrec* thischan = *n; - chan_hash::iterator i2 = ServerInstance->chanlist.find(thischan->name); - if (i2 != ServerInstance->chanlist.end()) - { - FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(i2->second)); - DELETE(i2->second); - ServerInstance->chanlist.erase(i2); - } - } - - this->UnOper(); + std::vector<chanrec*> to_delete; + + // firstly decrement the count on each channel + for (std::vector<ucrec*>::iterator f = this->chans.begin(); f != this->chans.end(); f++) + { + ucrec* uc = *f; + if (uc->channel) + { + if (uc->channel->DelUser(this) == 0) + { + /* No users left in here, mark it for deletion */ + to_delete.push_back(uc->channel); + uc->channel = NULL; + } + } + } + + for (std::vector<chanrec*>::iterator n = to_delete.begin(); n != to_delete.end(); n++) + { + chanrec* thischan = *n; + chan_hash::iterator i2 = ServerInstance->chanlist.find(thischan->name); + if (i2 != ServerInstance->chanlist.end()) + { + FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(i2->second)); + DELETE(i2->second); + ServerInstance->chanlist.erase(i2); + } + } + + this->UnOper(); +} + +void userrec::ShowMOTD() +{ + if (!ServerInstance->Config->MOTD.size()) + { + this->WriteServ("422 %s :Message of the day file is missing.",this->nick); + return; + } + this->WriteServ("375 %s :%s message of the day", this->nick, ServerInstance->Config->ServerName); + + for (unsigned int i = 0; i < ServerInstance->Config->MOTD.size(); i++) + this->WriteServ("372 %s :- %s",this->nick,ServerInstance->Config->MOTD[i].c_str()); + + this->WriteServ("376 %s :End of message of the day.", this->nick); +} + +void userrec::ShowRULES() +{ + if (!ServerInstance->Config->RULES.size()) + { + this->WriteServ("NOTICE %s :Rules file is missing.",this->nick); + return; + } + this->WriteServ("NOTICE %s :%s rules",this->nick,ServerInstance->Config->ServerName); + + for (unsigned int i = 0; i < ServerInstance->Config->RULES.size(); i++) + this->WriteServ("NOTICE %s :%s",this->nick,ServerInstance->Config->RULES[i].c_str()); + + this->WriteServ("NOTICE %s :End of %s rules.",this->nick,ServerInstance->Config->ServerName); } |