--- smsdaemon/PluginManager.cpp 2008/12/21 18:41:08 208 +++ smsdaemon/PluginManager.cpp 2009/12/26 23:01:01 520 @@ -5,6 +5,8 @@ #include "Common.h" #include "Util.h" + +#include "ProxyPlugin.h" #include "plugins/EchoPlugin.h" #include "plugins/SpamPlugin.h" #include "plugins/ShellExecPlugin.h" @@ -14,6 +16,10 @@ #include "plugins/HostStatusPlugin.h" #include "plugins/WeatherPlugin.h" #include "plugins/UrlTriggerPlugin.h" +#include "plugins/DelaySpamPlugin.h" + + +#include "AccessManager.h" typedef std::map::iterator MapIterator; @@ -78,6 +84,9 @@ if (pluginName == "urltrigger") return new UrlTriggerPlugin(args); + + if (pluginName == "delayspam") + return new DelaySpamPlugin(); return 0; } @@ -131,7 +140,10 @@ } if (pl) + { AddPlugin(pl); + ParseCommonOptions(name,args); + } else Logger::logMessage( std::string("Unknown plugin: ")+name); @@ -146,10 +158,29 @@ } } +void PluginManager::ParseCommonOptions(const std::string& pluginName, std::map& args) +{ + if (args["privileged"] == "1") + { + AccessManager::AddPrivPlugin(pluginName); + } +} Plugin* PluginManager::GetPlugin(const std::string& pluginname) { - return _plugins[ pluginname ]; + static ProxyPlugin proxy; + + std::map::iterator it = _plugins.find(pluginname ); + + if (it != _plugins.end() ) + { + proxy.SetPlugin(it->second); + return &proxy; + } + else + { + return 0; + } }