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

Contents of /smsdaemon/ProxyPlugin.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 217 - (show annotations) (download)
Tue Dec 23 14:20:43 2008 UTC (15 years, 4 months ago) by torben
File size: 711 byte(s)
Solved ToDo item:
'- Create a filtering method:
-  Incoming: which phonenumbers are allowed to invoke which plugins
-  Incoming could be solved with a PluginProxy() which intercepts the ExecutePlugin calls (only 
PluginManager needs to know about this one)'

Move the Access related items to AccessManager.*


1 #include "ProxyPlugin.h"
2 #include "Common.h"
3 #include "Logger.h"
4 #include "AccessManager.h"
5 #include "Sms.h"
6 #include "ISmsTransceiver.h"
7
8 void ProxyPlugin::Execute(ISmsTransceiver& modem, SMS& sms)
9 {
10 std::string sender = sms.GetSender();
11
12 if (AccessManager::IsBlacklisted(sender))
13 {
14 Logger::logMessage( "ProxyPlugin, blocked " + sender );
15 return;
16 }
17
18 std::string key = _plugin->GetCommand();
19
20 if (AccessManager::IsPrivPlugin(key))
21 {
22 if ( !(AccessManager::IsPrivileged(sender)) )
23 {
24 modem.SendSms(sender, "You are not allowed to access this command", false);
25 Logger::logMessage("Unprivileged access attempt to " + key + " from " + sender);
26 return;
27 }
28 }
29
30 _plugin->Execute(modem, sms);
31 }

  ViewVC Help
Powered by ViewVC 1.1.20