]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
half-voice is a better name than status prefix
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 9 Feb 2010 02:22:44 +0000 (02:22 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 9 Feb 2010 02:22:44 +0000 (02:22 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12406 e03df62e-2008-0410-955e-edbf42e46eb7

docs/modules.conf.example
src/modules/m_halfvoice.cpp [new file with mode: 0644]
src/modules/m_statusprefix.cpp [deleted file]

index 4db33190d820324d9041b78918fdf927236a24c3..7de56622d6d5646ab769005b7340ecfeb8c51d96 100644 (file)
 # Halfop module: Provides the +h (halfops) channel status mode.
 #<module name="m_halfop.so">
 
+#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
+# Status prefix: Adds the channel status mode +V
+#<module name="m_halfvoice.so">
+
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 # HELPOP module: Provides the /HELPOP command
 #<module name="m_helpop.so">
 # server to server traffic, you MUST load it before m_spanningtree in #
 # your configuration file!                                            #
 
-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# Status prefix: Adds the channel mode +V
-#<module name="m_statusprefix.so">
-
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 # Strip colour module: Adds the channel mode +S
 #<module name="m_stripcolor.so">
diff --git a/src/modules/m_halfvoice.cpp b/src/modules/m_halfvoice.cpp
new file mode 100644 (file)
index 0000000..93aa3c1
--- /dev/null
@@ -0,0 +1,102 @@
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ *            the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#include "inspircd.h"
+
+/* $ModDesc: Provides channel mode +V, adding the - prefix
+ *  which does nothing but serves as a status symbol. */
+
+#define HALFVOICE_VALUE 1
+
+class HalfVoiceMode : public ModeHandler
+{
+ public:
+       HalfVoiceMode(Module* parent) : ModeHandler(parent, "halfvoice", 'V', PARAM_ALWAYS, MODETYPE_CHANNEL)
+       {
+               list = true;
+               prefix = 0;
+               levelrequired = HALFOP_VALUE;
+               m_paramtype = TR_NICK;
+       }
+
+       void SetPrefix(char pfx) { prefix = pfx; }
+
+       unsigned int GetPrefixRank()
+       {
+               return STATUS_VALUE;
+       }
+
+       void RemoveMode(Channel* channel, irc::modestacker* stack)
+       {
+               const UserMembList* cl = channel->GetUsers();
+               std::vector<std::string> mode_junk;
+               mode_junk.push_back(channel->name);
+               irc::modestacker modestack(false);
+               std::deque<std::string> stackresult;
+
+               for (UserMembCIter i = cl->begin(); i != cl->end(); i++)
+               {
+                       if (i->second->hasMode('V'))
+                       {
+                               if (stack)
+                                       stack->Push(this->GetModeChar(), i->first->nick);
+                               else
+                                       modestack.Push(this->GetModeChar(), i->first->nick);
+                       }
+               }
+
+               if (stack)
+                       return;
+
+               while (modestack.GetStackedLine(stackresult))
+               {
+                       mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end());
+                       ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
+                       mode_junk.erase(mode_junk.begin() + 1, mode_junk.end());
+               }
+       }
+
+       void RemoveMode(User* user, irc::modestacker* stack)
+       {
+       }
+
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
+       {
+               return MODEACTION_ALLOW;
+       }
+};
+
+class ModuleHalfVoice : public Module
+{
+       HalfVoiceMode mh;
+
+ public:
+       ModuleHalfVoice() : mh(this)
+       {
+       }
+
+       void init()
+       {
+               ConfigTag* tag = ServerInstance->Config->ConfValue("halfvoice");
+               std::string pfxchar = tag->getString("prefix", "-");
+               mh.SetPrefix(pfxchar[0]);
+               ServerInstance->Modules->AddService(mh);
+       }
+
+       Version GetVersion()
+       {
+               return Version("Provides a channel mode that does nothing but serve as a status symbol", VF_VENDOR);
+       }
+};
+
+MODULE_INIT(ModuleHalfVoice)
diff --git a/src/modules/m_statusprefix.cpp b/src/modules/m_statusprefix.cpp
deleted file mode 100644 (file)
index 5f0587e..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *            the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#include "inspircd.h"
-
-/* $ModDesc: Provides channel mode +V, adding the - prefix
- *  which does nothing but serves as a status symbol. */
-
-#define STATUS_VALUE 1
-
-/** Abstraction of StatusPrefixBase for channel mode +a
- */
-class StatusPrefix : public ModeHandler
-{
- public:
-       StatusPrefix(Module* parent) : ModeHandler(parent, "status", 'V', PARAM_ALWAYS, MODETYPE_CHANNEL)
-       {
-               list = true;
-               prefix = 0;
-               levelrequired = HALFOP_VALUE;
-               m_paramtype = TR_NICK;
-       }
-
-       void SetPrefix(char pfx) { prefix = pfx; }
-
-       unsigned int GetPrefixRank()
-       {
-               return STATUS_VALUE;
-       }
-
-       void RemoveMode(Channel* channel, irc::modestacker* stack)
-       {
-               const UserMembList* cl = channel->GetUsers();
-               std::vector<std::string> mode_junk;
-               mode_junk.push_back(channel->name);
-               irc::modestacker modestack(false);
-               std::deque<std::string> stackresult;
-
-               for (UserMembCIter i = cl->begin(); i != cl->end(); i++)
-               {
-                       if (i->second->hasMode('V'))
-                       {
-                               if (stack)
-                                       stack->Push(this->GetModeChar(), i->first->nick);
-                               else
-                                       modestack.Push(this->GetModeChar(), i->first->nick);
-                       }
-               }
-
-               if (stack)
-                       return;
-
-               while (modestack.GetStackedLine(stackresult))
-               {
-                       mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end());
-                       ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
-                       mode_junk.erase(mode_junk.begin() + 1, mode_junk.end());
-               }
-       }
-
-       void RemoveMode(User* user, irc::modestacker* stack)
-       {
-       }
-
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
-       {
-               return MODEACTION_ALLOW;
-       }
-};
-
-class ModuleStatusPrefix : public Module
-{
-       StatusPrefix mh;
-
- public:
-       ModuleStatusPrefix() : mh(this)
-       {
-       }
-
-       void init()
-       {
-               ConfigTag* tag = ServerInstance->Config->ConfValue("statusprefix");
-               std::string pfxchar = tag->getString("prefix", "-");
-               mh.SetPrefix(pfxchar[0]);
-               ServerInstance->Modules->AddService(mh);
-       }
-
-       ~ModuleStatusPrefix()
-       {
-       }
-
-       Version GetVersion()
-       {
-               return Version("Provides a channel mode that does nothing but serve as a status symbol", VF_VENDOR);
-       }
-};
-
-MODULE_INIT(ModuleStatusPrefix)