summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-07 01:29:45 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-07 01:29:45 +0000
commit96a4a1d41e42dba806c2e9954e148ed838262511 (patch)
tree3d1b2679437012f10133182d0aa8a8d9b7479350 /include
parent526f5a4a02882b19056fe755dff1f64b764ff313 (diff)
Include explicit parameter list in ProtocolInterface::SendMode
Also leave the strings split into deque, there's no need to pack it into a string just to unpack it during the translate. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11181 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/command_parse.h2
-rw-r--r--include/inspircd.h1
-rw-r--r--include/mode.h4
-rw-r--r--include/modules.h4
-rw-r--r--include/protocol.h8
-rw-r--r--include/u_listmode.h8
6 files changed, 16 insertions, 11 deletions
diff --git a/include/command_parse.h b/include/command_parse.h
index 21dae89dd..6f6b96ca1 100644
--- a/include/command_parse.h
+++ b/include/command_parse.h
@@ -203,7 +203,7 @@ class CoreExport CommandParser : public classbase
*/
int TranslateUIDs(TranslateType to, const std::string &source, std::string &dest);
- int TranslateUIDs(const std::vector<TranslateType> to, const std::string &source, std::string &dest);
+ int TranslateUIDs(const std::deque<TranslateType> to, const std::deque<std::string> &source, std::string &dest);
};
/** Command handler class for the RELOAD command.
diff --git a/include/inspircd.h b/include/inspircd.h
index fcd6849d5..5461adcca 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -721,7 +721,6 @@ class CoreExport InspIRCd : public classbase
* The parameters provided are identical to that sent to the
* handler for class cmd_mode.
* @param parameters The mode parameters
- * @param pcnt The number of items you have given in the first parameter
* @param user The user to send error messages to
*/
void SendMode(const std::vector<std::string>& parameters, User *user);
diff --git a/include/mode.h b/include/mode.h
index 525a26208..94d9f3dfe 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -445,6 +445,8 @@ class CoreExport ModeParser : public classbase
* Use GetLastParse() to get this value, to be used for display purposes.
*/
std::string LastParse;
+ std::deque<std::string> LastParseParams;
+ std::deque<TranslateType> LastParseTranslate;
unsigned int sent[256];
@@ -486,6 +488,8 @@ class CoreExport ModeParser : public classbase
* @return Last parsed string, as seen by users.
*/
const std::string& GetLastParse();
+ const std::deque<std::string>& GetLastParseParams() { return LastParseParams; }
+ const std::deque<TranslateType>& GetLastParseTranslate() { return LastParseTranslate; }
/** Add a mode to the mode parser.
* @return True if the mode was successfully added.
*/
diff --git a/include/modules.h b/include/modules.h
index 90aeb178e..b58cbbc20 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -741,7 +741,7 @@ class CoreExport Module : public Extensible
* @param text The actual modes and their parameters if any
* @param translate The translation types of the mode parameters
*/
- virtual void OnMode(User* user, void* dest, int target_type, const std::string &text, const std::vector<TranslateType> &translate);
+ virtual void OnMode(User* user, void* dest, int target_type, const std::deque<std::string> &text, const std::deque<TranslateType> &translate);
/** Allows modules to alter or create server descriptions
* Whenever a module requires a server description, for example for display in
@@ -850,7 +850,7 @@ class CoreExport Module : public Extensible
* @param modeline The modes and parameters to be sent
* @param translate The translation types of the mode parameters
*/
- virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::string &modeline, const std::vector<TranslateType> &translate);
+ virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::deque<std::string> &modeline, const std::deque<TranslateType> &translate);
/** Implemented by modules which provide the ability to link servers.
* These modules will implement this method, which allows metadata (extra data added to
diff --git a/include/protocol.h b/include/protocol.h
index 4d6f8f27d..d9a2ce25d 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -68,7 +68,7 @@ class ProtocolInterface : public Extensible
* @param target The channel name or user to send mode changes for.
* @param The mode changes to send.
*/
- virtual void SendMode(const std::string &target, parameterlist &modedata) { }
+ virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::deque<TranslateType> &translate) { }
/** Convenience function, string wrapper around the above.
*/
@@ -76,10 +76,14 @@ class ProtocolInterface : public Extensible
{
irc::spacesepstream x(modeline);
parameterlist n;
+ std::deque<TranslateType> types;
std::string v;
while (x.GetToken(v))
+ {
n.push_back(v);
- SendMode(target, n);
+ types.push_back(TR_TEXT);
+ }
+ SendMode(target, n, types);
}
/** Send a notice to users with a given mode(s).
diff --git a/include/u_listmode.h b/include/u_listmode.h
index 88b5fb3ee..1e7d1cceb 100644
--- a/include/u_listmode.h
+++ b/include/u_listmode.h
@@ -423,21 +423,19 @@ class ListModeBase : public ModeHandler
chan->GetExt(infokey, mlist);
irc::modestacker modestack(ServerInstance, true);
std::deque<std::string> stackresult;
- std::vector<TranslateType> types;
+ std::deque<TranslateType> types;
types.push_back(TR_TEXT);
if (mlist)
{
for (modelist::iterator it = mlist->begin(); it != mlist->end(); it++)
{
modestack.Push(std::string(1, mode)[0], it->mask);
- types.push_back(this->GetTranslateType());
}
}
while (modestack.GetStackedLine(stackresult))
{
- irc::stringjoiner mode_join(" ", stackresult, 0, stackresult.size() - 1);
- std::string line = mode_join.GetJoined();
- proto->ProtoSendMode(opaque, TYPE_CHANNEL, chan, line, types);
+ types.assign(stackresult.size(), this->GetTranslateType());
+ proto->ProtoSendMode(opaque, TYPE_CHANNEL, chan, stackresult, types);
}
}