X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_callerid.cpp;h=37787b525ee5e1a504dca701b96cba852cc835cd;hb=b55c842c9d8730e50865fb7dd98bce4aa85af0d7;hp=812df1da0ba3fd86384663e996854cafbe0a7b0d;hpb=82c53822ecef034b1b88f47ebaa13b4d8c8ac836;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 812df1da0..37787b525 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -82,9 +82,11 @@ struct CallerIDExtInfo : public ExtensionItem User *u = ServerInstance->FindNick(tok); if ((u) && (u->registered == REG_ALL) && (!u->quitting) && (!IS_SERVER(u))) { - callerid_data* other = this->get(u, true); - other->wholistsme.push_back(dat); - dat->accepting.insert(u); + if (dat->accepting.insert(u).second) + { + callerid_data* other = this->get(u, true); + other->wholistsme.push_back(dat); + } } } @@ -114,11 +116,16 @@ struct CallerIDExtInfo : public ExtensionItem callerid_data *targ = this->get(*it, false); if (!targ) + { + ServerInstance->Logs->Log("m_callerid", DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (1)"); continue; // shouldn't happen, but oh well. + } std::list::iterator it2 = std::find(targ->wholistsme.begin(), targ->wholistsme.end(), dat); if (it2 != targ->wholistsme.end()) targ->wholistsme.erase(it2); + else + ServerInstance->Logs->Log("m_callerid", DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (2)"); } delete dat; } @@ -278,6 +285,7 @@ public: if (!dat2) { // How the fuck is this possible. + ServerInstance->Logs->Log("m_callerid", DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (3)"); return false; } @@ -285,6 +293,9 @@ public: if (it != dat2->wholistsme.end()) // Found me! dat2->wholistsme.erase(it); + else + ServerInstance->Logs->Log("m_callerid", DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (4)"); + user->WriteServ("NOTICE %s :%s is no longer on your accept list", user->nick.c_str(), whotoremove->nick.c_str()); return true; @@ -322,6 +333,8 @@ private: if (it2 != dat->accepting.end()) dat->accepting.erase(it2); + else + ServerInstance->Logs->Log("m_callerid", DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (5)"); } userdata->wholistsme.clear(); @@ -360,7 +373,7 @@ public: ModResult PreText(User* user, User* dest, std::string& text) { - if (!dest->IsModeSet('g')) + if (!dest->IsModeSet('g') || (user == dest)) return MOD_RES_PASSTHRU; if (operoverride && IS_OPER(user))