1 /*
2  * This file is part of Licq, an instant messaging client for UNIX.
3  * Copyright (C) 2011-2014 Licq developers <licq-dev@googlegroups.com>
4  *
5  * Licq is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * Licq is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with Licq; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #ifndef LICQ_PROTOCOLPLUGIN_H
21 #define LICQ_PROTOCOLPLUGIN_H
22 
23 #include "plugin.h"
24 #include "protocolplugininstance.h"
25 
26 #include <vector>
27 
28 namespace Licq
29 {
30 
31 /**
32  * Represents a loaded protocol plugin.
33  */
34 class ProtocolPlugin : public virtual Plugin
35 {
36 public:
37   typedef std::vector<ProtocolPluginInstance::Ptr> Instances;
38 
39   enum Capabilities
40   {
41     CanSendMsg          = 1<<0,
42     CanSendUrl          = 1<<1,
43     CanSendFile         = 1<<2,
44     CanSendChat         = 1<<3,
45     CanSendContact      = 1<<4,
46     CanSendAuth         = 1<<5,
47     CanSendAuthReq      = 1<<6,
48     CanSendSecure       = 1<<8,
49     CanSendDirect       = 1<<9,
50     CanHoldStatusMsg    = 1<<10,
51     CanVaryEncoding     = 1<<11,
52     CanSingleGroup      = 1<<12,    // Contacts have only a single group in server list
53     CanMultipleOwners   = 1<<13,        // Protocol can handle multiple owners
54     CanConversationId   = 1<<14,        // Conversation id field is used for messaging
55   };
56 
57   /// A smart pointer to a ProtocolPlugin instance
58   typedef boost::shared_ptr<ProtocolPlugin> Ptr;
59 
60   /// Get the protocol's unique identifier
61   virtual unsigned long protocolId() const = 0;
62 
63   /**
64    * Get protocol plugin supported features
65    *
66    * @return A mask of bits from Capabilities enum
67    */
68   virtual unsigned long capabilities() const = 0;
69 
70   /**
71    * Get protocol supported status
72    *
73    * @return A mask of bits from Licq::User::StatusFlags
74    */
75   virtual unsigned long statuses() const = 0;
76 
77   /// Get all instances that are active for this protocol
78   virtual Instances instances() const = 0;
79 
80 protected:
81   /// Destructor
~ProtocolPlugin()82   virtual ~ProtocolPlugin() { }
83 };
84 
85 } // namespace Licq
86 
87 #endif
88