libpurple/protocols/demo/purpledemoprotocol.c

Mon, 04 Sep 2023 22:57:36 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 04 Sep 2023 22:57:36 -0500
changeset 42304
51a419226147
parent 42126
6dbe216fad28
child 42323
119cc14f9c12
permissions
-rw-r--r--

A basic context menu for PurpleContactInfo

This is currently only displayed via the contact list and it takes a shortcut
to just show the menu for the priority contact.

The view profile option currently just logs the profile as we need to determine
how we want the user interface to look/work for this yet.

Testing Done:
Verified that `view profile` was disabled for an xmpp account.
Verified that `view profile` worked for a demo contact with a profile and one without.

Bugs closed: PIDGIN-17682

Reviewed at https://reviews.imfreedom.org/r/2592/

41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 *
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * Lesser General Public License for more details.
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 *
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 */
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 #include <glib/gi18n-lib.h>
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 #include "purpledemoprotocol.h"
41999
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
22
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
23 #include "purpledemoconnection.h"
41459
53a9d24d5be2 Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41285
diff changeset
24 #include "purpledemoprotocolactions.h"
41285
cc3c735c14f4 Split apart demo's PurpleProtocolClient implementation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41284
diff changeset
25 #include "purpledemoprotocolclient.h"
42304
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42126
diff changeset
26 #include "purpledemoprotocolcontacts.h"
41284
7b29786ffdc7 Split apart the demo's PurpleProtocolIM implementation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41281
diff changeset
27 #include "purpledemoprotocolim.h"
41487
86b6cbbee778 Add a stub VV implementation to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41459
diff changeset
28 #include "purpledemoprotocolmedia.h"
41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 struct _PurpleDemoProtocol {
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 PurpleProtocol parent;
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 };
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 /******************************************************************************
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 * PurpleProtocol Implementation
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 *****************************************************************************/
41999
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
37 static PurpleConnection *
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
38 purple_demo_protocol_create_connection(PurpleProtocol *protocol,
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
39 PurpleAccount *account,
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
40 const char *password,
42009
fb172b78a9ee Replace the account-actions-changed signal with an actions-changed signal on PurpleProtocolActions
Gary Kramlich <grim@reaperworld.com>
parents: 41999
diff changeset
41 G_GNUC_UNUSED GError **error)
41775
82c861678f39 Pass the PurpleProtocol objects to all methods of the class
Gary Kramlich <grim@reaperworld.com>
parents: 41487
diff changeset
42 {
41999
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
43 g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), NULL);
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
44 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45
41999
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
46 return g_object_new(
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
47 PURPLE_DEMO_TYPE_CONNECTION,
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
48 "protocol", protocol,
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
49 "account", account,
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
50 "password", password,
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
51 NULL);
41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 }
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 static GList *
41775
82c861678f39 Pass the PurpleProtocol objects to all methods of the class
Gary Kramlich <grim@reaperworld.com>
parents: 41487
diff changeset
56 purple_demo_protocol_status_types(G_GNUC_UNUSED PurpleProtocol *protocol,
41968
2fc2db360044 Bump C standard to C99 for Demo protocol and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41911
diff changeset
57 G_GNUC_UNUSED PurpleAccount *account)
41775
82c861678f39 Pass the PurpleProtocol objects to all methods of the class
Gary Kramlich <grim@reaperworld.com>
parents: 41487
diff changeset
58 {
41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 PurpleStatusType *type = NULL;
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 GList *status_types = NULL;
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 type = purple_status_type_new_with_attrs(
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 PURPLE_STATUS_AVAILABLE, "available", NULL,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 TRUE, TRUE, FALSE,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 "message", _("Message"), purple_value_new(G_TYPE_STRING),
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 NULL);
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 status_types = g_list_append(status_types, type);
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 type = purple_status_type_new_with_attrs(
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 PURPLE_STATUS_AWAY, "away", NULL,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 TRUE, TRUE, FALSE,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 "message", _("Message"), purple_value_new(G_TYPE_STRING),
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 NULL);
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 status_types = g_list_append(status_types, type);
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75
41845
c4e4896c5437 add ivanhoe to Demo plugin
Markus Fischer <ivanhoe@fiscari.de>
parents: 41814
diff changeset
76 type = purple_status_type_new_with_attrs(
c4e4896c5437 add ivanhoe to Demo plugin
Markus Fischer <ivanhoe@fiscari.de>
parents: 41814
diff changeset
77 PURPLE_STATUS_EXTENDED_AWAY, "extended_away", NULL,
c4e4896c5437 add ivanhoe to Demo plugin
Markus Fischer <ivanhoe@fiscari.de>
parents: 41814
diff changeset
78 TRUE, TRUE, FALSE,
c4e4896c5437 add ivanhoe to Demo plugin
Markus Fischer <ivanhoe@fiscari.de>
parents: 41814
diff changeset
79 "message", _("Message"), purple_value_new(G_TYPE_STRING),
c4e4896c5437 add ivanhoe to Demo plugin
Markus Fischer <ivanhoe@fiscari.de>
parents: 41814
diff changeset
80 NULL);
c4e4896c5437 add ivanhoe to Demo plugin
Markus Fischer <ivanhoe@fiscari.de>
parents: 41814
diff changeset
81 status_types = g_list_append(status_types, type);
c4e4896c5437 add ivanhoe to Demo plugin
Markus Fischer <ivanhoe@fiscari.de>
parents: 41814
diff changeset
82
41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 type = purple_status_type_new_full(
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 PURPLE_STATUS_OFFLINE, NULL, NULL,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 TRUE, TRUE, FALSE);
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 status_types = g_list_append(status_types, type);
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 return status_types;
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 }
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 /******************************************************************************
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 * GObject Implementation
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 *****************************************************************************/
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 G_DEFINE_DYNAMIC_TYPE_EXTENDED(
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 PurpleDemoProtocol,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 purple_demo_protocol,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 PURPLE_TYPE_PROTOCOL,
41911
201aae92d734 Clean up the G_DEFINE_DYNAMIC_TYPE definitions for protocols
Gary Kramlich <grim@reaperworld.com>
parents: 41845
diff changeset
98 G_TYPE_FLAG_FINAL,
41459
53a9d24d5be2 Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41285
diff changeset
99 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_ACTIONS,
53a9d24d5be2 Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41285
diff changeset
100 purple_demo_protocol_actions_init)
41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CLIENT,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 purple_demo_protocol_client_init)
42304
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42126
diff changeset
103 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CONTACTS,
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42126
diff changeset
104 purple_demo_protocol_contacts_init)
41281
aa8fc0497d6d Add an echo user to the demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41224
diff changeset
105 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_IM,
41284
7b29786ffdc7 Split apart the demo's PurpleProtocolIM implementation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41281
diff changeset
106 purple_demo_protocol_im_init)
41487
86b6cbbee778 Add a stub VV implementation to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41459
diff changeset
107 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_MEDIA,
41911
201aae92d734 Clean up the G_DEFINE_DYNAMIC_TYPE definitions for protocols
Gary Kramlich <grim@reaperworld.com>
parents: 41845
diff changeset
108 purple_demo_protocol_media_init))
41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 static void
41968
2fc2db360044 Bump C standard to C99 for Demo protocol and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41911
diff changeset
111 purple_demo_protocol_init(G_GNUC_UNUSED PurpleDemoProtocol *protocol) {
41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 }
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 static void
41968
2fc2db360044 Bump C standard to C99 for Demo protocol and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41911
diff changeset
115 purple_demo_protocol_class_finalize(G_GNUC_UNUSED PurpleDemoProtocolClass *klass) {
41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 }
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 static void
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 purple_demo_protocol_class_init(PurpleDemoProtocolClass *klass) {
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass);
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 protocol_class->status_types = purple_demo_protocol_status_types;
41999
91af085cf35b Update the demo protocol plugin to use the new create_connection virtual method
Gary Kramlich <grim@reaperworld.com>
parents: 41968
diff changeset
123 protocol_class->create_connection = purple_demo_protocol_create_connection;
41224
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 }
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 /******************************************************************************
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 * Local Exports
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 *****************************************************************************/
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 void
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 purple_demo_protocol_register(GPluginNativePlugin *plugin) {
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 purple_demo_protocol_register_type(G_TYPE_MODULE(plugin));
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 }
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 PurpleProtocol *
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 purple_demo_protocol_new(void) {
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 return g_object_new(
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 PURPLE_DEMO_TYPE_PROTOCOL,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 "id", "prpl-demo",
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 "name", "Demo",
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 "description", "A protocol plugin with static data to be used in "
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 "screen shots.",
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 "icon-name", "im-purple-demo",
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 "icon-resource-path", "/im/pidgin/purple/demo/icons",
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 "options", OPT_PROTO_NO_PASSWORD,
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 NULL);
32a7796a2a36 Create a demo protocol plugin that right now just adds contacts and statuses.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 }

mercurial