--- smsdaemon/plugins/PluginManager.cpp 2008/06/11 10:21:47 49 +++ smsdaemon/PluginManager.cpp 2008/12/08 21:28:40 157 @@ -1,12 +1,15 @@ #include "PluginManager.h" -#include "common.h" +#include "Logger.h" -#include "EchoPlugin.h" -#include "SpamPlugin.h" -#include "ShellExecPlugin.h" -#include "TogPlugin.h" +#include "plugins/EchoPlugin.h" +#include "plugins/SpamPlugin.h" +#include "plugins/ShellExecPlugin.h" +#include "plugins/TogPlugin.h" +#include "plugins/StatusPlugin.h" +#include "plugins/ListPlugin.h" +#include "plugins/HostStatusPlugin.h" typedef std::map::iterator MapIterator; @@ -21,8 +24,6 @@ void PluginManager::AddPlugin(Plugin* plugin) { - Common* cmn = Common::instance(); - if (plugin != 0) { std::string command = plugin->GetCommand(); @@ -30,31 +31,36 @@ if ( _plugins[ command ] == 0) _plugins[ command ] = plugin; else - cmn->logMessage( std::string("AddPlugin() -- already have a plugin called ") + command); + Logger::logMessage( std::string("AddPlugin() -- already have a plugin called ") + command); } else { - cmn->logMessage("AddPlugin() -- cannot register a null pointer"); + Logger::logMessage("AddPlugin() -- cannot register a null pointer"); } } void PluginManager::LoadPlugins() { - Common* cmn = Common::instance(); - static EchoPlugin echo; static SpamPlugin spam; - static ShellExecPlugin wake("wake", "/home/torben/bin/wake"); + static ShellExecPlugin wake("wake", "/home/torben/bin/wake", false, false); + static ShellExecPlugin ping("ping", "nmap -sP 192.168.10.1-255 | grep appears | awk '{print $2}'", false,true); static TogPlugin tog; + static StatusPlugin status; + + static ListPlugin list; + + static HostStatusPlugin hoststatus; + for(MapIterator it = _plugins.begin(); it != _plugins.end(); ++it) { Plugin* pl = (*it).second; if (pl != 0) - cmn->logMessage( std::string("Loaded plugin \"") + pl->GetCommand() + "\" - " + pl->GetDescription() ); + Logger::logMessage( std::string("Loaded plugin \"") + pl->GetCommand() + "\" - " + pl->GetDescription() ); } }