/[projects]/smsdaemon/Plugin.h
ViewVC logotype

Contents of /smsdaemon/Plugin.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 184 - (show annotations) (download)
Fri Dec 12 14:06:11 2008 UTC (15 years, 5 months ago) by torben
File MIME type: text/plain
File size: 1104 byte(s)
Add the helper plugin concept

1 #ifndef __PLUGIN_H__
2 #define __PLUGIN_H__
3
4 #include <string>
5
6 /*
7 * Abstract parent class for a sms-daemon plugin.
8 */
9
10
11 class ISmsTransceiver;
12 class SMS;
13
14 class Plugin
15 {
16 public:
17 Plugin(std::string cmd, std::string desc);
18
19 /* Called when a incomming sms triggers this plugin.
20 * Use the conversation object to write the response.
21 * Note: the plugin is responsible for parsing and validating the arguments,
22 * and if necessary write a error message back to the user.
23 */
24 virtual void Execute(ISmsTransceiver& modem, SMS& sms) = 0;
25
26 /*
27 * returns the command that triggers this plugin, for example: "myplugin"
28 */
29 virtual std::string GetCommand() {return _command;}
30
31 /*
32 * Returns a desciption of this plugin - displayed when somebody calls "help"
33 */
34 virtual std::string GetDescription() {return _description;}
35
36
37 /*
38 * A helper plugin is not accessible to the client but can be used to build a proxy / decorater plugin
39 */
40 virtual bool IsHelper() {return false;}
41
42 virtual ~Plugin() {}
43 protected:
44
45 std::string _command;
46 std::string _description;
47 };
48
49
50 #endif // __PLUGIN_H__

  ViewVC Help
Powered by ViewVC 1.1.20