1 /*
2  * This file is part of Licq, an instant messaging client for UNIX.
3  * Copyright (C) 2013 Licq Developers <licq-dev@googlegroups.com>
4  *
5  * Please refer to the COPYRIGHT file distributed with this source
6  * distribution for the names of the individual contributors.
7  *
8  * Licq is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Licq is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Licq; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22 
23 #ifndef LICQDAEMON_GENERALPLUGININSTANCE_H
24 #define LICQDAEMON_GENERALPLUGININSTANCE_H
25 
26 #include "generalplugin.h"
27 #include "plugininstance.h"
28 
29 #include <licq/plugin/generalplugininstance.h>
30 
31 namespace Licq
32 {
33 class Event;
34 class GeneralPluginFactory;
35 class PluginSignal;
36 }
37 
38 namespace LicqDaemon
39 {
40 
41 class GeneralPluginInstance : public PluginInstance,
42                               public Licq::GeneralPluginInstance
43 {
44 public:
45   typedef boost::shared_ptr<GeneralPluginInstance> Ptr;
46 
47   GeneralPluginInstance(
48       int id, GeneralPlugin::Ptr plugin, PluginThread::Ptr thread);
49   ~GeneralPluginInstance();
50 
plugin()51   GeneralPlugin::Ptr plugin() { return myPlugin; }
52 
53   // From Licq::GeneralPluginInstance
54   boost::shared_ptr<Licq::GeneralPlugin> plugin() const;
55   bool isEnabled() const;
56   void enable();
57   void disable();
58 
59   bool wantSignal(unsigned long signalType) const;
60   void pushSignal(boost::shared_ptr<const Licq::PluginSignal> signal);
61   void pushEvent(boost::shared_ptr<const Licq::Event> event);
62 
63 protected:
64   // From PluginInstance
65   void createInterface();
66   boost::shared_ptr<Licq::PluginInterface> interface();
67   boost::shared_ptr<const Licq::PluginInterface> interface() const;
68 
69 private:
70   GeneralPlugin::Ptr myPlugin;
71   boost::shared_ptr<Licq::GeneralPluginInterface> myInterface;
72 };
73 
74 } // namespace LicqDaemon
75 
76 #endif
77