Mercurial > pidgin
diff libpurple/protocols/novell/novell.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | f07501af8bae |
children |
line wrap: on
line diff
--- a/libpurple/protocols/novell/novell.c Sat Jun 02 02:30:13 2012 +0000 +++ b/libpurple/protocols/novell/novell.c Sat Jun 02 02:30:49 2012 +0000 @@ -131,8 +131,8 @@ /* Don't attempt to auto-reconnect if our * password was invalid. */ - if (!purple_account_get_remember_password(gc->account)) - purple_account_set_password(gc->account, NULL); + if (!purple_account_get_remember_password(purple_connection_get_account(gc))) + purple_account_set_password(purple_connection_get_account(gc), NULL); reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; break; default: @@ -140,7 +140,7 @@ reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; } - purple_connection_error_reason(gc, reason, err); + purple_connection_error(gc, reason, err); g_free(err); } } @@ -741,16 +741,16 @@ if (allowed) { - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, display_id, TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE); } } else { - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, display_id, TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE); } } @@ -789,10 +789,10 @@ if (display_id) { - if (!g_slist_find_custom(gc->account->deny, + if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, display_id, TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE); } } else { @@ -840,11 +840,11 @@ if (display_id) { - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, display_id, TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE); } } else { @@ -1126,7 +1126,7 @@ if (_is_disconnect_error(err)) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error communicating with server. Closing connection.")); return TRUE; @@ -1177,7 +1177,6 @@ const char *dn; const char *name; int idle = 0; - gboolean loggedin = TRUE; account = purple_buddy_get_account(buddy); name = purple_buddy_get_name(buddy); @@ -1194,7 +1193,6 @@ break; case NM_STATUS_OFFLINE: status_id = NOVELL_STATUS_TYPE_OFFLINE; - loggedin = FALSE; break; case NM_STATUS_AWAY_IDLE: status_id = NOVELL_STATUS_TYPE_AWAY; @@ -1202,7 +1200,6 @@ break; default: status_id = NOVELL_STATUS_TYPE_OFFLINE; - loggedin = FALSE; break; } @@ -1404,15 +1401,15 @@ /* Set the Purple privacy setting */ if (user->default_deny) { if (user->allow_list == NULL) { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_ALL; + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_ALL); } else { - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_USERS); } } else { if (user->deny_list == NULL) { - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL; + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_ALL); } else { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_USERS); } } @@ -1424,9 +1421,9 @@ else name =(char *)node->data; - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, name , TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE); } } @@ -1437,15 +1434,15 @@ else name =(char *)node->data; - if (!g_slist_find_custom(gc->account->deny, + if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, name, TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), name, TRUE); } } /* Remove stuff */ - for (node = gc->account->permit; node; node = node->next) { + for (node = purple_connection_get_account(gc)->permit; node; node = node->next) { dn = nm_lookup_dn(user, (char *)node->data); if (dn != NULL && !g_slist_find_custom(user->allow_list, @@ -1456,13 +1453,13 @@ if (rem_list) { for (node = rem_list; node; node = node->next) { - purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } g_slist_free(rem_list); rem_list = NULL; } - for (node = gc->account->deny; node; node = node->next) { + for (node = purple_connection_get_account(gc)->deny; node; node = node->next) { dn = nm_lookup_dn(user, (char *)node->data); if (dn != NULL && !g_slist_find_custom(user->deny_list, @@ -1473,7 +1470,7 @@ if (rem_list) { for (node = rem_list; node; node = node->next) { - purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } g_slist_free(rem_list); } @@ -1515,20 +1512,27 @@ tag = _("User ID"); value = nm_user_record_get_userid(user_record); if (value) { - purple_notify_user_info_add_pair(user_info, tag, value); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ + purple_notify_user_info_add_pair_html(user_info, tag, value); } -/* tag = _("DN"); +#if 0 + tag = _("DN"); value = nm_user_record_get_dn(user_record); if (value) { - purple_notify_user_info_add_pair(user_info, tag, value); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ + purple_notify_user_info_add_pair_html(user_info, tag, value); } -*/ +#endif /* if 0 */ tag = _("Full name"); value = nm_user_record_get_full_name(user_record); if (value) { - purple_notify_user_info_add_pair(user_info, tag, value); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ + purple_notify_user_info_add_pair_html(user_info, tag, value); } count = nm_user_record_get_property_count(user_record); @@ -1538,7 +1542,9 @@ tag = _map_property_tag(nm_property_get_tag(property)); value = nm_property_get_value(property); if (tag && value) { - purple_notify_user_info_add_pair(user_info, tag, value); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ + purple_notify_user_info_add_pair_html(user_info, tag, value); } nm_release_property(property); } @@ -1620,7 +1626,7 @@ buddy = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -1676,7 +1682,7 @@ NMUser *user; gc = data; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); user->conn->ssl_conn->data = NULL; purple_connection_ssl_error (gc, error); @@ -1693,7 +1699,7 @@ if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -1702,7 +1708,7 @@ if (_is_disconnect_error(rc)) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error communicating with server. Closing connection.")); } else { @@ -1727,7 +1733,7 @@ if (gc == NULL || gsc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if ((user == NULL) || (conn = user->conn) == NULL) return; @@ -1743,7 +1749,7 @@ conn->connected = TRUE; purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc); } else { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } @@ -2028,7 +2034,7 @@ { if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _("You have signed on from another location")); } @@ -2184,7 +2190,7 @@ */ /* ...but for now just error out with a nice message. */ - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Unable to connect to server. Please enter the " "address of the server to which you wish to connect.")); @@ -2197,7 +2203,7 @@ user = nm_initialize_user(name, server, port, account, _event_callback); if (user && user->conn) { /* save user */ - gc->proto_data = user; + purple_connection_set_protocol_data(gc, user); /* connect to the server */ purple_connection_update_progress(gc, _("Connecting"), @@ -2213,7 +2219,7 @@ user->conn->addr, user->conn->port, novell_ssl_connected_cb, novell_ssl_connect_error, gc); if (user->conn->ssl_conn->data == NULL) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); } @@ -2229,7 +2235,7 @@ if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { conn = user->conn; if (conn && conn->ssl_conn) { @@ -2237,7 +2243,7 @@ } nm_deinitialize_user(user); } - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } static int @@ -2257,7 +2263,7 @@ message_body == NULL || *message_body == '\0') return 0; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return 0; @@ -2343,7 +2349,7 @@ if (gc == NULL || name == NULL) return 0; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return 0; @@ -2377,7 +2383,7 @@ if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, who))) { conf = nm_find_conversation(user, dn); if (conf) { @@ -2399,7 +2405,7 @@ if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -2431,7 +2437,7 @@ if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -2470,7 +2476,7 @@ if (gc == NULL || text == NULL) return -1; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return -1; @@ -2536,7 +2542,7 @@ } static void -novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group) +novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group, const char *message) { NMFolder *folder = NULL; NMContact *contact; @@ -2610,7 +2616,7 @@ if (gc == NULL || buddy == NULL || group == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)))) { gname = purple_group_get_name(group); if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { @@ -2642,7 +2648,7 @@ if (gc == NULL || group == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { NMFolder *folder = nm_find_folder(user, purple_group_get_name(group)); @@ -2667,7 +2673,7 @@ if (gc == NULL || name == NULL || alias == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, name))) { /* Alias all of instances of the contact */ @@ -2726,7 +2732,7 @@ old_group_name == NULL || new_group_name == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, name))) { /* Find the old folder */ @@ -2784,7 +2790,7 @@ return; } - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { const char *gname = purple_group_get_name(group); /* Does new folder exist already? */ @@ -2830,7 +2836,7 @@ return; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - if (gc == NULL || (user = gc->proto_data) == NULL) + if (gc == NULL || (user = purple_connection_get_protocol_data(gc)) == NULL) return; if (PURPLE_BUDDY_IS_ONLINE(buddy)) { @@ -2860,10 +2866,13 @@ break; } - purple_notify_user_info_add_pair(user_info, _("Status"), status_str); - - if (text) - purple_notify_user_info_add_pair(user_info, _("Message"), text); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), status_str); + + if (text) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ + purple_notify_user_info_add_pair_html(user_info, _("Message"), text); + } } } } @@ -2879,7 +2888,7 @@ if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -2908,7 +2917,7 @@ if (gc == NULL || name == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { user_record = nm_find_user_record(user, name); @@ -2937,17 +2946,19 @@ if (buddy && account) { PurpleConnection *gc = purple_account_get_connection(account); - if (gc && gc->proto_data) { - NMUser *user = gc->proto_data; - - dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); - if (dn) { - NMUserRecord *user_record = nm_find_user_record(user, dn); - - if (user_record) { - text = nm_user_record_get_status_text(user_record); - if (text) - return g_strdup(text); + if (gc) { + NMUser *user = purple_connection_get_protocol_data(gc); + + if (user) { + dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); + if (dn) { + NMUserRecord *user_record = nm_find_user_record(user, dn); + + if (user_record) { + text = nm_user_record_get_status_text(user_record); + if (text) + return g_strdup(text); + } } } } @@ -3023,7 +3034,7 @@ return; gc = purple_account_get_connection(account); - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3070,14 +3081,14 @@ if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; /* Remove first -- we will add it back in when we get * the okay from the server */ - purple_privacy_permit_remove(gc->account, who, TRUE); + purple_privacy_permit_remove(purple_connection_get_account(gc), who, TRUE); if (nm_user_is_privacy_locked(user)) { _show_privacy_locked_error(gc, user); @@ -3114,14 +3125,14 @@ if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; /* Remove first -- we will add it back in when we get * the okay from the server */ - purple_privacy_deny_remove(gc->account, who, TRUE); + purple_privacy_deny_remove(purple_connection_get_account(gc), who, TRUE); if (nm_user_is_privacy_locked(user)) { _show_privacy_locked_error(gc, user); @@ -3158,7 +3169,7 @@ if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3188,7 +3199,7 @@ if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3223,7 +3234,7 @@ if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3239,7 +3250,7 @@ return; } - switch (gc->account->perm_deny) { + switch (purple_account_get_privacy_type(purple_connection_get_account(gc))) { case PURPLE_PRIVACY_ALLOW_ALL: rc = nm_send_set_privacy_default(user, FALSE, @@ -3295,14 +3306,14 @@ if (user_record) { name = nm_user_record_get_display_id(user_record); - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, name , TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE); } } } - for (node = gc->account->permit; node; node = node->next) { + for (node = purple_connection_get_account(gc)->permit; node; node = node->next) { name = NULL; dn = nm_lookup_dn(user, (char *)node->data); if (dn) { @@ -3316,7 +3327,7 @@ g_strdup(dn)); } } else { - purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } } } @@ -3337,14 +3348,14 @@ if (user_record) { name = nm_user_record_get_display_id(user_record); - if (!g_slist_find_custom(gc->account->deny, + if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, name , TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), name , TRUE); } } } - for (node = gc->account->deny; node; node = node->next) { + for (node = purple_connection_get_account(gc)->deny; node; node = node->next) { name = NULL; dn = nm_lookup_dn(user, (char *)node->data); @@ -3359,7 +3370,7 @@ g_strdup(name)); } } else { - purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } } @@ -3451,7 +3462,7 @@ if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3460,6 +3471,7 @@ } static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ 0, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -3500,7 +3512,6 @@ novell_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ novell_alias_buddy, /* alias_buddy */ novell_group_buddy, /* group_buddy */ novell_rename_group, /* rename_group */ @@ -3525,15 +3536,12 @@ NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = {