1 /*
2 * This file is part of Licq, an instant messaging client for UNIX.
3 * Copyright (C) 2013-2014 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 #include "factory.h"
24
25 #include <licq/plugin/protocolplugin.h>
26 #include <licq/version.h>
27
28 #include "icqprotocolplugin.h"
29 #include "owner.h"
30 #include "pluginversion.h"
31 #include "user.h"
32
33 using namespace LicqIcq;
34
35
name() const36 std::string Factory::name() const
37 {
38 return "ICQ";
39 }
40
version() const41 std::string Factory::version() const
42 {
43 return PLUGIN_VERSION_STRING;
44 }
45
destroyPlugin(Licq::PluginInterface * plugin)46 void Factory::destroyPlugin(Licq::PluginInterface* plugin)
47 {
48 delete plugin;
49 }
50
protocolId() const51 unsigned long Factory::protocolId() const
52 {
53 return ICQ_PPID;
54 }
55
capabilities() const56 unsigned long Factory::capabilities() const
57 {
58 using Licq::ProtocolPlugin;
59
60 return ProtocolPlugin::CanSendMsg
61 | ProtocolPlugin::CanSendUrl
62 | ProtocolPlugin::CanSendFile
63 | ProtocolPlugin::CanSendChat
64 | ProtocolPlugin::CanSendContact
65 | ProtocolPlugin::CanSendAuth
66 | ProtocolPlugin::CanSendAuthReq
67 | ProtocolPlugin::CanSendSecure
68 | ProtocolPlugin::CanSendDirect
69 | ProtocolPlugin::CanHoldStatusMsg
70 | ProtocolPlugin::CanVaryEncoding
71 | ProtocolPlugin::CanSingleGroup;
72 }
73
statuses() const74 unsigned long Factory::statuses() const
75 {
76 using Licq::User;
77
78 return User::OnlineStatus
79 | User::InvisibleStatus
80 | User::AwayStatus
81 | User::NotAvailableStatus
82 | User::OccupiedStatus
83 | User::DoNotDisturbStatus
84 | User::FreeForChatStatus;
85 }
86
createPlugin()87 Licq::ProtocolPluginInterface* Factory::createPlugin()
88 {
89 return new IcqProtocolPlugin;
90 }
91
createUser(const Licq::UserId & id,bool temporary)92 Licq::User* Factory::createUser(const Licq::UserId& id, bool temporary)
93 {
94 return new User(id, temporary);
95 }
96
createOwner(const Licq::UserId & id)97 Licq::Owner* Factory::createOwner(const Licq::UserId& id)
98 {
99 return new Owner(id);
100 }
101
102
createFactory()103 static Licq::ProtocolPluginFactory* createFactory()
104 {
105 static LicqIcq::Factory factory;
106 return &factory;
107 }
108
destroyFactory(Licq::ProtocolPluginFactory *)109 static void destroyFactory(Licq::ProtocolPluginFactory*)
110 {
111 // Empty
112 }
113
114 LICQ_PROTOCOL_PLUGIN_DATA(&createFactory, &destroyFactory);
115