summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-06 22:28:57 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-06 22:28:57 +0000
commit526f5a4a02882b19056fe755dff1f64b764ff313 (patch)
tree6a9e92e4f3f7088b18dcdde360d07c911ee174df /src/modules
parenteacd707421be4f2612df9bde4517649061bb062e (diff)
Construct explicit parameter type list for MODE parameters
Previously, we used TR_SPACENICKLIST on the parameters. This worked only because usually, if anything in the list parsed as a nick, then it was a nick. However, some modes like +k and +g allow free-form text, which could also resolve as a nick. Add extra parameters to allow modes to specify their TranslateType, defaulting to TR_TEXT. This fixes bug #757, found by Taros git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11180 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_chanprotect.cpp4
-rw-r--r--src/modules/m_operprefix.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp10
-rw-r--r--src/modules/m_spanningtree/main.h4
4 files changed, 10 insertions, 10 deletions
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 85c8660a2..627857175 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -159,7 +159,7 @@ class ChanFounder : public ModeHandler, public FounderProtectBase
{
public:
ChanFounder(InspIRCd* Instance, char my_prefix, bool &depriv_self, bool &depriv_others)
- : ModeHandler(Instance, 'q', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0),
+ : ModeHandler(Instance, 'q', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0, TR_NICK),
FounderProtectBase(Instance, "cm_founder_", "founder", 386, 387, depriv_self, depriv_others) { }
unsigned int GetPrefixRank()
@@ -235,7 +235,7 @@ class ChanProtect : public ModeHandler, public FounderProtectBase
{
public:
ChanProtect(InspIRCd* Instance, char my_prefix, bool &depriv_self, bool &depriv_others)
- : ModeHandler(Instance, 'a', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0),
+ : ModeHandler(Instance, 'a', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0, TR_NICK),
FounderProtectBase(Instance,"cm_protect_","protected user", 388, 389, depriv_self, depriv_others) { }
unsigned int GetPrefixRank()
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index 0dd762878..7fda38bb3 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -51,7 +51,7 @@ void AddPrefixChan(User* user, Channel* channel)
class OperPrefixMode : public ModeHandler
{
public:
- OperPrefixMode(InspIRCd* Instance, char pfx) : ModeHandler(Instance, 'y', 1, 1, true, MODETYPE_CHANNEL, false, pfx) { }
+ OperPrefixMode(InspIRCd* Instance, char pfx) : ModeHandler(Instance, 'y', 1, 1, true, MODETYPE_CHANNEL, false, pfx, pfx, TR_NICK) { }
unsigned int GetPrefixRank()
{
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index da393858c..51a9eb025 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -800,7 +800,7 @@ void ModuleSpanningTree::OnDelLine(User* user, XLine *x)
}
}
-void ModuleSpanningTree::OnMode(User* user, void* dest, int target_type, const std::string &text)
+void ModuleSpanningTree::OnMode(User* user, void* dest, int target_type, const std::string &text, const std::vector<TranslateType> &translate)
{
if ((IS_LOCAL(user)) && (user->registered == REG_ALL))
{
@@ -808,7 +808,7 @@ void ModuleSpanningTree::OnMode(User* user, void* dest, int target_type, const s
std::string command;
std::string output_text;
- ServerInstance->Parser->TranslateUIDs(TR_SPACENICKLIST, text, output_text);
+ ServerInstance->Parser->TranslateUIDs(translate, text, output_text);
if (target_type == TYPE_USER)
{
@@ -851,19 +851,19 @@ int ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg)
return 0;
}
-void ModuleSpanningTree::ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::string &modeline)
+void ModuleSpanningTree::ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::string &modeline, const std::vector<TranslateType> &translate)
{
TreeSocket* s = (TreeSocket*)opaque;
std::string output_text;
- ServerInstance->Parser->TranslateUIDs(TR_SPACENICKLIST, modeline, output_text);
+ ServerInstance->Parser->TranslateUIDs(translate, modeline, output_text);
if (target)
{
if (target_type == TYPE_USER)
{
User* u = (User*)target;
- s->WriteLine(std::string(":")+ServerInstance->Config->GetSID()+" FMODE "+u->uuid+" "+ConvToStr(u->age)+" "+output_text);
+ s->WriteLine(std::string(":")+ServerInstance->Config->GetSID()+" MODE "+u->uuid+" "+output_text);
}
else if (target_type == TYPE_CHANNEL)
{
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 1dd7692c1..19ec2d43c 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -174,10 +174,10 @@ class ModuleSpanningTree : public Module
void OnLine(User* source, const std::string &host, bool adding, char linetype, long duration, const std::string &reason);
virtual void OnAddLine(User *u, XLine *x);
virtual void OnDelLine(User *u, XLine *x);
- virtual void OnMode(User* user, void* dest, int target_type, const std::string &text);
+ virtual void OnMode(User* user, void* dest, int target_type, const std::string &text, const std::vector<TranslateType> &translate);
virtual int OnStats(char statschar, User* user, string_list &results);
virtual int OnSetAway(User* user, const std::string &awaymsg);
- virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::string &modeline);
+ virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::string &modeline, const std::vector<TranslateType> &translate);
virtual void ProtoSendMetaData(void* opaque, TargetTypeFlags target_type, void* target, const std::string &extname, const std::string &extdata);
virtual void OnEvent(Event* event);
virtual void OnLoadModule(Module* mod,const std::string &name);