postcommand.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "inspircd.h"
00017 #include "commands/cmd_whois.h"
00018 #include "commands/cmd_stats.h"
00019 #include "socket.h"
00020 #include "xline.h"
00021 #include "transport.h"
00022
00023 #include "m_spanningtree/main.h"
00024 #include "m_spanningtree/utils.h"
00025 #include "m_spanningtree/treeserver.h"
00026 #include "m_spanningtree/treesocket.h"
00027
00028
00029
00030 void ModuleSpanningTree::OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, User *user, CmdResult result, const std::string &original_line)
00031 {
00032 if ((result == CMD_SUCCESS) && (ServerInstance->IsValidModuleCommand(command, parameters.size(), user)))
00033 {
00034
00035 Command* thiscmd = ServerInstance->Parser->GetHandler(command);
00036
00037
00038
00039
00040
00041 std::deque<std::string> params;
00042 params.clear();
00043 unsigned int n_translate = thiscmd->translation.size();
00044 TranslateType translate_to;
00045
00046
00047
00048
00049
00050 for (unsigned int j = 0; j < parameters.size(); j++)
00051 {
00052 std::string target;
00053
00054
00055 if (j < n_translate)
00056 {
00057
00058 translate_to = thiscmd->translation[j] != TR_END ? thiscmd->translation[j] : TR_TEXT;
00059 }
00060 else
00061 translate_to = TR_TEXT;
00062
00063 ServerInstance->Logs->Log("m_spanningtree",DEBUG,"TRANSLATION: %s - type is %d", parameters[j].c_str(), translate_to);
00064 if (translate_to == TR_CUSTOM)
00065 {
00066 target = parameters[j];
00067 thiscmd->EncodeParameter(target, j);
00068 }
00069 else
00070 {
00071 ServerInstance->Parser->TranslateUIDs(translate_to, parameters[j], target);
00072 }
00073
00074 if (j == (parameters.size() - 1))
00075 params.push_back(":" + target);
00076 else
00077 params.push_back(target);
00078 }
00079 Utils->DoOneToMany(user->uuid, command, params);
00080 }
00081 }
00082