/[projects]/smsdaemon/PluginManager.cpp
ViewVC logotype

Diff of /smsdaemon/PluginManager.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 27 by torben, Mon Jun 9 19:22:59 2008 UTC revision 28 by torben, Mon Jun 9 20:56:03 2008 UTC
# Line 4  Line 4 
4  #include "common.h"  #include "common.h"
5    
6  #include "EchoPlugin.h"  #include "EchoPlugin.h"
7    #include "SpamPlugin.h"
8    
9  typedef std::map<std::string, Plugin*>::iterator MapIterator;  typedef std::map<std::string, Plugin*>::iterator MapIterator;
10    
# Line 17  PluginManager::~PluginManager() Line 17  PluginManager::~PluginManager()
17  }  }
18    
19    
20    void PluginManager::AddPlugin(Plugin* plugin)
21    {
22            _plugins[ plugin->GetCommand() ] = plugin;
23    }
24    
25  void PluginManager::LoadPlugins()  void PluginManager::LoadPlugins()
26  {  {
27          Common* cmn = Common::instance();          Common* cmn = Common::instance();
28    
29    
30          static EchoPlugin echo;          static EchoPlugin echo;
31          _plugins[ echo.GetCommand() ] = &echo;          _plugins[ echo.GetCommand() ] = &echo;
32    
33            static SpamPlugin spam;
34            _plugins[ spam.GetCommand() ] = &spam;
35                    
36    
37          for(MapIterator it = _plugins.begin(); it != _plugins.end(); ++it)          for(MapIterator it = _plugins.begin(); it != _plugins.end(); ++it)
# Line 30  void PluginManager::LoadPlugins() Line 39  void PluginManager::LoadPlugins()
39                  Plugin* pl = (*it).second;                  Plugin* pl = (*it).second;
40                  cmn->logMessage( std::string("Loaded plugin \"") + pl->GetCommand() + "\" - " + pl->GetDescription() );                  cmn->logMessage( std::string("Loaded plugin \"") + pl->GetCommand() + "\" - " + pl->GetDescription() );
41          }          }
   
   
42  }  }
43    
44  Plugin* PluginManager::GetPlugin(const std::string& pluginname)  Plugin* PluginManager::GetPlugin(const std::string& pluginname)

Legend:
Removed from v.27  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.20