1 |
torben |
217 |
#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 |
|
|
} |