static int SILENCE_EXCLUDE = 0x0040; /* x exclude this pattern */
+class CommandSVSSilence : public Command
+{
+ public:
+ CommandSVSSilence(InspIRCd* Instance) : Command(Instance,"SVSSILENCE", 0, 2)
+ {
+ this->source = "m_silence.so";
+ 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. */
+ }
+
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
+ {
+ /*
+ * XXX: thought occurs to me
+ * We may want to change the syntax of this command to
+ * SVSSILENCE <flagsora+> +<nick> -<nick> +<nick>
+ * style command so services can modify lots of entries at once.
+ * leaving it backwards compatible for now as it's late. -- w
+ */
+ if (!ServerInstance->ULine(user->server))
+ return CMD_FAILURE;
+
+ User *u = ServerInstance->FindNick(parameters[0]);
+ if (!u)
+ return CMD_FAILURE;
+
+ if (IS_LOCAL(u))
+ {
+ ServerInstance->Parser->CallHandler("SILENCE", std::vector<std::string>(++parameters.begin(), parameters.end()), u);
+ }
+
+ return CMD_SUCCESS;
+ }
+};
+
class CommandSilence : public Command
{
unsigned int& maxsilence;
TRANSLATE3(TR_TEXT, TR_TEXT, TR_END);
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
- if (!pcnt)
+ if (!parameters.size())
{
// no parameters, show the current silence list.
// Use Extensible::GetExt to fetch the silence list
return CMD_LOCALONLY;
}
- else if (pcnt > 0)
+ else if (parameters.size() > 0)
{
// one or more parameters, add or delete entry from the list (only the first parameter is used)
- std::string mask = parameters[0] + 1;
- char action = *parameters[0];
+ std::string mask = parameters[0].substr(1);
+ char action = parameters[0][0];
// Default is private and notice so clients do not break
int pattern = CompilePattern("pn");
// if pattern supplied, use it
- if (pcnt > 1) {
- pattern = CompilePattern(parameters[1]);
+ if (parameters.size() > 1) {
+ pattern = CompilePattern(parameters[1].c_str());
}
if (!mask.length())
class ModuleSilence : public Module
{
- CommandSilence* mycommand;
+ CommandSilence* cmdsilence;
+ CommandSVSSilence *cmdsvssilence;
unsigned int maxsilence;
public:
: Module(Me), maxsilence(32)
{
OnRehash(NULL, "");
- mycommand = new CommandSilence(ServerInstance,maxsilence);
- ServerInstance->AddCommand(mycommand);
+ cmdsilence = new CommandSilence(ServerInstance,maxsilence);
+ cmdsvssilence = new CommandSVSSilence(ServerInstance);
+ ServerInstance->AddCommand(cmdsilence);
+ ServerInstance->AddCommand(cmdsvssilence);
+
Implementation eventlist[] = { I_OnRehash, I_OnBuildExemptList, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnUserPreInvite };
ServerInstance->Modules->Attach(eventlist, this, 7);
}
int MatchPattern(User* dest, User* source, int pattern)
{
+ /* Server source */
+ if (!source || !dest)
+ return 1;
+
silencelist* sl;
dest->GetExt("silence_list", sl);
if (sl)