Mon, 15 Aug 2022 02:39:09 -0500
Port PidginAddBuddyDialog to GTK4
Testing Done:
Compiled
Reviewed at https://reviews.imfreedom.org/r/1586/
|
34707
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1 | /* |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
34707
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
4 | * |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
7 | * source distribution. |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
8 | * |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
13 | * |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
18 | * |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
34707
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
21 | */ |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
22 | |
|
40870
e3397381fd35
Remove includes from protocol.h that weren't used there and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents:
40804
diff
changeset
|
23 | #include "buddy.h" |
|
e3397381fd35
Remove includes from protocol.h that weren't used there and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents:
40804
diff
changeset
|
24 | |
|
e3397381fd35
Remove includes from protocol.h that weren't used there and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents:
40804
diff
changeset
|
25 | #include "debug.h" |
|
34721
ad8974e1a268
Added includes and finished up blistnodetypes.c
Ankit Vani <a@nevitus.org>
parents:
34720
diff
changeset
|
26 | #include "internal.h" |
|
40537
fbf29150c28c
Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
27 | #include "purplebuddypresence.h" |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
28 | #include "purpleconversationmanager.h" |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40537
diff
changeset
|
29 | #include "purpleprotocolclient.h" |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
30 | #include "util.h" |
|
34707
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
31 | |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
32 | typedef struct { |
|
41302
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
33 | gchar *id; |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
34 | gchar *name; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
35 | gchar *local_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
36 | gchar *server_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
37 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
38 | gpointer proto_data; |
|
34707
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
39 | |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
40 | PurpleBuddyIcon *icon; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
41 | PurpleAccount *account; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
42 | PurplePresence *presence; |
|
35090
c181fdc1ceac
Make a few buddy, chat, group properties save data correctly on set_property after construction
Ankit Vani <a@nevitus.org>
parents:
35085
diff
changeset
|
43 | |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
44 | PurpleMediaCaps media_caps; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
45 | } PurpleBuddyPrivate; |
|
34707
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
46 | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
47 | enum { |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
48 | PROP_0, |
|
41302
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
49 | PROP_ID, |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
50 | PROP_NAME, |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
51 | PROP_LOCAL_ALIAS, |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
52 | PROP_SERVER_ALIAS, |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
53 | PROP_ICON, |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
54 | PROP_ACCOUNT, |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
55 | PROP_PRESENCE, |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
56 | PROP_MEDIA_CAPS, |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
57 | N_PROPERTIES |
| 34714 | 58 | }; |
| 59 | ||
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
60 | static GParamSpec *properties[N_PROPERTIES] = { NULL, }; |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
61 | |
|
39432
4c9808e30b3e
Use G_DEFINE_TYPE_WITH_PRIVATE on PurpleBuddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
62 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleBuddy, purple_buddy, PURPLE_TYPE_BLIST_NODE) |
|
4c9808e30b3e
Use G_DEFINE_TYPE_WITH_PRIVATE on PurpleBuddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
63 | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
64 | /****************************************************************************** |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
65 | * Helpers |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
66 | *****************************************************************************/ |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
67 | static void |
|
41302
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
68 | purple_buddy_set_id(PurpleBuddy *buddy, const gchar *id) { |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
69 | PurpleBuddyPrivate *priv = purple_buddy_get_instance_private(buddy); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
70 | |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
71 | g_free(priv->id); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
72 | priv->id = g_strdup(id); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
73 | |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
74 | g_object_notify_by_pspec(G_OBJECT(buddy), properties[PROP_ID]); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
75 | } |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
76 | |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
77 | static void |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
78 | purple_buddy_set_account(PurpleBuddy *buddy, PurpleAccount *account) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
79 | PurpleBuddyPrivate *priv = purple_buddy_get_instance_private(buddy); |
|
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
|
80 | |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
81 | if(g_set_object(&priv->account, account)) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
82 | g_object_notify_by_pspec(G_OBJECT(buddy), properties[PROP_ACCOUNT]); |
|
34727
579e9a8dbd5f
Moved methods from buddylist.[ch] to the appropriate object files
Ankit Vani <a@nevitus.org>
parents:
34722
diff
changeset
|
83 | } |
|
34707
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
84 | } |
|
d433bf40792a
Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
85 | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
86 | /****************************************************************************** |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
87 | * GObject Implementation |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
88 | *****************************************************************************/ |
| 34714 | 89 | static void |
| 90 | purple_buddy_set_property(GObject *obj, guint param_id, const GValue *value, | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
91 | GParamSpec *pspec) |
| 34714 | 92 | { |
| 93 | PurpleBuddy *buddy = PURPLE_BUDDY(obj); | |
| 94 | ||
| 95 | switch (param_id) { | |
|
41302
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
96 | case PROP_ID: |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
97 | purple_buddy_set_id(buddy, g_value_get_string(value)); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
98 | break; |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
99 | case PROP_NAME: |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
100 | purple_buddy_set_name(buddy, g_value_get_string(value)); |
| 34714 | 101 | break; |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
102 | case PROP_LOCAL_ALIAS: |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
103 | purple_buddy_set_local_alias(buddy, g_value_get_string(value)); |
| 34714 | 104 | break; |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
105 | case PROP_SERVER_ALIAS: |
| 34714 | 106 | purple_buddy_set_server_alias(buddy, g_value_get_string(value)); |
| 107 | break; | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
108 | case PROP_ICON: |
|
34831
da607046d658
Backed out changeset d9b286af48ba
Ankit Vani <a@nevitus.org>
parents:
34830
diff
changeset
|
109 | purple_buddy_set_icon(buddy, g_value_get_pointer(value)); |
| 34714 | 110 | break; |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
111 | case PROP_ACCOUNT: |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
112 | purple_buddy_set_account(buddy, |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
113 | PURPLE_ACCOUNT(g_value_get_object(value))); |
| 34714 | 114 | break; |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
115 | case PROP_MEDIA_CAPS: |
| 34714 | 116 | purple_buddy_set_media_caps(buddy, g_value_get_enum(value)); |
| 117 | break; | |
| 118 | default: | |
| 119 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); | |
| 120 | break; | |
| 121 | } | |
| 122 | } | |
| 123 | ||
| 124 | static void | |
| 125 | purple_buddy_get_property(GObject *obj, guint param_id, GValue *value, | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
126 | GParamSpec *pspec) |
| 34714 | 127 | { |
| 128 | PurpleBuddy *buddy = PURPLE_BUDDY(obj); | |
| 129 | ||
| 130 | switch (param_id) { | |
|
41302
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
131 | case PROP_ID: |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
132 | g_value_set_string(value, purple_buddy_get_id(buddy)); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
133 | break; |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
134 | case PROP_NAME: |
| 34714 | 135 | g_value_set_string(value, purple_buddy_get_name(buddy)); |
| 136 | break; | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
137 | case PROP_LOCAL_ALIAS: |
| 34714 | 138 | g_value_set_string(value, purple_buddy_get_local_alias(buddy)); |
| 139 | break; | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
140 | case PROP_SERVER_ALIAS: |
| 34714 | 141 | g_value_set_string(value, purple_buddy_get_server_alias(buddy)); |
| 142 | break; | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
143 | case PROP_ICON: |
|
34831
da607046d658
Backed out changeset d9b286af48ba
Ankit Vani <a@nevitus.org>
parents:
34830
diff
changeset
|
144 | g_value_set_pointer(value, purple_buddy_get_icon(buddy)); |
| 34714 | 145 | break; |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
146 | case PROP_ACCOUNT: |
| 34714 | 147 | g_value_set_object(value, purple_buddy_get_account(buddy)); |
| 148 | break; | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
149 | case PROP_PRESENCE: |
|
34836
289bc0df25bb
API changes for PurplePresence. See details.
Ankit Vani <a@nevitus.org>
parents:
34833
diff
changeset
|
150 | g_value_set_object(value, purple_buddy_get_presence(buddy)); |
| 34714 | 151 | break; |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
152 | case PROP_MEDIA_CAPS: |
| 34714 | 153 | g_value_set_enum(value, purple_buddy_get_media_caps(buddy)); |
| 154 | break; | |
| 155 | default: | |
| 156 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); | |
| 157 | break; | |
| 158 | } | |
| 159 | } | |
| 160 | ||
| 161 | static void | |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
162 | purple_buddy_init(PurpleBuddy *buddy) { |
|
34743
fccb496c385e
Override GObject constructed method for PurpleBuddy, PurpleChat and PurpleGroup, to inform UI of creation
Ankit Vani <a@nevitus.org>
parents:
34742
diff
changeset
|
163 | } |
|
fccb496c385e
Override GObject constructed method for PurpleBuddy, PurpleChat and PurpleGroup, to inform UI of creation
Ankit Vani <a@nevitus.org>
parents:
34742
diff
changeset
|
164 | |
|
fccb496c385e
Override GObject constructed method for PurpleBuddy, PurpleChat and PurpleGroup, to inform UI of creation
Ankit Vani <a@nevitus.org>
parents:
34742
diff
changeset
|
165 | static void |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
166 | purple_buddy_constructed(GObject *object) { |
|
34743
fccb496c385e
Override GObject constructed method for PurpleBuddy, PurpleChat and PurpleGroup, to inform UI of creation
Ankit Vani <a@nevitus.org>
parents:
34742
diff
changeset
|
167 | PurpleBuddy *buddy = PURPLE_BUDDY(object); |
|
39432
4c9808e30b3e
Use G_DEFINE_TYPE_WITH_PRIVATE on PurpleBuddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
168 | PurpleBuddyPrivate *priv = purple_buddy_get_instance_private(buddy); |
| 34714 | 169 | |
|
39432
4c9808e30b3e
Use G_DEFINE_TYPE_WITH_PRIVATE on PurpleBuddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
170 | G_OBJECT_CLASS(purple_buddy_parent_class)->constructed(object); |
|
34743
fccb496c385e
Override GObject constructed method for PurpleBuddy, PurpleChat and PurpleGroup, to inform UI of creation
Ankit Vani <a@nevitus.org>
parents:
34742
diff
changeset
|
171 | |
|
41302
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
172 | if(priv->id == NULL) { |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
173 | gchar *id = g_uuid_string_random(); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
174 | |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
175 | purple_buddy_set_id(buddy, id); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
176 | |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
177 | g_free(id); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
178 | } |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
179 | |
|
34844
e341dbc04539
Refactored plugins, account, blistnodetypes to use the GObject presence API
Ankit Vani <a@nevitus.org>
parents:
34838
diff
changeset
|
180 | priv->presence = PURPLE_PRESENCE(purple_buddy_presence_new(buddy)); |
| 34714 | 181 | purple_presence_set_status_active(priv->presence, "offline", TRUE); |
| 182 | ||
|
39676
1e8394d47205
Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39675
diff
changeset
|
183 | purple_blist_new_node(purple_blist_get_default(), |
|
1e8394d47205
Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39675
diff
changeset
|
184 | PURPLE_BLIST_NODE(buddy)); |
| 34714 | 185 | } |
| 186 | ||
| 187 | static void | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
188 | purple_buddy_dispose(GObject *object) { |
|
39432
4c9808e30b3e
Use G_DEFINE_TYPE_WITH_PRIVATE on PurpleBuddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
189 | PurpleBuddyPrivate *priv = purple_buddy_get_instance_private(PURPLE_BUDDY(object)); |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
190 | |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
191 | g_clear_pointer(&priv->icon, purple_buddy_icon_unref); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
192 | g_clear_object(&priv->presence); |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
193 | |
|
39432
4c9808e30b3e
Use G_DEFINE_TYPE_WITH_PRIVATE on PurpleBuddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
194 | G_OBJECT_CLASS(purple_buddy_parent_class)->dispose(object); |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
195 | } |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
196 | |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
197 | static void |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
198 | purple_buddy_finalize(GObject *object) { |
| 34714 | 199 | PurpleBuddy *buddy = PURPLE_BUDDY(object); |
|
39432
4c9808e30b3e
Use G_DEFINE_TYPE_WITH_PRIVATE on PurpleBuddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
200 | PurpleBuddyPrivate *priv = purple_buddy_get_instance_private(buddy); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36365
diff
changeset
|
201 | PurpleProtocol *protocol; |
| 34714 | 202 | |
| 203 | /* | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
204 | * Tell the owner protocol that we're about to free the buddy so it |
| 34714 | 205 | * can free proto_data |
| 206 | */ | |
|
40804
5496016b3c00
Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents:
40752
diff
changeset
|
207 | protocol = purple_account_get_protocol(priv->account); |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40537
diff
changeset
|
208 | if(protocol) { |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40537
diff
changeset
|
209 | purple_protocol_client_buddy_free(PURPLE_PROTOCOL_CLIENT(protocol), |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40537
diff
changeset
|
210 | buddy); |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40537
diff
changeset
|
211 | } |
| 34714 | 212 | |
|
41302
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
213 | g_free(priv->id); |
| 34714 | 214 | g_free(priv->name); |
| 215 | g_free(priv->local_alias); | |
| 216 | g_free(priv->server_alias); | |
| 217 | ||
|
39432
4c9808e30b3e
Use G_DEFINE_TYPE_WITH_PRIVATE on PurpleBuddy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
218 | G_OBJECT_CLASS(purple_buddy_parent_class)->finalize(object); |
| 34714 | 219 | } |
| 220 | ||
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
221 | static void purple_buddy_class_init(PurpleBuddyClass *klass) { |
| 34714 | 222 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
| 223 | ||
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
224 | obj_class->constructed = purple_buddy_constructed; |
| 34714 | 225 | obj_class->dispose = purple_buddy_dispose; |
| 226 | obj_class->finalize = purple_buddy_finalize; | |
| 227 | obj_class->get_property = purple_buddy_get_property; | |
| 228 | obj_class->set_property = purple_buddy_set_property; | |
| 229 | ||
|
41302
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
230 | /** |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
231 | * PurpleBuddy::id: |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
232 | * |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
233 | * A globally unique identifier for this specific buddy. |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
234 | * |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
235 | * If an id is not passed during instantiation a uuid4 string is set as the |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
236 | * id. |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
237 | * |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
238 | * Since: 3.0.0 |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
239 | */ |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
240 | properties[PROP_ID] = g_param_spec_string( |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
241 | "id", "id", |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
242 | "The globally unique identifier of the buddy.", |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
243 | NULL, |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
244 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
245 | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
246 | properties[PROP_NAME] = g_param_spec_string( |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
247 | "name", "Name", |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
248 | "The name of the buddy.", |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
249 | NULL, |
|
41309
f33f4713508b
Don't set some PurpleBuddy properties at construction time
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41302
diff
changeset
|
250 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 34714 | 251 | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
252 | properties[PROP_LOCAL_ALIAS] = g_param_spec_string( |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
253 | "local-alias", "Local alias", |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
254 | "Local alias of thee buddy.", |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
255 | NULL, |
|
41309
f33f4713508b
Don't set some PurpleBuddy properties at construction time
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41302
diff
changeset
|
256 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 34714 | 257 | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
258 | properties[PROP_SERVER_ALIAS] = g_param_spec_string( |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
259 | "server-alias", "Server alias", |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
260 | "Server-side alias of the buddy.", |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
261 | NULL, |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
262 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 34714 | 263 | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
264 | properties[PROP_ICON] = g_param_spec_pointer( |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
265 | "icon", "Buddy icon", |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
266 | "The icon for the buddy.", |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
267 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
268 | |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
269 | properties[PROP_ACCOUNT] = g_param_spec_object( |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
270 | "account", "Account", |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
271 | "The account for the buddy.", |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
272 | PURPLE_TYPE_ACCOUNT, |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
273 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
| 34714 | 274 | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
275 | properties[PROP_PRESENCE] = g_param_spec_object( |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
276 | "presence", "Presence", |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
277 | "The status information for the buddy.", |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
278 | PURPLE_TYPE_PRESENCE, |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
279 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
| 34714 | 280 | |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
281 | properties[PROP_MEDIA_CAPS] = g_param_spec_enum( |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
282 | "media-caps", "Media capabilities", |
|
37948
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
283 | "The media capabilities of the buddy.", |
|
2a8f41535c8f
rename blistnodetypes.[ch] to buddy.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
37947
diff
changeset
|
284 | PURPLE_MEDIA_TYPE_CAPS, PURPLE_MEDIA_CAPS_NONE, |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
285 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 34714 | 286 | |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
287 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
| 34714 | 288 | } |
| 289 | ||
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
290 | /****************************************************************************** |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
291 | * Public API |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
292 | *****************************************************************************/ |
| 34714 | 293 | PurpleBuddy * |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
294 | purple_buddy_new(PurpleAccount *account, const gchar *name, const gchar *alias) |
| 34714 | 295 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34908
diff
changeset
|
296 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
| 34714 | 297 | g_return_val_if_fail(name != NULL, NULL); |
| 298 | ||
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
299 | return g_object_new( |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
300 | PURPLE_TYPE_BUDDY, |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
301 | "account", account, |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
302 | "name", name, |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
303 | "local-alias", alias, |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
304 | NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
305 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
306 | |
|
41302
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
307 | const gchar * |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
308 | purple_buddy_get_id(PurpleBuddy *buddy) { |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
309 | PurpleBuddyPrivate *priv = NULL; |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
310 | |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
311 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
312 | |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
313 | priv = purple_buddy_get_instance_private(buddy); |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
314 | |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
315 | return priv->id; |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
316 | } |
|
d7d40a5d9533
Add an id property to PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
317 | |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
318 | void |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
319 | purple_buddy_set_icon(PurpleBuddy *buddy, PurpleBuddyIcon *icon) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
320 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
321 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
322 | g_return_if_fail(PURPLE_IS_BUDDY(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
323 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
324 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
325 | if(priv->icon == icon) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
326 | return; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
327 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
328 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
329 | g_clear_pointer(&priv->icon, purple_buddy_icon_unref); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
330 | if(icon != NULL) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
331 | priv->icon = purple_buddy_icon_ref(icon); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
332 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
333 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
334 | g_object_notify_by_pspec(G_OBJECT(buddy), properties[PROP_ICON]); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
335 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
336 | purple_signal_emit(purple_blist_get_handle(), "buddy-icon-changed", buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
337 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
338 | purple_blist_update_node(purple_blist_get_default(), |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
339 | PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
340 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
341 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
342 | PurpleBuddyIcon * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
343 | purple_buddy_get_icon(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
344 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
345 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
346 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
347 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
348 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
349 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
350 | return priv->icon; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
351 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
352 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
353 | PurpleAccount * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
354 | purple_buddy_get_account(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
355 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
356 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
357 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
358 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
359 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
360 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
361 | return priv->account; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
362 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
363 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
364 | void |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
365 | purple_buddy_set_name(PurpleBuddy *buddy, const gchar *name) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
366 | PurpleBuddyList *blist = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
367 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
368 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
369 | g_return_if_fail(PURPLE_IS_BUDDY(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
370 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
371 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
372 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
373 | if(priv->name != NULL) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
374 | purple_blist_update_buddies_cache(buddy, name); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
375 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
376 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
377 | g_free(priv->name); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
378 | priv->name = purple_utf8_strip_unprintables(name); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
379 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
380 | g_object_notify_by_pspec(G_OBJECT(buddy), properties[PROP_NAME]); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
381 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
382 | blist = purple_blist_get_default(); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
383 | purple_blist_save_node(blist, PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
384 | purple_blist_update_node(blist, PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
385 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
386 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
387 | const gchar * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
388 | purple_buddy_get_name(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
389 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
390 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
391 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
392 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
393 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
394 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
395 | return priv->name; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
396 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
397 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
398 | gpointer |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
399 | purple_buddy_get_protocol_data(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
400 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
401 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
402 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
403 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
404 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
405 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
406 | return priv->proto_data; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
407 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
408 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
409 | void |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
410 | purple_buddy_set_protocol_data(PurpleBuddy *buddy, gpointer data) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
411 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
412 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
413 | g_return_if_fail(PURPLE_IS_BUDDY(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
414 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
415 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
416 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
417 | priv->proto_data = data; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
418 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
419 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
420 | const gchar * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
421 | purple_buddy_get_alias_only(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
422 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
423 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
424 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
425 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
426 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
427 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
428 | if((priv->local_alias != NULL) && (*priv->local_alias != '\0')) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
429 | return priv->local_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
430 | } else if((priv->server_alias != NULL) && (*priv->server_alias != '\0')) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
431 | return priv->server_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
432 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
433 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
434 | return NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
435 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
436 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
437 | const gchar * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
438 | purple_buddy_get_contact_alias(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
439 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
440 | PurpleContact *c = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
441 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
442 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
443 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
444 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
445 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
446 | /* Search for an alias for the buddy. In order of precedence: */ |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
447 | /* The local buddy alias */ |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
448 | if(priv->local_alias != NULL) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
449 | return priv->local_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
450 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
451 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
452 | /* The contact alias */ |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
453 | c = purple_buddy_get_contact(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
454 | if((c != NULL) && (purple_contact_get_alias(c) != NULL)) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
455 | return purple_contact_get_alias(c); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
456 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
457 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
458 | /* The server alias */ |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
459 | if((priv->server_alias) && (*priv->server_alias != '\0')) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
460 | return priv->server_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
461 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
462 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
463 | /* The buddy's user name (i.e. no alias) */ |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
464 | return priv->name; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
465 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
466 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
467 | const gchar * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
468 | purple_buddy_get_alias(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
469 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
470 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
471 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
472 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
473 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
474 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
475 | /* Search for an alias for the buddy. In order of precedence: */ |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
476 | /* The buddy alias */ |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
477 | if(priv->local_alias != NULL) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
478 | return priv->local_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
479 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
480 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
481 | /* The server alias */ |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
482 | if((priv->server_alias) && (*priv->server_alias != '\0')) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
483 | return priv->server_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
484 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
485 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
486 | /* The buddy's user name (i.e. no alias) */ |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
487 | return priv->name; |
| 34714 | 488 | } |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
489 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
490 | void |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
491 | purple_buddy_set_local_alias(PurpleBuddy *buddy, const gchar *alias) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
492 | PurpleBuddyList *blist = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
493 | PurpleBuddyPrivate *priv = NULL; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
494 | PurpleConversation *im = NULL; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
495 | PurpleConversationManager *manager = NULL; |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
496 | gchar *old_alias = NULL, *new_alias = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
497 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
498 | g_return_if_fail(PURPLE_IS_BUDDY(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
499 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
500 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
501 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
502 | if((alias != NULL) && (*alias != '\0')) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
503 | new_alias = purple_utf8_strip_unprintables(alias); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
504 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
505 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
506 | if(purple_strequal(priv->local_alias, new_alias)) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
507 | g_free(new_alias); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
508 | return; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
509 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
510 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
511 | old_alias = priv->local_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
512 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
513 | if((new_alias != NULL) && (*new_alias != '\0')) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
514 | priv->local_alias = new_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
515 | } else { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
516 | priv->local_alias = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
517 | g_free(new_alias); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
518 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
519 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
520 | g_object_notify_by_pspec(G_OBJECT(buddy), properties[PROP_LOCAL_ALIAS]); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
521 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
522 | blist = purple_blist_get_default(); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
523 | purple_blist_save_node(blist, PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
524 | purple_blist_update_node(blist, PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
525 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
526 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
527 | im = purple_conversation_manager_find_im(manager, priv->account, |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
528 | priv->name); |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
529 | if(PURPLE_IS_IM_CONVERSATION(im)) { |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
530 | purple_conversation_autoset_title(im); |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
531 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
532 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
533 | purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", buddy, |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
534 | old_alias); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
535 | g_free(old_alias); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
536 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
537 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
538 | const gchar * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
539 | purple_buddy_get_local_alias(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
540 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
541 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
542 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
543 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
544 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
545 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
546 | return priv->local_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
547 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
548 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
549 | void |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
550 | purple_buddy_set_server_alias(PurpleBuddy *buddy, const gchar *alias) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
551 | PurpleBuddyList *blist = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
552 | PurpleBuddyPrivate *priv = NULL; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
553 | PurpleConversation *im = NULL; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
554 | PurpleConversationManager *manager = NULL; |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
555 | gchar *old_alias = NULL, *new_alias = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
556 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
557 | g_return_if_fail(PURPLE_IS_BUDDY(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
558 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
559 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
560 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
561 | if((alias != NULL) && (*alias != '\0') && g_utf8_validate(alias, -1, NULL)) |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
562 | { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
563 | new_alias = purple_utf8_strip_unprintables(alias); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
564 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
565 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
566 | if(purple_strequal(priv->server_alias, new_alias)) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
567 | g_free(new_alias); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
568 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
569 | return; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
570 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
571 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
572 | old_alias = priv->server_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
573 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
574 | if((new_alias != NULL) && (*new_alias != '\0')) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
575 | priv->server_alias = new_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
576 | } else { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
577 | priv->server_alias = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
578 | g_free(new_alias); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
579 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
580 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
581 | g_object_notify_by_pspec(G_OBJECT(buddy), properties[PROP_SERVER_ALIAS]); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
582 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
583 | blist = purple_blist_get_default(); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
584 | purple_blist_save_node(blist, PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
585 | purple_blist_update_node(blist, PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
586 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
587 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
588 | im = purple_conversation_manager_find_im(manager, priv->account, |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
589 | priv->name); |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
590 | if(PURPLE_IS_IM_CONVERSATION(im)) { |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40870
diff
changeset
|
591 | purple_conversation_autoset_title(im); |
|
40752
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
592 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
593 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
594 | purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", buddy, |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
595 | old_alias); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
596 | g_free(old_alias); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
597 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
598 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
599 | const gchar * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
600 | purple_buddy_get_server_alias(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
601 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
602 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
603 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
604 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
605 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
606 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
607 | if((priv->server_alias) && (*priv->server_alias != '\0')) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
608 | return priv->server_alias; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
609 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
610 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
611 | return NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
612 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
613 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
614 | PurpleContact * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
615 | purple_buddy_get_contact(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
616 | PurpleBlistNode *parent = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
617 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
618 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
619 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
620 | parent = purple_blist_node_get_parent(PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
621 | if(PURPLE_IS_CONTACT(parent)) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
622 | return PURPLE_CONTACT(parent); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
623 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
624 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
625 | return NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
626 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
627 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
628 | PurplePresence * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
629 | purple_buddy_get_presence(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
630 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
631 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
632 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
633 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
634 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
635 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
636 | return priv->presence; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
637 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
638 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
639 | void |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
640 | purple_buddy_update_status(PurpleBuddy *buddy, PurpleStatus *old_status) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
641 | PurpleBuddyList *blist = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
642 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
643 | PurpleStatus *status = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
644 | gpointer handle = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
645 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
646 | gboolean old_online = FALSE, new_online = FALSE; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
647 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
648 | g_return_if_fail(PURPLE_IS_BUDDY(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
649 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
650 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
651 | status = purple_presence_get_active_status(priv->presence); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
652 | blist = purple_blist_get_default(); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
653 | handle = purple_blist_get_handle(); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
654 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
655 | purple_debug_info("blistnodetypes", "Updating buddy status for %s (%s)\n", |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
656 | priv->name, |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
657 | purple_account_get_protocol_name(priv->account)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
658 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
659 | old_online = purple_status_is_online(old_status); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
660 | new_online = purple_status_is_online(status); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
661 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
662 | if(old_online != new_online) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
663 | PurpleBlistNode *cnode = NULL, *gnode = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
664 | PurpleContact *contact = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
665 | PurpleCountingNode *contact_counter = NULL, *group_counter = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
666 | gint delta = 0, limit = 0; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
667 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
668 | if(new_online) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
669 | purple_signal_emit(handle, "buddy-signed-on", buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
670 | delta = 1; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
671 | limit = 1; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
672 | } else { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
673 | purple_blist_node_set_int(PURPLE_BLIST_NODE(buddy), "last_seen", |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
674 | time(NULL)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
675 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
676 | purple_signal_emit(handle, "buddy-signed-off", buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
677 | delta = -1; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
678 | limit = 0; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
679 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
680 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
681 | cnode = purple_blist_node_get_parent(PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
682 | contact = PURPLE_CONTACT(cnode); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
683 | contact_counter = PURPLE_COUNTING_NODE(contact); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
684 | gnode = purple_blist_node_get_parent(cnode); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
685 | group_counter = PURPLE_COUNTING_NODE(gnode); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
686 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
687 | purple_counting_node_change_online_count(contact_counter, delta); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
688 | if(purple_counting_node_get_online_count(contact_counter) == limit) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
689 | purple_counting_node_change_online_count(group_counter, delta); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
690 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
691 | } else { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
692 | purple_signal_emit(handle, "buddy-status-changed", buddy, old_status, |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
693 | status); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
694 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
695 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
696 | /* |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
697 | * This function used to only call the following two functions if one of |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
698 | * the above signals had been triggered, but that's not good, because |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
699 | * if someone's away message changes and they don't go from away to back |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
700 | * to away then no signal is triggered. |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
701 | * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
702 | * It's a safe assumption that SOMETHING called this function. PROBABLY |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
703 | * because something, somewhere changed. Calling the stuff below |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
704 | * certainly won't hurt anything. Unless you're on a K6-2 300. |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
705 | */ |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
706 | purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
707 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
708 | purple_blist_update_node(blist, PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
709 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
710 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
711 | PurpleMediaCaps |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
712 | purple_buddy_get_media_caps(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
713 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
714 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
715 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), 0); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
716 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
717 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
718 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
719 | return priv->media_caps; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
720 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
721 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
722 | void |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
723 | purple_buddy_set_media_caps(PurpleBuddy *buddy, PurpleMediaCaps media_caps) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
724 | PurpleBuddyPrivate *priv = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
725 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
726 | g_return_if_fail(PURPLE_IS_BUDDY(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
727 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
728 | priv = purple_buddy_get_instance_private(buddy); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
729 | priv->media_caps = media_caps; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
730 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
731 | g_object_notify_by_pspec(G_OBJECT(buddy), properties[PROP_MEDIA_CAPS]); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
732 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
733 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
734 | PurpleGroup * |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
735 | purple_buddy_get_group(PurpleBuddy *buddy) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
736 | PurpleBlistNode *contact = NULL, *group = NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
737 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
738 | g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
739 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
740 | contact = purple_blist_node_get_parent(PURPLE_BLIST_NODE(buddy)); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
741 | if(!PURPLE_IS_CONTACT(contact)) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
742 | return purple_blist_get_default_group(); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
743 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
744 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
745 | group = purple_blist_node_get_parent(contact); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
746 | if(PURPLE_IS_GROUP(group)) { |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
747 | return PURPLE_GROUP(group); |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
748 | } |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
749 | |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
750 | return NULL; |
|
81e94476e3ac
Update buddy.c to more closely match our current gobject structure.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
751 | } |