diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_sqloper.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_chanprotect.cpp | 106 | ||||
-rw-r--r-- | src/modules/m_chghost.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_cloaking.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_hostchange.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_sethost.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_setname.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_sslmodes.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_vhost.cpp | 2 |
10 files changed, 73 insertions, 70 deletions
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 3e91959b8..a67ec46e2 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -231,7 +231,7 @@ public: std::string operhost = Conf.ReadValue("type", "host", j); if (operhost.size()) - Srv->ChangeHost(user, operhost); + user->ChangeDisplayedHost(operhost); strlcpy(user->oper, type.c_str(), NICKMAX-1); diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 85e8d4a78..4ad3796b9 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -3,13 +3,13 @@ * +------------------------------------+ * * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * <brain@chatspike.net> - * <Craig@chatspike.net> + * E-mail: + * <brain@chatspike.net> + * <Craig@chatspike.net> * * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -33,9 +33,9 @@ class ChanFounder : public ModeHandler ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { - userrec* x = Find(parameter); - if (x) - { + userrec* x = Find(parameter); + if (x) + { if (!channel->HasUser(x)) { return std::make_pair(false, parameter); @@ -44,15 +44,15 @@ class ChanFounder : public ModeHandler { std::string founder = "cm_founder_"+std::string(channel->name); if (x->GetExt(founder,dummyptr)) - { - return std::make_pair(true, x->nick); - } - else - { - return std::make_pair(false, parameter); - } + { + return std::make_pair(true, x->nick); + } + else + { + return std::make_pair(false, parameter); + } } - } + } return std::make_pair(false, parameter); } @@ -125,13 +125,13 @@ class ChanFounder : public ModeHandler void DisplayList(userrec* user, chanrec* channel) { - chanuserlist cl = Srv->GetUsers(channel); + CUList* cl = channel->GetUsers(); std::string founder = "cm_founder_"+std::string(channel->name); - for (unsigned int i = 0; i < cl.size(); i++) + for (CUList::iterator i = cl->begin(); i != cl->end(); i++) { - if (cl[i]->GetExt(founder, dummyptr)) + if (i->second->GetExt(founder, dummyptr)) { - user->WriteServ("386 %s %s %s",user->nick, channel->name,cl[i]->nick); + user->WriteServ("386 %s %s %s",user->nick, channel->name,i->second->nick); } } user->WriteServ("387 %s %s :End of channel founder list",user->nick, channel->name); @@ -146,30 +146,30 @@ class ChanProtect : public ModeHandler public: ChanProtect(Server* s) : ModeHandler('a', 1, 1, true, MODETYPE_CHANNEL, false), Srv(s) { } - ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) - { - userrec* x = Find(parameter); - if (x) - { - if (!channel->HasUser(x)) - { - return std::make_pair(false, parameter); - } - else - { - std::string founder = "cm_protect_"+std::string(channel->name); - if (x->GetExt(founder,dummyptr)) - { - return std::make_pair(true, x->nick); - } - else - { - return std::make_pair(false, parameter); - } - } - } - return std::make_pair(false, parameter); - } + ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { + userrec* x = Find(parameter); + if (x) + { + if (!channel->HasUser(x)) + { + return std::make_pair(false, parameter); + } + else + { + std::string founder = "cm_protect_"+std::string(channel->name); + if (x->GetExt(founder,dummyptr)) + { + return std::make_pair(true, x->nick); + } + else + { + return std::make_pair(false, parameter); + } + } + } + return std::make_pair(false, parameter); + } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -227,13 +227,13 @@ class ChanProtect : public ModeHandler virtual void DisplayList(userrec* user, chanrec* channel) { - chanuserlist cl = Srv->GetUsers(channel); + CUList* cl = channel->GetUsers(); std::string protect = "cm_protect_"+std::string(channel->name); - for (unsigned int i = 0; i < cl.size(); i++) + for (CUList::iterator i = cl->begin(); i != cl->end(); i++) { - if (cl[i]->GetExt(protect,dummyptr)) + if (i->second->GetExt(protect,dummyptr)) { - user->WriteServ("388 %s %s %s",user->nick, channel->name,cl[i]->nick); + user->WriteServ("388 %s %s %s",user->nick, channel->name,i->second->nick); } } user->WriteServ("389 %s %s :End of channel protected user list",user->nick, channel->name); @@ -436,19 +436,19 @@ class ModuleChanProtect : public Module // this is called when the server is linking into a net and wants to sync channel data. // we should send our mode changes for the channel here to ensure that other servers // know whos +q/+a on the channel. - chanuserlist cl = Srv->GetUsers(chan); + CUList* cl = chan->GetUsers(); string_list commands; std::string founder = "cm_founder_"+std::string(chan->name); std::string protect = "cm_protect_"+std::string(chan->name); - for (unsigned int i = 0; i < cl.size(); i++) + for (CUList::iterator i = cl->begin(); i != cl->end(); i++) { - if (cl[i]->GetExt(founder,dummyptr)) + if (i->second->GetExt(founder,dummyptr)) { - proto->ProtoSendMode(opaque,TYPE_CHANNEL,chan,"+q "+std::string(cl[i]->nick)); + proto->ProtoSendMode(opaque,TYPE_CHANNEL,chan,"+q "+std::string(i->second->nick)); } - if (cl[i]->GetExt(protect,dummyptr)) + if (i->second->GetExt(protect,dummyptr)) { - proto->ProtoSendMode(opaque,TYPE_CHANNEL,chan,"+a "+std::string(cl[i]->nick)); + proto->ProtoSendMode(opaque,TYPE_CHANNEL,chan,"+a "+std::string(i->second->nick)); } } } diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 82a94fadc..23a482a65 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -59,8 +59,7 @@ class cmd_chghost : public command_t userrec* dest = Srv->FindNick(std::string(parameters[0])); if (dest) { - Srv->ChangeHost(dest,parameters[1]); - if (!Srv->IsUlined(user->server)) + if ((dest->ChangeDisplayedHost(parameters[1])) && (!Srv->IsUlined(user->server))) { // fix by brain - ulines set hosts silently Srv->SendOpers(std::string(user->nick)+" used CHGHOST to make the displayed host of "+std::string(dest->nick)+" become "+std::string(parameters[1])); diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 1e1826b41..b8164d9ba 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -347,7 +347,7 @@ class CloakUser : public ModeHandler b = std::string(ra) + "." + prefix + ".cloak"; } Srv->Log(DEBUG,"cloak: allocated "+b); - Srv->ChangeHost(dest,b); + dest->ChangeDisplayedHost(b.c_str()); } dest->SetMode('x',true); @@ -361,7 +361,7 @@ class CloakUser : public ModeHandler /* User is removing the mode, so just restore their real host * and make it match the displayed one. */ - Srv->ChangeHost(dest,dest->host); + dest->ChangeDisplayedHost(dest->host); dest->SetMode('x',false); return MODEACTION_ALLOW; } diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 0a9ea8ccc..354eea3ed 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -134,7 +134,8 @@ class ModuleHostChange : public Module if (newhost != "") { user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your virtual host: " + newhost); - Srv->ChangeHost(user,newhost); + if (!user->ChangeDisplayedHost(newhost.c_str())) + user->WriteServ("NOTICE "+std::string(user->nick)+" :Could not set your virtual host: " + newhost); return; } } diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 94e811d79..631bd13a1 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -54,8 +54,8 @@ class cmd_sethost : public command_t } } } - Srv->ChangeHost(user,parameters[0]); - Srv->SendOpers(std::string(user->nick)+" used SETHOST to change their displayed host to "+std::string(parameters[0])); + if (user->ChangeDisplayedHost(parameters[0])) + Srv->SendOpers(std::string(user->nick)+" used SETHOST to change their displayed host to "+std::string(parameters[0])); } }; diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 72d255be7..30eab34df 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -44,7 +44,7 @@ class cmd_setname : public command_t line = line + std::string(parameters[i]) + " "; } line = line + std::string(parameters[pcnt-1]); - Srv->ChangeGECOS(user,line); + user->ChangeName(line.c_str()); } }; diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 6ced44c9f..aeeaa2c52 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -2189,7 +2189,7 @@ class TreeSocket : public InspSocket if (u) { - Srv->ChangeHost(u,params[0]); + u->ChangeDisplayedHost(params[0].c_str()); DoOneToAllButSender(prefix,"FHOST",params,u->server); } return true; @@ -2261,7 +2261,7 @@ class TreeSocket : public InspSocket if (u) { - Srv->ChangeGECOS(u,params[0]); + u->ChangeName(params[0].c_str()); params[0] = ":" + params[0]; DoOneToAllButSender(prefix,"FNAME",params,u->server); } diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 673c30536..0d4b0e515 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -19,13 +19,16 @@ class SSLMode : public ModeHandler { if (!channel->IsModeSet('z')) { - chanuserlist userlist = Srv->GetUsers(channel); - for(unsigned int i = 0; i < userlist.size(); i++) + if (IS_LOCAL(source)) { - if(!userlist[i]->GetExt("ssl", dummy)) + CUList* userlist = channel->GetUsers(); + for(CUList::iterator i = userlist->begin(); i != userlist->end(); i++) { - source->WriteServ("490 %s %s :all members of the channel must be connected via SSL", source->nick, channel->name); - return MODEACTION_DENY; + if(!i->second->GetExt("ssl", dummy)) + { + source->WriteServ("490 %s %s :all members of the channel must be connected via SSL", source->nick, channel->name); + return MODEACTION_DENY; + } } } channel->SetMode('z',true); diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 71fadf2f9..80d3f8f6b 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -48,7 +48,7 @@ class cmd_vhost : public command_t if (mask != "") { user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask); - Srv->ChangeHost(user,mask); + user->ChangeDisplayedHost(mask.c_str()); return; } } |