libpurple/purpleprotocolfactory.c

Thu, 25 Aug 2022 21:34:53 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 25 Aug 2022 21:34:53 -0500
branch
gtk4
changeset 41591
ad6f5ffc2825
parent 41158
e250a5b59c97
child 41713
aaab7ef540cf
permissions
-rw-r--r--

Port the invite dialog to GTK4

Testing Done:
Opened the dialog via conversations -> invite and made sure it worked as expected.

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

40339
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * purple
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 *
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * source distribution.
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 *
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * (at your option) any later version.
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 *
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * GNU General Public License for more details.
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 *
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "purpleprotocolfactory.h"
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
41024
a2ad2d034162 Set the prereq type for all Protocol interfaces to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40339
diff changeset
25 G_DEFINE_INTERFACE(PurpleProtocolFactory, purple_protocol_factory,
a2ad2d034162 Set the prereq type for all Protocol interfaces to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40339
diff changeset
26 PURPLE_TYPE_PROTOCOL);
40339
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 /******************************************************************************
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 * GInterface Implementation
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 *****************************************************************************/
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 static void
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 purple_protocol_factory_default_init(PurpleProtocolFactoryInterface *iface) {
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 }
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 /******************************************************************************
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 * Public API
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 *****************************************************************************/
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 PurpleConnection *
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 purple_protocol_factory_connection_new(PurpleProtocolFactory *factory,
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 PurpleAccount *account,
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 const gchar *password)
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 {
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 PurpleProtocolFactoryInterface *iface = NULL;
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 g_return_val_if_fail(PURPLE_IS_PROTOCOL_FACTORY(factory), NULL);
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 iface = PURPLE_PROTOCOL_FACTORY_GET_IFACE(factory);
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 if(iface && iface->connection_new) {
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 return iface->connection_new(factory, account, password);
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 }
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 return NULL;
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 }
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 PurpleWhiteboard *
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 purple_protocol_factory_whiteboard_new(PurpleProtocolFactory *factory,
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 PurpleAccount *account,
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 const gchar *who,
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 gint state)
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 {
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 PurpleProtocolFactoryInterface *iface = NULL;
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 g_return_val_if_fail(PURPLE_IS_PROTOCOL_FACTORY(factory), NULL);
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 g_return_val_if_fail(who, NULL);
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 iface = PURPLE_PROTOCOL_FACTORY_GET_IFACE(factory);
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 if(iface && iface->whiteboard_new) {
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 return iface->whiteboard_new(factory, account, who, state);
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 }
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 return NULL;
54813fd13c13 Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 }

mercurial