libpurple/purpleprotocolmedia.c

Fri, 10 Mar 2023 16:37:41 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 10 Mar 2023 16:37:41 -0600
changeset 42139
c053558f1236
parent 41960
c8a4853205e3
child 42594
eddde70cedd8
permissions
-rw-r--r--

Make PurpleRequestFieldChoice into a GObject

This also does an `hg cp`, though with all the renaming of the parameter names, maybe that wasn't as useful for tracking the diff.

I wonder if this should implement `GListModel`, but the values are currently arbitrary pointers, so it won't work right now.

Testing Done:
Compiled and opened Request Fields from Demo protocol.

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

40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * purple
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 *
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * source distribution.
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 *
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * (at your option) any later version.
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 *
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * GNU General Public License for more details.
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 *
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
40539
2941deda6d8d Use an https link to gnu.org in the license file headers
Gary Kramlich <grim@reaperworld.com>
parents: 40525
diff changeset
19 * along with this program; if not, see <https://www.gnu.org/licenses/>.
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 */
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 #include "purpleprotocolmedia.h"
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 /******************************************************************************
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 * GObject Implementation
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 *****************************************************************************/
41024
a2ad2d034162 Set the prereq type for all Protocol interfaces to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40539
diff changeset
27 G_DEFINE_INTERFACE(PurpleProtocolMedia, purple_protocol_media,
a2ad2d034162 Set the prereq type for all Protocol interfaces to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40539
diff changeset
28 PURPLE_TYPE_PROTOCOL)
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 static void
41960
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41024
diff changeset
31 purple_protocol_media_default_init(G_GNUC_UNUSED PurpleProtocolMediaInterface *iface)
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41024
diff changeset
32 {
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 /******************************************************************************
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 * Public API
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 *****************************************************************************/
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 gboolean
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 purple_protocol_media_initiate_session(PurpleProtocolMedia *media,
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 PurpleAccount *account,
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 const gchar *who,
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 PurpleMediaSessionType type)
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 PurpleProtocolMediaInterface *iface = NULL;
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 g_return_val_if_fail(PURPLE_IS_PROTOCOL_MEDIA(media), FALSE);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 iface = PURPLE_PROTOCOL_MEDIA_GET_IFACE(media);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 if(iface && iface->initiate_session) {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 return iface->initiate_session(media, account, who, type);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 return FALSE;
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 PurpleMediaCaps
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 purple_protocol_media_get_caps(PurpleProtocolMedia *media,
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 PurpleAccount *account, const gchar *who)
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 PurpleProtocolMediaInterface *iface = NULL;
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61
41960
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41024
diff changeset
62 g_return_val_if_fail(PURPLE_IS_PROTOCOL_MEDIA(media),
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41024
diff changeset
63 PURPLE_MEDIA_CAPS_NONE);
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 iface = PURPLE_PROTOCOL_MEDIA_GET_IFACE(media);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 if(iface && iface->get_caps) {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 return iface->get_caps(media, account, who);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69
41960
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41024
diff changeset
70 return PURPLE_MEDIA_CAPS_NONE;
40525
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 gboolean
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 purple_protocol_media_send_dtmf(PurpleProtocolMedia *protocol_media,
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 PurpleMedia *media, gchar dtmf, guint8 volume,
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 guint8 duration)
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 PurpleProtocolMediaInterface *iface = NULL;
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 g_return_val_if_fail(PURPLE_IS_PROTOCOL_MEDIA(protocol_media), FALSE);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 iface = PURPLE_PROTOCOL_MEDIA_GET_IFACE(protocol_media);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 if(iface && iface->send_dtmf) {
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 return iface->send_dtmf(protocol_media, media, dtmf, volume, duration);
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 }
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 return FALSE;
96fc115d6c36 Move PurpleProtocolMediaInterface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 }

mercurial