diff options
| author | 2008-02-17 22:58:59 +0000 | |
|---|---|---|
| committer | 2008-02-17 22:58:59 +0000 | |
| commit | 702d62085637d2f1ab2fd4bd942e257e9de96991 (patch) | |
| tree | 66c31ba9bef0af16417de077f463537b52cad1e5 /src/modules/m_dccallow.cpp | |
| parent | Grrr! (diff) | |
Merge in tweaks
git-svn-id: http://svn.inspircd.org/repository/branches/1_1_stable@8961 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_dccallow.cpp')
| -rw-r--r-- | src/modules/m_dccallow.cpp | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 642bcb768..60aa04270 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -94,21 +94,17 @@ class cmd_dccallow : public command_t if (action == '-') { - user->GetExt("dccallow_list", dl); // check if it contains any entries - if (dl) + if (user->GetExt("dccallow_list", dl)) { - if (dl->size()) + for (dccallowlist::iterator i = dl->begin(); i != dl->end(); ++i) { - for (dccallowlist::iterator i = dl->begin(); i != dl->end(); ++i) + // search through list + if (i->nickname == target->nick) { - // search through list - if (i->nickname == target->nick) - { - dl->erase(i); - user->WriteServ("995 %s %s :Removed %s from your DCCALLOW list", user->nick, user->nick, target->nick); - break; - } + dl->erase(i); + user->WriteServ("995 %s %s :Removed %s from your DCCALLOW list", user->nick, user->nick, target->nick); + break; } } } @@ -131,10 +127,7 @@ class cmd_dccallow : public command_t } else if (action == '+') { - // fetch current DCCALLOW list - user->GetExt("dccallow_list", dl); - // they don't have one, create it - if (!dl) + if (!user->GetExt("dccallow_list", dl)) { dl = new dccallowlist; user->Extend("dccallow_list", dl); @@ -230,9 +223,8 @@ class cmd_dccallow : public command_t { // display current DCCALLOW list user->WriteServ("990 %s :Users on your DCCALLOW list:", user->nick); - user->GetExt("dccallow_list", dl); - - if (dl) + + if (user->GetExt("dccallow_list", dl)) { for (dccallowlist::const_iterator c = dl->begin(); c != dl->end(); ++c) { @@ -275,8 +267,7 @@ class ModuleDCCAllow : public Module dccallowlist* dl; // remove their DCCALLOW list if they have one - user->GetExt("dccallow_list", dl); - if (dl) + if (user->GetExt("dccallow_list", dl)) { DELETE(dl); user->Shrink("dccallow_list"); @@ -321,10 +312,8 @@ class ModuleDCCAllow : public Module // :jamie!jamie@test-D4457903BA652E0F.silverdream.org PRIVMSG eimaj :VERSION if (strncmp(text.c_str(), "\1DCC ", 5) == 0) - { - u->GetExt("dccallow_list", dl); - - if (dl && dl->size()) + { + if (u->GetExt("dccallow_list", dl) && dl->size()) { for (dccallowlist::const_iterator iter = dl->begin(); iter != dl->end(); ++iter) if (ServerInstance->MatchText(user->GetFullHost(), iter->hostmask)) @@ -387,9 +376,7 @@ class ModuleDCCAllow : public Module for (userlist::iterator iter = ul.begin(); iter != ul.end(); ++iter) { userrec* u = (userrec*)(*iter); - u->GetExt("dccallow_list", dl); - - if (dl) + if (u->GetExt("dccallow_list", dl)) { if (dl->size()) { @@ -421,9 +408,7 @@ class ModuleDCCAllow : public Module for (userlist::iterator iter = ul.begin(); iter != ul.end(); ++iter) { userrec *u = (userrec*)(*iter); - u->GetExt("dccallow_list", dl); - - if (dl) + if (u->GetExt("dccallow_list", dl)) { if (dl->size()) { @@ -487,3 +472,4 @@ class ModuleDCCAllow : public Module }; MODULE_INIT(ModuleDCCAllow) + |
