libpurple/purplepresence.c

Sun, 14 Apr 2024 01:14:59 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sun, 14 Apr 2024 01:14:59 -0500
changeset 42725
ceb13f1de2d2
parent 42705
e78a46048ae7
child 42747
801025bad2e1
permissions
-rw-r--r--

Remove PurpleBuddy

PurpleContactInfo was created long ago to replace this, it is now its time!

Testing Done:
Ran the turtles.

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

40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
1 /*
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
2 * Purple - Internet Messaging Library
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
4 *
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
7 * source distribution.
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
8 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
12 * any later version.
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
13 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
17 * more details.
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
18 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
19 * You should have received a copy of the GNU General Public License along with
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
21 */
40441
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
22
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
23 #include <glib/gi18n-lib.h>
f23c7e772667 Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
24
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
25 #include "purplepresence.h"
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
26
34846
dea8dd8343d5 Added GObject code to presenses.c.
Ankit Vani <a@nevitus.org>
parents: 34840
diff changeset
27 #include "debug.h"
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
28 #include "purpleenums.h"
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40195
diff changeset
29 #include "purpleprivate.h"
42725
ceb13f1de2d2 Remove PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 42705
diff changeset
30 #include "util.h"
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
31
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
32 typedef struct {
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
33 gboolean idle;
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
34 GDateTime *idle_time;
41963
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
35 GDateTime *login_time;
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
36
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
37 PurplePresencePrimitive primitive;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
38 char *message;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
39 char *emoji;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
40 gboolean mobile;
42310
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
41 gboolean notifications_disabled;
39538
00ee7c55cd54 Re-group presence type definitions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39435
diff changeset
42 } PurplePresencePrivate;
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
43
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
44 enum {
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
45 PROP_0,
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
46 PROP_IDLE,
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
47 PROP_IDLE_TIME,
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
48 PROP_LOGIN_TIME,
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
49 PROP_PRIMITIVE,
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
50 PROP_MESSAGE,
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
51 PROP_EMOJI,
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
52 PROP_MOBILE,
42310
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
53 PROP_NOTIFICATIONS_DISABLED,
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42509
diff changeset
54 N_PROPERTIES,
34846
dea8dd8343d5 Added GObject code to presenses.c.
Ankit Vani <a@nevitus.org>
parents: 34840
diff changeset
55 };
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42509
diff changeset
56 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
39538
00ee7c55cd54 Re-group presence type definitions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39435
diff changeset
57
00ee7c55cd54 Re-group presence type definitions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39435
diff changeset
58 G_DEFINE_TYPE_WITH_PRIVATE(PurplePresence, purple_presence, G_TYPE_OBJECT)
00ee7c55cd54 Re-group presence type definitions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39435
diff changeset
59
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
60 /******************************************************************************
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
61 * GObject Implementation
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
62 *****************************************************************************/
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
63 static void
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
64 purple_presence_set_property(GObject *obj, guint param_id, const GValue *value,
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
65 GParamSpec *pspec)
34836
289bc0df25bb API changes for PurplePresence. See details.
Ankit Vani <a@nevitus.org>
parents: 34834
diff changeset
66 {
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
67 PurplePresence *presence = PURPLE_PRESENCE(obj);
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
68
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
69 switch (param_id) {
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
70 case PROP_IDLE:
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
71 purple_presence_set_idle(presence, g_value_get_boolean(value),
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
72 NULL);
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
73 break;
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
74 case PROP_IDLE_TIME:
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
75 purple_presence_set_idle(presence, TRUE, g_value_get_boxed(value));
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
76 break;
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
77 case PROP_LOGIN_TIME:
41963
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
78 purple_presence_set_login_time(presence, g_value_get_boxed(value));
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
79 break;
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
80 case PROP_PRIMITIVE:
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
81 purple_presence_set_primitive(presence, g_value_get_enum(value));
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
82 break;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
83 case PROP_MESSAGE:
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
84 purple_presence_set_message(presence, g_value_get_string(value));
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
85 break;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
86 case PROP_EMOJI:
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
87 purple_presence_set_emoji(presence, g_value_get_string(value));
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
88 break;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
89 case PROP_MOBILE:
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
90 purple_presence_set_mobile(presence, g_value_get_boolean(value));
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
91 break;
42310
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
92 case PROP_NOTIFICATIONS_DISABLED:
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
93 purple_presence_set_notifications_disabled(presence,
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
94 g_value_get_boolean(value));
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
95 break;
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
96 default:
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
97 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
98 break;
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
99 }
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
100 }
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
101
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
102 static void
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
103 purple_presence_get_property(GObject *obj, guint param_id, GValue *value,
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
104 GParamSpec *pspec)
34846
dea8dd8343d5 Added GObject code to presenses.c.
Ankit Vani <a@nevitus.org>
parents: 34840
diff changeset
105 {
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
106 PurplePresence *presence = PURPLE_PRESENCE(obj);
39538
00ee7c55cd54 Re-group presence type definitions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39435
diff changeset
107
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
108 switch (param_id) {
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
109 case PROP_IDLE:
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
110 g_value_set_boolean(value, purple_presence_is_idle(presence));
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
111 break;
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
112 case PROP_IDLE_TIME:
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
113 g_value_set_boxed(value, purple_presence_get_idle_time(presence));
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
114 break;
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
115 case PROP_LOGIN_TIME:
41963
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
116 g_value_set_boxed(value, purple_presence_get_login_time(presence));
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
117 break;
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
118 case PROP_PRIMITIVE:
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
119 g_value_set_enum(value, purple_presence_get_primitive(presence));
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
120 break;
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
121 case PROP_MESSAGE:
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
122 g_value_set_string(value, purple_presence_get_message(presence));
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
123 break;
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
124 case PROP_EMOJI:
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
125 g_value_set_string(value, purple_presence_get_emoji(presence));
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
126 break;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
127 case PROP_MOBILE:
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
128 g_value_set_boolean(value, purple_presence_get_mobile(presence));
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
129 break;
42310
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
130 case PROP_NOTIFICATIONS_DISABLED:
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
131 g_value_set_boolean(value,
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
132 purple_presence_get_notifications_disabled(presence));
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
133 break;
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
134 default:
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
135 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
136 break;
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
137 }
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
138 }
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
139
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
140 static void
42705
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
141 purple_presence_init(G_GNUC_UNUSED PurplePresence *presence) {
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
142 }
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
143
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
144 static void
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
145 purple_presence_finalize(GObject *obj) {
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
146 PurplePresencePrivate *priv = NULL;
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
147
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
148 priv = purple_presence_get_instance_private(PURPLE_PRESENCE(obj));
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
149
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
150 g_clear_pointer(&priv->idle_time, g_date_time_unref);
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
151 g_clear_pointer(&priv->login_time, g_date_time_unref);
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
152
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
153 g_clear_pointer(&priv->message, g_free);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
154 g_clear_pointer(&priv->emoji, g_free);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
155
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
156 G_OBJECT_CLASS(purple_presence_parent_class)->finalize(obj);
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
157 }
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
158
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
159 static void
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
160 purple_presence_class_init(PurplePresenceClass *klass) {
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
161 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
162
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
163 obj_class->get_property = purple_presence_get_property;
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
164 obj_class->set_property = purple_presence_set_property;
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
165 obj_class->finalize = purple_presence_finalize;
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
166
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
167 /**
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
168 * PurplePresence:idle:
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
169 *
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
170 * Whether or not the presence is in an idle state.
42432
59c8baad6549 Add some missing since tags and other documentation for presences
Gary Kramlich <grim@reaperworld.com>
parents: 42310
diff changeset
171 *
42615
2f3308794a8f Remove the micro version from since tags for libpurple part 4
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
172 * Since: 3.0
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
173 */
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
174 properties[PROP_IDLE] = g_param_spec_boolean("idle", "Idle",
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
175 "Whether the presence is in idle state.", FALSE,
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
176 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
34846
dea8dd8343d5 Added GObject code to presenses.c.
Ankit Vani <a@nevitus.org>
parents: 34840
diff changeset
177
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
178 /**
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
179 * PurplePresence:idle-time:
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
180 *
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
181 * The time when the presence went idle.
42432
59c8baad6549 Add some missing since tags and other documentation for presences
Gary Kramlich <grim@reaperworld.com>
parents: 42310
diff changeset
182 *
42615
2f3308794a8f Remove the micro version from since tags for libpurple part 4
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
183 * Since: 3.0
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
184 */
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
185 properties[PROP_IDLE_TIME] = g_param_spec_boxed(
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
186 "idle-time", "Idle time",
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
187 "The idle time of the presence",
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
188 G_TYPE_DATE_TIME,
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
189 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
190
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
191 /**
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
192 * PurplePresence:login-time:
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
193 *
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
194 * The login-time of the presence.
42432
59c8baad6549 Add some missing since tags and other documentation for presences
Gary Kramlich <grim@reaperworld.com>
parents: 42310
diff changeset
195 *
42615
2f3308794a8f Remove the micro version from since tags for libpurple part 4
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
196 * Since: 3.0
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
197 */
41963
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
198 properties[PROP_LOGIN_TIME] = g_param_spec_boxed(
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
199 "login-time", "Login time",
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
200 "The login time of the presence.",
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
201 G_TYPE_DATE_TIME,
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
202 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
39435
b30e04a71ecf Use G_DEFINE_TYPE_WITH_PRIVATE for Purple*Presence.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39352
diff changeset
203
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
204 /**
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
205 * PurplePresence:primitive:
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
206 *
42705
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
207 * The [enum@Purple.PresencePrimitive] for this presence.
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
208 *
42615
2f3308794a8f Remove the micro version from since tags for libpurple part 4
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
209 * Since: 3.0
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
210 */
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
211 properties[PROP_PRIMITIVE] = g_param_spec_enum(
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
212 "primitive", "primitive",
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
213 "The primitive for the presence",
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
214 PURPLE_TYPE_PRESENCE_PRIMITIVE,
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
215 PURPLE_PRESENCE_PRIMITIVE_OFFLINE,
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
216 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
217
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
218 /**
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
219 * PurplePresence:message:
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
220 *
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
221 * The status message of the presence.
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
222 *
42615
2f3308794a8f Remove the micro version from since tags for libpurple part 4
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
223 * Since: 3.0
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
224 */
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
225 properties[PROP_MESSAGE] = g_param_spec_string(
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
226 "message", "message",
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
227 "The status message",
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
228 NULL,
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
229 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
230
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
231 /**
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
232 * PurplePresence:emoji:
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
233 *
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
234 * The emoji or mood of the presence.
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
235 *
42615
2f3308794a8f Remove the micro version from since tags for libpurple part 4
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
236 * Since: 3.0
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
237 */
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
238 properties[PROP_EMOJI] = g_param_spec_string(
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
239 "emoji", "emoji",
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
240 "The emoji for the presence.",
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
241 NULL,
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
242 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
243
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
244 /**
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
245 * PurplePresence:mobile:
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
246 *
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
247 * Whether or not the presence is on a mobile device.
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
248 *
42615
2f3308794a8f Remove the micro version from since tags for libpurple part 4
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
249 * Since: 3.0
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
250 */
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
251 properties[PROP_MOBILE] = g_param_spec_boolean(
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
252 "mobile", "mobile",
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
253 "Whether or not the presence is on a mobile device.",
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
254 FALSE,
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
255 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
256
42310
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
257 /**
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
258 * PurplePresence:notifications-disabled:
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
259 *
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
260 * Whether or not the presence has notifications disabled.
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
261 *
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
262 * Some protocols, like Slack, allow users to set an available schedule. By
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
263 * default it displays that the user has notifications turned off outside
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
264 * of that schedule.
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
265 *
42615
2f3308794a8f Remove the micro version from since tags for libpurple part 4
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
266 * Since: 3.0
42310
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
267 */
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
268 properties[PROP_NOTIFICATIONS_DISABLED] = g_param_spec_boolean(
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
269 "notifications-disabled", "notifications-disabled",
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
270 "Whether or not this presence has notifications disabled.",
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
271 FALSE,
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
272 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
273
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
274 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
275 }
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
276
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
277 /******************************************************************************
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
278 * Public API
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
279 *****************************************************************************/
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
280 PurplePresence *
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
281 purple_presence_new(void) {
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
282 return g_object_new(PURPLE_TYPE_PRESENCE, NULL);
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
283 }
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
284
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
285 void
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
286 purple_presence_set_idle(PurplePresence *presence, gboolean idle,
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
287 GDateTime *idle_time)
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
288 {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
289 PurplePresencePrivate *priv = NULL;
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
290 PurplePresenceClass *klass = NULL;
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
291 gboolean old_idle;
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
292 GObject *obj = NULL;
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
293
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
294 g_return_if_fail(PURPLE_IS_PRESENCE(presence));
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
295
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
296 priv = purple_presence_get_instance_private(presence);
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
297 klass = PURPLE_PRESENCE_GET_CLASS(presence);
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
298
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
299 if (priv->idle == idle && priv->idle_time == idle_time) {
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
300 return;
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
301 }
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
302
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
303 old_idle = priv->idle;
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
304 priv->idle = idle;
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
305
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
306 g_clear_pointer(&priv->idle_time, g_date_time_unref);
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
307 if(idle && idle_time != NULL) {
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
308 priv->idle_time = g_date_time_ref(idle_time);
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
309 }
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
310
35066
f997e5384f79 libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 35058
diff changeset
311 obj = G_OBJECT(presence);
f997e5384f79 libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 35058
diff changeset
312 g_object_freeze_notify(obj);
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
313 g_object_notify_by_pspec(obj, properties[PROP_IDLE]);
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
314 g_object_notify_by_pspec(obj, properties[PROP_IDLE_TIME]);
35066
f997e5384f79 libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 35058
diff changeset
315 g_object_thaw_notify(obj);
f997e5384f79 libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 35058
diff changeset
316
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
317 if(klass->update_idle) {
34846
dea8dd8343d5 Added GObject code to presenses.c.
Ankit Vani <a@nevitus.org>
parents: 34840
diff changeset
318 klass->update_idle(presence, old_idle);
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
319 }
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
320 }
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
321
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
322 void
41963
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
323 purple_presence_set_login_time(PurplePresence *presence, GDateTime *login_time)
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
324 {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
325 PurplePresencePrivate *priv = NULL;
34847
770ba2679b24 Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents: 34846
diff changeset
326
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
327 g_return_if_fail(PURPLE_IS_PRESENCE(presence));
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
328
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
329 priv = purple_presence_get_instance_private(presence);
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
330
41963
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
331 if(priv->login_time != NULL && login_time != NULL) {
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
332 if(g_date_time_equal(priv->login_time, login_time)) {
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
333 return;
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
334 }
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
335 }
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
336
41963
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
337 if(priv->login_time != NULL) {
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
338 g_date_time_unref(priv->login_time);
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
339 }
35013
4718438d053b Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents: 34986
diff changeset
340
41963
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
341 if(login_time != NULL) {
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
342 priv->login_time = g_date_time_ref(login_time);
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
343 } else {
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
344 priv->login_time = NULL;
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
345 }
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
346
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
347 g_object_notify_by_pspec(G_OBJECT(presence), properties[PROP_LOGIN_TIME]);
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
348 }
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
349
42705
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
350 gboolean
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
351 purple_presence_is_available(PurplePresence *presence) {
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
352 PurplePresencePrivate *priv = NULL;
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
353
42705
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
354 g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), FALSE);
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
355
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
356 priv = purple_presence_get_instance_private(presence);
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
357
42705
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
358 return priv->primitive == PURPLE_PRESENCE_PRIMITIVE_AVAILABLE;
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
359 }
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
360
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
361 gboolean
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
362 purple_presence_is_online(PurplePresence *presence) {
42705
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
363 PurplePresencePrivate *priv = NULL;
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
364
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
365 g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), FALSE);
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
366
42705
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
367 priv = purple_presence_get_instance_private(presence);
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
368
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
369 switch(priv->primitive) {
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
370 case PURPLE_PRESENCE_PRIMITIVE_AVAILABLE:
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
371 case PURPLE_PRESENCE_PRIMITIVE_IDLE:
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
372 case PURPLE_PRESENCE_PRIMITIVE_INVISIBLE:
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
373 case PURPLE_PRESENCE_PRIMITIVE_AWAY:
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
374 case PURPLE_PRESENCE_PRIMITIVE_DO_NOT_DISTURB:
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
375 case PURPLE_PRESENCE_PRIMITIVE_STREAMING:
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
376 return TRUE;
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
377 case PURPLE_PRESENCE_PRIMITIVE_OFFLINE:
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
378 default:
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
379 return FALSE;
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
380 }
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
381 }
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
382
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
383 gboolean
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
384 purple_presence_is_idle(PurplePresence *presence) {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
385 PurplePresencePrivate *priv = NULL;
34847
770ba2679b24 Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents: 34846
diff changeset
386
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
387 g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), FALSE);
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
388
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
389 if(!purple_presence_is_online(presence)) {
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
390 return FALSE;
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
391 }
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
392
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
393 priv = purple_presence_get_instance_private(presence);
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
394
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
395 return priv->idle;
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
396 }
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
397
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
398 GDateTime *
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
399 purple_presence_get_idle_time(PurplePresence *presence) {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
400 PurplePresencePrivate *priv = NULL;
34847
770ba2679b24 Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents: 34846
diff changeset
401
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
402 g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), NULL);
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
403
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
404 priv = purple_presence_get_instance_private(presence);
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
405
34846
dea8dd8343d5 Added GObject code to presenses.c.
Ankit Vani <a@nevitus.org>
parents: 34840
diff changeset
406 return priv->idle_time;
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
407 }
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
408
41963
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
409 GDateTime *
40537
fbf29150c28c Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents: 40441
diff changeset
410 purple_presence_get_login_time(PurplePresence *presence) {
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
411 PurplePresencePrivate *priv = NULL;
34847
770ba2679b24 Refactored presence.c and status.c to use the GObject PurplePresence API
Ankit Vani <a@nevitus.org>
parents: 34846
diff changeset
412
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
413 g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), 0);
34834
f45f0745da61 Started GObjectification of PurplePresence.
Ankit Vani <a@nevitus.org>
parents:
diff changeset
414
39782
db027c5e1463 Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39675
diff changeset
415 priv = purple_presence_get_instance_private(presence);
40575
b82c365e04e8 Rename presence.[ch] to purplepresence.[ch], fix some docs, and other tweaks.
Gary Kramlich <grim@reaperworld.com>
parents: 40537
diff changeset
416
41963
d140e4f6bb02 Move the PurplePresence::login-time property from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 41740
diff changeset
417 return priv->login_time;
34846
dea8dd8343d5 Added GObject code to presenses.c.
Ankit Vani <a@nevitus.org>
parents: 34840
diff changeset
418 }
41740
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
419
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
420 gint
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
421 purple_presence_compare(PurplePresence *presence1, PurplePresence *presence2) {
42270
1bdd57a0c0d1 Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
422 PurplePresencePrimitive primitive1 = PURPLE_PRESENCE_PRIMITIVE_OFFLINE;
1bdd57a0c0d1 Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
423 PurplePresencePrimitive primitive2 = PURPLE_PRESENCE_PRIMITIVE_OFFLINE;
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
424 GDateTime *idle1 = NULL;
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
425 GDateTime *idle2 = NULL;
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
426 GDateTime *now = NULL;
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
427 GTimeSpan diff1 = 0;
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
428 GTimeSpan diff2 = 0;
41740
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
429
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
430 if(presence1 == presence2) {
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
431 return 0;
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
432 } else if (presence1 == NULL) {
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
433 return 1;
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
434 } else if (presence2 == NULL) {
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
435 return -1;
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
436 }
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
437
42270
1bdd57a0c0d1 Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
438 primitive1 = purple_presence_get_primitive(presence1);
1bdd57a0c0d1 Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
439 primitive2 = purple_presence_get_primitive(presence2);
1bdd57a0c0d1 Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
440
1bdd57a0c0d1 Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
441 if(primitive1 != PURPLE_PRESENCE_PRIMITIVE_OFFLINE &&
1bdd57a0c0d1 Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
442 primitive2 == PURPLE_PRESENCE_PRIMITIVE_OFFLINE)
41740
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
443 {
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
444 return -1;
42270
1bdd57a0c0d1 Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
445 } else if(primitive1 == PURPLE_PRESENCE_PRIMITIVE_OFFLINE &&
1bdd57a0c0d1 Propagate notify signals from the priority contact of a person
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
446 primitive2 != PURPLE_PRESENCE_PRIMITIVE_OFFLINE)
41740
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
447 {
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
448 return 1;
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
449 }
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
450
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
451 idle1 = purple_presence_get_idle_time(presence1);
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
452 idle2 = purple_presence_get_idle_time(presence2);
41740
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
453
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
454 if(idle1 == NULL && idle2 == NULL) {
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
455 return 0;
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
456 } else if(idle1 == NULL && idle2 != NULL) {
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
457 return -1;
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
458 } else if(idle1 != NULL && idle2 == NULL) {
41740
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
459 return 1;
42071
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
460 }
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
461
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
462 now = g_date_time_new_now_local();
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
463 diff1 = g_date_time_difference(now, idle1);
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
464 diff2 = g_date_time_difference(now, idle2);
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
465 g_date_time_unref(now);
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
466
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
467 if(diff1 > diff2) {
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
468 return 1;
a719f0f3c600 Convert idle_time in PurplePresence to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents: 42051
diff changeset
469 } else if (diff1 < diff2) {
41740
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
470 return -1;
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
471 }
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
472
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
473 return 0;
d8fcd2907c3d Add purple_presence_compare
Gary Kramlich <grim@reaperworld.com>
parents: 40575
diff changeset
474 }
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
475
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
476 PurplePresencePrimitive
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
477 purple_presence_get_primitive(PurplePresence *presence) {
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
478 PurplePresencePrivate *priv = NULL;
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
479
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
480 g_return_val_if_fail(PURPLE_IS_PRESENCE(presence),
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
481 PURPLE_PRESENCE_PRIMITIVE_OFFLINE);
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
482
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
483 priv = purple_presence_get_instance_private(presence);
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
484
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
485 return priv->primitive;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
486 }
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
487
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
488 void
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
489 purple_presence_set_primitive(PurplePresence *presence,
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
490 PurplePresencePrimitive primitive)
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
491 {
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
492 PurplePresencePrivate *priv = NULL;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
493
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
494 g_return_if_fail(PURPLE_IS_PRESENCE(presence));
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
495
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
496 priv = purple_presence_get_instance_private(presence);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
497
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
498 if(priv->primitive != primitive) {
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
499 priv->primitive = primitive;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
500
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
501 g_object_notify_by_pspec(G_OBJECT(presence),
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
502 properties[PROP_PRIMITIVE]);
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
503 }
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
504 }
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
505
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
506 const char *
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
507 purple_presence_get_message(PurplePresence *presence) {
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
508 PurplePresencePrivate *priv = NULL;
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
509
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
510 g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), NULL);
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
511
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
512 priv = purple_presence_get_instance_private(presence);
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
513
42705
e78a46048ae7 Remove the old status API
Gary Kramlich <grim@reaperworld.com>
parents: 42615
diff changeset
514 return priv->message;
42051
18adb1710a54 Add read-only properties for primitive and message to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 41963
diff changeset
515 }
42173
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
516
42177
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
517 void
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
518 purple_presence_set_message(PurplePresence *presence, const char *message) {
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
519 PurplePresencePrivate *priv = NULL;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
520
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
521 g_return_if_fail(PURPLE_IS_PRESENCE(presence));
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
522
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
523 priv = purple_presence_get_instance_private(presence);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
524
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
525 if(!purple_strequal(priv->message, message)) {
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
526 g_free(priv->message);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
527 priv->message = g_strdup(message);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
528
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
529 g_object_notify_by_pspec(G_OBJECT(presence), properties[PROP_MESSAGE]);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
530 }
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
531 }
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
532
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
533 const char *
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
534 purple_presence_get_emoji(PurplePresence *presence) {
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
535 PurplePresencePrivate *priv = NULL;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
536
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
537 g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), NULL);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
538
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
539 priv = purple_presence_get_instance_private(presence);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
540
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
541 return priv->emoji;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
542 }
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
543
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
544 void
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
545 purple_presence_set_emoji(PurplePresence *presence, const char *emoji) {
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
546 PurplePresencePrivate *priv = NULL;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
547
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
548 g_return_if_fail(PURPLE_IS_PRESENCE(presence));
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
549
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
550 priv = purple_presence_get_instance_private(presence);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
551
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
552 if(!purple_strequal(priv->emoji, emoji)) {
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
553 g_free(priv->emoji);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
554 priv->emoji = g_strdup(emoji);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
555
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
556 g_object_notify_by_pspec(G_OBJECT(presence), properties[PROP_EMOJI]);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
557 }
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
558 }
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
559
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
560 gboolean
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
561 purple_presence_get_mobile(PurplePresence *presence) {
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
562 PurplePresencePrivate *priv = NULL;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
563
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
564 g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), FALSE);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
565
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
566 priv = purple_presence_get_instance_private(presence);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
567
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
568 return priv->mobile;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
569 }
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
570
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
571 void
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
572 purple_presence_set_mobile(PurplePresence *presence, gboolean mobile) {
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
573 PurplePresencePrivate *priv = NULL;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
574
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
575 g_return_if_fail(PURPLE_IS_PRESENCE(presence));
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
576
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
577 priv = purple_presence_get_instance_private(presence);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
578
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
579 if(priv->mobile != mobile) {
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
580 priv->mobile = mobile;
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
581
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
582 g_object_notify_by_pspec(G_OBJECT(presence), properties[PROP_MOBILE]);
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
583 }
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
584 }
d5722fdbdf86 Add "new-status" properties to PurplePresence with fallbacks were applicable
Gary Kramlich <grim@reaperworld.com>
parents: 42173
diff changeset
585
42310
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
586 gboolean
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
587 purple_presence_get_notifications_disabled(PurplePresence *presence) {
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
588 PurplePresencePrivate *priv = NULL;
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
589
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
590 g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), FALSE);
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
591
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
592 priv = purple_presence_get_instance_private(presence);
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
593
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
594 return priv->notifications_disabled;
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
595 }
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
596
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
597 void
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
598 purple_presence_set_notifications_disabled(PurplePresence *presence,
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
599 gboolean notifications_disabled)
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
600 {
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
601 PurplePresencePrivate *priv = NULL;
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
602
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
603 g_return_if_fail(PURPLE_IS_PRESENCE(presence));
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
604
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
605 priv = purple_presence_get_instance_private(presence);
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
606
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
607 if(priv->notifications_disabled != notifications_disabled) {
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
608 priv->notifications_disabled = notifications_disabled;
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
609
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
610 g_object_notify_by_pspec(G_OBJECT(presence),
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
611 properties[PROP_NOTIFICATIONS_DISABLED]);
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
612 }
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
613 }
eea341b0d614 Add a notifications-disabled property to PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents: 42270
diff changeset
614
42173
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
615 const char *
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
616 purple_presence_primitive_to_string(PurplePresencePrimitive primitive) {
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
617 switch(primitive) {
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
618 case PURPLE_PRESENCE_PRIMITIVE_OFFLINE:
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
619 return _("Offline");
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
620 break;
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
621 case PURPLE_PRESENCE_PRIMITIVE_AVAILABLE:
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
622 return _("Available");
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
623 break;
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
624 case PURPLE_PRESENCE_PRIMITIVE_IDLE:
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
625 return _("Idle");
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
626 break;
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
627 case PURPLE_PRESENCE_PRIMITIVE_INVISIBLE:
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
628 return _("Invisible");
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
629 break;
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
630 case PURPLE_PRESENCE_PRIMITIVE_AWAY:
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
631 return _("Away");
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
632 break;
42509
e96a15f7f0d8 Rename PURPLE_PRESENCE_EXTENDED_AWAY to PURPLE_PRESENCE_DO_NOT_DISTURB
Gary Kramlich <grim@reaperworld.com>
parents: 42432
diff changeset
633 case PURPLE_PRESENCE_PRIMITIVE_DO_NOT_DISTURB:
42173
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
634 return _("Do not disturb");
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
635 break;
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
636 case PURPLE_PRESENCE_PRIMITIVE_STREAMING:
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
637 return _("Streaming");
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
638 break;
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
639 default:
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
640 return _("Unknown");
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
641 break;
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
642 }
50558d740eff Add purple_presence_primitive_to_string for easier display
Gary Kramlich <grim@reaperworld.com>
parents: 42071
diff changeset
643 }

mercurial