Sat, 01 Oct 2022 01:50:52 -0500
Create and add PurpleContacts to the manager when purple_buddy_new is called
This required some additional changes to PurpleContact. Namely that the contact always has a presence and it is no longer writeable.
Testing Done:
Ran the unit tests and verified nothing funky happens when running.
We can't test that all of the properties are properly bound because we would have to start up a lot more of libpurple than I'm willing to do for something that's temporary.
Bugs closed: PIDGIN-17685
Reviewed at https://reviews.imfreedom.org/r/1873/
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include "purplecontact.h" |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | struct _PurpleContact { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | GObject parent; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | gchar *id; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | PurpleAccount *account; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | gchar *username; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | gchar *display_name; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | gchar *alias; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | GdkPixbuf *avatar; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | PurplePresence *presence; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | PurpleTags *tags; |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
36 | |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
37 | PurplePerson *person; |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | }; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | enum { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | PROP_0, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | PROP_ID, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | PROP_ACCOUNT, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | PROP_USERNAME, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | PROP_DISPLAY_NAME, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | PROP_ALIAS, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | PROP_AVATAR, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | PROP_PRESENCE, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | PROP_TAGS, |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
50 | PROP_PERSON, |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | N_PROPERTIES |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | }; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | G_DEFINE_TYPE(PurpleContact, purple_contact, G_TYPE_OBJECT) |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | /****************************************************************************** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | * Helpers |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | *****************************************************************************/ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | purple_contact_set_account(PurpleContact *contact, PurpleAccount *account) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | if(g_set_object(&contact->account, account)) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_ACCOUNT]); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | purple_contact_set_id(PurpleContact *contact, const gchar *id) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | g_free(contact->id); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | if(id != NULL) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | contact->id = g_strdup(id); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | } else { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | contact->id = g_uuid_string_random(); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_ID]); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | /****************************************************************************** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | * GObject Implementation |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | *****************************************************************************/ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | purple_contact_get_property(GObject *obj, guint param_id, GValue *value, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | GParamSpec *pspec) |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | PurpleContact *contact = PURPLE_CONTACT(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | switch(param_id) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | case PROP_ID: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | g_value_set_string(value, purple_contact_get_id(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | case PROP_ACCOUNT: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | g_value_set_object(value, purple_contact_get_account(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | case PROP_USERNAME: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | g_value_set_string(value, purple_contact_get_username(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | case PROP_DISPLAY_NAME: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | g_value_set_string(value, purple_contact_get_display_name(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | case PROP_ALIAS: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | g_value_set_string(value, purple_contact_get_alias(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | case PROP_AVATAR: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | g_value_set_object(value, purple_contact_get_avatar(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | case PROP_PRESENCE: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | g_value_set_object(value, purple_contact_get_presence(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | case PROP_TAGS: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | g_value_set_object(value, purple_contact_get_tags(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | break; |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
119 | case PROP_PERSON: |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
120 | g_value_set_object(value, purple_contact_get_person(contact)); |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
121 | break; |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | default: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | purple_contact_set_property(GObject *obj, guint param_id, const GValue *value, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | GParamSpec *pspec) |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | PurpleContact *contact = PURPLE_CONTACT(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | switch(param_id) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | case PROP_ID: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | purple_contact_set_id(contact, g_value_get_string(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | case PROP_ACCOUNT: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | purple_contact_set_account(contact, g_value_get_object(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | case PROP_USERNAME: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | purple_contact_set_username(contact, g_value_get_string(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | case PROP_DISPLAY_NAME: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | purple_contact_set_display_name(contact, g_value_get_string(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | case PROP_ALIAS: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | purple_contact_set_alias(contact, g_value_get_string(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | case PROP_AVATAR: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | purple_contact_set_avatar(contact, g_value_get_object(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | break; |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
153 | case PROP_PERSON: |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
154 | purple_contact_set_person(contact, g_value_get_object(value)); |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
155 | break; |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | default: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | purple_contact_dispose(GObject *obj) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | PurpleContact *contact = PURPLE_CONTACT(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | g_clear_object(&contact->account); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | g_clear_object(&contact->avatar); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | g_clear_object(&contact->presence); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | g_clear_object(&contact->tags); |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
170 | g_clear_object(&contact->person); |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | G_OBJECT_CLASS(purple_contact_parent_class)->dispose(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | purple_contact_finalize(GObject *obj) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | PurpleContact *contact = PURPLE_CONTACT(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | g_clear_pointer(&contact->id, g_free); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | g_clear_pointer(&contact->username, g_free); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | g_clear_pointer(&contact->display_name, g_free); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | g_clear_pointer(&contact->alias, g_free); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | G_OBJECT_CLASS(purple_contact_parent_class)->finalize(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | purple_contact_constructed(GObject *obj) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | PurpleContact *contact = NULL; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | G_OBJECT_CLASS(purple_contact_parent_class)->constructed(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | contact = PURPLE_CONTACT(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | if(contact->id == NULL) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | purple_contact_set_id(contact, NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | purple_contact_init(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | contact->tags = purple_tags_new(); |
|
41771
c5877e2c93f2
Create and add PurpleContacts to the manager when purple_buddy_new is called
Gary Kramlich <grim@reaperworld.com>
parents:
41759
diff
changeset
|
202 | contact->presence = g_object_new(PURPLE_TYPE_PRESENCE, NULL); |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | purple_contact_class_init(PurpleContactClass *klass) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | obj_class->get_property = purple_contact_get_property; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | obj_class->set_property = purple_contact_set_property; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | obj_class->constructed = purple_contact_constructed; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | obj_class->dispose = purple_contact_dispose; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | obj_class->finalize = purple_contact_finalize; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | * PurpleContact:id: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | * The protocol specific id for the contact. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | properties[PROP_ID] = g_param_spec_string( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | "id", "id", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | "The id of the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | NULL, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | * PurpleContact:account: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | * The account that this contact belongs to. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | properties[PROP_ACCOUNT] = g_param_spec_object( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | "account", "account", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | "The account this contact belongs to", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | PURPLE_TYPE_ACCOUNT, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | * PurpleContact:username: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | * The username for this contact. In rare cases this can change, like when |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | * a user changes their "nick" on IRC which is their user name. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | properties[PROP_USERNAME] = g_param_spec_string( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | "username", "username", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | "The username of the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | NULL, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | * PurpleContact:display-name: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | * The display name for this contact. This is generally set by the person |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | * the contact is representing and controlled via the protocol plugin. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | properties[PROP_DISPLAY_NAME] = g_param_spec_string( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | "display-name", "display-name", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | "The display name of the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | NULL, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | * PurpleContact:alias: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | * The alias for this contact. This is controlled by the libpurple user and |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | * may be used by the protocol if it allows for aliasing. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | properties[PROP_ALIAS] = g_param_spec_string( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | "alias", "alias", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | "The alias of the contact.", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | NULL, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | * PurpleContact:avatar: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | * The avatar for this contact. This is typically controlled by the protocol |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | * and should only be read by others. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | properties[PROP_AVATAR] = g_param_spec_object( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | "avatar", "avatar", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | "The avatar of the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | GDK_TYPE_PIXBUF, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | * PurpleContact:presence: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | * The [class@Purple.Presence] for this contact. This is typically |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | * controlled by the protocol and should only be read by others. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | properties[PROP_PRESENCE] = g_param_spec_object( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | "presence", "presence", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | "The presence of the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | PURPLE_TYPE_PRESENCE, |
|
41771
c5877e2c93f2
Create and add PurpleContacts to the manager when purple_buddy_new is called
Gary Kramlich <grim@reaperworld.com>
parents:
41759
diff
changeset
|
309 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
312 | * PurpleContact:tags: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | * The [class@Purple.Tags] for this contact. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | properties[PROP_TAGS] = g_param_spec_object( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | "tags", "tags", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | "The tags for the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | PURPLE_TYPE_TAGS, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
324 | /** |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
325 | * PurpleContact:person: |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
326 | * |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
327 | * The [class@Purple.Person] that this contact belongs to. |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
328 | * |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
329 | * Since: 3.0.0 |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
330 | */ |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
331 | properties[PROP_PERSON] = g_param_spec_object( |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
332 | "person", "person", |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
333 | "The person this contact belongs to.", |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
334 | PURPLE_TYPE_PERSON, |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
335 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
336 | |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
338 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
339 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | /****************************************************************************** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | * Public API |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | *****************************************************************************/ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | PurpleContact * |
|
41759
1ecc0512e714
Make purple_contact_new take the id instead of the username.
Gary Kramlich <grim@reaperworld.com>
parents:
41755
diff
changeset
|
344 | purple_contact_new(PurpleAccount *account, const gchar *id) { |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | return g_object_new(PURPLE_TYPE_CONTACT, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | "account", account, |
|
41759
1ecc0512e714
Make purple_contact_new take the id instead of the username.
Gary Kramlich <grim@reaperworld.com>
parents:
41755
diff
changeset
|
349 | "id", id, |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
350 | NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
352 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
353 | PurpleAccount * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
354 | purple_contact_get_account(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | return contact->account; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
359 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
360 | const gchar * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
361 | purple_contact_get_id(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
362 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
363 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
364 | return contact->id; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
365 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
366 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
367 | const gchar * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
368 | purple_contact_get_username(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
369 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
370 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
371 | return contact->username; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
372 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
373 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
374 | void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
375 | purple_contact_set_username(PurpleContact *contact, const gchar *username) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
376 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
377 | g_return_if_fail(username != NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
378 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
379 | g_free(contact->username); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
380 | contact->username = g_strdup(username); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
381 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
382 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_USERNAME]); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
383 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
384 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
385 | const gchar * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
386 | purple_contact_get_display_name(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
387 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
388 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
389 | return contact->display_name; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
390 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
391 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
392 | void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
393 | purple_contact_set_display_name(PurpleContact *contact, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
394 | const gchar *display_name) |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
395 | { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
396 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
397 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
398 | g_free(contact->display_name); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
399 | contact->display_name = g_strdup(display_name); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
400 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
401 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_DISPLAY_NAME]); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
402 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
403 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
404 | const gchar * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
405 | purple_contact_get_alias(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
406 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
407 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
408 | return contact->alias; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
409 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
410 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
411 | void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
412 | purple_contact_set_alias(PurpleContact *contact, const gchar *alias) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
413 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
414 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
415 | g_free(contact->alias); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
416 | contact->alias = g_strdup(alias); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
417 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
418 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_ALIAS]); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
419 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
420 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
421 | GdkPixbuf * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
422 | purple_contact_get_avatar(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
423 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
424 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
425 | return contact->avatar; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
426 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
427 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
428 | void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
429 | purple_contact_set_avatar(PurpleContact *contact, GdkPixbuf *avatar) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
430 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
431 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
432 | if(g_set_object(&contact->avatar, avatar)) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
433 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_AVATAR]); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
434 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
435 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
436 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
437 | PurplePresence * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
438 | purple_contact_get_presence(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
439 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
440 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
441 | return contact->presence; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
442 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
443 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
444 | PurpleTags * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
445 | purple_contact_get_tags(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
446 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
447 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
448 | return contact->tags; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
449 | } |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
450 | |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
451 | void |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
452 | purple_contact_set_person(PurpleContact *contact, PurplePerson *person) { |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
453 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
454 | |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
455 | if(g_set_object(&contact->person, person)) { |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
456 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_PERSON]); |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
457 | } |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
458 | } |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
459 | |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
460 | PurplePerson * |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
461 | purple_contact_get_person(PurpleContact *contact) { |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
462 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
463 | |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
464 | return contact->person; |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
465 | } |