summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-12-10 16:50:12 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-12-10 16:50:12 +0100
commitbfc85ec4300d32fe164794ad2247fc0c3bd6050d (patch)
tree29ca9c51dcd84fa0cd6882ca5e219c3debe171aa
parent7cb79020b7a9d7431d3038953c8e05ec0f2158c7 (diff)
m_callerid Simplify code interacting with containers
-rw-r--r--src/modules/m_callerid.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index 7f615494b..c861b7687 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -302,15 +302,12 @@ public:
user->WriteNumeric(ERR_ACCEPTNOT, "%s :is not on your accept list", whotoremove->nick.c_str());
return false;
}
- std::set<User*>::iterator i = dat->accepting.find(whotoremove);
- if (i == dat->accepting.end())
+ if (!dat->accepting.erase(whotoremove))
{
user->WriteNumeric(ERR_ACCEPTNOT, "%s :is not on your accept list", whotoremove->nick.c_str());
return false;
}
- dat->accepting.erase(i);
-
// Look up their list to remove me.
callerid_data *dat2 = extInfo.get(whotoremove, false);
if (!dat2)
@@ -355,11 +352,7 @@ class ModuleCallerID : public Module
callerid_data *dat = *(it);
// Find me on their callerid list
- std::set<User *>::iterator it2 = dat->accepting.find(who);
-
- if (it2 != dat->accepting.end())
- dat->accepting.erase(it2);
- else
+ if (!dat->accepting.erase(who))
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (5)");
}
@@ -394,9 +387,7 @@ public:
return MOD_RES_PASSTHRU;
callerid_data* dat = cmd.extInfo.get(dest, true);
- std::set<User*>::iterator i = dat->accepting.find(user);
-
- if (i == dat->accepting.end())
+ if (!dat->accepting.count(user))
{
time_t now = ServerInstance->Time();
/* +g and *not* accepted */