class CommandSVSSilence : public Command
{
public:
- CommandSVSSilence(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SVSSILENCE", 0, 2)
+ CommandSVSSilence(Module* Creator) : Command(Creator,"SVSSILENCE", 2)
{
syntax = "<target> {[+|-]<mask> <p|c|i|n|t|a|x>}";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */
unsigned int& maxsilence;
public:
SimpleExtItem<silencelist> ext;
- CommandSilence (InspIRCd* Instance, Module* Creator, unsigned int &max) : Command(Instance, Creator, "SILENCE", 0, 0),
+ CommandSilence(Module* Creator, unsigned int &max) : Command(Creator, "SILENCE", 0),
maxsilence(max), ext("silence_list", Creator)
{
syntax = "{[+|-]<mask> <p|c|i|n|t|a|x>}";
CommandSVSSilence cmdsvssilence;
public:
- ModuleSilence(InspIRCd* Me)
- : Module(Me), maxsilence(32), cmdsilence(Me, this, maxsilence), cmdsvssilence(Me, this)
+ ModuleSilence()
+ : maxsilence(32), cmdsilence(this, maxsilence), cmdsvssilence(this)
{
OnRehash(NULL);
ServerInstance->AddCommand(&cmdsilence);
ServerInstance->AddCommand(&cmdsvssilence);
- Implementation eventlist[] = { I_OnRehash, I_OnBuildExemptList, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnUserPreInvite };
- ServerInstance->Modules->Attach(eventlist, this, 6);
+ Implementation eventlist[] = { I_OnRehash, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnUserPreInvite };
+ ServerInstance->Modules->Attach(eventlist, this, 5);
}
void OnRehash(User* user)
{
- ConfigReader Conf(ServerInstance);
+ ConfigReader Conf;
maxsilence = Conf.ReadInteger("silence", "maxentries", 0, true);
if (!maxsilence)
maxsilence = 32;
void OnBuildExemptList(MessageType message_type, Channel* chan, User* sender, char status, CUList &exempt_list, const std::string &text)
{
int public_silence = (message_type == MSG_PRIVMSG ? SILENCE_CHANNEL : SILENCE_CNOTICE);
- CUList *ulist;
- switch (status)
- {
- case '@':
- ulist = chan->GetOppedUsers();
- break;
- case '%':
- ulist = chan->GetHalfoppedUsers();
- break;
- case '+':
- ulist = chan->GetVoicedUsers();
- break;
- default:
- ulist = chan->GetUsers();
- break;
- }
+ const UserMembList *ulist = chan->GetUsers();
- for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
+ for (UserMembCIter i = ulist->begin(); i != ulist->end(); i++)
{
if (IS_LOCAL(i->first))
{
if (MatchPattern(i->first, sender, public_silence) == MOD_RES_ALLOW)
{
- exempt_list[i->first] = i->first->nick;
+ exempt_list.insert(i->first);
}
}
}
Version GetVersion()
{
- return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
+ return Version("Provides support for the /SILENCE command", VF_COMMON | VF_VENDOR);
}
};