5 |
#include "Common.h" |
#include "Common.h" |
6 |
#include "Util.h" |
#include "Util.h" |
7 |
|
|
8 |
|
|
9 |
|
#include "ProxyPlugin.h" |
10 |
#include "plugins/EchoPlugin.h" |
#include "plugins/EchoPlugin.h" |
11 |
#include "plugins/SpamPlugin.h" |
#include "plugins/SpamPlugin.h" |
12 |
#include "plugins/ShellExecPlugin.h" |
#include "plugins/ShellExecPlugin.h" |
16 |
#include "plugins/HostStatusPlugin.h" |
#include "plugins/HostStatusPlugin.h" |
17 |
#include "plugins/WeatherPlugin.h" |
#include "plugins/WeatherPlugin.h" |
18 |
#include "plugins/UrlTriggerPlugin.h" |
#include "plugins/UrlTriggerPlugin.h" |
19 |
|
#include "plugins/DelaySpamPlugin.h" |
20 |
|
|
21 |
|
|
22 |
|
#include "AccessManager.h" |
23 |
|
|
24 |
typedef std::map<std::string, Plugin*>::iterator MapIterator; |
typedef std::map<std::string, Plugin*>::iterator MapIterator; |
25 |
|
|
84 |
|
|
85 |
if (pluginName == "urltrigger") |
if (pluginName == "urltrigger") |
86 |
return new UrlTriggerPlugin(args); |
return new UrlTriggerPlugin(args); |
87 |
|
|
88 |
|
if (pluginName == "delayspam") |
89 |
|
return new DelaySpamPlugin(); |
90 |
|
|
91 |
return 0; |
return 0; |
92 |
} |
} |
140 |
} |
} |
141 |
|
|
142 |
if (pl) |
if (pl) |
143 |
|
{ |
144 |
AddPlugin(pl); |
AddPlugin(pl); |
145 |
|
ParseCommonOptions(name,args); |
146 |
|
} |
147 |
else |
else |
148 |
Logger::logMessage( std::string("Unknown plugin: ")+name); |
Logger::logMessage( std::string("Unknown plugin: ")+name); |
149 |
|
|
158 |
} |
} |
159 |
} |
} |
160 |
|
|
161 |
|
void PluginManager::ParseCommonOptions(const std::string& pluginName, std::map<std::string,std::string>& args) |
162 |
|
{ |
163 |
|
if (args["privileged"] == "1") |
164 |
|
{ |
165 |
|
AccessManager::AddPrivPlugin(pluginName); |
166 |
|
} |
167 |
|
} |
168 |
|
|
169 |
Plugin* PluginManager::GetPlugin(const std::string& pluginname) |
Plugin* PluginManager::GetPlugin(const std::string& pluginname) |
170 |
{ |
{ |
171 |
return _plugins[ pluginname ]; |
static ProxyPlugin proxy; |
172 |
|
|
173 |
|
std::map<std::string,Plugin*>::iterator it = _plugins.find(pluginname ); |
174 |
|
|
175 |
|
if (it != _plugins.end() ) |
176 |
|
{ |
177 |
|
proxy.SetPlugin(it->second); |
178 |
|
return &proxy; |
179 |
|
} |
180 |
|
else |
181 |
|
{ |
182 |
|
return 0; |
183 |
|
} |
184 |
} |
} |
185 |
|
|
186 |
|
|