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_PROTOCOLPLUGININSTANCE_H 24 #define LICQDAEMON_PROTOCOLPLUGININSTANCE_H 25 26 #include "plugininstance.h" 27 #include "protocolplugin.h" 28 29 #include <licq/plugin/protocolplugininstance.h> 30 31 #include <licq/userid.h> 32 33 namespace Licq 34 { 35 class ProtocolPluginFactory; 36 class ProtocolSignal; 37 } 38 39 namespace LicqDaemon 40 { 41 42 class ProtocolPluginInstance : public PluginInstance, 43 public Licq::ProtocolPluginInstance 44 { 45 public: 46 typedef boost::shared_ptr<ProtocolPluginInstance> Ptr; 47 48 ProtocolPluginInstance( 49 int id, const Licq::UserId& ownerId, ProtocolPlugin::Ptr plugin, 50 PluginThread::Ptr thread); 51 ~ProtocolPluginInstance(); 52 plugin()53 ProtocolPlugin::Ptr plugin() { return myPlugin; } 54 55 // From PluginInstance 56 void run(void (*startCallback)(const PluginInstance&), 57 void (*exitCallback)(const PluginInstance&)); 58 59 // From Licq::ProtocolPluginInstance 60 boost::shared_ptr<Licq::ProtocolPlugin> plugin() const; ownerId()61 const Licq::UserId& ownerId() const { return myOwnerId; } 62 63 void pushSignal(boost::shared_ptr<const Licq::ProtocolSignal> signal); 64 65 protected: 66 // From PluginInstance 67 void createInterface(); 68 boost::shared_ptr<Licq::PluginInterface> interface(); 69 boost::shared_ptr<const Licq::PluginInterface> interface() const; 70 71 private: 72 Licq::UserId myOwnerId; 73 ProtocolPlugin::Ptr myPlugin; 74 boost::shared_ptr<Licq::ProtocolPluginInterface> myInterface; 75 }; 76 77 } // namespace LicqDaemon 78 79 #endif 80