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

Diff of /smsdaemon/PluginManager.cpp

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

revision 216 by torben, Sun Dec 21 18:41:08 2008 UTC revision 217 by torben, Tue Dec 23 14:20:43 2008 UTC
# Line 5  Line 5 
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"
# Line 15  Line 17 
17  #include "plugins/WeatherPlugin.h"  #include "plugins/WeatherPlugin.h"
18  #include "plugins/UrlTriggerPlugin.h"  #include "plugins/UrlTriggerPlugin.h"
19    
20    #include "AccessManager.h"
21    
22  typedef std::map<std::string, Plugin*>::iterator MapIterator;  typedef std::map<std::string, Plugin*>::iterator MapIterator;
23    
24  PluginManager::PluginManager()  PluginManager::PluginManager()
# Line 131  void PluginManager::LoadPlugins() Line 135  void PluginManager::LoadPlugins()
135                  }                  }
136    
137                  if (pl)                  if (pl)
138                    {
139                          AddPlugin(pl);                          AddPlugin(pl);
140                            ParseCommonOptions(name,args);
141                    }
142                  else                  else
143                          Logger::logMessage( std::string("Unknown plugin: ")+name);                          Logger::logMessage( std::string("Unknown plugin: ")+name);
144                                    
# Line 146  void PluginManager::LoadPlugins() Line 153  void PluginManager::LoadPlugins()
153          }          }
154  }  }
155    
156    void PluginManager::ParseCommonOptions(const std::string& pluginName, std::map<std::string,std::string>& args)
157    {
158            if (args["privileged"] == "1")
159            {
160                    AccessManager::AddPrivPlugin(pluginName);
161            }
162    }
163    
164  Plugin* PluginManager::GetPlugin(const std::string& pluginname)  Plugin* PluginManager::GetPlugin(const std::string& pluginname)
165  {  {
166          return _plugins[ pluginname ];          static ProxyPlugin proxy;
167    
168            Plugin* pl = _plugins[ pluginname ];
169    
170            if (pl)
171            {
172                    proxy.SetPlugin(pl);
173                    return &proxy;
174            }
175            else
176            {
177                    return 0;
178            }
179  }  }
180    
181    

Legend:
Removed from v.216  
changed lines
  Added in v.217

  ViewVC Help
Powered by ViewVC 1.1.20