]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove mode counter, not reliable and only used for umode +i
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 9 Jan 2010 17:48:40 +0000 (17:48 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 9 Jan 2010 17:48:40 +0000 (17:48 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12246 e03df62e-2008-0410-955e-edbf42e46eb7

12 files changed:
include/mode.h
include/modes/umode_i.h
include/modes/umode_o.h
include/modes/umode_w.h
include/users.h
src/mode.cpp
src/modes/umode_i.cpp
src/modes/umode_o.cpp
src/modes/umode_w.cpp
src/modules/m_spanningtree/uid.cpp
src/usermanager.cpp
src/users.cpp

index ce9d2ee2bd0cecf93e462d6eb4a3b02b359d3176..31d0922077a51977f88a8d5c37fc7a4cedcaecdc 100644 (file)
@@ -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.
index 58ec2d4caa4b566fed509cbcac5bfddc9df7fa8b..062126779b17be9b8395bab8e0fe6d6d7f17d3f0 100644 (file)
@@ -21,5 +21,4 @@ class ModeUserInvisible : public SimpleUserModeHandler
 {
  public:
        ModeUserInvisible();
-       unsigned int GetCount();
 };
index a58c55670ca50adcea2cdcee642edb02f8565174..f47280d09c729e74c631335efd5d88805effe8a2 100644 (file)
@@ -22,5 +22,4 @@ class ModeUserOperator : public ModeHandler
  public:
        ModeUserOperator();
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
-       unsigned int GetCount();
 };
index ddda3db83c4410c4b02e69b3488dce04cd573017..503c9ddc89e215b547c41e4599692370efa2a7f0 100644 (file)
@@ -21,5 +21,4 @@ class ModeUserWallops : public SimpleUserModeHandler
 {
  public:
        ModeUserWallops();
-       unsigned int GetCount();
 };
index e1171e2c33785c8da36a58b64f171000d46bb509..637f8f88e0ca815b470c1ba1b751db78d3e8fa47 100644 (file)
@@ -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.
index 28390d327e13d5bd5623e52411f81470e3958959..ce8323a5114edeb893f63be2ecbdb8abd45acafd 100644 (file)
@@ -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);
 
index e652b803a76884036e47cc358289ecd4bc61dd49..38ef624211de052cd666a96d3120c405cf23473f 100644 (file)
@@ -20,8 +20,3 @@
 ModeUserInvisible::ModeUserInvisible() : SimpleUserModeHandler(NULL, "invisible", 'i')
 {
 }
-
-unsigned int ModeUserInvisible::GetCount()
-{
-       return count;
-}
index 1f8d7795018a0e3c78e774faa5e192ee5b28941d..423a20d2afb9ecdcec0ed99e9b231e5e50d1328d 100644 (file)
@@ -45,8 +45,3 @@ ModeAction ModeUserOperator::OnModeChange(User* source, User* dest, Channel*, st
 
        return MODEACTION_ALLOW;
 }
-
-unsigned int ModeUserOperator::GetCount()
-{
-       return count;
-}
index 13656ec2d0d699f4660467fd86f7ed19ef8c08dd..a91c7363ecb7f5bcb7f9a8dac04f760ce6a7acb1 100644 (file)
@@ -20,8 +20,3 @@
 ModeUserWallops::ModeUserWallops() : SimpleUserModeHandler(NULL, "wallops", 'w')
 {
 }
-
-unsigned int ModeUserWallops::GetCount()
-{
-       return count;
-}
index 24691c3ca5d274c3790270722953ddc32fd9e157..417e9b4b0ea254f8c23389a6751850ae3f6269f3 100644 (file)
@@ -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
                {
index 1e3e9fa72ef35e1f6a19d86b4ecc1fc9437501b6..afabf40470bc7fe8f9c4212340dd3e50fc2df71c 100644 (file)
@@ -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;
 }
index cb824393468966e4729a3e0494706a78fa264f6a..622cc89bdfb8a91f0b5e89e66cb33d7ee26d63cf 100644 (file)
@@ -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);