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 STATUS_VALUE 1
21 /** Abstraction of StatusPrefixBase for channel mode +a
23 class StatusPrefix : public ModeHandler
26 StatusPrefix(Module* parent) : ModeHandler(parent, "status", 'V', PARAM_ALWAYS, MODETYPE_CHANNEL)
30 levelrequired = HALFOP_VALUE;
31 m_paramtype = TR_NICK;
34 void SetPrefix(char pfx) { prefix = pfx; }
36 unsigned int GetPrefixRank()
41 void RemoveMode(Channel* channel, irc::modestacker* stack)
43 const UserMembList* cl = channel->GetUsers();
44 std::vector<std::string> mode_junk;
45 mode_junk.push_back(channel->name);
46 irc::modestacker modestack(false);
47 std::deque<std::string> stackresult;
49 for (UserMembCIter i = cl->begin(); i != cl->end(); i++)
51 if (i->second->hasMode('V'))
54 stack->Push(this->GetModeChar(), i->first->nick);
56 modestack.Push(this->GetModeChar(), i->first->nick);
63 while (modestack.GetStackedLine(stackresult))
65 mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end());
66 ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
67 mode_junk.erase(mode_junk.begin() + 1, mode_junk.end());
71 void RemoveMode(User* user, irc::modestacker* stack)
75 ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
77 return MODEACTION_ALLOW;
81 class ModuleStatusPrefix : public Module
86 ModuleStatusPrefix() : mh(this)
92 ConfigTag* tag = ServerInstance->Config->ConfValue("statusprefix");
93 std::string pfxchar = tag->getString("prefix", "-");
94 mh.SetPrefix(pfxchar[0]);
95 ServerInstance->Modules->AddService(mh);
104 return Version("Provides a channel mode that does nothing but serve as a status symbol", VF_VENDOR);
108 MODULE_INIT(ModuleStatusPrefix)