| |
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 "purpledemoconnection.h" |
| |
22 |
| |
23 #include "purpledemocontacts.h" |
| |
24 |
| |
25 struct _PurpleDemoConnection { |
| |
26 PurpleConnection parent; |
| |
27 }; |
| |
28 |
| |
29 G_DEFINE_DYNAMIC_TYPE_EXTENDED(PurpleDemoConnection, purple_demo_connection, |
| |
30 PURPLE_TYPE_CONNECTION, G_TYPE_FLAG_FINAL, {}) |
| |
31 |
| |
32 /****************************************************************************** |
| |
33 * PurpleConnection Implementation |
| |
34 *****************************************************************************/ |
| |
35 static gboolean |
| |
36 purple_demo_connection_connect(PurpleConnection *connection, |
| |
37 G_GNUC_UNUSED GError **error) |
| |
38 { |
| |
39 PurpleAccount *account = purple_connection_get_account(connection); |
| |
40 |
| |
41 purple_connection_set_state(connection, PURPLE_CONNECTION_STATE_CONNECTED); |
| |
42 |
| |
43 purple_demo_contacts_load(account); |
| |
44 |
| |
45 return TRUE; |
| |
46 } |
| |
47 |
| |
48 static gboolean |
| |
49 purple_demo_connection_disconnect(G_GNUC_UNUSED PurpleConnection *connection, |
| |
50 G_GNUC_UNUSED GError **error) |
| |
51 { |
| |
52 return TRUE; |
| |
53 } |
| |
54 |
| |
55 /****************************************************************************** |
| |
56 * GObject Implementation |
| |
57 *****************************************************************************/ |
| |
58 static void |
| |
59 purple_demo_connection_init(G_GNUC_UNUSED PurpleDemoConnection *connection) { |
| |
60 } |
| |
61 |
| |
62 static void |
| |
63 purple_demo_connection_class_finalize(G_GNUC_UNUSED PurpleDemoConnectionClass *klass) { |
| |
64 } |
| |
65 |
| |
66 static void |
| |
67 purple_demo_connection_class_init(PurpleDemoConnectionClass *klass) { |
| |
68 PurpleConnectionClass *connection_class = PURPLE_CONNECTION_CLASS(klass); |
| |
69 |
| |
70 connection_class->connect = purple_demo_connection_connect; |
| |
71 connection_class->disconnect = purple_demo_connection_disconnect; |
| |
72 } |
| |
73 |
| |
74 /****************************************************************************** |
| |
75 * Internal API |
| |
76 *****************************************************************************/ |
| |
77 void |
| |
78 purple_demo_connection_register(GPluginNativePlugin *plugin) { |
| |
79 purple_demo_connection_register_type(G_TYPE_MODULE(plugin)); |
| |
80 } |