1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides channel mode +V, adding the - prefix
17 * which does nothing but serves as a status symbol. */
19 #define HALFVOICE_VALUE 1
21 class HalfVoiceMode : public ModeHandler
24 HalfVoiceMode(Module* parent) : ModeHandler(parent, "halfvoice", 'V', PARAM_ALWAYS, MODETYPE_CHANNEL)
28 levelrequired = HALFOP_VALUE;
29 m_paramtype = TR_NICK;
32 void SetPrefix(char pfx) { prefix = pfx; }
34 unsigned int GetPrefixRank()
36 return HALFVOICE_VALUE;
39 void RemoveMode(Channel* channel, irc::modestacker* stack)
41 const UserMembList* cl = channel->GetUsers();
42 std::vector<std::string> mode_junk;
43 mode_junk.push_back(channel->name);
44 irc::modestacker modestack(false);
45 std::deque<std::string> stackresult;
47 for (UserMembCIter i = cl->begin(); i != cl->end(); i++)
49 if (i->second->hasMode('V'))
52 stack->Push(this->GetModeChar(), i->first->nick);
54 modestack.Push(this->GetModeChar(), i->first->nick);
61 while (modestack.GetStackedLine(stackresult))
63 mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end());
64 ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
65 mode_junk.erase(mode_junk.begin() + 1, mode_junk.end());
69 void RemoveMode(User* user, irc::modestacker* stack)
73 ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
75 return MODEACTION_ALLOW;
79 class ModuleHalfVoice : public Module
84 ModuleHalfVoice() : mh(this)
90 ConfigTag* tag = ServerInstance->Config->ConfValue("halfvoice");
91 std::string pfxchar = tag->getString("prefix", "-");
92 mh.SetPrefix(pfxchar[0]);
93 ServerInstance->Modules->AddService(mh);
98 return Version("Provides a channel mode that does nothing but serve as a status symbol", VF_VENDOR);
102 MODULE_INIT(ModuleHalfVoice)