Wed, 16 Nov 2022 23:43:30 -0600
Add a contact property to PurpleAccount
This contact can be used by the protocol to store additional information about
the account, including the user id, alias, etc. When the protocol connects, it
will be responsible for adding this contact to the ContactManager once it knows
that the id is correct.
This will also be used in the future when PurpleMessage gets migrated to using
PurpleContact's as well.
Testing Done:
Connected an IRCv3 and demo accounts.
Reviewed at https://reviews.imfreedom.org/r/2064/
|
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 | |
|
41918
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
21 | #include "purpleenums.h" |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
22 | |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | struct _PurpleContact { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | GObject parent; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | gchar *id; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | PurpleAccount *account; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | gchar *username; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | gchar *display_name; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | gchar *alias; |
|
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 | GdkPixbuf *avatar; |
|
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 | PurplePresence *presence; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | PurpleTags *tags; |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
38 | |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
39 | PurplePerson *person; |
|
41918
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
40 | |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
41 | PurpleContactPermission permission; |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | }; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | enum { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | PROP_0, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | PROP_ID, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | PROP_ACCOUNT, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | PROP_USERNAME, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | PROP_DISPLAY_NAME, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | PROP_ALIAS, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | PROP_AVATAR, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | PROP_PRESENCE, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | PROP_TAGS, |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
54 | PROP_PERSON, |
|
41918
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
55 | PROP_PERMISSION, |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | N_PROPERTIES |
|
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 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
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 | G_DEFINE_TYPE(PurpleContact, purple_contact, G_TYPE_OBJECT) |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | /****************************************************************************** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | * Helpers |
|
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 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | purple_contact_set_account(PurpleContact *contact, PurpleAccount *account) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
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 | if(g_set_object(&contact->account, account)) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_ACCOUNT]); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | } |
|
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 | |
|
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 | * GObject Implementation |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | *****************************************************************************/ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | purple_contact_get_property(GObject *obj, guint param_id, GValue *value, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | GParamSpec *pspec) |
|
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 | PurpleContact *contact = PURPLE_CONTACT(obj); |
|
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 | switch(param_id) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | case PROP_ID: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | g_value_set_string(value, purple_contact_get_id(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | case PROP_ACCOUNT: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | g_value_set_object(value, purple_contact_get_account(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | case PROP_USERNAME: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | g_value_set_string(value, purple_contact_get_username(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | case PROP_DISPLAY_NAME: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | g_value_set_string(value, purple_contact_get_display_name(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | case PROP_ALIAS: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | g_value_set_string(value, purple_contact_get_alias(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | case PROP_AVATAR: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | g_value_set_object(value, purple_contact_get_avatar(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | case PROP_PRESENCE: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | g_value_set_object(value, purple_contact_get_presence(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | case PROP_TAGS: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | g_value_set_object(value, purple_contact_get_tags(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | break; |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
109 | case PROP_PERSON: |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
110 | 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
|
111 | break; |
|
41918
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
112 | case PROP_PERMISSION: |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
113 | g_value_set_enum(value, purple_contact_get_permission(contact)); |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
114 | break; |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | default: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | 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
|
123 | GParamSpec *pspec) |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | PurpleContact *contact = PURPLE_CONTACT(obj); |
|
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 | switch(param_id) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | case PROP_ID: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | purple_contact_set_id(contact, g_value_get_string(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | case PROP_ACCOUNT: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | purple_contact_set_account(contact, g_value_get_object(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | case PROP_USERNAME: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | purple_contact_set_username(contact, g_value_get_string(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | case PROP_DISPLAY_NAME: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | purple_contact_set_display_name(contact, g_value_get_string(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | case PROP_ALIAS: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | purple_contact_set_alias(contact, g_value_get_string(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | case PROP_AVATAR: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | purple_contact_set_avatar(contact, g_value_get_object(value)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | break; |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
146 | case PROP_PERSON: |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
147 | 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
|
148 | break; |
|
41918
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
149 | case PROP_PERMISSION: |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
150 | purple_contact_set_permission(contact, g_value_get_enum(value)); |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
151 | break; |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | default: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | break; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | purple_contact_dispose(GObject *obj) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | PurpleContact *contact = PURPLE_CONTACT(obj); |
|
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 | g_clear_object(&contact->account); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | g_clear_object(&contact->avatar); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | g_clear_object(&contact->presence); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | g_clear_object(&contact->tags); |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
166 | g_clear_object(&contact->person); |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | G_OBJECT_CLASS(purple_contact_parent_class)->dispose(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | purple_contact_finalize(GObject *obj) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | PurpleContact *contact = PURPLE_CONTACT(obj); |
|
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 | g_clear_pointer(&contact->id, g_free); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | g_clear_pointer(&contact->username, g_free); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | g_clear_pointer(&contact->display_name, g_free); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | g_clear_pointer(&contact->alias, g_free); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | G_OBJECT_CLASS(purple_contact_parent_class)->finalize(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | purple_contact_constructed(GObject *obj) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | PurpleContact *contact = NULL; |
|
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 | G_OBJECT_CLASS(purple_contact_parent_class)->constructed(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | contact = PURPLE_CONTACT(obj); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | if(contact->id == NULL) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | purple_contact_set_id(contact, NULL); |
|
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 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | purple_contact_init(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | 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
|
198 | contact->presence = g_object_new(PURPLE_TYPE_PRESENCE, NULL); |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | static void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | purple_contact_class_init(PurpleContactClass *klass) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
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 | obj_class->constructed = purple_contact_constructed; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | obj_class->dispose = purple_contact_dispose; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | obj_class->finalize = purple_contact_finalize; |
|
41918
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
208 | obj_class->get_property = purple_contact_get_property; |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
209 | obj_class->set_property = purple_contact_set_property; |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | * PurpleContact:id: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | * The protocol specific id for the contact. |
|
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 | * Since: 3.0.0 |
|
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 | properties[PROP_ID] = g_param_spec_string( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | "id", "id", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | "The id of the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | NULL, |
|
41920
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
222 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | * PurpleContact:account: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | * The account that this contact belongs to. |
|
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 | * Since: 3.0.0 |
|
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 | properties[PROP_ACCOUNT] = g_param_spec_object( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | "account", "account", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | "The account this contact belongs to", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | PURPLE_TYPE_ACCOUNT, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | * PurpleContact:username: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | * 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
|
241 | * 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
|
242 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | properties[PROP_USERNAME] = g_param_spec_string( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | "username", "username", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | "The username of the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | NULL, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | * PurpleContact:display-name: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | * 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
|
255 | * the contact is representing and controlled via the protocol plugin. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | properties[PROP_DISPLAY_NAME] = g_param_spec_string( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | "display-name", "display-name", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | "The display name of the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | NULL, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | * PurpleContact:alias: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | * 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
|
269 | * may be used by the protocol if it allows for aliasing. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | properties[PROP_ALIAS] = g_param_spec_string( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | "alias", "alias", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | "The alias of the contact.", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | NULL, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | * PurpleContact:avatar: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | * 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
|
283 | * and should only be read by others. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | properties[PROP_AVATAR] = g_param_spec_object( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | "avatar", "avatar", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | "The avatar of the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | GDK_TYPE_PIXBUF, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | * PurpleContact:presence: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | * The [class@Purple.Presence] for this contact. This is typically |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | * controlled by the protocol and should only be read by others. |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | * Since: 3.0.0 |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | */ |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | properties[PROP_PRESENCE] = g_param_spec_object( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | "presence", "presence", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | "The presence of the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | 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
|
305 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | /** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | * PurpleContact:tags: |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | * The [class@Purple.Tags] for this contact. |
|
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 | * Since: 3.0.0 |
|
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 | properties[PROP_TAGS] = g_param_spec_object( |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | "tags", "tags", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | "The tags for the contact", |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | PURPLE_TYPE_TAGS, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
320 | /** |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
321 | * PurpleContact:person: |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
322 | * |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
323 | * 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
|
324 | * |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
325 | * Since: 3.0.0 |
|
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 | properties[PROP_PERSON] = g_param_spec_object( |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
328 | "person", "person", |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
329 | "The person this contact belongs to.", |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
330 | PURPLE_TYPE_PERSON, |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
331 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
332 | |
|
41918
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
333 | /** |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
334 | * PurpleContact:permission: |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
335 | * |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
336 | * The permission level for the contact. |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
337 | * |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
338 | * Since: 3.0.0 |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
339 | */ |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
340 | properties[PROP_PERMISSION] = g_param_spec_enum( |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
341 | "permission", "permission", |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
342 | "The permission level of the contact", |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
343 | PURPLE_TYPE_CONTACT_PERMISSION, |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
344 | PURPLE_CONTACT_PERMISSION_UNSET, |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
345 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
346 | |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
350 | /****************************************************************************** |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | * Public API |
|
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 | PurpleContact * |
|
41759
1ecc0512e714
Make purple_contact_new take the id instead of the username.
Gary Kramlich <grim@reaperworld.com>
parents:
41755
diff
changeset
|
354 | purple_contact_new(PurpleAccount *account, const gchar *id) { |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), 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 g_object_new(PURPLE_TYPE_CONTACT, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 | "account", account, |
|
41759
1ecc0512e714
Make purple_contact_new take the id instead of the username.
Gary Kramlich <grim@reaperworld.com>
parents:
41755
diff
changeset
|
359 | "id", id, |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
360 | NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
361 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
362 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
363 | PurpleAccount * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
364 | purple_contact_get_account(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
365 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
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 | return contact->account; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
368 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
369 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
370 | const gchar * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
371 | purple_contact_get_id(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
372 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
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 | return contact->id; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
375 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
376 | |
|
41920
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
377 | void |
|
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
378 | purple_contact_set_id(PurpleContact *contact, const gchar *id) { |
|
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
379 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
380 | |
|
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
381 | g_free(contact->id); |
|
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
382 | contact->id = g_strdup(id); |
|
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
383 | |
|
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
384 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_ID]); |
|
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
385 | } |
|
29ebd938c592
Add a contact property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41918
diff
changeset
|
386 | |
|
41739
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
387 | const gchar * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
388 | purple_contact_get_username(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
389 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
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 | return contact->username; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
392 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
393 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
394 | void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
395 | purple_contact_set_username(PurpleContact *contact, const gchar *username) { |
|
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 | g_return_if_fail(username != NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
398 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
399 | g_free(contact->username); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
400 | contact->username = g_strdup(username); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
401 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
402 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_USERNAME]); |
|
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 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
405 | const gchar * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
406 | purple_contact_get_display_name(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
407 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
408 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
409 | return contact->display_name; |
|
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 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
412 | void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
413 | purple_contact_set_display_name(PurpleContact *contact, |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
414 | const gchar *display_name) |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
415 | { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
416 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
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_free(contact->display_name); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
419 | contact->display_name = g_strdup(display_name); |
|
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 | 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
|
422 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
423 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
424 | const gchar * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
425 | purple_contact_get_alias(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
426 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
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 | return contact->alias; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
429 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
430 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
431 | void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
432 | purple_contact_set_alias(PurpleContact *contact, const gchar *alias) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
433 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
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 | g_free(contact->alias); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
436 | contact->alias = g_strdup(alias); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
437 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
438 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_ALIAS]); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
439 | } |
|
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 | GdkPixbuf * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
442 | purple_contact_get_avatar(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
443 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
444 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
445 | return contact->avatar; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
446 | } |
|
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 | void |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
449 | purple_contact_set_avatar(PurpleContact *contact, GdkPixbuf *avatar) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
450 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
451 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
452 | if(g_set_object(&contact->avatar, avatar)) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
453 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_AVATAR]); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
454 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
455 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
456 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
457 | PurplePresence * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
458 | purple_contact_get_presence(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
459 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
460 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
461 | return contact->presence; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
462 | } |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
463 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
464 | PurpleTags * |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
465 | purple_contact_get_tags(PurpleContact *contact) { |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
466 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
467 | |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
468 | return contact->tags; |
|
f589ceec0172
Create the new PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
469 | } |
|
41755
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
470 | |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
471 | void |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
472 | purple_contact_set_person(PurpleContact *contact, PurplePerson *person) { |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
473 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
474 | |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
475 | if(g_set_object(&contact->person, person)) { |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
476 | 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
|
477 | } |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
478 | } |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
479 | |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
480 | PurplePerson * |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
481 | purple_contact_get_person(PurpleContact *contact) { |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
482 | 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
|
483 | |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
484 | return contact->person; |
|
b7e6166e5300
Add a person property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41739
diff
changeset
|
485 | } |
|
41918
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
486 | |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
487 | PurpleContactPermission |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
488 | purple_contact_get_permission(PurpleContact *contact) { |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
489 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
490 | PURPLE_CONTACT_PERMISSION_UNSET); |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
491 | |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
492 | return contact->permission; |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
493 | } |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
494 | |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
495 | void |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
496 | purple_contact_set_permission(PurpleContact *contact, |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
497 | PurpleContactPermission permission) |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
498 | { |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
499 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
500 | |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
501 | contact->permission = permission; |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
502 | |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
503 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_PERMISSION]); |
|
106ae46b290b
Add a permission property to PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
41771
diff
changeset
|
504 | } |