Sat, 02 Jan 2021 19:06:28 -0600
Use PurpleCredentialManager instead of the old keyring api.
Testing Done:
Connected with bonjour (no password), irc (optional password, non set), and xmpp (password required, not saved, entered manually, not saved) and verified that all of them connected properly.
Reviewed at https://reviews.imfreedom.org/r/289/
| 8675 | 1 | /* |
| 2 | * novell.c | |
| 3 | * | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
4 | * Copyright (c) 2004 Novell, Inc. All Rights Reserved. |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
5 | * |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
6 | * This program is free software; you can redistribute it and/or modify |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
7 | * it under the terms of the GNU General Public License as published by |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
8 | * the Free Software Foundation; version 2 of the License. |
| 8675 | 9 | * |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
13 | * GNU General Public License for more details. |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
14 | * |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
16 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17154
diff
changeset
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8675 | 18 | * |
| 19 | */ | |
| 20 | ||
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
21 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
22 | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
23 | #ifndef _WIN32 |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
24 | # include <sys/utsname.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
25 | #endif |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
26 | |
|
40358
e6fe6fc1f516
move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents:
40119
diff
changeset
|
27 | #include <purple.h> |
|
e6fe6fc1f516
move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents:
40119
diff
changeset
|
28 | |
| 8675 | 29 | #include "nmuser.h" |
|
36657
4a7f5f97d1ec
Make sure internal.h is included first
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
30 | #include "novell.h" |
| 8675 | 31 | |
| 32 | #define DEFAULT_PORT 8300 | |
| 33 | #define NOVELL_CONNECT_STEPS 4 | |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
34 | #define NM_ROOT_FOLDER_NAME "GroupWise Messenger" |
| 8675 | 35 | |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
36 | #define NOVELL_STATUS_TYPE_AVAILABLE "available" |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
37 | #define NOVELL_STATUS_TYPE_AWAY "away" |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
38 | #define NOVELL_STATUS_TYPE_BUSY "busy" |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
39 | #define NOVELL_STATUS_TYPE_OFFLINE "offline" |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
40 | #define NOVELL_STATUS_TYPE_IDLE "idle" |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
41 | #define NOVELL_STATUS_TYPE_APPEAR_OFFLINE "appearoffline" |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
42 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
43 | static PurpleProtocol *my_protocol = NULL; |
| 8675 | 44 | |
| 45 | static gboolean | |
| 46 | _is_disconnect_error(NMERR_T err); | |
| 47 | ||
| 48 | static gboolean | |
| 49 | _check_for_disconnect(NMUser * user, NMERR_T err); | |
| 50 | ||
| 51 | static void | |
| 52 | _send_message(NMUser * user, NMMessage * message); | |
| 53 | ||
| 54 | static void | |
| 15884 | 55 | _update_buddy_status(NMUser *user, PurpleBuddy * buddy, int status, int gmt); |
| 8675 | 56 | |
| 57 | static void | |
| 15884 | 58 | _remove_purple_buddies(NMUser * user); |
| 8675 | 59 | |
| 60 | static void | |
| 15884 | 61 | _add_contacts_to_purple_blist(NMUser * user, NMFolder * folder); |
| 8675 | 62 | |
| 63 | static void | |
| 15884 | 64 | _add_purple_buddies(NMUser * user); |
| 8675 | 65 | |
| 66 | static void | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
67 | _sync_contact_list(NMUser *user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
68 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
69 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
70 | _sync_privacy_lists(NMUser *user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
71 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
72 | static void |
|
31344
a5ccecc17f1c
Stop Groupwise from showing two windows for Get Info. Fixes #13108.
Gabriel Burt <gabriel.burt@gmail.com>
parents:
31294
diff
changeset
|
73 | _show_info(PurpleConnection * gc, NMUserRecord * user_record, char * name); |
| 8675 | 74 | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
75 | const char * |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
76 | _get_conference_name(int id); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
77 | |
| 8675 | 78 | /******************************************************************************* |
| 79 | * Response callbacks | |
| 80 | *******************************************************************************/ | |
| 81 | ||
| 82 | /* Handle login response */ | |
| 83 | static void | |
| 84 | _login_resp_cb(NMUser * user, NMERR_T ret_code, | |
| 85 | gpointer resp_data, gpointer user_data) | |
| 86 | { | |
| 15884 | 87 | PurpleConnection *gc; |
| 8675 | 88 | const char *alias; |
| 89 | NMERR_T rc; | |
| 90 | ||
| 91 | if (user == NULL) | |
| 92 | return; | |
| 93 | ||
| 15884 | 94 | gc = purple_account_get_connection(user->client_data); |
| 8675 | 95 | if (gc == NULL) |
| 96 | return; | |
| 97 | ||
| 98 | if (ret_code == NM_OK) { | |
| 99 | ||
| 100 | /* Set alias for user if not set (use Full Name) */ | |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
34578
diff
changeset
|
101 | alias = purple_account_get_private_alias(user->client_data); |
| 8675 | 102 | if (alias == NULL || *alias == '\0') { |
| 103 | alias = nm_user_record_get_full_name(user->user_record); | |
| 104 | ||
| 105 | if (alias) | |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
34578
diff
changeset
|
106 | purple_account_set_private_alias(user->client_data, alias); |
| 8675 | 107 | } |
| 108 | ||
| 15884 | 109 | /* Tell Purple that we are connected */ |
|
34746
dc9c911dbd35
Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
110 | purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTED); |
| 8675 | 111 | |
|
9360
c40bc951573a
[gaim-migrate @ 10168]
Mike Stoddard <mistoddard@novell.com>
parents:
9308
diff
changeset
|
112 | _sync_contact_list(user); |
|
c40bc951573a
[gaim-migrate @ 10168]
Mike Stoddard <mistoddard@novell.com>
parents:
9308
diff
changeset
|
113 | |
| 8675 | 114 | rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL, |
| 115 | NULL); | |
| 116 | _check_for_disconnect(user, rc); | |
| 117 | ||
| 118 | } else { | |
| 21279 | 119 | PurpleConnectionError reason; |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27525
diff
changeset
|
120 | char *err = g_strdup_printf(_("Unable to login: %s"), |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
121 | nm_error_to_string (ret_code)); |
| 8675 | 122 | |
|
20451
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
123 | switch (ret_code) { |
|
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
124 | case NMERR_AUTHENTICATION_FAILED: |
|
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
125 | case NMERR_CREDENTIALS_MISSING: |
|
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
126 | case NMERR_PASSWORD_INVALID: |
|
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
127 | /* Don't attempt to auto-reconnect if our |
|
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
128 | * password was invalid. |
|
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
129 | */ |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
130 | if (!purple_account_get_remember_password(purple_connection_get_account(gc))) { |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
131 | PurpleAccount *account = NULL; |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
132 | PurpleCredentialManager *manager = NULL; |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
133 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
134 | account = purple_connection_get_account(gc); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
135 | manager = purple_credential_manager_get_default(); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
136 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
137 | purple_credential_manager_clear_password_async(manager, |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
138 | account, |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
139 | NULL, NULL, |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
140 | NULL); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
141 | } |
| 21279 | 142 | reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
|
20451
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
143 | break; |
|
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
144 | default: |
|
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
145 | /* FIXME: There are other reasons login could fail */ |
| 21279 | 146 | reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
147 | } |
|
20451
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
148 | |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31595
diff
changeset
|
149 | purple_connection_error(gc, reason, err); |
| 8675 | 150 | g_free(err); |
| 151 | } | |
| 152 | } | |
| 153 | ||
| 154 | /* Handle getstatus response*/ | |
| 155 | static void | |
| 156 | _get_status_resp_cb(NMUser * user, NMERR_T ret_code, | |
| 157 | gpointer resp_data, gpointer user_data) | |
| 158 | { | |
| 15884 | 159 | PurpleBuddy *buddy; |
| 8675 | 160 | GSList *buddies; |
| 161 | GSList *bnode; | |
| 162 | NMUserRecord *user_record = (NMUserRecord *) resp_data; | |
| 163 | int status; | |
| 164 | ||
| 165 | if (user == NULL || user_record == NULL) | |
| 166 | return; | |
| 167 | ||
| 168 | if (ret_code == NM_OK) { | |
| 169 | ||
| 15884 | 170 | /* Find all Purple buddies and update their statuses */ |
| 8675 | 171 | const char *name = nm_user_record_get_display_id(user_record); |
| 172 | ||
| 173 | if (name) { | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
174 | buddies = purple_blist_find_buddies((PurpleAccount *) user->client_data, name); |
| 8675 | 175 | for (bnode = buddies; bnode; bnode = bnode->next) { |
| 15884 | 176 | buddy = (PurpleBuddy *) bnode->data; |
| 8675 | 177 | if (buddy) { |
| 178 | status = nm_user_record_get_status(user_record); | |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
179 | _update_buddy_status(user, buddy, status, time(0)); |
| 8675 | 180 | } |
| 181 | } | |
|
12126
3b70215e9630
[gaim-migrate @ 14426]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11972
diff
changeset
|
182 | g_slist_free(buddies); |
| 8675 | 183 | } |
| 184 | ||
| 185 | } else { | |
| 186 | ||
| 15884 | 187 | purple_debug(PURPLE_DEBUG_INFO, "novell", |
| 8675 | 188 | "_get_status_resp_cb(): rc = 0x%X\n", ret_code); |
| 189 | ||
| 190 | } | |
| 191 | } | |
| 192 | ||
| 193 | /* Show an error if the rename failed */ | |
| 194 | static void | |
| 195 | _rename_contact_resp_cb(NMUser * user, NMERR_T ret_code, | |
| 196 | gpointer resp_data, gpointer user_data) | |
| 197 | { | |
| 198 | if (ret_code != NM_OK) { | |
| 15884 | 199 | purple_debug(PURPLE_DEBUG_INFO, "novell", |
| 8675 | 200 | "_rename_contact_resp_cb(): rc = 0x%X\n", ret_code); |
| 201 | } | |
| 202 | } | |
| 203 | ||
| 204 | /* Handle the getdetails response and send the message */ | |
| 205 | static void | |
| 206 | _get_details_resp_send_msg(NMUser * user, NMERR_T ret_code, | |
| 207 | gpointer resp_data, gpointer user_data) | |
| 208 | { | |
| 15884 | 209 | PurpleConversation *gconv; |
| 210 | PurpleConnection *gc; | |
| 8675 | 211 | NMUserRecord *user_record = NULL; |
| 212 | NMContact *cntct = NULL; | |
| 213 | NMConference *conf; | |
| 214 | NMMessage *msg = user_data; | |
| 215 | const char *dn = NULL; | |
| 216 | const char *name; | |
| 217 | ||
| 218 | if (user == NULL || msg == NULL) | |
| 219 | return; | |
| 220 | ||
| 221 | if (ret_code == NM_OK) { | |
| 222 | user_record = (NMUserRecord *) resp_data; | |
| 223 | if (user_record) { | |
| 224 | ||
| 225 | /* Set the title for the conversation */ | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
226 | /* XXX - Should this be find_im_with_account? */ |
|
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
227 | gconv = purple_conversations_find_with_account(nm_user_record_get_display_id(user_record), |
| 15884 | 228 | (PurpleAccount *) user->client_data); |
| 8675 | 229 | if (gconv) { |
| 230 | ||
| 231 | dn = nm_user_record_get_dn(user_record); | |
| 232 | if (dn) { | |
| 233 | cntct = nm_find_contact(user, dn); | |
| 234 | } | |
| 235 | ||
| 236 | if (cntct) { | |
| 15884 | 237 | purple_conversation_set_title(gconv, |
| 8675 | 238 | nm_contact_get_display_name(cntct)); |
| 239 | } else { | |
| 240 | ||
| 241 | /* Not in the contact list, try to user full name */ | |
| 242 | name = (char *) nm_user_record_get_full_name(user_record); | |
| 243 | if (name) | |
| 15884 | 244 | purple_conversation_set_title(gconv, name); |
| 8675 | 245 | } |
| 246 | } | |
| 247 | ||
| 248 | /* Add the user record to particpant list */ | |
| 249 | conf = nm_message_get_conference(msg); | |
| 250 | if (conf) { | |
| 251 | nm_conference_add_participant(conf, user_record); | |
| 252 | _send_message(user, msg); | |
| 253 | } | |
| 254 | } | |
| 255 | ||
| 256 | } else { | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
257 | |
| 15884 | 258 | gc = purple_account_get_connection(user->client_data); |
| 8675 | 259 | if (gc != NULL) { |
| 260 | char *err = g_strdup_printf(_("Unable to send message." | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
261 | " Could not get details for user (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
262 | nm_error_to_string (ret_code)); |
| 8675 | 263 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
264 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
265 | purple_request_cpar_from_connection(gc)); |
| 8675 | 266 | g_free(err); |
| 267 | } | |
| 268 | ||
|
39913
ce96d4639dc7
Remove redundant conditions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39894
diff
changeset
|
269 | nm_release_message(msg); |
| 8675 | 270 | } |
| 271 | } | |
| 272 | ||
| 15884 | 273 | /* Set up the new PurpleBuddy based on the response from getdetails */ |
| 8675 | 274 | static void |
| 275 | _get_details_resp_setup_buddy(NMUser * user, NMERR_T ret_code, | |
| 276 | gpointer resp_data, gpointer user_data) | |
| 277 | { | |
| 278 | NMUserRecord *user_record; | |
| 279 | NMContact *contact; | |
| 15884 | 280 | PurpleBuddy *buddy; |
| 8675 | 281 | const char *alias; |
| 282 | NMERR_T rc = NM_OK; | |
| 283 | ||
| 284 | if (user == NULL || resp_data == NULL || user_data == NULL) | |
| 285 | return; | |
| 286 | ||
| 287 | contact = user_data; | |
| 288 | ||
| 289 | if (ret_code == NM_OK) { | |
| 290 | user_record = resp_data; | |
| 291 | ||
| 292 | buddy = nm_contact_get_data(contact); | |
| 293 | ||
| 294 | nm_contact_set_user_record(contact, user_record); | |
| 295 | ||
| 296 | /* Set the display id */ | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
297 | purple_buddy_set_name(buddy, |
| 8675 | 298 | nm_user_record_get_display_id(user_record)); |
| 299 | ||
| 15884 | 300 | alias = purple_buddy_get_alias(buddy); |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
301 | if (alias == NULL || *alias == '\0' || purple_strequal(alias, purple_buddy_get_name(buddy))) { |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
302 | purple_buddy_set_local_alias(buddy, |
| 8675 | 303 | nm_user_record_get_full_name(user_record)); |
| 304 | ||
| 305 | /* Tell the server about the new display name */ | |
| 306 | rc = nm_send_rename_contact(user, contact, | |
| 307 | nm_user_record_get_full_name(user_record), | |
| 308 | NULL, NULL); | |
| 309 | _check_for_disconnect(user, rc); | |
| 310 | ||
| 311 | } | |
| 312 | ||
| 313 | ||
| 314 | /* Get initial status for the buddy */ | |
| 315 | rc = nm_send_get_status(user, resp_data, _get_status_resp_cb, NULL); | |
| 316 | _check_for_disconnect(user, rc); | |
| 317 | ||
| 318 | /* nm_release_contact(contact);*/ | |
| 319 | ||
| 320 | } | |
| 321 | ||
|
39913
ce96d4639dc7
Remove redundant conditions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39894
diff
changeset
|
322 | nm_release_contact(contact); |
| 8675 | 323 | } |
| 324 | ||
| 15884 | 325 | /* Add the new contact into the PurpleBuddy list */ |
| 8675 | 326 | static void |
| 327 | _create_contact_resp_cb(NMUser * user, NMERR_T ret_code, | |
| 328 | gpointer resp_data, gpointer user_data) | |
| 329 | { | |
| 330 | NMContact *tmp_contact = (NMContact *) user_data; | |
| 331 | NMContact *new_contact = NULL; | |
| 332 | NMFolder *folder = NULL; | |
| 15884 | 333 | PurpleGroup *group; |
| 334 | PurpleBuddy *buddy; | |
| 8675 | 335 | const char *folder_name = NULL; |
| 336 | NMERR_T rc = NM_OK; | |
| 337 | ||
| 338 | if (user == NULL) | |
| 339 | return; | |
| 340 | ||
| 341 | if (ret_code == NM_OK) { | |
| 342 | ||
| 343 | new_contact = (NMContact *) resp_data; | |
| 344 | if (new_contact == NULL || tmp_contact == NULL) | |
| 345 | return; | |
| 346 | ||
| 347 | /* Get the userid and folder name for the new contact */ | |
| 348 | folder = nm_find_folder_by_id(user, | |
| 349 | nm_contact_get_parent_id(new_contact)); | |
| 350 | if (folder) { | |
| 351 | folder_name = nm_folder_get_name(folder); | |
| 352 | } | |
| 353 | ||
|
13437
5c4c7be53d37
[gaim-migrate @ 15811]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
354 | if (folder_name == NULL || *folder_name == '\0') |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
355 | folder_name = NM_ROOT_FOLDER_NAME; |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
356 | |
| 8675 | 357 | /* Re-add the buddy now that we got the okay from the server */ |
|
39913
ce96d4639dc7
Remove redundant conditions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39894
diff
changeset
|
358 | group = purple_blist_find_group(folder_name); |
|
ce96d4639dc7
Remove redundant conditions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39894
diff
changeset
|
359 | if (group) { |
| 8675 | 360 | const char *alias = nm_contact_get_display_name(tmp_contact); |
| 361 | const char *display_id = nm_contact_get_display_id(new_contact); | |
| 362 | ||
| 363 | if (display_id == NULL) | |
| 364 | display_id = nm_contact_get_dn(new_contact); | |
| 365 | ||
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
366 | if (alias && !purple_strequal(alias, display_id)) { |
| 8675 | 367 | |
| 368 | /* The user requested an alias, tell the server about it. */ | |
| 369 | rc = nm_send_rename_contact(user, new_contact, alias, | |
| 370 | _rename_contact_resp_cb, NULL); | |
| 371 | _check_for_disconnect(user, rc); | |
| 372 | ||
| 373 | } else { | |
| 374 | ||
| 375 | alias = ""; | |
| 376 | ||
| 377 | } | |
| 378 | ||
| 15884 | 379 | /* Add it to the purple buddy list if it is not there */ |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
380 | buddy = purple_blist_find_buddy_in_group(user->client_data, display_id, group); |
| 8675 | 381 | if (buddy == NULL) { |
| 15884 | 382 | buddy = purple_buddy_new(user->client_data, display_id, alias); |
| 383 | purple_blist_add_buddy(buddy, NULL, group, NULL); | |
| 8675 | 384 | } |
| 385 | ||
| 386 | /* Save the new buddy as part of the contact object */ | |
| 387 | nm_contact_set_data(new_contact, (gpointer) buddy); | |
| 388 | ||
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
389 | /* We need details for the user before we can setup the |
| 15884 | 390 | * new Purple buddy. We always call this because the |
| 8675 | 391 | * 'createcontact' response fields do not always contain |
| 392 | * everything that we need. | |
| 393 | */ | |
| 394 | nm_contact_add_ref(new_contact); | |
| 395 | ||
| 396 | rc = nm_send_get_details(user, nm_contact_get_dn(new_contact), | |
| 397 | _get_details_resp_setup_buddy, new_contact); | |
| 398 | _check_for_disconnect(user, rc); | |
| 399 | } | |
| 400 | ||
| 401 | } else { | |
| 15884 | 402 | PurpleConnection *gc = purple_account_get_connection(user->client_data); |
| 8675 | 403 | const char *name = nm_contact_get_dn(tmp_contact); |
| 404 | char *err; | |
| 405 | ||
| 406 | err = | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
407 | g_strdup_printf(_("Unable to add %s to your buddy list (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
408 | name, nm_error_to_string (ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
409 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
410 | purple_request_cpar_from_connection(gc)); |
| 8675 | 411 | g_free(err); |
| 412 | ||
| 413 | } | |
| 414 | ||
| 415 | if (tmp_contact) | |
| 416 | nm_release_contact(tmp_contact); | |
| 417 | } | |
| 418 | ||
| 419 | /* Show an error if we failed to send the message */ | |
| 420 | static void | |
| 421 | _send_message_resp_cb(NMUser * user, NMERR_T ret_code, | |
| 422 | gpointer resp_data, gpointer user_data) | |
| 423 | { | |
| 15884 | 424 | PurpleConnection *gc; |
| 8675 | 425 | char *err = NULL; |
| 426 | ||
| 427 | if (user == NULL) | |
| 428 | return; | |
| 429 | ||
| 430 | if (ret_code != NM_OK) { | |
| 15884 | 431 | gc = purple_account_get_connection(user->client_data); |
| 8675 | 432 | |
| 433 | /* TODO: Improve this! message to who or for what conference? */ | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
434 | err = g_strdup_printf(_("Unable to send message (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
435 | nm_error_to_string (ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
436 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
437 | purple_request_cpar_from_connection(gc)); |
| 8675 | 438 | g_free(err); |
| 439 | } | |
| 440 | } | |
| 441 | ||
| 442 | /* Show an error if the remove failed */ | |
| 443 | static void | |
| 444 | _remove_contact_resp_cb(NMUser * user, NMERR_T ret_code, | |
| 445 | gpointer resp_data, gpointer user_data) | |
| 446 | { | |
| 447 | if (ret_code != NM_OK) { | |
| 448 | /* TODO: Display an error? */ | |
| 449 | ||
| 15884 | 450 | purple_debug(PURPLE_DEBUG_INFO, "novell", |
| 8675 | 451 | "_remove_contact_resp_cb(): rc = 0x%x\n", ret_code); |
| 452 | } | |
| 453 | } | |
| 454 | ||
| 455 | /* Show an error if the remove failed */ | |
| 456 | static void | |
| 457 | _remove_folder_resp_cb(NMUser * user, NMERR_T ret_code, | |
| 458 | gpointer resp_data, gpointer user_data) | |
| 459 | { | |
| 460 | if (ret_code != NM_OK) { | |
| 461 | /* TODO: Display an error? */ | |
| 462 | ||
| 15884 | 463 | purple_debug(PURPLE_DEBUG_INFO, "novell", |
| 8675 | 464 | "_remove_folder_resp_cb(): rc = 0x%x\n", ret_code); |
| 465 | } | |
| 466 | } | |
| 467 | ||
| 468 | /* Show an error if the move failed */ | |
| 469 | static void | |
| 470 | _move_contact_resp_cb(NMUser * user, NMERR_T ret_code, | |
| 471 | gpointer resp_data, gpointer user_data) | |
| 472 | { | |
| 473 | if (ret_code != NM_OK) { | |
| 474 | /* TODO: Display an error? */ | |
| 475 | ||
| 15884 | 476 | purple_debug(PURPLE_DEBUG_INFO, "novell", |
| 8675 | 477 | "_move_contact_resp_cb(): rc = 0x%x\n", ret_code); |
| 478 | } | |
| 479 | } | |
| 480 | ||
| 481 | /* Show an error if the rename failed */ | |
| 482 | static void | |
| 483 | _rename_folder_resp_cb(NMUser * user, NMERR_T ret_code, | |
| 484 | gpointer resp_data, gpointer user_data) | |
| 485 | { | |
| 486 | if (ret_code != NM_OK) { | |
| 487 | /* TODO: Display an error? */ | |
| 488 | ||
| 15884 | 489 | purple_debug(PURPLE_DEBUG_INFO, "novell", |
| 8675 | 490 | "_rename_folder_resp_cb(): rc = 0x%x\n", ret_code); |
| 491 | } | |
| 492 | } | |
| 493 | ||
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
494 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
495 | _sendinvite_resp_cb(NMUser *user, NMERR_T ret_code, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
496 | gpointer resp_data, gpointer user_data) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
497 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
498 | char *err; |
| 15884 | 499 | PurpleConnection *gc; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
500 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
501 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
502 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
503 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
504 | if (ret_code != NM_OK) { |
| 15884 | 505 | gc = purple_account_get_connection(user->client_data); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
506 | err = g_strdup_printf(_("Unable to invite user (%s)."), nm_error_to_string(ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
507 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
508 | purple_request_cpar_from_connection(gc)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
509 | g_free(err); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
510 | |
| 15884 | 511 | purple_debug(PURPLE_DEBUG_INFO, "novell", |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
512 | "_sendinvite_resp_cb(): rc = 0x%x\n", ret_code); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
513 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
514 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
515 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
516 | |
| 8675 | 517 | /* If the createconf was successful attempt to send the message, |
| 518 | * otherwise display an error message to the user. | |
| 519 | */ | |
| 520 | static void | |
| 521 | _createconf_resp_send_msg(NMUser * user, NMERR_T ret_code, | |
| 522 | gpointer resp_data, gpointer user_data) | |
| 523 | { | |
| 524 | NMConference *conf; | |
| 525 | NMMessage *msg = user_data; | |
| 526 | ||
| 527 | if (user == NULL || msg == NULL) | |
| 528 | return; | |
| 529 | ||
| 530 | if (ret_code == NM_OK) { | |
| 531 | _send_message(user, msg); | |
| 532 | } else { | |
| 533 | ||
| 534 | if ((conf = nm_message_get_conference(msg))) { | |
| 535 | ||
| 15884 | 536 | PurpleConnection *gc = purple_account_get_connection(user->client_data); |
| 8675 | 537 | const char *name = NULL; |
| 538 | char *err; | |
| 539 | NMUserRecord *ur; | |
| 540 | ||
| 541 | ur = nm_conference_get_participant(conf, 0); | |
| 542 | if (ur) | |
| 543 | name = nm_user_record_get_userid(ur); | |
| 544 | ||
| 545 | if (name) | |
| 546 | err = g_strdup_printf(_("Unable to send message to %s." | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
547 | " Could not create the conference (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
548 | name, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
549 | nm_error_to_string (ret_code)); |
| 8675 | 550 | else |
| 551 | err = g_strdup_printf(_("Unable to send message." | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
552 | " Could not create the conference (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
553 | nm_error_to_string (ret_code)); |
| 8675 | 554 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
555 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
556 | purple_request_cpar_from_connection(gc)); |
| 8675 | 557 | g_free(err); |
| 558 | } | |
| 559 | ||
|
39913
ce96d4639dc7
Remove redundant conditions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39894
diff
changeset
|
560 | nm_release_message(msg); |
| 8675 | 561 | } |
| 562 | } | |
| 563 | ||
| 564 | /* Move contact to newly created folder */ | |
| 565 | static void | |
| 566 | _create_folder_resp_move_contact(NMUser * user, NMERR_T ret_code, | |
| 567 | gpointer resp_data, gpointer user_data) | |
| 568 | { | |
| 569 | NMContact *contact = user_data; | |
| 570 | NMFolder *new_folder; | |
| 571 | char *folder_name = resp_data; | |
| 572 | NMERR_T rc = NM_OK; | |
| 573 | ||
| 574 | if (user == NULL || folder_name == NULL || contact == NULL) { | |
| 575 | ||
|
37425
5061721fd98f
Remove more NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
576 | g_free(folder_name); |
| 8675 | 577 | |
| 578 | return; | |
| 579 | } | |
| 580 | ||
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
581 | if (ret_code == NM_OK || ret_code == NMERR_DUPLICATE_FOLDER) { |
| 8675 | 582 | new_folder = nm_find_folder(user, folder_name); |
| 583 | if (new_folder) { | |
| 584 | ||
| 585 | /* Tell the server to move the contact to the new folder */ | |
| 586 | /* rc = nm_send_move_contact(user, contact, new_folder, | |
| 587 | _move_contact_resp_cb, NULL); */ | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
588 | |
| 8675 | 589 | rc = nm_send_create_contact(user, new_folder, contact, |
| 590 | NULL, NULL); | |
| 591 | ||
| 592 | _check_for_disconnect(user, rc); | |
| 593 | ||
| 594 | } | |
| 595 | } else { | |
| 15884 | 596 | PurpleConnection *gc = purple_account_get_connection(user->client_data); |
| 8675 | 597 | char *err = g_strdup_printf(_("Unable to move user %s" |
| 598 | " to folder %s in the server side list." | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
599 | " Error while creating folder (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
600 | nm_contact_get_dn(contact), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
601 | folder_name, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
602 | nm_error_to_string (ret_code)); |
| 8675 | 603 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
604 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
605 | purple_request_cpar_from_connection(gc)); |
| 8675 | 606 | g_free(err); |
| 607 | } | |
| 608 | ||
|
37425
5061721fd98f
Remove more NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
609 | g_free(folder_name); |
| 8675 | 610 | } |
| 611 | ||
| 612 | /* Add contact to newly create folder */ | |
| 613 | static void | |
| 614 | _create_folder_resp_add_contact(NMUser * user, NMERR_T ret_code, | |
| 615 | gpointer resp_data, gpointer user_data) | |
| 616 | { | |
| 617 | NMContact *contact = (NMContact *) user_data; | |
| 618 | NMFolder *folder; | |
| 619 | char *folder_name = (char *) resp_data; | |
| 620 | NMERR_T rc = NM_OK; | |
| 621 | ||
| 622 | if (user == NULL || folder_name == NULL || contact == NULL) { | |
| 623 | ||
| 624 | if (contact) | |
| 625 | nm_release_contact(contact); | |
| 626 | ||
|
37425
5061721fd98f
Remove more NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
627 | g_free(folder_name); |
| 8675 | 628 | |
| 629 | return; | |
| 630 | } | |
| 631 | ||
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
632 | if (ret_code == NM_OK || ret_code == NMERR_DUPLICATE_FOLDER) { |
| 8675 | 633 | folder = nm_find_folder(user, folder_name); |
| 634 | if (folder) { | |
| 635 | ||
| 636 | rc = nm_send_create_contact(user, folder, contact, | |
| 637 | _create_contact_resp_cb, contact); | |
| 638 | _check_for_disconnect(user, rc); | |
| 639 | } | |
| 640 | } else { | |
| 15884 | 641 | PurpleConnection *gc = purple_account_get_connection(user->client_data); |
| 8675 | 642 | const char *name = nm_contact_get_dn(contact); |
| 643 | char *err = | |
| 644 | g_strdup_printf(_("Unable to add %s to your buddy list." | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
645 | " Error creating folder in server side list (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
646 | name, nm_error_to_string (ret_code)); |
| 8675 | 647 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
648 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
649 | purple_request_cpar_from_connection(gc)); |
| 8675 | 650 | |
| 651 | nm_release_contact(contact); | |
| 652 | g_free(err); | |
| 653 | } | |
| 654 | ||
| 655 | g_free(folder_name); | |
| 656 | } | |
| 657 | ||
| 658 | static void | |
| 659 | _join_conf_resp_cb(NMUser * user, NMERR_T ret_code, | |
| 660 | gpointer resp_data, gpointer user_data) | |
| 661 | { | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
662 | PurpleChatConversation *chat; |
| 15884 | 663 | PurpleConnection *gc; |
| 8675 | 664 | NMUserRecord *ur; |
| 665 | NMConference *conference = user_data; | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
666 | const char *name, *conf_name; |
| 8675 | 667 | int i, count; |
| 668 | ||
| 669 | if (user == NULL || conference == NULL) | |
| 670 | return; | |
| 671 | ||
| 15884 | 672 | gc = purple_account_get_connection(user->client_data); |
| 8675 | 673 | |
| 674 | if (ret_code == NM_OK) { | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
675 | conf_name = _get_conference_name(++user->conference_count); |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
676 | chat = purple_serv_got_joined_chat(gc, user->conference_count, conf_name); |
| 8675 | 677 | if (chat) { |
| 678 | ||
| 679 | nm_conference_set_data(conference, (gpointer) chat); | |
| 680 | ||
| 681 | count = nm_conference_get_participant_count(conference); | |
| 682 | for (i = 0; i < count; i++) { | |
| 683 | ur = nm_conference_get_participant(conference, i); | |
| 684 | if (ur) { | |
| 685 | name = nm_user_record_get_display_id(ur); | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
686 | purple_chat_conversation_add_user(chat, name, NULL, |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
687 | PURPLE_CHAT_USER_NONE, TRUE); |
| 8675 | 688 | } |
| 689 | } | |
| 690 | } | |
| 691 | } | |
| 692 | } | |
| 693 | ||
| 694 | /* Show info returned by getdetails */ | |
| 695 | static void | |
| 696 | _get_details_resp_show_info(NMUser * user, NMERR_T ret_code, | |
| 697 | gpointer resp_data, gpointer user_data) | |
| 698 | { | |
| 15884 | 699 | PurpleConnection *gc; |
| 8675 | 700 | NMUserRecord *user_record; |
| 701 | char *name; | |
| 702 | char *err; | |
| 703 | ||
| 704 | if (user == NULL) | |
| 705 | return; | |
| 706 | ||
| 707 | name = user_data; | |
| 708 | ||
| 709 | if (ret_code == NM_OK) { | |
| 710 | user_record = (NMUserRecord *) resp_data; | |
| 711 | if (user_record) { | |
| 15884 | 712 | _show_info(purple_account_get_connection(user->client_data), |
|
31344
a5ccecc17f1c
Stop Groupwise from showing two windows for Get Info. Fixes #13108.
Gabriel Burt <gabriel.burt@gmail.com>
parents:
31294
diff
changeset
|
713 | user_record, g_strdup(name)); |
| 8675 | 714 | } |
| 715 | } else { | |
| 15884 | 716 | gc = purple_account_get_connection(user->client_data); |
| 8675 | 717 | err = |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
718 | g_strdup_printf(_("Could not get details for user %s (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
719 | name, nm_error_to_string (ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
720 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
721 | purple_request_cpar_from_connection(gc)); |
| 8675 | 722 | g_free(err); |
| 723 | } | |
| 724 | ||
|
37425
5061721fd98f
Remove more NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
725 | g_free(name); |
| 8675 | 726 | } |
| 727 | ||
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
728 | /* Handle get details response add to privacy list */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
729 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
730 | _get_details_resp_add_privacy_item(NMUser *user, NMERR_T ret_code, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
731 | gpointer resp_data, gpointer user_data) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
732 | { |
| 15884 | 733 | PurpleConnection *gc; |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
734 | PurpleAccount *account; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
735 | NMUserRecord *user_record = resp_data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
736 | char *err; |
| 10112 | 737 | gboolean allowed = GPOINTER_TO_INT(user_data); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
738 | const char *display_id; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
739 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
740 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
741 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
742 | |
| 15884 | 743 | gc = purple_account_get_connection(user->client_data); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
744 | display_id = nm_user_record_get_display_id(user_record); |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
745 | account = purple_connection_get_account(gc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
746 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
747 | if (ret_code == NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
748 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
749 | if (allowed) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
750 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
751 | if (!g_slist_find_custom(purple_account_privacy_get_denied(account), |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
752 | display_id, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
753 | purple_account_privacy_permit_add(account, display_id, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
754 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
755 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
756 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
757 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
758 | if (!g_slist_find_custom(purple_account_privacy_get_denied(account), |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
759 | display_id, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
760 | purple_account_privacy_deny_add(account, display_id, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
761 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
762 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
763 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
764 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
765 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
766 | err = g_strdup_printf(_("Unable to add user to privacy list (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
767 | nm_error_to_string(ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
768 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
769 | purple_request_cpar_from_connection(gc)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
770 | g_free(err); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
771 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
772 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
773 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
774 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
775 | /* Handle response to create privacy item request */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
776 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
777 | _create_privacy_item_deny_resp_cb(NMUser *user, NMERR_T ret_code, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
778 | gpointer resp_data, gpointer user_data) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
779 | { |
| 15884 | 780 | PurpleConnection *gc; |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
781 | PurpleAccount *account; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
782 | NMUserRecord *user_record; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
783 | char *who = user_data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
784 | char *err; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
785 | NMERR_T rc = NM_OK; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
786 | const char *display_id = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
787 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
788 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
789 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
790 | |
| 15884 | 791 | gc = purple_account_get_connection(user->client_data); |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
792 | account = purple_connection_get_account(gc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
793 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
794 | if (ret_code == NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
795 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
796 | user_record = nm_find_user_record(user, who); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
797 | if (user_record) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
798 | display_id = nm_user_record_get_display_id(user_record); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
799 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
800 | if (display_id) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
801 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
802 | if (!g_slist_find_custom(purple_account_privacy_get_denied(account), |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
803 | display_id, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
804 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
805 | purple_account_privacy_deny_add(account, display_id, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
806 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
807 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
808 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
809 | rc = nm_send_get_details(user, who, |
|
39914
d685c3015215
Fix suspicious type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
810 | _get_details_resp_add_privacy_item, |
|
d685c3015215
Fix suspicious type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
811 | GINT_TO_POINTER(FALSE)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
812 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
813 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
814 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
815 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
816 | err = g_strdup_printf(_("Unable to add %s to deny list (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
817 | who, nm_error_to_string(ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
818 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
819 | purple_request_cpar_from_connection(gc)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
820 | g_free(err); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
821 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
822 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
823 | |
|
37425
5061721fd98f
Remove more NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
824 | g_free(who); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
825 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
826 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
827 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
828 | /* Handle response to create privacy item request */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
829 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
830 | _create_privacy_item_permit_resp_cb(NMUser *user, NMERR_T ret_code, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
831 | gpointer resp_data, gpointer user_data) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
832 | { |
| 15884 | 833 | PurpleConnection *gc; |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
834 | PurpleAccount *account; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
835 | NMUserRecord *user_record; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
836 | char *who = user_data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
837 | char *err; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
838 | NMERR_T rc = NM_OK; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
839 | const char *display_id = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
840 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
841 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
842 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
843 | |
| 15884 | 844 | gc = purple_account_get_connection(user->client_data); |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
845 | account = purple_connection_get_account(gc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
846 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
847 | if (ret_code == NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
848 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
849 | user_record = nm_find_user_record(user, who); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
850 | if (user_record) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
851 | display_id = nm_user_record_get_display_id(user_record); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
852 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
853 | if (display_id) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
854 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
855 | if (!g_slist_find_custom(purple_account_privacy_get_permitted(account), |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
856 | display_id, |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
857 | (GCompareFunc)purple_utf8_strcasecmp)) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
858 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
859 | purple_account_privacy_permit_add(account, display_id, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
860 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
861 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
862 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
863 | rc = nm_send_get_details(user, who, |
|
39914
d685c3015215
Fix suspicious type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
864 | _get_details_resp_add_privacy_item, |
|
d685c3015215
Fix suspicious type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
865 | GINT_TO_POINTER(TRUE)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
866 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
867 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
868 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
869 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
870 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
871 | err = g_strdup_printf(_("Unable to add %s to permit list (%s)."), who, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
872 | nm_error_to_string(ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
873 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
874 | purple_request_cpar_from_connection(gc)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
875 | g_free(err); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
876 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
877 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
878 | |
|
37425
5061721fd98f
Remove more NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
879 | g_free(who); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
880 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
881 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
882 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
883 | _get_details_send_privacy_create(NMUser *user, NMERR_T ret_code, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
884 | gpointer resp_data, gpointer user_data) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
885 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
886 | NMERR_T rc = NM_OK; |
| 15884 | 887 | PurpleConnection *gc; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
888 | NMUserRecord *user_record = resp_data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
889 | char *err; |
| 10112 | 890 | gboolean allowed = GPOINTER_TO_INT(user_data); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
891 | const char *dn, *display_id; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
892 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
893 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
894 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
895 | |
| 15884 | 896 | gc = purple_account_get_connection(user->client_data); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
897 | dn = nm_user_record_get_dn(user_record); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
898 | display_id = nm_user_record_get_display_id(user_record); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
899 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
900 | if (ret_code == NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
901 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
902 | if (allowed) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
903 | rc = nm_send_create_privacy_item(user, dn, TRUE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
904 | _create_privacy_item_permit_resp_cb, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
905 | g_strdup(display_id)); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
906 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
907 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
908 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
909 | rc = nm_send_create_privacy_item(user, dn, FALSE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
910 | _create_privacy_item_deny_resp_cb, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
911 | g_strdup(display_id)); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
912 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
913 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
914 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
915 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
916 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
917 | err = g_strdup_printf(_("Unable to add user to privacy list (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
918 | nm_error_to_string(ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
919 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
920 | purple_request_cpar_from_connection(gc)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
921 | g_free(err); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
922 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
923 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
924 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
925 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
926 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
927 | _remove_privacy_item_resp_cb(NMUser *user, NMERR_T ret_code, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
928 | gpointer resp_data, gpointer user_data) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
929 | { |
| 15884 | 930 | PurpleConnection *gc; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
931 | char *who = user_data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
932 | char *err; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
933 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
934 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
935 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
936 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
937 | if (ret_code != NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
938 | |
| 15884 | 939 | gc = purple_account_get_connection(user->client_data); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
940 | err = g_strdup_printf(_("Unable to remove %s from privacy list (%s)."), who, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
941 | nm_error_to_string(ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
942 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
943 | purple_request_cpar_from_connection(gc)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
944 | g_free(err); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
945 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
946 | |
|
37425
5061721fd98f
Remove more NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
947 | g_free(who); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
948 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
949 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
950 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
951 | _set_privacy_default_resp_cb(NMUser *user, NMERR_T ret_code, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
952 | gpointer resp_data, gpointer user_data) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
953 | { |
| 15884 | 954 | PurpleConnection *gc; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
955 | char *err; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
956 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
957 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
958 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
959 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
960 | if (ret_code != NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
961 | |
| 15884 | 962 | gc = purple_account_get_connection(user->client_data); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
963 | err = g_strdup_printf(_("Unable to change server side privacy settings (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
964 | nm_error_to_string(ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
965 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
966 | purple_request_cpar_from_connection(gc)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
967 | g_free(err); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
968 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
969 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
970 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
971 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
972 | /* Handle get details response add to privacy list */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
973 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
974 | _get_details_resp_send_invite(NMUser *user, NMERR_T ret_code, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
975 | gpointer resp_data, gpointer user_data) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
976 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
977 | NMERR_T rc = NM_OK; |
| 15884 | 978 | PurpleConnection *gc; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
979 | NMUserRecord *user_record = resp_data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
980 | char *err; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
981 | GSList *cnode; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
982 | NMConference *conference; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
983 | gpointer chat; |
|
39998
15488497cd1a
Fix several type conversion warnings on Windows.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39914
diff
changeset
|
984 | int id = GPOINTER_TO_INT(user_data); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
985 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
986 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
987 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
988 | |
| 15884 | 989 | gc = purple_account_get_connection(user->client_data); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
990 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
991 | if (ret_code == NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
992 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
993 | for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
994 | conference = cnode->data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
995 | if (conference && (chat = nm_conference_get_data(conference))) { |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
996 | if (purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat)) == id) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
997 | rc = nm_send_conference_invite(user, conference, user_record, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
998 | NULL, _sendinvite_resp_cb, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
999 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1000 | break; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1001 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1002 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1003 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1004 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1005 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1006 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1007 | err = g_strdup_printf(_("Unable to invite user (%s)."), nm_error_to_string(ret_code)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
1008 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
1009 | purple_request_cpar_from_connection(gc)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1010 | g_free(err); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1011 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1012 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1013 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1014 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1015 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1016 | _createconf_resp_send_invite(NMUser * user, NMERR_T ret_code, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1017 | gpointer resp_data, gpointer user_data) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1018 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1019 | NMERR_T rc = NM_OK; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1020 | NMConference *conference = resp_data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1021 | NMUserRecord *user_record = user_data; |
| 15884 | 1022 | PurpleConnection *gc; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1023 | char *err; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1024 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1025 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1026 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1027 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1028 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1029 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1030 | if (ret_code == NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1031 | rc = nm_send_conference_invite(user, conference, user_record, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1032 | NULL, _sendinvite_resp_cb, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1033 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1034 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1035 | err = g_strdup_printf(_("Unable to create conference (%s)."), nm_error_to_string(ret_code)); |
| 15884 | 1036 | gc = purple_account_get_connection(user->client_data); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
1037 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
1038 | purple_request_cpar_from_connection(gc)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1039 | g_free(err); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1040 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1041 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1042 | |
| 8675 | 1043 | /******************************************************************************* |
| 1044 | * Helper functions | |
| 1045 | ******************************************************************************/ | |
| 1046 | ||
| 1047 | static char * | |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
21630
diff
changeset
|
1048 | _user_agent_string(void) |
| 8675 | 1049 | { |
| 1050 | ||
| 1051 | #if !defined(_WIN32) | |
| 1052 | ||
| 1053 | const char *sysname = ""; | |
| 1054 | const char *release = ""; | |
| 1055 | struct utsname u; | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1056 | |
| 8675 | 1057 | if (uname(&u) == 0) { |
| 1058 | sysname = u.sysname; | |
| 1059 | release = u.release; | |
| 1060 | } else { | |
| 1061 | sysname = "Linux"; | |
| 1062 | release = "Unknown"; | |
| 1063 | } | |
| 1064 | ||
| 15884 | 1065 | return g_strdup_printf("Purple/%s (%s; %s)", VERSION, sysname, release); |
| 8675 | 1066 | |
| 1067 | #else | |
| 1068 | ||
| 1069 | const char *sysname = ""; | |
| 1070 | OSVERSIONINFO os_info; | |
| 1071 | SYSTEM_INFO sys_info; | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1072 | |
| 8675 | 1073 | os_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
| 1074 | GetVersionEx(&os_info); | |
| 1075 | GetSystemInfo(&sys_info); | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1076 | |
| 8675 | 1077 | if (os_info.dwPlatformId == VER_PLATFORM_WIN32_NT) { |
| 1078 | switch (os_info.dwMajorVersion) { | |
| 1079 | case 3: | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1080 | case 4: |
| 8675 | 1081 | sysname = "Windows NT"; |
| 1082 | break; | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1083 | case 5: |
| 8675 | 1084 | switch (os_info.dwMinorVersion) { |
| 1085 | case 0: | |
| 1086 | sysname = "Windows 2000"; | |
| 1087 | break; | |
| 1088 | case 1: | |
| 1089 | sysname = "Windows XP"; | |
| 1090 | break; | |
| 1091 | case 2: | |
| 1092 | sysname = "Windows Server 2003"; | |
| 1093 | break; | |
| 1094 | default: | |
| 1095 | sysname = "Windows"; | |
| 1096 | break; | |
| 1097 | } | |
| 1098 | break; | |
| 1099 | default: | |
| 1100 | sysname = "Windows"; | |
| 1101 | break; | |
| 1102 | } | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1103 | |
| 8675 | 1104 | } else if (os_info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { |
| 1105 | switch (os_info.dwMinorVersion) { | |
| 1106 | case 0: | |
| 1107 | sysname = "Windows 95"; | |
| 1108 | break; | |
| 1109 | case 10: | |
| 1110 | sysname = "Windows 98"; | |
| 1111 | break; | |
| 1112 | case 90: | |
| 1113 | sysname = "Windows ME"; | |
| 1114 | break; | |
| 1115 | default: | |
| 1116 | sysname = "Windows"; | |
| 1117 | break; | |
| 1118 | } | |
| 1119 | } else { | |
| 1120 | sysname = "Windows"; | |
| 1121 | } | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1122 | |
| 15884 | 1123 | return g_strdup_printf("Purple/%s (%s; %ld.%ld)", VERSION, sysname, |
| 8675 | 1124 | os_info.dwMajorVersion, os_info.dwMinorVersion); |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1125 | |
| 8675 | 1126 | #endif |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1127 | |
|
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1128 | |
| 8675 | 1129 | } |
| 1130 | ||
| 1131 | static gboolean | |
| 1132 | _is_disconnect_error(NMERR_T err) | |
| 1133 | { | |
| 1134 | return (err == NMERR_TCP_WRITE || | |
| 1135 | err == NMERR_TCP_READ || err == NMERR_PROTOCOL); | |
| 1136 | } | |
| 1137 | ||
| 1138 | static gboolean | |
| 1139 | _check_for_disconnect(NMUser * user, NMERR_T err) | |
| 1140 | { | |
| 15884 | 1141 | PurpleConnection *gc = purple_account_get_connection(user->client_data); |
| 8675 | 1142 | |
| 1143 | if (_is_disconnect_error(err)) { | |
| 1144 | ||
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31595
diff
changeset
|
1145 | purple_connection_error(gc, |
| 21279 | 1146 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20451
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
1147 | _("Error communicating with server. Closing connection.")); |
| 8675 | 1148 | return TRUE; |
| 1149 | ||
| 1150 | } | |
| 1151 | ||
| 1152 | return FALSE; | |
| 1153 | } | |
| 1154 | ||
| 1155 | /* Check to see if the conference is instantiated, if so send the message. | |
| 1156 | * If not send the create conference -- the response handler for the createconf | |
| 1157 | * will call this function again. | |
| 1158 | */ | |
| 1159 | static void | |
| 1160 | _send_message(NMUser * user, NMMessage * message) | |
| 1161 | { | |
| 1162 | NMConference *conf; | |
| 1163 | NMERR_T rc = NM_OK; | |
| 1164 | ||
| 1165 | conf = nm_message_get_conference(message); | |
| 1166 | if (conf) { | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1167 | /* We have a conference make sure that the |
| 8675 | 1168 | server knows about it already. */ |
| 1169 | if (nm_conference_is_instantiated(conf)) { | |
| 1170 | ||
| 1171 | /* We have everything that we need...finally! */ | |
| 1172 | rc = nm_send_message(user, message, _send_message_resp_cb); | |
| 1173 | _check_for_disconnect(user, rc); | |
| 1174 | ||
| 1175 | nm_release_message(message); | |
| 1176 | ||
| 1177 | } else { | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1178 | rc = nm_send_create_conference(user, conf, _createconf_resp_send_msg, message); |
| 8675 | 1179 | _check_for_disconnect(user, rc); |
| 1180 | } | |
| 1181 | } | |
| 1182 | } | |
| 1183 | ||
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
1184 | /* |
| 15884 | 1185 | * Update the status of the given buddy in the Purple buddy list |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
1186 | */ |
| 8675 | 1187 | static void |
| 15884 | 1188 | _update_buddy_status(NMUser *user, PurpleBuddy * buddy, int novellstatus, int gmt) |
| 8675 | 1189 | { |
| 15884 | 1190 | PurpleAccount *account; |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
1191 | const char *status_id; |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1192 | const char *text = NULL; |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1193 | const char *dn; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1194 | const char *name; |
| 8675 | 1195 | int idle = 0; |
| 1196 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1197 | account = purple_buddy_get_account(buddy); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1198 | name = purple_buddy_get_name(buddy); |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
1199 | |
|
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
1200 | switch (novellstatus) { |
| 8675 | 1201 | case NM_STATUS_AVAILABLE: |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1202 | status_id = NOVELL_STATUS_TYPE_AVAILABLE; |
| 8675 | 1203 | break; |
| 1204 | case NM_STATUS_AWAY: | |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1205 | status_id = NOVELL_STATUS_TYPE_AWAY; |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
1206 | break; |
| 8675 | 1207 | case NM_STATUS_BUSY: |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1208 | status_id = NOVELL_STATUS_TYPE_BUSY; |
| 8675 | 1209 | break; |
| 1210 | case NM_STATUS_OFFLINE: | |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1211 | status_id = NOVELL_STATUS_TYPE_OFFLINE; |
| 8675 | 1212 | break; |
| 1213 | case NM_STATUS_AWAY_IDLE: | |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1214 | status_id = NOVELL_STATUS_TYPE_AWAY; |
| 8675 | 1215 | idle = gmt; |
| 1216 | break; | |
| 1217 | default: | |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1218 | status_id = NOVELL_STATUS_TYPE_OFFLINE; |
| 8675 | 1219 | break; |
| 1220 | } | |
| 1221 | ||
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1222 | /* Get status text for the user */ |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1223 | dn = nm_lookup_dn(user, name); |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1224 | if (dn) { |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1225 | NMUserRecord *user_record = nm_find_user_record(user, dn); |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1226 | if (user_record) { |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1227 | text = nm_user_record_get_status_text(user_record); |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1228 | } |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1229 | } |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1230 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1231 | purple_protocol_got_user_status(account, name, status_id, |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1232 | "message", text, NULL); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1233 | purple_protocol_got_user_idle(account, name, |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
1234 | (novellstatus == NM_STATUS_AWAY_IDLE), idle); |
| 8675 | 1235 | } |
| 1236 | ||
| 15884 | 1237 | /* Iterate through the cached Purple buddy list and remove buddies |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1238 | * that are not in the server side list. |
| 8675 | 1239 | */ |
| 1240 | static void | |
| 15884 | 1241 | _remove_purple_buddies(NMUser *user) |
| 8675 | 1242 | { |
| 15884 | 1243 | PurpleBlistNode *gnode; |
| 1244 | PurpleBlistNode *cnode; | |
| 1245 | PurpleBlistNode *bnode; | |
| 1246 | PurpleGroup *group; | |
| 1247 | PurpleBuddy *buddy; | |
| 8675 | 1248 | GSList *rem_list = NULL; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1249 | NMFolder *folder = NULL; |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1250 | const char *gname = NULL; |
| 8675 | 1251 | |
|
39665
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39483
diff
changeset
|
1252 | for (gnode = purple_blist_get_default_root(); gnode; |
|
2172e3b8eeef
Rename some buddy list accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39483
diff
changeset
|
1253 | gnode = purple_blist_node_get_sibling_next(gnode)) { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1254 | if (!PURPLE_IS_GROUP(gnode)) |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1255 | continue; |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1256 | group = (PurpleGroup *) gnode; |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1257 | gname = purple_group_get_name(group); |
|
24945
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24398
diff
changeset
|
1258 | for (cnode = purple_blist_node_get_first_child(gnode); |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24398
diff
changeset
|
1259 | cnode; |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24398
diff
changeset
|
1260 | cnode = purple_blist_node_get_sibling_next(cnode)) { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1261 | if (!PURPLE_IS_CONTACT(cnode)) |
| 8675 | 1262 | continue; |
|
24945
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24398
diff
changeset
|
1263 | for (bnode = purple_blist_node_get_first_child(cnode); |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24398
diff
changeset
|
1264 | bnode; |
|
6678a8c83797
Some more struct hiding.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24398
diff
changeset
|
1265 | bnode = purple_blist_node_get_sibling_next(bnode)) { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1266 | if (!PURPLE_IS_BUDDY(bnode)) |
| 8675 | 1267 | continue; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1268 | buddy = (PurpleBuddy *) bnode; |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1269 | if (purple_buddy_get_account(buddy) == user->client_data) { |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1270 | if (purple_strequal(gname, NM_ROOT_FOLDER_NAME)) |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1271 | gname = ""; |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1272 | folder = nm_find_folder(user, gname); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1273 | if (folder == NULL || |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1274 | !nm_folder_find_contact_by_display_id(folder, purple_buddy_get_name(buddy))) { |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1275 | rem_list = g_slist_append(rem_list, buddy); |
| 8675 | 1276 | } |
| 1277 | } | |
| 1278 | } | |
| 1279 | } | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1280 | } |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1281 | |
|
40052
cc03b5af25ea
Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
40001
diff
changeset
|
1282 | g_slist_free_full(rem_list, (GDestroyNotify)purple_blist_remove_buddy); |
| 8675 | 1283 | } |
| 1284 | ||
| 15884 | 1285 | /* Add all of the contacts in the given folder to the Purple buddy list */ |
| 8675 | 1286 | static void |
| 15884 | 1287 | _add_contacts_to_purple_blist(NMUser * user, NMFolder * folder) |
| 8675 | 1288 | { |
| 1289 | NMUserRecord *user_record = NULL; | |
| 1290 | NMContact *contact = NULL; | |
| 15884 | 1291 | PurpleBuddy *buddy = NULL; |
| 1292 | PurpleGroup *group; | |
| 8675 | 1293 | NMERR_T cnt = 0, i; |
| 1294 | const char *name = NULL; | |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1295 | const char *fname = NULL; |
| 8675 | 1296 | int status = 0; |
| 1297 | ||
| 15884 | 1298 | /* If this is the root folder give it a name. Purple does not have the concept of |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1299 | * a root folder. |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1300 | */ |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1301 | fname = nm_folder_get_name(folder); |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1302 | if (fname == NULL || *fname == '\0') { |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1303 | fname = NM_ROOT_FOLDER_NAME; |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1304 | } |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1305 | |
| 15884 | 1306 | /* Does the Purple group exist already? */ |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
1307 | group = purple_blist_find_group(fname); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1308 | if (group == NULL) { |
| 15884 | 1309 | group = purple_group_new(fname); |
| 1310 | purple_blist_add_group(group, NULL); | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1311 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1312 | |
| 8675 | 1313 | /* Get each contact for this folder */ |
| 1314 | cnt = nm_folder_get_contact_count(folder); | |
| 1315 | for (i = 0; i < cnt; i++) { | |
| 1316 | contact = nm_folder_get_contact(folder, i); | |
| 1317 | if (contact) { | |
| 1318 | ||
| 1319 | name = nm_contact_get_display_id(contact); | |
| 1320 | if (name) { | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1321 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
1322 | buddy = purple_blist_find_buddy_in_group(user->client_data, name, group); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1323 | if (buddy == NULL) { |
| 15884 | 1324 | /* Add it to the purple buddy list */ |
| 1325 | buddy = purple_buddy_new(user->client_data, | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1326 | name, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1327 | nm_contact_get_display_name(contact)); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1328 | |
| 15884 | 1329 | purple_blist_add_buddy(buddy, NULL, group, NULL); |
| 8675 | 1330 | } |
| 1331 | ||
| 1332 | /* Set the initial status for the buddy */ | |
| 1333 | user_record = nm_contact_get_user_record(contact); | |
| 1334 | if (user_record) { | |
| 1335 | status = nm_user_record_get_status(user_record); | |
| 1336 | } | |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1337 | _update_buddy_status(user, buddy, status, time(0)); |
| 8675 | 1338 | |
| 1339 | /* Save the new buddy as part of the contact object */ | |
| 1340 | nm_contact_set_data(contact, (gpointer) buddy); | |
| 1341 | } | |
| 1342 | ||
| 1343 | } else { | |
| 1344 | /* NULL contact. This should not happen, but | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1345 | * let's break out of the loop. |
| 8675 | 1346 | */ |
| 1347 | break; | |
| 1348 | } | |
| 1349 | } | |
| 1350 | } | |
| 1351 | ||
| 15884 | 1352 | /* Add all of the server side contacts to the Purple buddy list. */ |
| 8675 | 1353 | static void |
| 15884 | 1354 | _add_purple_buddies(NMUser * user) |
| 8675 | 1355 | { |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1356 | int cnt = 0, i; |
| 8675 | 1357 | NMFolder *root_folder = NULL; |
| 1358 | NMFolder *folder = NULL; | |
| 1359 | ||
| 1360 | root_folder = nm_get_root_folder(user); | |
| 1361 | if (root_folder) { | |
| 1362 | ||
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1363 | /* Add sub-folders and contacts to sub-folders... |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1364 | * iterate throught the sub-folders in reverse order |
| 15884 | 1365 | * because Purple adds the folders to the front -- so we |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1366 | * want to add the first folder last |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1367 | */ |
| 8675 | 1368 | cnt = nm_folder_get_subfolder_count(root_folder); |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
1369 | for (i = cnt-1; i >= 0; i--) { |
| 8675 | 1370 | folder = nm_folder_get_subfolder(root_folder, i); |
| 1371 | if (folder) { | |
| 15884 | 1372 | _add_contacts_to_purple_blist(user, folder); |
| 8675 | 1373 | } |
| 1374 | } | |
| 1375 | ||
| 1376 | /* Add contacts for the root folder */ | |
| 15884 | 1377 | _add_contacts_to_purple_blist(user, root_folder); |
| 8675 | 1378 | } |
| 1379 | } | |
| 1380 | ||
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1381 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1382 | _sync_contact_list(NMUser *user) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1383 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1384 | /* Remove all buddies from the local list that are |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1385 | * not in the server side list and add all buddies |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1386 | * from the server side list that are not in |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1387 | * the local list |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1388 | */ |
| 15884 | 1389 | _remove_purple_buddies(user); |
| 1390 | _add_purple_buddies(user); | |
|
9360
c40bc951573a
[gaim-migrate @ 10168]
Mike Stoddard <mistoddard@novell.com>
parents:
9308
diff
changeset
|
1391 | user->clist_synched = TRUE; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1392 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1393 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1394 | static void |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1395 | _sync_privacy_lists(NMUser *user) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1396 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1397 | GSList *node = NULL, *rem_list = NULL; |
| 15884 | 1398 | PurpleConnection *gc; |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1399 | PurpleAccount *account; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1400 | const char *name, *dn; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1401 | NMUserRecord *user_record; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1402 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1403 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1404 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1405 | |
| 15884 | 1406 | gc = purple_account_get_connection(user->client_data); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1407 | if (gc == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1408 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1409 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1410 | account = purple_connection_get_account(gc); |
|
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1411 | |
| 15884 | 1412 | /* Set the Purple privacy setting */ |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1413 | if (user->default_deny) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1414 | if (user->allow_list == NULL) { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1415 | purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_ALL); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1416 | } else { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1417 | purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1418 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1419 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1420 | if (user->deny_list == NULL) { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1421 | purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1422 | } else { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1423 | purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_USERS); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1424 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1425 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1426 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1427 | /* Add stuff */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1428 | for (node = user->allow_list; node; node = node->next) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1429 | user_record = nm_find_user_record(user, (char *)node->data); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1430 | if (user_record) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1431 | name = nm_user_record_get_display_id(user_record); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1432 | else |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1433 | name =(char *)node->data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1434 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1435 | if (!g_slist_find_custom(purple_account_privacy_get_permitted(account), |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
1436 | name, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1437 | purple_account_privacy_permit_add(account, name , TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1438 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1439 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1440 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1441 | for (node = user->deny_list; node; node = node->next) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1442 | user_record = nm_find_user_record(user, (char *)node->data); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1443 | if (user_record) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1444 | name = nm_user_record_get_display_id(user_record); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1445 | else |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1446 | name =(char *)node->data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1447 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1448 | if (!g_slist_find_custom(purple_account_privacy_get_denied(account), |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
1449 | name, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1450 | purple_account_privacy_deny_add(account, name, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1451 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1452 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1453 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1454 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1455 | /* Remove stuff */ |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1456 | for (node = purple_account_privacy_get_permitted(account); node; node = node->next) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1457 | dn = nm_lookup_dn(user, (char *)node->data); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1458 | if (dn != NULL && |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1459 | !g_slist_find_custom(user->allow_list, |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
1460 | dn, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1461 | rem_list = g_slist_append(rem_list, node->data); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1462 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1463 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1464 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1465 | if (rem_list) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1466 | for (node = rem_list; node; node = node->next) { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1467 | purple_account_privacy_permit_remove(account, (char *)node->data, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1468 | } |
|
29952
899e277a5a7e
Properly use g_slist_free instead of g_free in this instance. Fixes #11605.
Jürgen Orschiedt <jorschiedt@web.de>
parents:
29757
diff
changeset
|
1469 | g_slist_free(rem_list); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1470 | rem_list = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1471 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1472 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1473 | for (node = purple_account_privacy_get_denied(account); node; node = node->next) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1474 | dn = nm_lookup_dn(user, (char *)node->data); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1475 | if (dn != NULL && |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1476 | !g_slist_find_custom(user->deny_list, |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
1477 | dn, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1478 | rem_list = g_slist_append(rem_list, node->data); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1479 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1480 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1481 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1482 | if (rem_list) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1483 | for (node = rem_list; node; node = node->next) { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
1484 | purple_account_privacy_deny_remove(account, (char *)node->data, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1485 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1486 | g_slist_free(rem_list); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1487 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1488 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1489 | |
|
9820
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1490 | /* Map known property tags to user-friendly strings */ |
|
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1491 | static const char * |
|
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1492 | _map_property_tag(const char *tag) |
|
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1493 | { |
|
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1494 | if (tag == NULL) return NULL; |
|
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1495 | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1496 | if (purple_strequal(tag, "telephoneNumber")) |
|
9820
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1497 | return _("Telephone Number"); |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1498 | else if (purple_strequal(tag, "L")) |
|
9820
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1499 | return _("Location"); |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1500 | else if (purple_strequal(tag, "OU")) |
|
9820
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1501 | return _("Department"); |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1502 | else if (purple_strequal(tag, "personalTitle")) |
|
9820
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1503 | return _("Personal Title"); |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1504 | else if (purple_strequal(tag, "Title")) |
|
29965
d4d794093d2d
Eliminate the name collisions on "Title". I have a few qualms:
Paul Aurich <darkrain42@pidgin.im>
parents:
29952
diff
changeset
|
1505 | return _("Job Title"); |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1506 | else if (purple_strequal(tag, "mailstop")) |
|
9820
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1507 | return _("Mailstop"); |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1508 | else if (purple_strequal(tag, "Internet EMail Address")) |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23295
diff
changeset
|
1509 | return _("Email Address"); |
|
9820
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1510 | else |
|
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1511 | return tag; |
|
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1512 | } |
|
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1513 | |
| 8675 | 1514 | /* Display a dialog box showing the properties for the given user record */ |
| 1515 | static void | |
|
31344
a5ccecc17f1c
Stop Groupwise from showing two windows for Get Info. Fixes #13108.
Gabriel Burt <gabriel.burt@gmail.com>
parents:
31294
diff
changeset
|
1516 | _show_info(PurpleConnection * gc, NMUserRecord * user_record, char * name) |
| 8675 | 1517 | { |
| 15884 | 1518 | PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); |
| 8675 | 1519 | int count, i; |
| 1520 | NMProperty *property; | |
| 1521 | const char *tag, *value; | |
| 1522 | ||
|
9820
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1523 | tag = _("User ID"); |
| 8675 | 1524 | value = nm_user_record_get_userid(user_record); |
| 1525 | if (value) { | |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1526 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1527 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1528 | purple_notify_user_info_add_pair_html(user_info, tag, value); |
| 8675 | 1529 | } |
| 1530 | ||
| 1531 | tag = _("Full name"); | |
| 1532 | value = nm_user_record_get_full_name(user_record); | |
| 1533 | if (value) { | |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1534 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1535 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1536 | purple_notify_user_info_add_pair_html(user_info, tag, value); |
| 8675 | 1537 | } |
| 1538 | ||
| 1539 | count = nm_user_record_get_property_count(user_record); | |
| 1540 | for (i = 0; i < count; i++) { | |
| 1541 | property = nm_user_record_get_property(user_record, i); | |
| 1542 | if (property) { | |
|
9820
45b8904a0a83
[gaim-migrate @ 10691]
Mike Stoddard <mistoddard@novell.com>
parents:
9797
diff
changeset
|
1543 | tag = _map_property_tag(nm_property_get_tag(property)); |
| 8675 | 1544 | value = nm_property_get_value(property); |
| 1545 | if (tag && value) { | |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1546 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1547 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1548 | purple_notify_user_info_add_pair_html(user_info, tag, value); |
| 8675 | 1549 | } |
| 1550 | nm_release_property(property); | |
| 1551 | } | |
| 1552 | } | |
| 1553 | ||
|
31344
a5ccecc17f1c
Stop Groupwise from showing two windows for Get Info. Fixes #13108.
Gabriel Burt <gabriel.burt@gmail.com>
parents:
31294
diff
changeset
|
1554 | purple_notify_userinfo(gc, name, user_info, NULL, NULL); |
| 15884 | 1555 | purple_notify_user_info_destroy(user_info); |
|
31344
a5ccecc17f1c
Stop Groupwise from showing two windows for Get Info. Fixes #13108.
Gabriel Burt <gabriel.burt@gmail.com>
parents:
31294
diff
changeset
|
1556 | |
|
a5ccecc17f1c
Stop Groupwise from showing two windows for Get Info. Fixes #13108.
Gabriel Burt <gabriel.burt@gmail.com>
parents:
31294
diff
changeset
|
1557 | g_free(name); |
| 8675 | 1558 | } |
| 1559 | ||
| 1560 | /* Send a join conference, the first item in the parms list is the | |
| 1561 | * NMUser object and the second item is the conference to join. | |
| 15884 | 1562 | * This callback is passed to purple_request_action when we ask the |
| 8675 | 1563 | * user if they want to join the conference. |
| 1564 | */ | |
| 1565 | static void | |
| 1566 | _join_conference_cb(GSList * parms) | |
| 1567 | { | |
| 1568 | NMUser *user; | |
| 1569 | NMConference *conference; | |
| 1570 | NMERR_T rc = NM_OK; | |
| 1571 | ||
| 1572 | if (parms == NULL || g_slist_length(parms) != 2) | |
| 1573 | return; | |
| 1574 | ||
| 1575 | user = g_slist_nth_data(parms, 0); | |
| 1576 | conference = g_slist_nth_data(parms, 1); | |
| 1577 | ||
| 1578 | if (user && conference) { | |
| 1579 | rc = nm_send_join_conference(user, conference, | |
| 1580 | _join_conf_resp_cb, conference); | |
| 1581 | _check_for_disconnect(user, rc); | |
| 1582 | } | |
| 1583 | ||
| 1584 | g_slist_free(parms); | |
| 1585 | } | |
| 1586 | ||
| 1587 | /* Send a reject conference, the first item in the parms list is the | |
| 1588 | * NMUser object and the second item is the conference to reject. | |
| 15884 | 1589 | * This callback is passed to purple_request_action when we ask the |
| 8675 | 1590 | * user if they want to joing the conference. |
| 1591 | */ | |
| 1592 | static void | |
| 1593 | _reject_conference_cb(GSList * parms) | |
| 1594 | { | |
| 1595 | NMUser *user; | |
| 1596 | NMConference *conference; | |
| 1597 | NMERR_T rc = NM_OK; | |
| 1598 | ||
| 1599 | if (parms == NULL || g_slist_length(parms) != 2) | |
| 1600 | return; | |
| 1601 | ||
| 1602 | user = g_slist_nth_data(parms, 0); | |
| 1603 | conference = g_slist_nth_data(parms, 1); | |
| 1604 | ||
| 1605 | if (user && conference) { | |
| 1606 | rc = nm_send_reject_conference(user, conference, NULL, NULL); | |
| 1607 | _check_for_disconnect(user, rc); | |
| 1608 | } | |
| 1609 | ||
| 1610 | g_slist_free(parms); | |
| 1611 | } | |
| 1612 | ||
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1613 | static void |
| 15884 | 1614 | _initiate_conference_cb(PurpleBlistNode *node, gpointer ignored) |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1615 | { |
| 15884 | 1616 | PurpleBuddy *buddy; |
| 1617 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1618 | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1619 | NMUser *user; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1620 | const char *conf_name; |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1621 | PurpleChatConversation *chat = NULL; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1622 | NMUserRecord *user_record; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1623 | NMConference *conference; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1624 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1625 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
| 15884 | 1626 | |
| 1627 | buddy = (PurpleBuddy *) node; | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1628 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1629 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1630 | user = purple_connection_get_protocol_data(gc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1631 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1632 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1633 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1634 | /* We should already have a userrecord for the buddy */ |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
1635 | user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1636 | if (user_record == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1637 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1638 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1639 | conf_name = _get_conference_name(++user->conference_count); |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
1640 | chat = purple_serv_got_joined_chat(gc, user->conference_count, conf_name); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1641 | if (chat) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1642 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1643 | conference = nm_create_conference(NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1644 | nm_conference_set_data(conference, (gpointer) chat); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1645 | nm_send_create_conference(user, conference, _createconf_resp_send_invite, user_record); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1646 | nm_release_conference(conference); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1647 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1648 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1649 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1650 | const char * |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1651 | _get_conference_name(int id) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1652 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1653 | static char *name = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1654 | |
|
37425
5061721fd98f
Remove more NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
1655 | g_free(name); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1656 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1657 | name = g_strdup_printf(_("GroupWise Conference %d"), id); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1658 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1659 | return name; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1660 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1661 | |
|
12408
7c923b031326
[gaim-migrate @ 14715]
Richard Laager <rlaager@pidgin.im>
parents:
12222
diff
changeset
|
1662 | static void |
| 15884 | 1663 | _show_privacy_locked_error(PurpleConnection *gc, NMUser *user) |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1664 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1665 | char *err; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1666 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1667 | err = g_strdup_printf(_("Unable to change server side privacy settings (%s)."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1668 | nm_error_to_string(NMERR_ADMIN_LOCKED)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
1669 | purple_notify_error(gc, NULL, err, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
1670 | purple_request_cpar_from_connection(gc)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1671 | g_free(err); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1672 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1673 | |
| 8675 | 1674 | /******************************************************************************* |
| 1675 | * Connect and recv callbacks | |
| 1676 | ******************************************************************************/ | |
| 1677 | ||
| 1678 | static void | |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1679 | novell_ssl_recv_cb(GObject *stream, gpointer data) |
| 8675 | 1680 | { |
| 15884 | 1681 | PurpleConnection *gc = data; |
| 8675 | 1682 | NMUser *user; |
| 1683 | NMERR_T rc; | |
| 1684 | ||
| 1685 | if (gc == NULL) | |
| 1686 | return; | |
| 1687 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1688 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 1689 | if (user == NULL) |
| 1690 | return; | |
| 1691 | ||
| 1692 | rc = nm_process_new_data(user); | |
| 1693 | if (rc != NM_OK) { | |
| 1694 | ||
| 1695 | if (_is_disconnect_error(rc)) { | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1696 | |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31595
diff
changeset
|
1697 | purple_connection_error(gc, |
| 21279 | 1698 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20451
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
1699 | _("Error communicating with server. Closing connection.")); |
| 8675 | 1700 | } else { |
| 15884 | 1701 | purple_debug(PURPLE_DEBUG_INFO, "novell", |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
1702 | "Error processing event or response (%d).\n", rc); |
| 8675 | 1703 | } |
| 1704 | } | |
| 1705 | } | |
| 1706 | ||
| 1707 | static void | |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1708 | novell_login_callback(GObject *source_object, GAsyncResult *res, gpointer data) |
| 8675 | 1709 | { |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1710 | GSocketClient *client = G_SOCKET_CLIENT(source_object); |
| 15884 | 1711 | PurpleConnection *gc = data; |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1712 | GSocketConnection *sockconn; |
| 8675 | 1713 | NMUser *user; |
| 1714 | NMConn *conn; | |
| 1715 | NMERR_T rc = 0; | |
| 1716 | const char *pwd = NULL; | |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1717 | gchar *my_addr = NULL; |
| 8675 | 1718 | char *ua = NULL; |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1719 | GError *error = NULL; |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1720 | |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1721 | sockconn = g_socket_client_connect_to_host_finish(client, res, &error); |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1722 | if (sockconn == NULL) { |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1723 | if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1724 | g_error_free(error); |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1725 | } else { |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1726 | purple_connection_take_error(gc, error); |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1727 | } |
| 8675 | 1728 | return; |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1729 | } |
| 8675 | 1730 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1731 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 1732 | if ((user == NULL) || (conn = user->conn) == NULL) |
| 1733 | return; | |
| 1734 | ||
| 15884 | 1735 | purple_connection_update_progress(gc, _("Authenticating..."), |
| 8675 | 1736 | 2, NOVELL_CONNECT_STEPS); |
| 1737 | ||
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1738 | conn->stream = G_IO_STREAM(sockconn); |
|
40119
2e1969768857
novell: Replace socket wrappers with GIO functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40118
diff
changeset
|
1739 | conn->input = |
|
2e1969768857
novell: Replace socket wrappers with GIO functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40118
diff
changeset
|
1740 | g_data_input_stream_new(g_io_stream_get_input_stream(conn->stream)); |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1741 | conn->output = g_io_stream_get_output_stream(conn->stream); |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1742 | |
|
40119
2e1969768857
novell: Replace socket wrappers with GIO functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40118
diff
changeset
|
1743 | g_data_input_stream_set_byte_order(conn->input, |
|
2e1969768857
novell: Replace socket wrappers with GIO functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40118
diff
changeset
|
1744 | G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN); |
|
2e1969768857
novell: Replace socket wrappers with GIO functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40118
diff
changeset
|
1745 | g_data_input_stream_set_newline_type(conn->input, |
|
2e1969768857
novell: Replace socket wrappers with GIO functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40118
diff
changeset
|
1746 | G_DATA_STREAM_NEWLINE_TYPE_LF); |
|
2e1969768857
novell: Replace socket wrappers with GIO functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40118
diff
changeset
|
1747 | |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1748 | my_addr = purple_network_get_my_ip_from_gio(sockconn); |
| 15884 | 1749 | pwd = purple_connection_get_password(gc); |
| 8675 | 1750 | ua = _user_agent_string(); |
| 1751 | ||
| 1752 | rc = nm_send_login(user, pwd, my_addr, ua, _login_resp_cb, NULL); | |
| 1753 | if (rc == NM_OK) { | |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1754 | GSource *source; |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1755 | source = g_pollable_input_stream_create_source( |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1756 | G_POLLABLE_INPUT_STREAM(conn->input), user->cancellable); |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1757 | g_source_set_callback(source, (GSourceFunc)novell_ssl_recv_cb, gc, |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1758 | NULL); |
| 8675 | 1759 | } else { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31595
diff
changeset
|
1760 | purple_connection_error(gc, |
| 21279 | 1761 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27525
diff
changeset
|
1762 | _("Unable to connect")); |
| 8675 | 1763 | } |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
1764 | |
| 15884 | 1765 | purple_connection_update_progress(gc, _("Waiting for response..."), |
| 8675 | 1766 | 3, NOVELL_CONNECT_STEPS); |
| 1767 | ||
| 1768 | g_free(ua); | |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
1769 | g_free(my_addr); |
| 8675 | 1770 | } |
| 1771 | ||
| 1772 | /******************************************************************************* | |
| 1773 | * Event callback and event handlers | |
| 1774 | ******************************************************************************/ | |
| 1775 | ||
| 1776 | static void | |
| 1777 | _evt_receive_message(NMUser * user, NMEvent * event) | |
| 1778 | { | |
| 1779 | NMUserRecord *user_record = NULL; | |
| 1780 | NMContact *contact = NULL; | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1781 | PurpleIMConversation *im; |
| 8675 | 1782 | NMConference *conference; |
| 15884 | 1783 | PurpleMessageFlags flags; |
|
9268
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
1784 | char *text = NULL; |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
1785 | |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
1786 | text = g_markup_escape_text(nm_event_get_text(event), -1); |
| 8675 | 1787 | |
| 1788 | conference = nm_event_get_conference(event); | |
| 1789 | if (conference) { | |
| 1790 | ||
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1791 | PurpleChatConversation *chat = nm_conference_get_data(conference); |
| 8675 | 1792 | |
| 1793 | /* Is this a single person 'conversation' or a conference? */ | |
| 1794 | if (chat == NULL && nm_conference_get_participant_count(conference) == 1) { | |
| 1795 | ||
| 1796 | user_record = nm_find_user_record(user, nm_event_get_source(event)); | |
| 1797 | if (user_record) { | |
| 1798 | ||
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
1799 | flags = 0; |
| 8675 | 1800 | if (nm_event_get_type(event) == NMEVT_RECEIVE_AUTOREPLY) |
| 15884 | 1801 | flags |= PURPLE_MESSAGE_AUTO_RESP; |
| 1802 | ||
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
1803 | purple_serv_got_im(purple_account_get_connection(user->client_data), |
| 8675 | 1804 | nm_user_record_get_display_id(user_record), |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
1805 | text, flags, |
| 8675 | 1806 | nm_event_get_gmt(event)); |
| 1807 | ||
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1808 | im = purple_conversations_find_im_with_account( |
| 8675 | 1809 | nm_user_record_get_display_id(user_record), |
| 15884 | 1810 | (PurpleAccount *) user->client_data); |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1811 | if (im) { |
| 8675 | 1812 | |
| 1813 | contact = nm_find_contact(user, nm_event_get_source(event)); | |
| 1814 | if (contact) { | |
| 1815 | ||
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1816 | purple_conversation_set_title(PURPLE_CONVERSATION(im), |
|
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1817 | nm_contact_get_display_name(contact)); |
| 8675 | 1818 | |
| 1819 | ||
| 1820 | } else { | |
| 1821 | ||
| 1822 | const char *name = | |
| 1823 | nm_user_record_get_full_name(user_record); | |
| 1824 | ||
| 1825 | if (name == NULL) | |
| 1826 | name = nm_user_record_get_userid(user_record); | |
| 1827 | ||
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1828 | purple_conversation_set_title(PURPLE_CONVERSATION(im), name); |
| 8675 | 1829 | } |
| 1830 | ||
| 1831 | } | |
| 1832 | ||
| 1833 | } else { | |
| 1834 | /* this should not happen, see the event code. | |
| 1835 | * the event code will get the contact details from | |
| 1836 | * the server if it does not have them before calling | |
| 1837 | * the event callback. | |
| 1838 | */ | |
| 1839 | } | |
| 1840 | ||
| 1841 | } else if (chat) { | |
| 1842 | ||
| 1843 | /* get the contact for send if we have one */ | |
| 1844 | NMContact *contact = nm_find_contact(user, | |
| 1845 | nm_event_get_source(event)); | |
| 1846 | ||
| 1847 | /* get the user record for the sender */ | |
| 1848 | user_record = nm_find_user_record(user, nm_event_get_source(event)); | |
| 1849 | if (user_record) { | |
| 1850 | const char *name = nm_contact_get_display_name(contact); | |
| 1851 | ||
| 1852 | if (name == NULL) { | |
| 1853 | name = nm_user_record_get_full_name(user_record); | |
| 1854 | if (name == NULL) | |
| 1855 | name = nm_user_record_get_display_id(user_record); | |
| 1856 | } | |
| 1857 | ||
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
1858 | purple_serv_got_chat_in(purple_account_get_connection(user->client_data), |
|
36092
cf0a11121049
Fix message flags
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36089
diff
changeset
|
1859 | purple_chat_conversation_get_id(chat), |
|
cf0a11121049
Fix message flags
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36089
diff
changeset
|
1860 | name, PURPLE_MESSAGE_RECV, text, nm_event_get_gmt(event)); |
| 8675 | 1861 | } |
| 1862 | } | |
| 1863 | } | |
|
9268
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
1864 | |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
1865 | g_free(text); |
| 8675 | 1866 | } |
| 1867 | ||
| 1868 | static void | |
| 1869 | _evt_conference_left(NMUser * user, NMEvent * event) | |
| 1870 | { | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1871 | PurpleChatConversation *chat; |
| 8675 | 1872 | NMConference *conference; |
| 1873 | ||
| 1874 | conference = nm_event_get_conference(event); | |
| 1875 | if (conference) { | |
| 1876 | chat = nm_conference_get_data(conference); | |
| 1877 | if (chat) { | |
| 1878 | NMUserRecord *ur = nm_find_user_record(user, | |
| 1879 | nm_event_get_source(event)); | |
| 1880 | ||
| 1881 | if (ur) | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1882 | purple_chat_conversation_remove_user(chat, |
| 8675 | 1883 | nm_user_record_get_display_id(ur), |
| 1884 | NULL); | |
| 1885 | } | |
| 1886 | } | |
| 1887 | } | |
| 1888 | ||
| 1889 | static void | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1890 | _evt_conference_invite_notify(NMUser * user, NMEvent * event) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1891 | { |
| 15884 | 1892 | PurpleConversation *gconv; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1893 | NMConference *conference; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1894 | NMUserRecord *user_record = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1895 | char *str = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1896 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1897 | user_record = nm_find_user_record(user, nm_event_get_source(event)); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1898 | conference = nm_event_get_conference(event); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1899 | if (user_record && conference) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1900 | gconv = nm_conference_get_data(conference); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1901 | str = g_strdup_printf(_("%s has been invited to this conversation."), |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1902 | nm_user_record_get_display_id(user_record)); |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36078
diff
changeset
|
1903 | purple_conversation_write_system_message(gconv, str, 0); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1904 | g_free(str); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1905 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1906 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1907 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1908 | static void |
| 8675 | 1909 | _evt_conference_invite(NMUser * user, NMEvent * event) |
| 1910 | { | |
| 1911 | NMUserRecord *ur; | |
| 15884 | 1912 | PurpleConnection *gc; |
| 8675 | 1913 | GSList *parms = NULL; |
| 1914 | const char *title = NULL; | |
| 1915 | const char *secondary = NULL; | |
| 1916 | const char *name = NULL; | |
| 1917 | char *primary = NULL; | |
| 1918 | time_t gmt; | |
| 1919 | ||
| 1920 | ur = nm_find_user_record(user, nm_event_get_source(event)); | |
| 1921 | if (ur) | |
| 1922 | name = nm_user_record_get_full_name(ur); | |
| 1923 | ||
| 1924 | if (name == NULL) | |
| 1925 | name = nm_event_get_source(event); | |
| 1926 | ||
| 1927 | gmt = nm_event_get_gmt(event); | |
| 1928 | title = _("Invitation to Conversation"); | |
| 1929 | primary = g_strdup_printf(_("Invitation from: %s\n\nSent: %s"), | |
| 15884 | 1930 | name, purple_date_format_full(localtime(&gmt))); |
| 8675 | 1931 | secondary = _("Would you like to join the conversation?"); |
| 1932 | ||
| 1933 | /* Set up parms list for the callbacks | |
| 1934 | * We need to send the NMUser object and | |
| 1935 | * the NMConference object to the callbacks | |
| 1936 | */ | |
| 1937 | parms = NULL; | |
| 1938 | parms = g_slist_append(parms, user); | |
| 1939 | parms = g_slist_append(parms, nm_event_get_conference(event)); | |
| 1940 | ||
| 1941 | /* Prompt the user */ | |
| 35501 | 1942 | /* TODO: Would it be better to use purple_serv_got_chat_invite() here? */ |
| 15884 | 1943 | gc = purple_account_get_connection(user->client_data); |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1944 | purple_request_action(gc, title, primary, secondary, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16119
diff
changeset
|
1945 | PURPLE_DEFAULT_ACTION_NONE, |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34321
diff
changeset
|
1946 | purple_request_cpar_from_connection(gc), |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1947 | parms, 2, |
| 8675 | 1948 | _("Yes"), G_CALLBACK(_join_conference_cb), |
| 1949 | _("No"), G_CALLBACK(_reject_conference_cb)); | |
| 1950 | ||
| 1951 | g_free(primary); | |
| 1952 | } | |
| 1953 | ||
| 1954 | ||
| 1955 | static void | |
| 1956 | _evt_conference_joined(NMUser * user, NMEvent * event) | |
| 1957 | { | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1958 | PurpleChatConversation *chat = NULL; |
| 15884 | 1959 | PurpleConnection *gc; |
| 8675 | 1960 | NMConference *conference = NULL; |
| 1961 | NMUserRecord *ur = NULL; | |
| 1962 | const char *name; | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1963 | const char *conf_name; |
| 8675 | 1964 | |
| 15884 | 1965 | gc = purple_account_get_connection(user->client_data); |
| 8675 | 1966 | if (gc == NULL) |
| 1967 | return; | |
| 1968 | ||
| 1969 | conference = nm_event_get_conference(event); | |
| 1970 | if (conference) { | |
| 1971 | chat = nm_conference_get_data(conference); | |
| 1972 | if (nm_conference_get_participant_count(conference) == 2 && chat == NULL) { | |
| 1973 | ur = nm_conference_get_participant(conference, 0); | |
| 1974 | if (ur) { | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1975 | conf_name = _get_conference_name(++user->conference_count); |
| 8675 | 1976 | chat = |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
1977 | purple_serv_got_joined_chat(gc, user->conference_count, conf_name); |
| 8675 | 1978 | if (chat) { |
| 1979 | ||
| 1980 | nm_conference_set_data(conference, (gpointer) chat); | |
| 1981 | ||
| 1982 | name = nm_user_record_get_display_id(ur); | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1983 | purple_chat_conversation_add_user(chat, name, NULL, |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
1984 | PURPLE_CHAT_USER_NONE, TRUE); |
| 8675 | 1985 | |
| 1986 | } | |
| 1987 | } | |
| 1988 | } | |
| 1989 | ||
| 1990 | if (chat != NULL) { | |
| 1991 | ur = nm_find_user_record(user, nm_event_get_source(event)); | |
| 1992 | if (ur) { | |
| 1993 | name = nm_user_record_get_display_id(ur); | |
|
34653
88ae47a7d595
Updated protocols for the API changes
Ankit Vani <a@nevitus.org>
parents:
34639
diff
changeset
|
1994 | if (!purple_chat_conversation_has_user(chat, name)) { |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
1995 | purple_chat_conversation_add_user(chat, name, NULL, |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
1996 | PURPLE_CHAT_USER_NONE, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
1997 | } |
| 8675 | 1998 | } |
| 1999 | } | |
| 2000 | } | |
| 2001 | } | |
| 2002 | ||
| 2003 | static void | |
| 2004 | _evt_status_change(NMUser * user, NMEvent * event) | |
| 2005 | { | |
| 15884 | 2006 | PurpleBuddy *buddy = NULL; |
| 8675 | 2007 | GSList *buddies; |
| 2008 | GSList *bnode; | |
| 2009 | NMUserRecord *user_record; | |
| 2010 | const char *display_id; | |
| 2011 | int status; | |
| 2012 | ||
| 2013 | user_record = nm_event_get_user_record(event); | |
| 2014 | if (user_record) { | |
| 2015 | ||
| 2016 | /* Retrieve new status */ | |
| 2017 | status = nm_user_record_get_status(user_record); | |
| 2018 | ||
| 2019 | /* Update status for buddy in all folders */ | |
| 2020 | display_id = nm_user_record_get_display_id(user_record); | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
2021 | buddies = purple_blist_find_buddies(user->client_data, display_id); |
| 8675 | 2022 | for (bnode = buddies; bnode; bnode = bnode->next) { |
| 15884 | 2023 | buddy = (PurpleBuddy *) bnode->data; |
| 8675 | 2024 | if (buddy) { |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2025 | _update_buddy_status(user, buddy, status, nm_event_get_gmt(event)); |
| 8675 | 2026 | } |
| 2027 | } | |
| 2028 | ||
| 2029 | g_slist_free(buddies); | |
| 2030 | ||
| 2031 | } | |
| 2032 | } | |
| 2033 | ||
| 2034 | static void | |
| 2035 | _evt_user_disconnect(NMUser * user, NMEvent * event) | |
| 2036 | { | |
| 15884 | 2037 | PurpleConnection *gc; |
|
20658
91594d39738c
Clear the password consistently when we get a "Signed-On elsewhere" or a "Invalid Password" disconnection. Disconnection reason codes will take care of this in the core, but until then, this is ok. Fixes #3204.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
2038 | PurpleAccount *account = user->client_data; |
|
91594d39738c
Clear the password consistently when we get a "Signed-On elsewhere" or a "Invalid Password" disconnection. Disconnection reason codes will take care of this in the core, but until then, this is ok. Fixes #3204.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
2039 | |
|
91594d39738c
Clear the password consistently when we get a "Signed-On elsewhere" or a "Invalid Password" disconnection. Disconnection reason codes will take care of this in the core, but until then, this is ok. Fixes #3204.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
2040 | gc = purple_account_get_connection(account); |
| 8675 | 2041 | if (gc) |
|
14655
7e86ddfcfdfa
[gaim-migrate @ 17318]
Mike Stoddard <mistoddard@novell.com>
parents:
14604
diff
changeset
|
2042 | { |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
2043 | if (!purple_account_get_remember_password(account)) { |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
2044 | PurpleCredentialManager *manager = NULL; |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
2045 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
2046 | manager = purple_credential_manager_get_default(); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
2047 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
2048 | purple_credential_manager_clear_password_async(manager, account, |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
2049 | NULL, NULL, NULL); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40637
diff
changeset
|
2050 | } |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31595
diff
changeset
|
2051 | purple_connection_error(gc, |
| 21279 | 2052 | PURPLE_CONNECTION_ERROR_NAME_IN_USE, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27525
diff
changeset
|
2053 | _("You have signed on from another location")); |
|
14655
7e86ddfcfdfa
[gaim-migrate @ 17318]
Mike Stoddard <mistoddard@novell.com>
parents:
14604
diff
changeset
|
2054 | } |
| 8675 | 2055 | } |
| 2056 | ||
| 2057 | static void | |
| 2058 | _evt_user_typing(NMUser * user, NMEvent * event) | |
| 2059 | { | |
| 15884 | 2060 | PurpleConnection *gc; |
| 8675 | 2061 | NMUserRecord *user_record = NULL; |
| 2062 | ||
| 15884 | 2063 | gc = purple_account_get_connection((PurpleAccount *) user->client_data); |
| 8675 | 2064 | if (gc) { |
| 2065 | user_record = nm_find_user_record(user, nm_event_get_source(event)); | |
| 2066 | if (user_record) { | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
2067 | purple_serv_got_typing(gc, nm_user_record_get_display_id(user_record), |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
2068 | 30, PURPLE_IM_TYPING); |
| 8675 | 2069 | } |
| 2070 | } | |
| 2071 | } | |
| 2072 | ||
| 2073 | static void | |
| 2074 | _evt_user_not_typing(NMUser * user, NMEvent * event) | |
| 2075 | { | |
| 15884 | 2076 | PurpleConnection *gc; |
| 8675 | 2077 | NMUserRecord *user_record; |
| 2078 | ||
| 15884 | 2079 | gc = purple_account_get_connection((PurpleAccount *) user->client_data); |
| 8675 | 2080 | if (gc) { |
| 2081 | user_record = nm_find_user_record(user, nm_event_get_source(event)); | |
| 2082 | if (user_record) { | |
| 35501 | 2083 | purple_serv_got_typing_stopped(gc, |
| 8675 | 2084 | nm_user_record_get_display_id(user_record)); |
| 2085 | } | |
| 2086 | } | |
| 2087 | } | |
| 2088 | ||
| 2089 | static void | |
| 2090 | _evt_undeliverable_status(NMUser * user, NMEvent * event) | |
| 2091 | { | |
| 2092 | NMUserRecord *ur; | |
| 15884 | 2093 | PurpleConversation *gconv; |
| 8675 | 2094 | char *str; |
| 2095 | ||
| 2096 | ur = nm_find_user_record(user, nm_event_get_source(event)); | |
| 2097 | if (ur) { | |
| 15884 | 2098 | /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ |
| 8675 | 2099 | gconv = |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
2100 | purple_conversations_find_with_account(nm_user_record_get_display_id(ur), |
| 8675 | 2101 | user->client_data); |
| 2102 | if (gconv) { | |
| 2103 | const char *name = nm_user_record_get_full_name(ur); | |
| 2104 | ||
| 2105 | if (name == NULL) { | |
| 2106 | name = nm_user_record_get_display_id(ur); | |
| 2107 | } | |
| 2108 | str = g_strdup_printf(_("%s appears to be offline and did not receive" | |
| 2109 | " the message that you just sent."), name); | |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36078
diff
changeset
|
2110 | purple_conversation_write_system_message(gconv, str, 0); |
| 8675 | 2111 | g_free(str); |
| 2112 | } | |
| 2113 | } | |
| 2114 | } | |
| 2115 | ||
| 2116 | static void | |
| 2117 | _event_callback(NMUser * user, NMEvent * event) | |
| 2118 | { | |
| 2119 | if (user == NULL || event == NULL) | |
| 2120 | return; | |
| 2121 | ||
| 2122 | switch (nm_event_get_type(event)) { | |
| 2123 | case NMEVT_STATUS_CHANGE: | |
| 2124 | _evt_status_change(user, event); | |
| 2125 | break; | |
| 2126 | case NMEVT_RECEIVE_AUTOREPLY: | |
| 2127 | case NMEVT_RECEIVE_MESSAGE: | |
| 2128 | _evt_receive_message(user, event); | |
| 2129 | break; | |
| 2130 | case NMEVT_USER_DISCONNECT: | |
| 2131 | _evt_user_disconnect(user, event); | |
| 2132 | break; | |
| 2133 | case NMEVT_USER_TYPING: | |
| 2134 | _evt_user_typing(user, event); | |
| 2135 | break; | |
| 2136 | case NMEVT_USER_NOT_TYPING: | |
| 2137 | _evt_user_not_typing(user, event); | |
| 2138 | break; | |
| 2139 | case NMEVT_SERVER_DISCONNECT: | |
| 2140 | /* Nothing to do? */ | |
| 2141 | break; | |
| 2142 | case NMEVT_INVALID_RECIPIENT: | |
| 2143 | break; | |
| 2144 | case NMEVT_UNDELIVERABLE_STATUS: | |
| 2145 | _evt_undeliverable_status(user, event); | |
| 2146 | break; | |
| 2147 | case NMEVT_CONFERENCE_INVITE_NOTIFY: | |
| 2148 | /* Someone else has been invited to join a | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
2149 | * conference that we are currently a part of |
| 8675 | 2150 | */ |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2151 | _evt_conference_invite_notify(user, event); |
| 8675 | 2152 | break; |
| 2153 | case NMEVT_CONFERENCE_INVITE: | |
| 2154 | /* We have been invited to join a conference */ | |
| 2155 | _evt_conference_invite(user, event); | |
| 2156 | break; | |
| 2157 | case NMEVT_CONFERENCE_JOINED: | |
| 2158 | /* Some one has joined a conference that we | |
| 2159 | * are a part of | |
| 2160 | */ | |
| 2161 | _evt_conference_joined(user, event); | |
| 2162 | break; | |
| 2163 | case NMEVT_CONFERENCE_LEFT: | |
| 2164 | /* Someone else has left a conference that we | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
2165 | * are currently a part of |
| 8675 | 2166 | */ |
| 2167 | _evt_conference_left(user, event); | |
| 2168 | break; | |
| 2169 | default: | |
| 15884 | 2170 | purple_debug(PURPLE_DEBUG_INFO, "novell", |
| 8675 | 2171 | "_event_callback(): unhandled event, %d\n", |
| 2172 | nm_event_get_type(event)); | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
2173 | break; |
| 8675 | 2174 | } |
| 2175 | } | |
| 2176 | ||
| 2177 | /******************************************************************************* | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36628
diff
changeset
|
2178 | * Protocol Ops |
| 8675 | 2179 | ******************************************************************************/ |
| 2180 | ||
| 2181 | static void | |
| 15884 | 2182 | novell_login(PurpleAccount * account) |
| 8675 | 2183 | { |
| 15884 | 2184 | PurpleConnection *gc; |
| 8675 | 2185 | NMUser *user = NULL; |
| 2186 | const char *server; | |
| 2187 | const char *name; | |
| 2188 | int port; | |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2189 | GError *error = NULL; |
| 8675 | 2190 | |
| 2191 | if (account == NULL) | |
| 2192 | return; | |
| 2193 | ||
| 15884 | 2194 | gc = purple_account_get_connection(account); |
| 8675 | 2195 | if (gc == NULL) |
| 2196 | return; | |
| 2197 | ||
|
36055
33978dc8ef6f
Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35508
diff
changeset
|
2198 | purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_NO_IMAGES); |
|
33978dc8ef6f
Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35508
diff
changeset
|
2199 | |
| 15884 | 2200 | server = purple_account_get_string(account, "server", NULL); |
| 8675 | 2201 | if (server == NULL || *server == '\0') { |
| 2202 | ||
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
2203 | /* TODO: Would be nice to prompt if not set! |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2204 | * purple_request_fields(gc, _("Server Address"),...); |
| 8675 | 2205 | */ |
| 2206 | ||
| 2207 | /* ...but for now just error out with a nice message. */ | |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31595
diff
changeset
|
2208 | purple_connection_error(gc, |
| 21279 | 2209 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
|
20451
ea021ef20f51
Add disconnect reasons to novell.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
2210 | _("Unable to connect to server. Please enter the " |
|
27525
579b9d64b364
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26611
diff
changeset
|
2211 | "address of the server to which you wish to connect.")); |
| 8675 | 2212 | return; |
| 2213 | } | |
| 2214 | ||
| 15884 | 2215 | port = purple_account_get_int(account, "port", DEFAULT_PORT); |
| 2216 | name = purple_account_get_username(account); | |
| 8675 | 2217 | |
| 2218 | user = nm_initialize_user(name, server, port, account, _event_callback); | |
|
14658
714464049acb
[gaim-migrate @ 17323]
Mike Stoddard <mistoddard@novell.com>
parents:
14655
diff
changeset
|
2219 | if (user && user->conn) { |
| 8675 | 2220 | /* save user */ |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2221 | purple_connection_set_protocol_data(gc, user); |
| 8675 | 2222 | |
| 2223 | /* connect to the server */ | |
| 15884 | 2224 | purple_connection_update_progress(gc, _("Connecting"), |
| 8675 | 2225 | 1, NOVELL_CONNECT_STEPS); |
| 2226 | ||
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2227 | user->conn->client = purple_gio_socket_client_new(account, &error); |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2228 | if (user->conn->client == NULL) { |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2229 | purple_connection_take_error(gc, error); |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2230 | return; |
| 8675 | 2231 | } |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2232 | |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2233 | g_socket_client_set_tls(user->conn->client, TRUE); |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2234 | g_socket_client_connect_to_host_async( |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2235 | user->conn->client, user->conn->addr, user->conn->port, |
|
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2236 | user->cancellable, novell_login_callback, gc); |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
2237 | } |
| 8675 | 2238 | } |
| 2239 | ||
| 2240 | static void | |
| 15884 | 2241 | novell_close(PurpleConnection * gc) |
| 8675 | 2242 | { |
| 2243 | NMUser *user; | |
| 2244 | NMConn *conn; | |
| 2245 | ||
| 2246 | if (gc == NULL) | |
| 2247 | return; | |
| 2248 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2249 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2250 | if (user) { |
| 2251 | conn = user->conn; | |
|
40099
349378b539ca
novell: Fold NMSSLConn into NMConn.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40098
diff
changeset
|
2252 | if (conn) { |
|
40118
621987e8e765
Convert novell to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40099
diff
changeset
|
2253 | nm_release_conn(conn); |
| 8675 | 2254 | } |
| 2255 | nm_deinitialize_user(user); | |
| 2256 | } | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2257 | purple_connection_set_protocol_data(gc, NULL); |
| 8675 | 2258 | } |
| 2259 | ||
| 2260 | static int | |
|
40507
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
2261 | novell_send_im(PurpleProtocolIM *im, PurpleConnection *gc, PurpleMessage *msg) |
| 8675 | 2262 | { |
| 2263 | NMUserRecord *user_record = NULL; | |
| 2264 | NMConference *conf = NULL; | |
| 2265 | NMMessage *message; | |
| 2266 | NMUser *user; | |
| 2267 | const char *dn = NULL; | |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2268 | char *plain; |
| 8675 | 2269 | gboolean done = TRUE, created_conf = FALSE; |
| 2270 | NMERR_T rc = NM_OK; | |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36092
diff
changeset
|
2271 | const gchar *name = purple_message_get_recipient(msg); |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
2272 | |
|
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
2273 | if (gc == NULL || name == NULL || purple_message_is_empty(msg)) |
| 8675 | 2274 | return 0; |
| 2275 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2276 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2277 | if (user == NULL) |
| 2278 | return 0; | |
| 2279 | ||
| 2280 | /* Create a new message */ | |
|
36076
a0e5b68ff4ef
Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36055
diff
changeset
|
2281 | plain = purple_unescape_html(purple_message_get_contents(msg)); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2282 | message = nm_create_message(plain); |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2283 | g_free(plain); |
| 8675 | 2284 | |
| 2285 | /* Need to get the DN for the buddy so we can look up the convo */ | |
| 2286 | dn = nm_lookup_dn(user, name); | |
| 2287 | ||
| 2288 | /* Do we already know about the sender? */ | |
| 2289 | user_record = nm_find_user_record(user, dn); | |
| 2290 | if (user_record) { | |
| 2291 | ||
| 2292 | /* Do we already have an instantiated conference? */ | |
| 2293 | conf = nm_find_conversation(user, dn); | |
| 2294 | if (conf == NULL) { | |
| 2295 | ||
| 2296 | /* If not, create a blank conference */ | |
| 2297 | conf = nm_create_conference(NULL); | |
| 2298 | created_conf = TRUE; | |
| 2299 | ||
| 2300 | nm_conference_add_participant(conf, user_record); | |
| 2301 | } | |
| 2302 | ||
| 2303 | nm_message_set_conference(message, conf); | |
| 2304 | ||
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2305 | /* Make sure conference is instantiated */ |
| 8675 | 2306 | if (!nm_conference_is_instantiated(conf)) { |
| 2307 | ||
| 2308 | /* It is not, so send the createconf. We will | |
| 2309 | * have to finish sending the message when we | |
| 2310 | * get the response with the new conference guid. | |
| 2311 | */ | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2312 | rc = nm_send_create_conference(user, conf, _createconf_resp_send_msg, message); |
| 8675 | 2313 | _check_for_disconnect(user, rc); |
| 2314 | ||
| 2315 | done = FALSE; | |
| 2316 | } | |
| 2317 | ||
| 2318 | } else { | |
| 2319 | ||
| 2320 | /* If we don't have details for the user, then we don't have | |
| 2321 | * a conference yet. So create one and send the getdetails | |
| 2322 | * to the server. We will have to finish sending the message | |
| 2323 | * when we get the response from the server. | |
| 2324 | */ | |
| 2325 | conf = nm_create_conference(NULL); | |
| 2326 | created_conf = TRUE; | |
| 2327 | ||
| 2328 | nm_message_set_conference(message, conf); | |
|
8684
7ec649752daa
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8676
diff
changeset
|
2329 | |
| 8675 | 2330 | rc = nm_send_get_details(user, name, _get_details_resp_send_msg, message); |
| 2331 | _check_for_disconnect(user, rc); | |
| 2332 | ||
| 2333 | done = FALSE; | |
| 2334 | } | |
| 2335 | ||
| 2336 | if (done) { | |
| 2337 | ||
| 2338 | /* Did we find everything we needed? */ | |
| 2339 | rc = nm_send_message(user, message, _send_message_resp_cb); | |
| 2340 | _check_for_disconnect(user, rc); | |
| 2341 | ||
| 2342 | nm_release_message(message); | |
| 2343 | } | |
| 2344 | ||
| 2345 | if (created_conf && conf) | |
| 2346 | nm_release_conference(conf); | |
| 2347 | ||
| 2348 | return 1; | |
| 2349 | } | |
| 2350 | ||
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13713
diff
changeset
|
2351 | static unsigned int |
|
40507
77d7bc9e5151
Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
2352 | novell_send_typing(PurpleProtocolIM *im, PurpleConnection * gc, const char *name, PurpleIMTypingState state) |
| 8675 | 2353 | { |
| 2354 | NMConference *conf = NULL; | |
| 2355 | NMUser *user; | |
| 2356 | const char *dn = NULL; | |
| 2357 | NMERR_T rc = NM_OK; | |
| 2358 | ||
| 2359 | if (gc == NULL || name == NULL) | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13713
diff
changeset
|
2360 | return 0; |
| 8675 | 2361 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2362 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2363 | if (user == NULL) |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13713
diff
changeset
|
2364 | return 0; |
| 8675 | 2365 | |
| 2366 | /* Need to get the DN for the buddy so we can look up the convo */ | |
| 2367 | dn = nm_lookup_dn(user, name); | |
| 2368 | if (dn) { | |
| 2369 | ||
| 2370 | /* Now find the conference in our list */ | |
| 2371 | conf = nm_find_conversation(user, dn); | |
| 2372 | if (conf) { | |
| 2373 | ||
| 2374 | rc = nm_send_typing(user, conf, | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
2375 | ((state == PURPLE_IM_TYPING) ? TRUE : FALSE), NULL); |
| 8675 | 2376 | _check_for_disconnect(user, rc); |
| 2377 | ||
| 2378 | } | |
| 2379 | ||
| 2380 | } | |
| 2381 | ||
| 2382 | return 0; | |
| 2383 | } | |
| 2384 | ||
| 2385 | static void | |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
2386 | novell_convo_closed(PurpleProtocolClient *client, PurpleConnection * gc, |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
2387 | const char *who) |
| 8675 | 2388 | { |
| 2389 | NMUser *user; | |
| 2390 | NMConference *conf; | |
| 2391 | const char *dn; | |
| 2392 | NMERR_T rc = NM_OK; | |
| 2393 | ||
| 2394 | if (gc == NULL || who == NULL) | |
| 2395 | return; | |
| 2396 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2397 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2398 | if (user && (dn = nm_lookup_dn(user, who))) { |
| 2399 | conf = nm_find_conversation(user, dn); | |
| 2400 | if (conf) { | |
| 2401 | rc = nm_send_leave_conference(user, conf, NULL, NULL); | |
| 2402 | _check_for_disconnect(user, rc); | |
| 2403 | } | |
| 2404 | } | |
| 2405 | } | |
| 2406 | ||
| 2407 | static void | |
| 15884 | 2408 | novell_chat_leave(PurpleConnection * gc, int id) |
| 8675 | 2409 | { |
| 2410 | NMConference *conference; | |
| 2411 | NMUser *user; | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
2412 | PurpleChatConversation *chat; |
| 8675 | 2413 | GSList *cnode; |
| 2414 | NMERR_T rc = NM_OK; | |
| 2415 | ||
| 2416 | if (gc == NULL) | |
| 2417 | return; | |
| 2418 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2419 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2420 | if (user == NULL) |
| 2421 | return; | |
| 2422 | ||
| 2423 | for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { | |
| 2424 | conference = cnode->data; | |
| 2425 | if (conference && (chat = nm_conference_get_data(conference))) { | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
2426 | if (purple_chat_conversation_get_id(chat) == id) { |
| 8675 | 2427 | rc = nm_send_leave_conference(user, conference, NULL, NULL); |
| 2428 | _check_for_disconnect(user, rc); | |
| 2429 | break; | |
| 2430 | } | |
| 2431 | } | |
| 2432 | } | |
| 2433 | ||
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35005
diff
changeset
|
2434 | purple_serv_got_chat_left(gc, id); |
| 8675 | 2435 | } |
| 2436 | ||
|
12408
7c923b031326
[gaim-migrate @ 14715]
Richard Laager <rlaager@pidgin.im>
parents:
12222
diff
changeset
|
2437 | static void |
| 15884 | 2438 | novell_chat_invite(PurpleConnection *gc, int id, |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2439 | const char *message, const char *who) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2440 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2441 | NMConference *conference; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2442 | NMUser *user; |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
2443 | PurpleChatConversation *chat; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2444 | GSList *cnode; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2445 | NMERR_T rc = NM_OK; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2446 | NMUserRecord *user_record = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2447 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2448 | if (gc == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2449 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2450 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2451 | user = purple_connection_get_protocol_data(gc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2452 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2453 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2454 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2455 | user_record = nm_find_user_record(user, who); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2456 | if (user_record == NULL) { |
| 10112 | 2457 | rc = nm_send_get_details(user, who, _get_details_resp_send_invite, GINT_TO_POINTER(id)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2458 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2459 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2460 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2461 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2462 | for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2463 | conference = cnode->data; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2464 | if (conference && (chat = nm_conference_get_data(conference))) { |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
2465 | if (purple_chat_conversation_get_id(chat) == id) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2466 | rc = nm_send_conference_invite(user, conference, user_record, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2467 | message, _sendinvite_resp_cb, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2468 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2469 | break; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2470 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2471 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2472 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2473 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2474 | |
| 8675 | 2475 | static int |
|
36077
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
2476 | novell_chat_send(PurpleConnection * gc, int id, PurpleMessage *msg) |
| 8675 | 2477 | { |
| 2478 | NMConference *conference; | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
2479 | PurpleChatConversation *chat; |
| 8675 | 2480 | GSList *cnode; |
| 2481 | NMMessage *message; | |
| 2482 | NMUser *user; | |
| 2483 | NMERR_T rc = NM_OK; | |
| 2484 | const char *name; | |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2485 | char *str, *plain; |
| 8675 | 2486 | |
|
36077
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
2487 | if (gc == NULL || purple_message_is_empty(msg)) |
| 8675 | 2488 | return -1; |
| 2489 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2490 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2491 | if (user == NULL) |
| 2492 | return -1; | |
| 2493 | ||
|
36077
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
2494 | plain = purple_unescape_html(purple_message_get_contents(msg)); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2495 | message = nm_create_message(plain); |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2496 | g_free(plain); |
| 8675 | 2497 | |
| 2498 | for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { | |
| 2499 | conference = cnode->data; | |
| 2500 | if (conference && (chat = nm_conference_get_data(conference))) { | |
|
34639
53b5e1b31031
Refactored novell and oscar protocols to use GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
2501 | if (purple_chat_conversation_get_id(chat) == id) { |
| 8675 | 2502 | |
| 2503 | nm_message_set_conference(message, conference); | |
| 2504 | ||
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2505 | /* check to see if the conference is instatiated yet */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2506 | if (!nm_conference_is_instantiated(conference)) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2507 | nm_message_add_ref(message); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2508 | nm_send_create_conference(user, conference, _createconf_resp_send_msg, message); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2509 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2510 | rc = nm_send_message(user, message, _send_message_resp_cb); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2511 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2512 | |
| 8675 | 2513 | nm_release_message(message); |
| 2514 | ||
| 2515 | if (!_check_for_disconnect(user, rc)) { | |
| 2516 | ||
| 2517 | /* Use the account alias if it is set */ | |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
34578
diff
changeset
|
2518 | name = purple_account_get_private_alias(user->client_data); |
| 8675 | 2519 | if (name == NULL || *name == '\0') { |
| 2520 | ||
| 2521 | /* If there is no account alias, try full name */ | |
| 2522 | name = nm_user_record_get_full_name(user->user_record); | |
| 2523 | if (name == NULL || *name == '\0') { | |
| 2524 | ||
| 2525 | /* Fall back to the username that we are signed in with */ | |
| 15884 | 2526 | name = purple_account_get_username(user->client_data); |
| 8675 | 2527 | } |
| 2528 | } | |
| 2529 | ||
|
36077
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
2530 | purple_serv_got_chat_in(gc, id, name, |
|
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
2531 | purple_message_get_flags(msg), |
|
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36076
diff
changeset
|
2532 | purple_message_get_contents(msg), time(NULL)); |
| 8675 | 2533 | return 0; |
| 2534 | } else | |
| 2535 | return -1; | |
| 2536 | ||
| 2537 | } | |
| 2538 | } | |
| 2539 | } | |
| 2540 | ||
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
2541 | |
| 8675 | 2542 | /* The conference was not found, must be closed */ |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2543 | chat = purple_conversations_find_chat(gc, id); |
| 8675 | 2544 | if (chat) { |
|
25359
ea172b7ea601
The remainder of a patch from fqueze to fix some incorrect *printf() function
Daniel Atallah <datallah@pidgin.im>
parents:
23325
diff
changeset
|
2545 | str = g_strdup(_("This conference has been closed." |
|
ea172b7ea601
The remainder of a patch from fqueze to fix some incorrect *printf() function
Daniel Atallah <datallah@pidgin.im>
parents:
23325
diff
changeset
|
2546 | " No more messages can be sent.")); |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36078
diff
changeset
|
2547 | purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), str, 0); |
| 8675 | 2548 | g_free(str); |
| 2549 | } | |
| 2550 | ||
|
8744
14a15b6f466d
[gaim-migrate @ 9499]
Mike Stoddard <mistoddard@novell.com>
parents:
8739
diff
changeset
|
2551 | if (message) |
|
14a15b6f466d
[gaim-migrate @ 9499]
Mike Stoddard <mistoddard@novell.com>
parents:
8739
diff
changeset
|
2552 | nm_release_message(message); |
|
14a15b6f466d
[gaim-migrate @ 9499]
Mike Stoddard <mistoddard@novell.com>
parents:
8739
diff
changeset
|
2553 | |
| 8675 | 2554 | return -1; |
| 2555 | } | |
| 2556 | ||
| 2557 | static void | |
|
32315
2550a39e0285
Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32267
diff
changeset
|
2558 | novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group, const char *message) |
| 8675 | 2559 | { |
| 2560 | NMFolder *folder = NULL; | |
| 2561 | NMContact *contact; | |
| 2562 | NMUser *user; | |
| 2563 | NMERR_T rc = NM_OK; | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2564 | const char *alias, *gname, *bname; |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9268
diff
changeset
|
2565 | |
|
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9268
diff
changeset
|
2566 | if (gc == NULL || buddy == NULL || group == NULL) |
| 8675 | 2567 | return; |
| 2568 | ||
| 26539 | 2569 | user = (NMUser *) purple_connection_get_protocol_data(gc); |
| 8675 | 2570 | if (user == NULL) |
| 2571 | return; | |
| 2572 | ||
|
9360
c40bc951573a
[gaim-migrate @ 10168]
Mike Stoddard <mistoddard@novell.com>
parents:
9308
diff
changeset
|
2573 | /* If we haven't synched the contact list yet, ignore |
|
c40bc951573a
[gaim-migrate @ 10168]
Mike Stoddard <mistoddard@novell.com>
parents:
9308
diff
changeset
|
2574 | * the add_buddy calls. Server side list is the master. |
|
c40bc951573a
[gaim-migrate @ 10168]
Mike Stoddard <mistoddard@novell.com>
parents:
9308
diff
changeset
|
2575 | */ |
|
c40bc951573a
[gaim-migrate @ 10168]
Mike Stoddard <mistoddard@novell.com>
parents:
9308
diff
changeset
|
2576 | if (!user->clist_synched) |
|
c40bc951573a
[gaim-migrate @ 10168]
Mike Stoddard <mistoddard@novell.com>
parents:
9308
diff
changeset
|
2577 | return; |
|
c40bc951573a
[gaim-migrate @ 10168]
Mike Stoddard <mistoddard@novell.com>
parents:
9308
diff
changeset
|
2578 | |
|
24867
69105eeaf010
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <darkrain42@pidgin.im>
parents:
23325
diff
changeset
|
2579 | /* Don't re-add a buddy that is already on our contact list */ |
| 26539 | 2580 | if (nm_find_user_record(user, purple_buddy_get_name(buddy)) != NULL) |
|
24867
69105eeaf010
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <darkrain42@pidgin.im>
parents:
23325
diff
changeset
|
2581 | return; |
|
69105eeaf010
The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <darkrain42@pidgin.im>
parents:
23325
diff
changeset
|
2582 | |
| 8675 | 2583 | contact = nm_create_contact(); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2584 | nm_contact_set_dn(contact, purple_buddy_get_name(buddy)); |
| 8675 | 2585 | |
| 15884 | 2586 | /* Remove the PurpleBuddy (we will add it back after adding it |
| 8675 | 2587 | * to the server side list). Save the alias if there is one. |
| 2588 | */ | |
| 15884 | 2589 | alias = purple_buddy_get_alias(buddy); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2590 | bname = purple_buddy_get_name(buddy); |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2591 | if (alias && !purple_strequal(alias, bname)) |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9268
diff
changeset
|
2592 | nm_contact_set_display_name(contact, alias); |
|
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9268
diff
changeset
|
2593 | |
| 15884 | 2594 | purple_blist_remove_buddy(buddy); |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9268
diff
changeset
|
2595 | buddy = NULL; |
| 8675 | 2596 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2597 | gname = purple_group_get_name(group); |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2598 | if (purple_strequal(gname, NM_ROOT_FOLDER_NAME)) { |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2599 | gname = ""; |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2600 | } |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2601 | |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2602 | folder = nm_find_folder(user, gname); |
| 8675 | 2603 | if (folder) { |
| 2604 | ||
| 2605 | /* We have everything that we need, so send the createcontact */ | |
| 2606 | rc = nm_send_create_contact(user, folder, contact, | |
| 2607 | _create_contact_resp_cb, contact); | |
| 2608 | ||
| 2609 | } else { | |
| 2610 | ||
| 2611 | /* Need to create the folder before we can add the contact */ | |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2612 | rc = nm_send_create_folder(user, gname, |
| 8675 | 2613 | _create_folder_resp_add_contact, contact); |
| 2614 | } | |
| 2615 | ||
| 2616 | _check_for_disconnect(user, rc); | |
| 2617 | ||
| 2618 | } | |
| 2619 | ||
| 2620 | static void | |
| 15884 | 2621 | novell_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
| 8675 | 2622 | { |
| 2623 | NMContact *contact; | |
| 2624 | NMFolder *folder; | |
| 2625 | NMUser *user; | |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2626 | const char *dn, *gname; |
| 8675 | 2627 | NMERR_T rc = NM_OK; |
| 2628 | ||
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9268
diff
changeset
|
2629 | if (gc == NULL || buddy == NULL || group == NULL) |
| 8675 | 2630 | return; |
| 2631 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2632 | user = purple_connection_get_protocol_data(gc); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2633 | if (user && (dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)))) { |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2634 | gname = purple_group_get_name(group); |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2635 | if (purple_strequal(gname, NM_ROOT_FOLDER_NAME)) { |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2636 | gname = ""; |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2637 | } |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2638 | folder = nm_find_folder(user, gname); |
| 8675 | 2639 | if (folder) { |
| 2640 | contact = nm_folder_find_contact(folder, dn); | |
| 2641 | if (contact) { | |
| 2642 | ||
| 2643 | /* Remove the buddy from the contact */ | |
| 2644 | nm_contact_set_data(contact, NULL); | |
| 2645 | ||
| 2646 | /* Tell the server to remove the contact */ | |
| 2647 | rc = nm_send_remove_contact(user, folder, contact, | |
| 2648 | _remove_contact_resp_cb, NULL); | |
| 2649 | _check_for_disconnect(user, rc); | |
| 2650 | } | |
| 2651 | } | |
| 2652 | } | |
| 2653 | } | |
| 2654 | ||
| 2655 | static void | |
| 15884 | 2656 | novell_remove_group(PurpleConnection * gc, PurpleGroup *group) |
| 8675 | 2657 | { |
| 2658 | NMUser *user; | |
| 2659 | NMERR_T rc = NM_OK; | |
| 2660 | ||
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9268
diff
changeset
|
2661 | if (gc == NULL || group == NULL) |
| 8675 | 2662 | return; |
| 2663 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2664 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2665 | if (user) { |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2666 | NMFolder *folder = nm_find_folder(user, purple_group_get_name(group)); |
| 8675 | 2667 | |
| 2668 | if (folder) { | |
| 2669 | rc = nm_send_remove_folder(user, folder, | |
| 2670 | _remove_folder_resp_cb, NULL); | |
| 2671 | _check_for_disconnect(user, rc); | |
| 2672 | } | |
| 2673 | } | |
| 2674 | } | |
| 2675 | ||
| 2676 | static void | |
| 15884 | 2677 | novell_alias_buddy(PurpleConnection * gc, const char *name, const char *alias) |
| 8675 | 2678 | { |
| 2679 | NMContact *contact; | |
| 2680 | NMUser *user; | |
| 2681 | GList *contacts = NULL; | |
| 2682 | GList *cnode = NULL; | |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2683 | const char *dn = NULL, *fname = NULL; |
| 8675 | 2684 | NMERR_T rc = NM_OK; |
| 2685 | ||
| 2686 | if (gc == NULL || name == NULL || alias == NULL) | |
| 2687 | return; | |
| 2688 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2689 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2690 | if (user && (dn = nm_lookup_dn(user, name))) { |
| 2691 | ||
| 2692 | /* Alias all of instances of the contact */ | |
| 2693 | contacts = nm_find_contacts(user, dn); | |
| 2694 | for (cnode = contacts; cnode != NULL; cnode = cnode->next) { | |
| 2695 | contact = (NMContact *) cnode->data; | |
| 2696 | if (contact) { | |
| 15884 | 2697 | PurpleGroup *group = NULL; |
| 2698 | PurpleBuddy *buddy; | |
| 8675 | 2699 | NMFolder *folder; |
| 2700 | ||
| 15884 | 2701 | /* Alias the Purple buddy? */ |
| 8675 | 2702 | folder = nm_find_folder_by_id(user, |
| 2703 | nm_contact_get_parent_id(contact)); | |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2704 | if (folder) { |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2705 | fname = nm_folder_get_name(folder); |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2706 | if (*fname == '\0') { |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2707 | fname = NM_ROOT_FOLDER_NAME; |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2708 | } |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
2709 | group = purple_blist_find_group(fname); |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2710 | } |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2711 | |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2712 | if (group) { |
|
24950
143f594f0cd0
Alias foo. I think blist.h structs are now completely hidden.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24945
diff
changeset
|
2713 | const char *balias; |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
2714 | buddy = purple_blist_find_buddy_in_group(user->client_data, |
| 8675 | 2715 | name, group); |
|
34717
b3e588adef5a
Global replace purple_buddy_get_local_buddy_alias() with purple_buddy_get_local_alias()
Ankit Vani <a@nevitus.org>
parents:
34699
diff
changeset
|
2716 | balias = buddy ? purple_buddy_get_local_alias(buddy) : NULL; |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2717 | if (balias && !purple_strequal(balias, alias)) |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
2718 | purple_buddy_set_local_alias(buddy, alias); |
| 8675 | 2719 | } |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2720 | |
| 8675 | 2721 | /* Tell the server to alias the contact */ |
| 2722 | rc = nm_send_rename_contact(user, contact, alias, | |
| 2723 | _rename_contact_resp_cb, NULL); | |
| 2724 | _check_for_disconnect(user, rc); | |
| 2725 | } | |
| 2726 | } | |
| 2727 | if (contacts) | |
| 2728 | g_list_free(contacts); | |
| 2729 | } | |
| 2730 | } | |
| 2731 | ||
| 2732 | static void | |
| 15884 | 2733 | novell_group_buddy(PurpleConnection * gc, |
| 8675 | 2734 | const char *name, const char *old_group_name, |
| 2735 | const char *new_group_name) | |
| 2736 | { | |
| 2737 | NMFolder *old_folder; | |
| 2738 | NMFolder *new_folder; | |
| 2739 | NMContact *contact; | |
| 2740 | NMUser *user; | |
| 2741 | const char *dn; | |
| 2742 | NMERR_T rc = NM_OK; | |
| 2743 | ||
| 2744 | if (gc == NULL || name == NULL || | |
| 2745 | old_group_name == NULL || new_group_name == NULL) | |
| 2746 | return; | |
| 2747 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2748 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2749 | if (user && (dn = nm_lookup_dn(user, name))) { |
| 2750 | ||
| 2751 | /* Find the old folder */ | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2752 | if (purple_strequal(old_group_name, NM_ROOT_FOLDER_NAME)) { |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2753 | old_folder = nm_get_root_folder(user); |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2754 | if (nm_folder_find_contact(old_folder, dn) == NULL) |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2755 | old_folder = nm_find_folder(user, old_group_name); |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2756 | } else { |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2757 | old_folder = nm_find_folder(user, old_group_name); |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2758 | } |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2759 | |
| 8675 | 2760 | if (old_folder && (contact = nm_folder_find_contact(old_folder, dn))) { |
| 2761 | ||
| 2762 | /* Find the new folder */ | |
| 2763 | new_folder = nm_find_folder(user, new_group_name); | |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2764 | if (new_folder == NULL) { |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2765 | if (purple_strequal(new_group_name, NM_ROOT_FOLDER_NAME)) |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2766 | new_folder = nm_get_root_folder(user); |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2767 | } |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2768 | |
| 8675 | 2769 | if (new_folder) { |
| 2770 | ||
| 2771 | /* Tell the server to move the contact to the new folder */ | |
| 2772 | rc = nm_send_move_contact(user, contact, new_folder, | |
| 2773 | _move_contact_resp_cb, NULL); | |
| 2774 | ||
| 2775 | } else { | |
| 2776 | ||
| 2777 | nm_contact_add_ref(contact); | |
| 2778 | ||
| 2779 | /* Remove the old contact first */ | |
| 2780 | nm_send_remove_contact(user, old_folder, contact, | |
| 2781 | _remove_contact_resp_cb, NULL); | |
| 2782 | ||
| 2783 | /* New folder does not exist yet, so create it */ | |
| 2784 | rc = nm_send_create_folder(user, new_group_name, | |
| 2785 | _create_folder_resp_move_contact, | |
| 2786 | contact); | |
| 2787 | } | |
| 2788 | ||
| 2789 | _check_for_disconnect(user, rc); | |
| 2790 | } | |
| 2791 | } | |
| 2792 | } | |
| 2793 | ||
| 2794 | static void | |
| 15884 | 2795 | novell_rename_group(PurpleConnection * gc, const char *old_name, |
| 2796 | PurpleGroup *group, GList *moved_buddies) | |
| 8675 | 2797 | { |
| 2798 | NMERR_T rc = NM_OK; | |
| 8782 | 2799 | NMFolder *folder; |
| 8675 | 2800 | NMUser *user; |
| 2801 | ||
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9268
diff
changeset
|
2802 | if (gc == NULL || old_name == NULL || group == NULL || moved_buddies == NULL) { |
| 8675 | 2803 | return; |
| 2804 | } | |
| 2805 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2806 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2807 | if (user) { |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2808 | const char *gname = purple_group_get_name(group); |
| 8675 | 2809 | /* Does new folder exist already? */ |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2810 | if (nm_find_folder(user, gname)) { |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34717
diff
changeset
|
2811 | /* purple_group_set_name() adds the buddies |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2812 | * to the new group and removes the old group... |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2813 | * so there is nothing more to do here. |
| 8675 | 2814 | */ |
| 2815 | return; | |
| 2816 | } | |
| 2817 | ||
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2818 | if (purple_strequal(old_name, NM_ROOT_FOLDER_NAME)) { |
|
9651
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2819 | /* Can't rename the root folder ... need to revisit this */ |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2820 | return; |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2821 | } |
|
211ff9721581
[gaim-migrate @ 10499]
Mike Stoddard <mistoddard@novell.com>
parents:
9620
diff
changeset
|
2822 | |
| 8782 | 2823 | folder = nm_find_folder(user, old_name); |
| 8675 | 2824 | if (folder) { |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2825 | rc = nm_send_rename_folder(user, folder, gname, |
| 8675 | 2826 | _rename_folder_resp_cb, NULL); |
| 2827 | _check_for_disconnect(user, rc); | |
| 2828 | } | |
| 2829 | } | |
| 2830 | } | |
| 2831 | ||
| 2832 | static const char * | |
| 15884 | 2833 | novell_list_icon(PurpleAccount * account, PurpleBuddy * buddy) |
| 8675 | 2834 | { |
| 2835 | return "novell"; | |
| 2836 | } | |
| 2837 | ||
|
12970
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
2838 | static void |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
2839 | novell_tooltip_text(PurpleProtocolClient *client, PurpleBuddy *buddy, |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
2840 | PurpleNotifyUserInfo *user_info, gboolean full) |
| 8675 | 2841 | { |
| 2842 | NMUserRecord *user_record = NULL; | |
| 15884 | 2843 | PurpleConnection *gc; |
| 8675 | 2844 | NMUser *user; |
| 2845 | int status = 0; | |
| 2846 | const char *status_str = NULL; | |
| 2847 | const char *text = NULL; | |
| 2848 | ||
| 2849 | if (buddy == NULL) | |
|
20658
91594d39738c
Clear the password consistently when we get a "Signed-On elsewhere" or a "Invalid Password" disconnection. Disconnection reason codes will take care of this in the core, but until then, this is ok. Fixes #3204.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
2850 | return; |
| 8675 | 2851 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2852 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2853 | if (gc == NULL || (user = purple_connection_get_protocol_data(gc)) == NULL) |
|
12970
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
2854 | return; |
| 8675 | 2855 | |
| 15884 | 2856 | if (PURPLE_BUDDY_IS_ONLINE(buddy)) { |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2857 | user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); |
| 8675 | 2858 | if (user_record) { |
| 2859 | status = nm_user_record_get_status(user_record); | |
| 2860 | text = nm_user_record_get_status_text(user_record); | |
| 2861 | /* No custom text, so default it ... */ | |
| 2862 | switch (status) { | |
| 2863 | case NM_STATUS_AVAILABLE: | |
| 2864 | status_str = _("Available"); | |
| 2865 | break; | |
| 2866 | case NM_STATUS_AWAY: | |
| 2867 | status_str = _("Away"); | |
| 2868 | break; | |
| 2869 | case NM_STATUS_BUSY: | |
| 2870 | status_str = _("Busy"); | |
| 2871 | break; | |
| 2872 | case NM_STATUS_AWAY_IDLE: | |
| 2873 | status_str = _("Idle"); | |
| 2874 | break; | |
| 2875 | case NM_STATUS_OFFLINE: | |
| 2876 | status_str = _("Offline"); | |
| 2877 | break; | |
| 2878 | default: | |
| 2879 | status_str = _("Unknown"); | |
| 2880 | break; | |
| 2881 | } | |
| 2882 | ||
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
2883 | purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), status_str); |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
2884 | |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
2885 | if (text) { |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
2886 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
2887 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
2888 | purple_notify_user_info_add_pair_html(user_info, _("Message"), text); |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
2889 | } |
| 8675 | 2890 | } |
| 2891 | } | |
| 2892 | } | |
| 2893 | ||
| 2894 | static void | |
| 15884 | 2895 | novell_set_idle(PurpleConnection * gc, int time) |
| 8675 | 2896 | { |
| 2897 | NMUser *user; | |
| 2898 | NMERR_T rc = NM_OK; | |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2899 | const char *id = NULL; |
| 15884 | 2900 | PurpleStatus *status = NULL; |
| 8675 | 2901 | |
| 2902 | if (gc == NULL) | |
| 2903 | return; | |
| 2904 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2905 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2906 | if (user == NULL) |
| 2907 | return; | |
| 2908 | ||
| 15884 | 2909 | status = purple_account_get_active_status(purple_connection_get_account(gc)); |
| 2910 | id = purple_status_get_id(status); | |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2911 | |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2912 | /* Only go idle if active status is available */ |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
33806
diff
changeset
|
2913 | if (purple_strequal(id, NOVELL_STATUS_TYPE_AVAILABLE)) { |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2914 | if (time > 0) { |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2915 | rc = nm_send_set_status(user, NM_STATUS_AWAY_IDLE, NULL, NULL, NULL, NULL); |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2916 | } else { |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2917 | rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL, NULL); |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2918 | } |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2919 | } |
| 8675 | 2920 | |
| 2921 | _check_for_disconnect(user, rc); | |
| 2922 | } | |
| 2923 | ||
| 2924 | static void | |
| 15884 | 2925 | novell_get_info(PurpleConnection * gc, const char *name) |
| 8675 | 2926 | { |
| 2927 | NMUserRecord *user_record; | |
| 2928 | NMUser *user; | |
| 2929 | NMERR_T rc; | |
| 2930 | ||
| 2931 | if (gc == NULL || name == NULL) | |
| 2932 | return; | |
| 2933 | ||
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2934 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 2935 | if (user) { |
| 2936 | ||
| 2937 | user_record = nm_find_user_record(user, name); | |
| 2938 | if (user_record) { | |
|
31344
a5ccecc17f1c
Stop Groupwise from showing two windows for Get Info. Fixes #13108.
Gabriel Burt <gabriel.burt@gmail.com>
parents:
31294
diff
changeset
|
2939 | _show_info(gc, user_record, g_strdup(name)); |
| 8675 | 2940 | |
| 2941 | } else { | |
| 2942 | rc = nm_send_get_details(user, name, | |
| 2943 | _get_details_resp_show_info, g_strdup(name)); | |
| 2944 | ||
| 2945 | _check_for_disconnect(user, rc); | |
| 2946 | ||
| 2947 | } | |
| 2948 | ||
| 2949 | } | |
| 2950 | } | |
| 2951 | ||
| 2952 | static char * | |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
2953 | novell_status_text(PurpleProtocolClient *client, PurpleBuddy * buddy) |
| 8675 | 2954 | { |
| 2955 | const char *text = NULL; | |
| 2956 | const char *dn = NULL; | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2957 | PurpleAccount *account; |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2958 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2959 | account = buddy ? purple_buddy_get_account(buddy) : NULL; |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2960 | if (buddy && account) { |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
2961 | PurpleConnection *gc = purple_account_get_connection(account); |
| 8675 | 2962 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2963 | if (gc) { |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2964 | NMUser *user = purple_connection_get_protocol_data(gc); |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2965 | |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2966 | if (user) { |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2967 | dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2968 | if (dn) { |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2969 | NMUserRecord *user_record = nm_find_user_record(user, dn); |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2970 | |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2971 | if (user_record) { |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2972 | text = nm_user_record_get_status_text(user_record); |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2973 | if (text) |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2974 | return g_strdup(text); |
|
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
2975 | } |
| 8675 | 2976 | } |
| 2977 | } | |
| 2978 | } | |
| 2979 | } | |
| 2980 | ||
| 2981 | return NULL; | |
| 2982 | } | |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
2983 | |
| 8675 | 2984 | static GList * |
| 15884 | 2985 | novell_status_types(PurpleAccount *account) |
| 8675 | 2986 | { |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
2987 | GList *status_types = NULL; |
| 15884 | 2988 | PurpleStatusType *type; |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
2989 | |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
2990 | g_return_val_if_fail(account != NULL, NULL); |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
2991 | |
| 15884 | 2992 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, NOVELL_STATUS_TYPE_AVAILABLE, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12408
diff
changeset
|
2993 | NULL, TRUE, TRUE, FALSE, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
2994 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
2995 | NULL); |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
2996 | status_types = g_list_append(status_types, type); |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
2997 | |
| 15884 | 2998 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, NOVELL_STATUS_TYPE_AWAY, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12408
diff
changeset
|
2999 | NULL, TRUE, TRUE, FALSE, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
3000 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
3001 | NULL); |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3002 | status_types = g_list_append(status_types, type); |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3003 | |
| 15884 | 3004 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, NOVELL_STATUS_TYPE_BUSY, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12408
diff
changeset
|
3005 | _("Busy"), TRUE, TRUE, FALSE, |
|
35005
bff56dfca65d
Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
3006 | "message", _("Message"), purple_value_new(G_TYPE_STRING), |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
3007 | NULL); |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3008 | status_types = g_list_append(status_types, type); |
|
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3009 | |
| 15884 | 3010 | type = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, NOVELL_STATUS_TYPE_APPEAR_OFFLINE, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12408
diff
changeset
|
3011 | NULL, TRUE, TRUE, FALSE); |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3012 | status_types = g_list_append(status_types, type); |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3013 | |
|
25552
ffd94785b2ad
For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25359
diff
changeset
|
3014 | type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE); |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
3015 | status_types = g_list_append(status_types, type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
3016 | |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3017 | return status_types; |
| 8675 | 3018 | } |
| 3019 | ||
| 3020 | static void | |
| 15884 | 3021 | novell_set_status(PurpleAccount *account, PurpleStatus *status) |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3022 | { |
| 15884 | 3023 | PurpleConnection *gc; |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3024 | gboolean connected; |
| 15884 | 3025 | PurplePresence *presence; |
| 3026 | PurpleStatusType *type; | |
| 3027 | PurpleStatusPrimitive primitive; | |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3028 | NMUser *user; |
|
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3029 | NMSTATUS_T novellstatus = NM_STATUS_AVAILABLE; |
|
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3030 | NMERR_T rc = NM_OK; |
|
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3031 | const char *msg = NULL; |
|
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3032 | char *text = NULL; |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3033 | |
| 15884 | 3034 | connected = purple_account_is_connected(account); |
| 3035 | presence = purple_status_get_presence(status); | |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34811
diff
changeset
|
3036 | type = purple_status_get_status_type(status); |
| 15884 | 3037 | primitive = purple_status_type_get_primitive(type); |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3038 | |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3039 | /* |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3040 | * We don't have any independent statuses, so we don't need to |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3041 | * do anything when a status is deactivated (because another |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3042 | * status is about to be activated). |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3043 | */ |
| 15884 | 3044 | if (!purple_status_is_active(status)) |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3045 | return; |
|
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3046 | |
|
11718
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
11540
diff
changeset
|
3047 | if (!connected) |
|
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
11540
diff
changeset
|
3048 | return; |
|
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
11540
diff
changeset
|
3049 | |
| 15884 | 3050 | gc = purple_account_get_connection(account); |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3051 | user = purple_connection_get_protocol_data(gc); |
| 8675 | 3052 | if (user == NULL) |
| 3053 | return; | |
| 3054 | ||
| 15884 | 3055 | if (primitive == PURPLE_STATUS_AVAILABLE) { |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3056 | novellstatus = NM_STATUS_AVAILABLE; |
| 15884 | 3057 | } else if (primitive == PURPLE_STATUS_AWAY) { |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3058 | novellstatus = NM_STATUS_AWAY; |
| 15884 | 3059 | } else if (primitive == PURPLE_STATUS_UNAVAILABLE) { |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3060 | novellstatus = NM_STATUS_BUSY; |
| 15884 | 3061 | } else if (primitive == PURPLE_STATUS_INVISIBLE) { |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3062 | novellstatus = NM_STATUS_OFFLINE; |
| 15884 | 3063 | } else if (purple_presence_is_idle(presence)) { |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3064 | novellstatus = NM_STATUS_AWAY_IDLE; |
| 8675 | 3065 | } else { |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3066 | novellstatus = NM_STATUS_AVAILABLE; |
| 8675 | 3067 | } |
| 3068 | ||
| 15884 | 3069 | if (primitive == PURPLE_STATUS_AWAY || primitive == PURPLE_STATUS_AVAILABLE || |
| 3070 | primitive == PURPLE_STATUS_UNAVAILABLE) { | |
| 3071 | msg = purple_status_get_attr_string(status, "message"); | |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
3072 | text = g_strdup(msg); |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
3073 | |
| 15884 | 3074 | if (primitive == PURPLE_STATUS_AVAILABLE) |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
3075 | msg = NULL; /* no auto replies for online status */ |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
3076 | |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
3077 | /* Don't want newlines in status text */ |
| 15884 | 3078 | purple_util_chrreplace(text, '\n', ' '); |
|
12222
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
3079 | } |
|
ae5f8ec1daee
[gaim-migrate @ 14524]
Mike Stoddard <mistoddard@novell.com>
parents:
12216
diff
changeset
|
3080 | |
|
11971
96e1ff18a312
[gaim-migrate @ 14264]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
3081 | rc = nm_send_set_status(user, novellstatus, text, msg, NULL, NULL); |
| 8675 | 3082 | _check_for_disconnect(user, rc); |
| 3083 | ||
|
37425
5061721fd98f
Remove more NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37163
diff
changeset
|
3084 | g_free(text); |
| 8675 | 3085 | } |
|
10762
981222704bc6
[gaim-migrate @ 12366]
Mark Doliner <markdoliner@pidgin.im>
parents:
10751
diff
changeset
|
3086 | |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3087 | static void |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3088 | novell_add_permit(PurpleProtocolPrivacy *privacy, PurpleConnection *gc, |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3089 | const char *who) |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3090 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3091 | NMUser *user; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3092 | NMERR_T rc = NM_OK; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3093 | const char *name = who; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3094 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3095 | if (gc == NULL || who == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3096 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3097 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3098 | user = purple_connection_get_protocol_data(gc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3099 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3100 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3101 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3102 | /* Remove first -- we will add it back in when we get |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3103 | * the okay from the server |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3104 | */ |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3105 | purple_account_privacy_permit_remove(purple_connection_get_account(gc), who, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3106 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3107 | if (nm_user_is_privacy_locked(user)) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3108 | _show_privacy_locked_error(gc, user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3109 | _sync_privacy_lists(user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3110 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3111 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3112 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3113 | /* Work around for problem with un-typed, dotted contexts */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3114 | if (strchr(who, '.')) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3115 | const char *dn = nm_lookup_dn(user, who); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3116 | if (dn == NULL) { |
|
39914
d685c3015215
Fix suspicious type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
3117 | rc = nm_send_get_details(user, who, |
|
d685c3015215
Fix suspicious type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
3118 | _get_details_send_privacy_create, |
|
d685c3015215
Fix suspicious type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
3119 | GINT_TO_POINTER(TRUE)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3120 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3121 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3122 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3123 | name = dn; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3124 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3125 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3126 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3127 | rc = nm_send_create_privacy_item(user, name, TRUE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3128 | _create_privacy_item_permit_resp_cb, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3129 | g_strdup(who)); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3130 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3131 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3132 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3133 | static void |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3134 | novell_add_deny(PurpleProtocolPrivacy *privacy, PurpleConnection *gc, |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3135 | const char *who) |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3136 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3137 | NMUser *user; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3138 | NMERR_T rc = NM_OK; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3139 | const char *name = who; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3140 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3141 | if (gc == NULL || who == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3142 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3143 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3144 | user = purple_connection_get_protocol_data(gc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3145 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3146 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3147 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3148 | /* Remove first -- we will add it back in when we get |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3149 | * the okay from the server |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3150 | */ |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3151 | purple_account_privacy_deny_remove(purple_connection_get_account(gc), who, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3152 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3153 | if (nm_user_is_privacy_locked(user)) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3154 | _show_privacy_locked_error(gc, user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3155 | _sync_privacy_lists(user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3156 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3157 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3158 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3159 | /* Work around for problem with un-typed, dotted contexts */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3160 | if (strchr(who, '.')) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3161 | const char *dn = nm_lookup_dn(user, who); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3162 | if (dn == NULL) { |
|
39914
d685c3015215
Fix suspicious type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
3163 | rc = nm_send_get_details(user, who, |
|
d685c3015215
Fix suspicious type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
3164 | _get_details_send_privacy_create, |
|
d685c3015215
Fix suspicious type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
3165 | GINT_TO_POINTER(FALSE)); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3166 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3167 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3168 | } else { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3169 | name = dn; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3170 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3171 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3172 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3173 | rc = nm_send_create_privacy_item(user, name, FALSE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3174 | _create_privacy_item_deny_resp_cb, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3175 | g_strdup(who)); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3176 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3177 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3178 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3179 | static void |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3180 | novell_remove_permit(PurpleProtocolPrivacy *privacy, PurpleConnection *gc, |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3181 | const char *who) |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3182 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3183 | NMUser *user; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3184 | NMERR_T rc = NM_OK; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3185 | const char *dn = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3186 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3187 | if (gc == NULL || who == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3188 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3189 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3190 | user = purple_connection_get_protocol_data(gc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3191 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3192 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3193 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3194 | if (nm_user_is_privacy_locked(user)) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3195 | _show_privacy_locked_error(gc, user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3196 | _sync_privacy_lists(user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3197 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3198 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3199 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3200 | dn = nm_lookup_dn(user, who); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3201 | if (dn == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3202 | dn = who; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3203 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3204 | rc = nm_send_remove_privacy_item(user, dn, TRUE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3205 | _remove_privacy_item_resp_cb, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3206 | g_strdup(who)); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3207 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3208 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3209 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3210 | static void |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3211 | novell_remove_deny(PurpleProtocolPrivacy *privacy, PurpleConnection *gc, |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3212 | const char *who) |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3213 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3214 | NMUser *user; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3215 | NMERR_T rc = NM_OK; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3216 | const char *dn = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3217 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3218 | if (gc == NULL || who == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3219 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3220 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3221 | user = purple_connection_get_protocol_data(gc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3222 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3223 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3224 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3225 | if (nm_user_is_privacy_locked(user)) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3226 | _show_privacy_locked_error(gc, user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3227 | _sync_privacy_lists(user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3228 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3229 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3230 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3231 | dn = nm_lookup_dn(user, who); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3232 | if (dn == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3233 | dn = who; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3234 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3235 | rc = nm_send_remove_privacy_item(user, dn, FALSE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3236 | _remove_privacy_item_resp_cb, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3237 | g_strdup(who)); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3238 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3239 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3240 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3241 | static void |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3242 | novell_set_permit_deny(PurpleProtocolPrivacy *privacy, PurpleConnection *gc) |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3243 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3244 | NMERR_T rc = NM_OK; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3245 | const char *dn, *name = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3246 | NMUserRecord *user_record = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3247 | GSList *node = NULL, *copy = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3248 | NMUser *user; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3249 | int i, j, num_contacts, num_folders; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3250 | NMContact *contact; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3251 | NMFolder *folder = NULL; |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3252 | PurpleAccount *account; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3253 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3254 | if (gc == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3255 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3256 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3257 | account = purple_connection_get_account(gc); |
|
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3258 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3259 | user = purple_connection_get_protocol_data(gc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3260 | if (user == NULL) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3261 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3262 | |
|
9268
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3263 | if (user->privacy_synched == FALSE) { |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3264 | _sync_privacy_lists(user); |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3265 | user->privacy_synched = TRUE; |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3266 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3267 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3268 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3269 | if (nm_user_is_privacy_locked(user)) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3270 | _show_privacy_locked_error(gc, user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3271 | _sync_privacy_lists(user); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3272 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3273 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3274 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3275 | switch (purple_account_get_privacy_type(account)) { |
|
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3276 | |
|
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3277 | case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL: |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3278 | rc = nm_send_set_privacy_default(user, FALSE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3279 | _set_privacy_default_resp_cb, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3280 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3281 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3282 | /* clear server side deny list */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3283 | if (rc == NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3284 | copy = g_slist_copy(user->deny_list); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3285 | for (node = copy; node && node->data; node = node->next) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3286 | rc = nm_send_remove_privacy_item(user, (const char *)node->data, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3287 | FALSE, NULL, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3288 | if (_check_for_disconnect(user, rc)) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3289 | break; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3290 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3291 | g_slist_free(copy); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3292 | g_slist_free(user->deny_list); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3293 | user->deny_list = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3294 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3295 | break; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3296 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3297 | case PURPLE_ACCOUNT_PRIVACY_DENY_ALL: |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3298 | rc = nm_send_set_privacy_default(user, TRUE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3299 | _set_privacy_default_resp_cb, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3300 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3301 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3302 | /* clear server side allow list */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3303 | if (rc == NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3304 | copy = g_slist_copy(user->allow_list); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3305 | for (node = copy; node && node->data; node = node->next) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3306 | rc = nm_send_remove_privacy_item(user, (const char *)node->data, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3307 | TRUE, NULL, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3308 | if (_check_for_disconnect(user, rc)) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3309 | break; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3310 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3311 | g_slist_free(copy); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3312 | g_slist_free(user->allow_list); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3313 | user->allow_list = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3314 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3315 | break; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3316 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3317 | case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS: |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3318 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3319 | rc = nm_send_set_privacy_default(user, TRUE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3320 | _set_privacy_default_resp_cb, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3321 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3322 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3323 | /* sync allow lists */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3324 | if (rc == NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3325 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3326 | for (node = user->allow_list; node; node = node->next) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3327 | user_record = nm_find_user_record(user, (char *)node->data); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3328 | if (user_record) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3329 | name = nm_user_record_get_display_id(user_record); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3330 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3331 | if (!g_slist_find_custom(purple_account_privacy_get_permitted(account), |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
3332 | name, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3333 | purple_account_privacy_permit_add(account, name , TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3334 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3335 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3336 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3337 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3338 | for (node = purple_account_privacy_get_permitted(account); node; node = node->next) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3339 | dn = nm_lookup_dn(user, (char *)node->data); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3340 | if (dn) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3341 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3342 | if (!g_slist_find_custom(user->allow_list, |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
3343 | dn, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3344 | rc = nm_send_create_privacy_item(user, dn, TRUE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3345 | _create_privacy_item_deny_resp_cb, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3346 | g_strdup(dn)); |
|
35508
715ca05f5798
Fix two novell clang analysis warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35501
diff
changeset
|
3347 | _check_for_disconnect(user, rc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3348 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3349 | } else { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3350 | purple_account_privacy_permit_remove(account, (char *)node->data, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3351 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3352 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3353 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3354 | break; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3355 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3356 | case PURPLE_ACCOUNT_PRIVACY_DENY_USERS: |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3357 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3358 | /* set to default allow */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3359 | rc = nm_send_set_privacy_default(user, FALSE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3360 | _set_privacy_default_resp_cb, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3361 | _check_for_disconnect(user, rc); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3362 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3363 | /* sync deny lists */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3364 | if (rc == NM_OK) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3365 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3366 | for (node = user->deny_list; node; node = node->next) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3367 | user_record = nm_find_user_record(user, (char *)node->data); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3368 | if (user_record) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3369 | name = nm_user_record_get_display_id(user_record); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3370 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3371 | if (!g_slist_find_custom(purple_account_privacy_get_denied(account), |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
3372 | name, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3373 | purple_account_privacy_deny_add(account, name , TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3374 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3375 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3376 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3377 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3378 | for (node = purple_account_privacy_get_denied(account); node; node = node->next) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3379 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3380 | name = NULL; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3381 | dn = nm_lookup_dn(user, (char *)node->data); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3382 | if (dn) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3383 | user_record = nm_find_user_record(user, dn); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3384 | name = nm_user_record_get_display_id(user_record); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3385 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3386 | if (!g_slist_find_custom(user->deny_list, |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
3387 | dn, (GCompareFunc)purple_utf8_strcasecmp)) { |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3388 | rc = nm_send_create_privacy_item(user, dn, FALSE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3389 | _create_privacy_item_deny_resp_cb, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3390 | g_strdup(name)); |
|
35508
715ca05f5798
Fix two novell clang analysis warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35501
diff
changeset
|
3391 | _check_for_disconnect(user, rc); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3392 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3393 | } else { |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3394 | purple_account_privacy_deny_remove(account, (char *)node->data, TRUE); |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3395 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3396 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3397 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3398 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3399 | break; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3400 | |
|
34578
cfb2f856a5d0
Refactored prpls according to the changed PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
3401 | case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST: |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3402 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3403 | /* remove users from allow list that are not in buddy list */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3404 | copy = g_slist_copy(user->allow_list); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3405 | for (node = copy; node && node->data; node = node->next) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3406 | if (!nm_find_contacts(user, node->data)) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3407 | rc = nm_send_remove_privacy_item(user, (const char *)node->data, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3408 | TRUE, NULL, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3409 | if (_check_for_disconnect(user, rc)) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3410 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3411 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3412 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3413 | g_slist_free(copy); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3414 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3415 | /* add all buddies to allow list */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3416 | num_contacts = nm_folder_get_contact_count(user->root_folder); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3417 | for (i = 0; i < num_contacts; i++) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3418 | contact = nm_folder_get_contact(user->root_folder, i); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3419 | dn = nm_contact_get_dn(contact); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3420 | if (dn && !g_slist_find_custom(user->allow_list, |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
3421 | dn, (GCompareFunc)purple_utf8_strcasecmp)) |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3422 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3423 | rc = nm_send_create_privacy_item(user, dn, TRUE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3424 | _create_privacy_item_deny_resp_cb, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3425 | g_strdup(dn)); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3426 | if (_check_for_disconnect(user, rc)) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3427 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3428 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3429 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3430 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3431 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3432 | num_folders = nm_folder_get_subfolder_count(user->root_folder); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3433 | for (i = 0; i < num_folders; i++) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3434 | folder = nm_folder_get_subfolder(user->root_folder, i); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3435 | num_contacts = nm_folder_get_contact_count(folder); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3436 | for (j = 0; j < num_contacts; j++) { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3437 | contact = nm_folder_get_contact(folder, j); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3438 | dn = nm_contact_get_dn(contact); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3439 | if (dn && !g_slist_find_custom(user->allow_list, |
|
17154
044116b99ca1
Replace nm_utf8_strcasecmp() with purple_utf8_strcasecmp().
Richard Laager <rlaager@pidgin.im>
parents:
16746
diff
changeset
|
3440 | dn, (GCompareFunc)purple_utf8_strcasecmp)) |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3441 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3442 | rc = nm_send_create_privacy_item(user, dn, TRUE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3443 | _create_privacy_item_deny_resp_cb, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3444 | g_strdup(dn)); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3445 | if (_check_for_disconnect(user, rc)) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3446 | return; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3447 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3448 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3449 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3450 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3451 | /* set to default deny */ |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3452 | rc = nm_send_set_privacy_default(user, TRUE, |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3453 | _set_privacy_default_resp_cb, NULL); |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3454 | if (_check_for_disconnect(user, rc)) |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3455 | break; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3456 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3457 | break; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3458 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3459 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3460 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3461 | static GList * |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
3462 | novell_blist_node_menu(PurpleProtocolClient *client, PurpleBlistNode *node) |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3463 | { |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3464 | GList *list = NULL; |
|
39481
4db28449567d
Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
3465 | PurpleActionMenu *act; |
| 15884 | 3466 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
3467 | if(PURPLE_IS_BUDDY(node)) { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
3468 | act = purple_action_menu_new(_("Initiate _Chat"), |
| 15884 | 3469 | PURPLE_CALLBACK(_initiate_conference_cb), |
| 13020 | 3470 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3471 | list = g_list_append(list, act); |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3472 | } |
|
8933
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3473 | |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3474 | return list; |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3475 | } |
|
0f1e8160581d
[gaim-migrate @ 9703]
Mike Stoddard <mistoddard@novell.com>
parents:
8838
diff
changeset
|
3476 | |
|
9268
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3477 | static void |
| 15884 | 3478 | novell_keepalive(PurpleConnection *gc) |
|
9268
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3479 | { |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3480 | NMUser *user; |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3481 | NMERR_T rc = NM_OK; |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3482 | |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3483 | if (gc == NULL) |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3484 | return; |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3485 | |
|
32267
3a87255b3ddc
Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
3486 | user = purple_connection_get_protocol_data(gc); |
|
9268
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3487 | if (user == NULL) |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3488 | return; |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3489 | |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3490 | rc = nm_send_keepalive(user, NULL, NULL); |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3491 | _check_for_disconnect(user, rc); |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3492 | } |
|
196cbf2cae4c
[gaim-migrate @ 10069]
Mike Stoddard <mistoddard@novell.com>
parents:
9030
diff
changeset
|
3493 | |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
3494 | static const char * |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
3495 | novell_normalize(PurpleProtocolClient *client, PurpleAccount *account, |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
3496 | const char *who) |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
3497 | { |
|
40637
08cb47165790
Fix a bug in purple_protocol_client_normalize which was requiring an account. Also remove the account parameter from purple_normalize_nocase as it wasn't used there.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
3498 | return purple_normalize_nocase(who); |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
3499 | } |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
3500 | |
|
34321
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34312
diff
changeset
|
3501 | static gssize |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
3502 | novell_get_max_message_size(PurpleProtocolClient *client, |
|
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
3503 | PurpleConversation *conv) |
|
34312
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34111
diff
changeset
|
3504 | { |
|
34321
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34312
diff
changeset
|
3505 | /* XXX: got from pidgin-otr - verify and document it */ |
|
34312
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34111
diff
changeset
|
3506 | return 1792; |
|
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34111
diff
changeset
|
3507 | } |
|
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34111
diff
changeset
|
3508 | |
|
36588
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3509 | static void |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3510 | novell_protocol_init(NovellProtocol *self) |
|
36588
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3511 | { |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3512 | PurpleProtocol *protocol = PURPLE_PROTOCOL(self); |
|
36588
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3513 | PurpleAccountOption *option; |
|
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3514 | |
| 37004 | 3515 | protocol->id = "prpl-novell"; |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
3516 | protocol->name = "GroupWise"; |
|
36588
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3517 | |
|
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3518 | option = purple_account_option_string_new(_("Server address"), "server", NULL); |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
37004
diff
changeset
|
3519 | protocol->account_options = |
|
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
37004
diff
changeset
|
3520 | g_list_append(protocol->account_options, option); |
|
36588
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3521 | |
|
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3522 | option = purple_account_option_int_new(_("Server port"), "port", DEFAULT_PORT); |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
37004
diff
changeset
|
3523 | protocol->account_options = |
|
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
37004
diff
changeset
|
3524 | g_list_append(protocol->account_options, option); |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
3525 | } |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
3526 | |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
3527 | static void |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3528 | novell_protocol_class_init(NovellProtocolClass *klass) |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
3529 | { |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3530 | PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass); |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3531 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3532 | protocol_class->login = novell_login; |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3533 | protocol_class->close = novell_close; |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3534 | protocol_class->status_types = novell_status_types; |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3535 | protocol_class->list_icon = novell_list_icon; |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3536 | } |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3537 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3538 | static void |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3539 | novell_protocol_class_finalize(G_GNUC_UNUSED NovellProtocolClass *klass) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3540 | { |
|
36588
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3541 | } |
| 8675 | 3542 | |
| 3543 | static void | |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
3544 | novell_protocol_client_iface_init(PurpleProtocolClientInterface *client_iface) |
|
36588
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3545 | { |
|
36729
7f9fac14ed60
Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents:
36714
diff
changeset
|
3546 | client_iface->status_text = novell_status_text; |
|
7f9fac14ed60
Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents:
36714
diff
changeset
|
3547 | client_iface->tooltip_text = novell_tooltip_text; |
|
7f9fac14ed60
Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents:
36714
diff
changeset
|
3548 | client_iface->blist_node_menu = novell_blist_node_menu; |
|
7f9fac14ed60
Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents:
36714
diff
changeset
|
3549 | client_iface->convo_closed = novell_convo_closed; |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40521
diff
changeset
|
3550 | client_iface->normalize = novell_normalize; |
|
36729
7f9fac14ed60
Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents:
36714
diff
changeset
|
3551 | client_iface->get_max_message_size = novell_get_max_message_size; |
|
36588
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3552 | } |
|
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3553 | |
|
36734
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3554 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
3555 | novell_protocol_server_iface_init(PurpleProtocolServerInterface *server_iface) |
|
36734
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3556 | { |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3557 | server_iface->get_info = novell_get_info; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3558 | server_iface->set_status = novell_set_status; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3559 | server_iface->set_idle = novell_set_idle; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3560 | server_iface->add_buddy = novell_add_buddy; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3561 | server_iface->remove_buddy = novell_remove_buddy; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3562 | server_iface->keepalive = novell_keepalive; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3563 | server_iface->alias_buddy = novell_alias_buddy; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3564 | server_iface->group_buddy = novell_group_buddy; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3565 | server_iface->rename_group = novell_rename_group; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3566 | server_iface->remove_group = novell_remove_group; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3567 | } |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3568 | |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3569 | static void |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
3570 | novell_protocol_im_iface_init(PurpleProtocolIMInterface *im_iface) |
|
36734
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3571 | { |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3572 | im_iface->send = novell_send_im; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3573 | im_iface->send_typing = novell_send_typing; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3574 | } |
| 8675 | 3575 | |
| 3576 | static void | |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
3577 | novell_protocol_chat_iface_init(PurpleProtocolChatInterface *chat_iface) |
|
36734
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3578 | { |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3579 | chat_iface->invite = novell_chat_invite; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3580 | chat_iface->leave = novell_chat_leave; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3581 | chat_iface->send = novell_chat_send; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3582 | } |
| 8675 | 3583 | |
| 3584 | static void | |
|
39757
4a5ba806d8c9
Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
3585 | novell_protocol_privacy_iface_init(PurpleProtocolPrivacyInterface *privacy_iface) |
| 8675 | 3586 | { |
|
36734
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3587 | privacy_iface->add_permit = novell_add_permit; |
|
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3588 | privacy_iface->add_deny = novell_add_deny; |
|
40521
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3589 | privacy_iface->remove_permit = novell_remove_permit; |
|
c4269b37a13a
Make PurpleProtocolPrivacy a proper GInterface and move it to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
40507
diff
changeset
|
3590 | privacy_iface->remove_deny = novell_remove_deny; |
|
36734
ed3ee92d5092
Refactored msn, mxit, myspace, novell to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents:
36729
diff
changeset
|
3591 | privacy_iface->set_permit_deny = novell_set_permit_deny; |
| 8675 | 3592 | } |
| 3593 | ||
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3594 | G_DEFINE_DYNAMIC_TYPE_EXTENDED( |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3595 | NovellProtocol, novell_protocol, PURPLE_TYPE_PROTOCOL, 0, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3596 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3597 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CLIENT, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3598 | novell_protocol_client_iface_init) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3599 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3600 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_SERVER, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3601 | novell_protocol_server_iface_init) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3602 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3603 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_IM, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3604 | novell_protocol_im_iface_init) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3605 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3606 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CHAT, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3607 | novell_protocol_chat_iface_init) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3608 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3609 | G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_PRIVACY, |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3610 | novell_protocol_privacy_iface_init)); |
|
36714
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
3611 | |
|
36529
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3612 | static PurplePluginInfo * |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3613 | plugin_query(GError **error) |
| 8675 | 3614 | { |
|
36529
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3615 | return purple_plugin_info_new( |
|
36985
9faafe43603e
Rename protocol plugin IDs to prpl-*
Ankit Vani <a@nevitus.org>
parents:
36862
diff
changeset
|
3616 | "id", "prpl-novell", |
|
36638
5f6dcd83e8c1
Seperate plugin and protocol IDs. Protocol ID example: "msn". Plugin ID example: "protocol-msn".
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
3617 | "name", "Novell GroupWise Protocol", |
|
36529
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3618 | "version", DISPLAY_VERSION, |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3619 | "category", N_("Protocol"), |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3620 | "summary", N_("Novell GroupWise Messenger Protocol Plugin"), |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3621 | "description", N_("Novell GroupWise Messenger Protocol Plugin"), |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3622 | "website", PURPLE_WEBSITE, |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3623 | "abi-version", PURPLE_ABI_VERSION, |
|
36653
4084c34c051d
Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents:
36652
diff
changeset
|
3624 | "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL | |
|
4084c34c051d
Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents:
36652
diff
changeset
|
3625 | PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD, |
|
36529
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3626 | NULL |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3627 | ); |
| 8675 | 3628 | } |
| 3629 | ||
|
36529
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3630 | static gboolean |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3631 | plugin_load(PurplePlugin *plugin, GError **error) |
| 8675 | 3632 | { |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39760
diff
changeset
|
3633 | novell_protocol_register_type(G_TYPE_MODULE(plugin)); |
|
36714
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
3634 | |
|
36628
3d43ca8d69ee
Refactored the protocols to use the error argument of purple_protocols_{add/remove}
Ankit Vani <a@nevitus.org>
parents:
36621
diff
changeset
|
3635 | my_protocol = purple_protocols_add(NOVELL_TYPE_PROTOCOL, error); |
|
3d43ca8d69ee
Refactored the protocols to use the error argument of purple_protocols_{add/remove}
Ankit Vani <a@nevitus.org>
parents:
36621
diff
changeset
|
3636 | if (!my_protocol) |
|
36588
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3637 | return FALSE; |
|
36529
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3638 | |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3639 | return TRUE; |
| 8675 | 3640 | } |
| 3641 | ||
|
36529
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3642 | static gboolean |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3643 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3644 | { |
|
36628
3d43ca8d69ee
Refactored the protocols to use the error argument of purple_protocols_{add/remove}
Ankit Vani <a@nevitus.org>
parents:
36621
diff
changeset
|
3645 | if (!purple_protocols_remove(my_protocol, error)) |
|
36588
5f2a39b1c49f
Refactored novell to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36583
diff
changeset
|
3646 | return FALSE; |
|
36529
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3647 | |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3648 | return TRUE; |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3649 | } |
|
2450be7d96d6
Refactored novell to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
3650 | |
|
36714
ec178f7d66da
Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
3651 | PURPLE_PLUGIN_INIT(novell, plugin_query, plugin_load, plugin_unload); |