protocols/xmpp/purplexmppprotocol.c

changeset 42529
f00a798a38a6
child 42546
a8a644e3e561
equal deleted inserted replaced
42528:6aaf9a66f9d9 42529:f00a798a38a6
1 /*
2 * Purple - Internet Messaging Library
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
4 *
5 * This program 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 * This program 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 this program; if not, see <https://www.gnu.org/licenses/>.
17 */
18
19 #include <glib/gi18n-lib.h>
20
21 #include "purplexmppprotocol.h"
22
23 struct _PurpleXmppProtocol {
24 PurpleProtocol parent;
25 };
26
27 /******************************************************************************
28 * PurpleProtocol Implementation
29 *****************************************************************************/
30 static GList *
31 purple_xmpp_protocol_get_user_splits(G_GNUC_UNUSED PurpleProtocol *protocol) {
32 PurpleAccountUserSplit *split = NULL;
33 GList *splits = NULL;
34
35 split = purple_account_user_split_new(_("Server"), NULL, '@');
36 splits = g_list_append(splits, split);
37
38 return splits;
39 }
40
41 static GList *
42 purple_xmpp_protocol_status_types(G_GNUC_UNUSED PurpleProtocol *protocol,
43 G_GNUC_UNUSED PurpleAccount *account)
44 {
45 PurpleStatusType *type = NULL;
46 GList *types = NULL;
47
48 type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE);
49 types = g_list_append(types, type);
50
51 type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE);
52 types = g_list_append(types, type);
53
54 return types;
55 }
56
57 /******************************************************************************
58 * GObject Implementation
59 *****************************************************************************/
60 G_DEFINE_DYNAMIC_TYPE_EXTENDED(
61 PurpleXmppProtocol,
62 purple_xmpp_protocol,
63 PURPLE_TYPE_PROTOCOL,
64 0,
65 )
66
67 static void
68 purple_xmpp_protocol_init(G_GNUC_UNUSED PurpleXmppProtocol *protocol) {
69 }
70
71 static void
72 purple_xmpp_protocol_class_finalize(G_GNUC_UNUSED PurpleXmppProtocolClass *klass) {
73 }
74
75 static void
76 purple_xmpp_protocol_class_init(PurpleXmppProtocolClass *klass) {
77 PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass);
78
79 protocol_class->get_user_splits = purple_xmpp_protocol_get_user_splits;
80 protocol_class->status_types = purple_xmpp_protocol_status_types;
81 }
82
83 /******************************************************************************
84 * Internal API
85 *****************************************************************************/
86 void
87 purple_xmpp_protocol_register(GPluginNativePlugin *plugin) {
88 purple_xmpp_protocol_register_type(G_TYPE_MODULE(plugin));
89 }
90
91 PurpleProtocol *
92 purple_xmpp_protocol_new(void) {
93 return g_object_new(
94 PURPLE_XMPP_TYPE_PROTOCOL,
95 "id", "prpl-xmpp",
96 "name", "XMPP",
97 "description", _("Modern Extensible Messaging and Presence Protocol."),
98 "icon-name", "im-xmpp",
99 "icon-resource-path", "/im/pidgin/libpurple/protocols/xmpp/icons",
100 "options", OPT_PROTO_PASSWORD_OPTIONAL,
101 NULL);
102 }

mercurial