diff options
-rw-r--r-- | include/mode.h | 10 | ||||
-rw-r--r-- | include/modes/umode_i.h | 1 | ||||
-rw-r--r-- | include/modes/umode_o.h | 1 | ||||
-rw-r--r-- | include/modes/umode_w.h | 1 | ||||
-rw-r--r-- | include/users.h | 5 | ||||
-rw-r--r-- | src/mode.cpp | 16 | ||||
-rw-r--r-- | src/modes/umode_i.cpp | 5 | ||||
-rw-r--r-- | src/modes/umode_o.cpp | 5 | ||||
-rw-r--r-- | src/modes/umode_w.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_spanningtree/uid.cpp | 1 | ||||
-rw-r--r-- | src/usermanager.cpp | 14 | ||||
-rw-r--r-- | src/users.cpp | 19 |
12 files changed, 9 insertions, 74 deletions
diff --git a/include/mode.h b/include/mode.h index ce9d2ee2b..31d092207 100644 --- a/include/mode.h +++ b/include/mode.h @@ -135,10 +135,6 @@ class CoreExport ModeHandler : public ServiceProvider */ ModeType m_type; - /** Number of items with this mode set on them - */ - unsigned int count; - /** The prefix char needed on channel to use this mode, * only checked for channel modes */ @@ -167,12 +163,6 @@ class CoreExport ModeHandler : public ServiceProvider * value for this mode prefix. */ inline char GetPrefix() const { return prefix; } - /** Get number of items with this mode set on them - */ - virtual unsigned int GetCount(); - /** Adjust usage count returned by GetCount - */ - virtual void ChangeCount(int modifier); /** * Get the 'value' of this modes prefix. * determines which to display when there are multiple. diff --git a/include/modes/umode_i.h b/include/modes/umode_i.h index 58ec2d4ca..062126779 100644 --- a/include/modes/umode_i.h +++ b/include/modes/umode_i.h @@ -21,5 +21,4 @@ class ModeUserInvisible : public SimpleUserModeHandler { public: ModeUserInvisible(); - unsigned int GetCount(); }; diff --git a/include/modes/umode_o.h b/include/modes/umode_o.h index a58c55670..f47280d09 100644 --- a/include/modes/umode_o.h +++ b/include/modes/umode_o.h @@ -22,5 +22,4 @@ class ModeUserOperator : public ModeHandler public: ModeUserOperator(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); - unsigned int GetCount(); }; diff --git a/include/modes/umode_w.h b/include/modes/umode_w.h index ddda3db83..503c9ddc8 100644 --- a/include/modes/umode_w.h +++ b/include/modes/umode_w.h @@ -21,5 +21,4 @@ class ModeUserWallops : public SimpleUserModeHandler { public: ModeUserWallops(); - unsigned int GetCount(); }; diff --git a/include/users.h b/include/users.h index e1171e2c3..637f8f88e 100644 --- a/include/users.h +++ b/include/users.h @@ -247,11 +247,6 @@ class CoreExport User : public Extensible */ std::string cachedip; - /** When we erase the user (in the destructor), - * we call this method to subtract one from all - * mode characters this user is making use of. - */ - void DecrementModes(); public: /** Hostname of connection. diff --git a/src/mode.cpp b/src/mode.cpp index 28390d327..ce8323a51 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -48,7 +48,7 @@ ModeHandler::ModeHandler(Module* Creator, const std::string& Name, char modeletter, ParamSpec Params, ModeType type) : ServiceProvider(Creator, Name, type == MODETYPE_CHANNEL ? SERVICE_CMODE : SERVICE_UMODE), m_paramtype(TR_TEXT), parameters_taken(Params), mode(modeletter), prefix(0), oper(false), - list(false), m_type(type), count(0), levelrequired(HALFOP_VALUE) + list(false), m_type(type), levelrequired(HALFOP_VALUE) { } @@ -75,17 +75,6 @@ unsigned int ModeHandler::GetPrefixRank() return 0; } -unsigned int ModeHandler::GetCount() -{ - return 0; -} - -void ModeHandler::ChangeCount(int modifier) -{ - count += modifier; - ServerInstance->Logs->Log("MODE", DEBUG,"Change count for mode %c is now %d", mode, count); -} - int ModeHandler::GetNumParams(bool adding) { switch (parameters_taken) @@ -371,9 +360,6 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool if (ma != MODEACTION_ALLOW) return ma; - // TODO this count may not be reliable - mh->ChangeCount(adding ? 1 : -1); - for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++) (*watchers)->AfterMode(user, targetuser, chan, parameter, adding, type); diff --git a/src/modes/umode_i.cpp b/src/modes/umode_i.cpp index e652b803a..38ef62421 100644 --- a/src/modes/umode_i.cpp +++ b/src/modes/umode_i.cpp @@ -20,8 +20,3 @@ ModeUserInvisible::ModeUserInvisible() : SimpleUserModeHandler(NULL, "invisible", 'i') { } - -unsigned int ModeUserInvisible::GetCount() -{ - return count; -} diff --git a/src/modes/umode_o.cpp b/src/modes/umode_o.cpp index 1f8d77950..423a20d2a 100644 --- a/src/modes/umode_o.cpp +++ b/src/modes/umode_o.cpp @@ -45,8 +45,3 @@ ModeAction ModeUserOperator::OnModeChange(User* source, User* dest, Channel*, st return MODEACTION_ALLOW; } - -unsigned int ModeUserOperator::GetCount() -{ - return count; -} diff --git a/src/modes/umode_w.cpp b/src/modes/umode_w.cpp index 13656ec2d..a91c7363e 100644 --- a/src/modes/umode_w.cpp +++ b/src/modes/umode_w.cpp @@ -20,8 +20,3 @@ ModeUserWallops::ModeUserWallops() : SimpleUserModeHandler(NULL, "wallops", 'w') { } - -unsigned int ModeUserWallops::GetCount() -{ - return count; -} diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 24691c3ca..417e9b4b0 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -141,7 +141,6 @@ bool TreeSocket::ParseUID(const std::string &source, parameterlist ¶ms) else mh->OnModeChange(_new, _new, NULL, empty, true); _new->SetMode(*v, true); - mh->ChangeCount(1); } else { diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 1e3e9fa72..afabf4047 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -392,10 +392,12 @@ void UserManager::ServerPrivmsgAll(const char* text, ...) /* return how many users have a given mode e.g. 'a' */ int UserManager::ModeCount(const char mode) { - ModeHandler* mh = ServerInstance->Modes->FindMode(mode, MODETYPE_USER); - - if (mh) - return mh->GetCount(); - else - return 0; + int c = 0; + for(user_hash::iterator i = clientlist->begin(); i != clientlist->end(); ++i) + { + User* u = i->second; + if (u->modes[mode-65]) + c++; + } + return c; } diff --git a/src/users.cpp b/src/users.cpp index cb8243934..622cc89bd 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -203,24 +203,6 @@ const char* User::FormatModes(bool showparameters) return data; } -void User::DecrementModes() -{ - ServerInstance->Logs->Log("USERS", DEBUG, "DecrementModes()"); - for (unsigned char n = 'A'; n <= 'z'; n++) - { - if (modes[n-65]) - { - ServerInstance->Logs->Log("USERS", DEBUG,"DecrementModes() found mode %c", n); - ModeHandler* mh = ServerInstance->Modes->FindMode(n, MODETYPE_USER); - if (mh) - { - ServerInstance->Logs->Log("USERS", DEBUG,"Found handler %c and call ChangeCount", n); - mh->ChangeCount(-1); - } - } - } -} - User::User(const std::string &uid, const std::string& sid, int type) : uuid(uid), server(sid), usertype(type) { @@ -589,7 +571,6 @@ CullResult User::cull() PurgeEmptyChannels(); this->InvalidateCache(); - this->DecrementModes(); if (client_sa.sa.sa_family != AF_UNSPEC) ServerInstance->Users->RemoveCloneCounts(this); |