diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-02-06 16:27:00 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-02-06 16:27:00 +0000 |
commit | 7bff99d3dca97374f8d029b393bcd113f6dfa89a (patch) | |
tree | f9d266a9f9ce7340ca34a34445dc18805f7e5be9 | |
parent | f1c95ba9301178017542afe9262a3f2f0528afd5 (diff) |
Add mode +V, status prefix. Because we haven't used up enough channel mode letters yet.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12385 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | docs/modules.conf.example | 6 | ||||
-rw-r--r-- | src/modules/m_statusprefix.cpp | 108 |
3 files changed, 114 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore index ede2efae1..635a18486 100644 --- a/.gitignore +++ b/.gitignore @@ -5,15 +5,10 @@ /.modulemanager /BSDmakefile /GNUmakefile -/bin /build /inspircd -/modules /org.inspircd.plist - -/conf/*.conf -/conf/*.pem -/conf/*.pid +/run /include/inspircd_config.h /include/inspircd_version.h diff --git a/docs/modules.conf.example b/docs/modules.conf.example index cc8620e89..82e722f59 100644 --- a/docs/modules.conf.example +++ b/docs/modules.conf.example @@ -688,7 +688,7 @@ # Delay message module: Adds the channel mode +d which disallows a user # from talking in the channel unless they've been joined for X seconds. # Settable a la: /mode +d 30 -#<module name="m_delaymsg.so> +#<module name="m_delaymsg.so"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Deny Channels: Deny Channels from being used by users @@ -1631,6 +1631,10 @@ # 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_statusprefix.cpp b/src/modules/m_statusprefix.cpp new file mode 100644 index 000000000..5f0587ee0 --- /dev/null +++ b/src/modules/m_statusprefix.cpp @@ -0,0 +1,108 @@ +/* +------------------------------------+ + * | 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 ¶meter, 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) |