summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-01-09 17:48:40 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-01-09 17:48:40 +0000
commit3cd1a24a51b9560a6dd6590b4a384f6b6942370d (patch)
tree5d412748be07a9cba449587e6ac659862c761fe3 /src
parentdd2ace5916a8bb24801e74aa8b209d396e012d9b (diff)
Remove mode counter, not reliable and only used for umode +i
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12246 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/mode.cpp16
-rw-r--r--src/modes/umode_i.cpp5
-rw-r--r--src/modes/umode_o.cpp5
-rw-r--r--src/modes/umode_w.cpp5
-rw-r--r--src/modules/m_spanningtree/uid.cpp1
-rw-r--r--src/usermanager.cpp14
-rw-r--r--src/users.cpp19
7 files changed, 9 insertions, 56 deletions
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 &params)
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);