Mercurial > pidgin
comparison 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 |
comparison
equal
deleted
inserted
replaced
32818:01ff09d4a463 | 32819:2c6510167895 |
---|---|
129 case NMERR_CREDENTIALS_MISSING: | 129 case NMERR_CREDENTIALS_MISSING: |
130 case NMERR_PASSWORD_INVALID: | 130 case NMERR_PASSWORD_INVALID: |
131 /* Don't attempt to auto-reconnect if our | 131 /* Don't attempt to auto-reconnect if our |
132 * password was invalid. | 132 * password was invalid. |
133 */ | 133 */ |
134 if (!purple_account_get_remember_password(gc->account)) | 134 if (!purple_account_get_remember_password(purple_connection_get_account(gc))) |
135 purple_account_set_password(gc->account, NULL); | 135 purple_account_set_password(purple_connection_get_account(gc), NULL); |
136 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; | 136 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
137 break; | 137 break; |
138 default: | 138 default: |
139 /* FIXME: There are other reasons login could fail */ | 139 /* FIXME: There are other reasons login could fail */ |
140 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; | 140 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
141 } | 141 } |
142 | 142 |
143 purple_connection_error_reason(gc, reason, err); | 143 purple_connection_error(gc, reason, err); |
144 g_free(err); | 144 g_free(err); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 /* Handle getstatus response*/ | 148 /* Handle getstatus response*/ |
739 | 739 |
740 if (ret_code == NM_OK) { | 740 if (ret_code == NM_OK) { |
741 | 741 |
742 if (allowed) { | 742 if (allowed) { |
743 | 743 |
744 if (!g_slist_find_custom(gc->account->permit, | 744 if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, |
745 display_id, (GCompareFunc)purple_utf8_strcasecmp)) { | 745 display_id, (GCompareFunc)purple_utf8_strcasecmp)) { |
746 purple_privacy_permit_add(gc->account, display_id, TRUE); | 746 purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE); |
747 } | 747 } |
748 | 748 |
749 } else { | 749 } else { |
750 | 750 |
751 if (!g_slist_find_custom(gc->account->permit, | 751 if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, |
752 display_id, (GCompareFunc)purple_utf8_strcasecmp)) { | 752 display_id, (GCompareFunc)purple_utf8_strcasecmp)) { |
753 purple_privacy_deny_add(gc->account, display_id, TRUE); | 753 purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE); |
754 } | 754 } |
755 } | 755 } |
756 | 756 |
757 } else { | 757 } else { |
758 | 758 |
787 if (user_record) | 787 if (user_record) |
788 display_id = nm_user_record_get_display_id(user_record); | 788 display_id = nm_user_record_get_display_id(user_record); |
789 | 789 |
790 if (display_id) { | 790 if (display_id) { |
791 | 791 |
792 if (!g_slist_find_custom(gc->account->deny, | 792 if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, |
793 display_id, (GCompareFunc)purple_utf8_strcasecmp)) { | 793 display_id, (GCompareFunc)purple_utf8_strcasecmp)) { |
794 | 794 |
795 purple_privacy_deny_add(gc->account, display_id, TRUE); | 795 purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE); |
796 } | 796 } |
797 | 797 |
798 } else { | 798 } else { |
799 rc = nm_send_get_details(user, who, | 799 rc = nm_send_get_details(user, who, |
800 _get_details_resp_add_privacy_item, | 800 _get_details_resp_add_privacy_item, |
838 if (user_record) | 838 if (user_record) |
839 display_id = nm_user_record_get_display_id(user_record); | 839 display_id = nm_user_record_get_display_id(user_record); |
840 | 840 |
841 if (display_id) { | 841 if (display_id) { |
842 | 842 |
843 if (!g_slist_find_custom(gc->account->permit, | 843 if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, |
844 display_id, | 844 display_id, |
845 (GCompareFunc)purple_utf8_strcasecmp)) { | 845 (GCompareFunc)purple_utf8_strcasecmp)) { |
846 | 846 |
847 purple_privacy_permit_add(gc->account, display_id, TRUE); | 847 purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE); |
848 } | 848 } |
849 | 849 |
850 } else { | 850 } else { |
851 rc = nm_send_get_details(user, who, | 851 rc = nm_send_get_details(user, who, |
852 _get_details_resp_add_privacy_item, | 852 _get_details_resp_add_privacy_item, |
1124 { | 1124 { |
1125 PurpleConnection *gc = purple_account_get_connection(user->client_data); | 1125 PurpleConnection *gc = purple_account_get_connection(user->client_data); |
1126 | 1126 |
1127 if (_is_disconnect_error(err)) { | 1127 if (_is_disconnect_error(err)) { |
1128 | 1128 |
1129 purple_connection_error_reason(gc, | 1129 purple_connection_error(gc, |
1130 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 1130 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
1131 _("Error communicating with server. Closing connection.")); | 1131 _("Error communicating with server. Closing connection.")); |
1132 return TRUE; | 1132 return TRUE; |
1133 | 1133 |
1134 } | 1134 } |
1175 const char *status_id; | 1175 const char *status_id; |
1176 const char *text = NULL; | 1176 const char *text = NULL; |
1177 const char *dn; | 1177 const char *dn; |
1178 const char *name; | 1178 const char *name; |
1179 int idle = 0; | 1179 int idle = 0; |
1180 gboolean loggedin = TRUE; | |
1181 | 1180 |
1182 account = purple_buddy_get_account(buddy); | 1181 account = purple_buddy_get_account(buddy); |
1183 name = purple_buddy_get_name(buddy); | 1182 name = purple_buddy_get_name(buddy); |
1184 | 1183 |
1185 switch (novellstatus) { | 1184 switch (novellstatus) { |
1192 case NM_STATUS_BUSY: | 1191 case NM_STATUS_BUSY: |
1193 status_id = NOVELL_STATUS_TYPE_BUSY; | 1192 status_id = NOVELL_STATUS_TYPE_BUSY; |
1194 break; | 1193 break; |
1195 case NM_STATUS_OFFLINE: | 1194 case NM_STATUS_OFFLINE: |
1196 status_id = NOVELL_STATUS_TYPE_OFFLINE; | 1195 status_id = NOVELL_STATUS_TYPE_OFFLINE; |
1197 loggedin = FALSE; | |
1198 break; | 1196 break; |
1199 case NM_STATUS_AWAY_IDLE: | 1197 case NM_STATUS_AWAY_IDLE: |
1200 status_id = NOVELL_STATUS_TYPE_AWAY; | 1198 status_id = NOVELL_STATUS_TYPE_AWAY; |
1201 idle = gmt; | 1199 idle = gmt; |
1202 break; | 1200 break; |
1203 default: | 1201 default: |
1204 status_id = NOVELL_STATUS_TYPE_OFFLINE; | 1202 status_id = NOVELL_STATUS_TYPE_OFFLINE; |
1205 loggedin = FALSE; | |
1206 break; | 1203 break; |
1207 } | 1204 } |
1208 | 1205 |
1209 /* Get status text for the user */ | 1206 /* Get status text for the user */ |
1210 dn = nm_lookup_dn(user, name); | 1207 dn = nm_lookup_dn(user, name); |
1402 return; | 1399 return; |
1403 | 1400 |
1404 /* Set the Purple privacy setting */ | 1401 /* Set the Purple privacy setting */ |
1405 if (user->default_deny) { | 1402 if (user->default_deny) { |
1406 if (user->allow_list == NULL) { | 1403 if (user->allow_list == NULL) { |
1407 gc->account->perm_deny = PURPLE_PRIVACY_DENY_ALL; | 1404 purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_ALL); |
1408 } else { | 1405 } else { |
1409 gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; | 1406 purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_USERS); |
1410 } | 1407 } |
1411 } else { | 1408 } else { |
1412 if (user->deny_list == NULL) { | 1409 if (user->deny_list == NULL) { |
1413 gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL; | 1410 purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_ALL); |
1414 } else { | 1411 } else { |
1415 gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; | 1412 purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_USERS); |
1416 } | 1413 } |
1417 } | 1414 } |
1418 | 1415 |
1419 /* Add stuff */ | 1416 /* Add stuff */ |
1420 for (node = user->allow_list; node; node = node->next) { | 1417 for (node = user->allow_list; node; node = node->next) { |
1422 if (user_record) | 1419 if (user_record) |
1423 name = nm_user_record_get_display_id(user_record); | 1420 name = nm_user_record_get_display_id(user_record); |
1424 else | 1421 else |
1425 name =(char *)node->data; | 1422 name =(char *)node->data; |
1426 | 1423 |
1427 if (!g_slist_find_custom(gc->account->permit, | 1424 if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, |
1428 name, (GCompareFunc)purple_utf8_strcasecmp)) { | 1425 name, (GCompareFunc)purple_utf8_strcasecmp)) { |
1429 purple_privacy_permit_add(gc->account, name , TRUE); | 1426 purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE); |
1430 } | 1427 } |
1431 } | 1428 } |
1432 | 1429 |
1433 for (node = user->deny_list; node; node = node->next) { | 1430 for (node = user->deny_list; node; node = node->next) { |
1434 user_record = nm_find_user_record(user, (char *)node->data); | 1431 user_record = nm_find_user_record(user, (char *)node->data); |
1435 if (user_record) | 1432 if (user_record) |
1436 name = nm_user_record_get_display_id(user_record); | 1433 name = nm_user_record_get_display_id(user_record); |
1437 else | 1434 else |
1438 name =(char *)node->data; | 1435 name =(char *)node->data; |
1439 | 1436 |
1440 if (!g_slist_find_custom(gc->account->deny, | 1437 if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, |
1441 name, (GCompareFunc)purple_utf8_strcasecmp)) { | 1438 name, (GCompareFunc)purple_utf8_strcasecmp)) { |
1442 purple_privacy_deny_add(gc->account, name, TRUE); | 1439 purple_privacy_deny_add(purple_connection_get_account(gc), name, TRUE); |
1443 } | 1440 } |
1444 } | 1441 } |
1445 | 1442 |
1446 | 1443 |
1447 /* Remove stuff */ | 1444 /* Remove stuff */ |
1448 for (node = gc->account->permit; node; node = node->next) { | 1445 for (node = purple_connection_get_account(gc)->permit; node; node = node->next) { |
1449 dn = nm_lookup_dn(user, (char *)node->data); | 1446 dn = nm_lookup_dn(user, (char *)node->data); |
1450 if (dn != NULL && | 1447 if (dn != NULL && |
1451 !g_slist_find_custom(user->allow_list, | 1448 !g_slist_find_custom(user->allow_list, |
1452 dn, (GCompareFunc)purple_utf8_strcasecmp)) { | 1449 dn, (GCompareFunc)purple_utf8_strcasecmp)) { |
1453 rem_list = g_slist_append(rem_list, node->data); | 1450 rem_list = g_slist_append(rem_list, node->data); |
1454 } | 1451 } |
1455 } | 1452 } |
1456 | 1453 |
1457 if (rem_list) { | 1454 if (rem_list) { |
1458 for (node = rem_list; node; node = node->next) { | 1455 for (node = rem_list; node; node = node->next) { |
1459 purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); | 1456 purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); |
1460 } | 1457 } |
1461 g_slist_free(rem_list); | 1458 g_slist_free(rem_list); |
1462 rem_list = NULL; | 1459 rem_list = NULL; |
1463 } | 1460 } |
1464 | 1461 |
1465 for (node = gc->account->deny; node; node = node->next) { | 1462 for (node = purple_connection_get_account(gc)->deny; node; node = node->next) { |
1466 dn = nm_lookup_dn(user, (char *)node->data); | 1463 dn = nm_lookup_dn(user, (char *)node->data); |
1467 if (dn != NULL && | 1464 if (dn != NULL && |
1468 !g_slist_find_custom(user->deny_list, | 1465 !g_slist_find_custom(user->deny_list, |
1469 dn, (GCompareFunc)purple_utf8_strcasecmp)) { | 1466 dn, (GCompareFunc)purple_utf8_strcasecmp)) { |
1470 rem_list = g_slist_append(rem_list, node->data); | 1467 rem_list = g_slist_append(rem_list, node->data); |
1471 } | 1468 } |
1472 } | 1469 } |
1473 | 1470 |
1474 if (rem_list) { | 1471 if (rem_list) { |
1475 for (node = rem_list; node; node = node->next) { | 1472 for (node = rem_list; node; node = node->next) { |
1476 purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); | 1473 purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); |
1477 } | 1474 } |
1478 g_slist_free(rem_list); | 1475 g_slist_free(rem_list); |
1479 } | 1476 } |
1480 } | 1477 } |
1481 | 1478 |
1513 const char *tag, *value; | 1510 const char *tag, *value; |
1514 | 1511 |
1515 tag = _("User ID"); | 1512 tag = _("User ID"); |
1516 value = nm_user_record_get_userid(user_record); | 1513 value = nm_user_record_get_userid(user_record); |
1517 if (value) { | 1514 if (value) { |
1518 purple_notify_user_info_add_pair(user_info, tag, value); | 1515 /* TODO: Check whether it's correct to call add_pair_html, |
1519 } | 1516 or if we should be using add_pair_plaintext */ |
1520 | 1517 purple_notify_user_info_add_pair_html(user_info, tag, value); |
1521 /* tag = _("DN"); | 1518 } |
1519 | |
1520 #if 0 | |
1521 tag = _("DN"); | |
1522 value = nm_user_record_get_dn(user_record); | 1522 value = nm_user_record_get_dn(user_record); |
1523 if (value) { | 1523 if (value) { |
1524 purple_notify_user_info_add_pair(user_info, tag, value); | 1524 /* TODO: Check whether it's correct to call add_pair_html, |
1525 } | 1525 or if we should be using add_pair_plaintext */ |
1526 */ | 1526 purple_notify_user_info_add_pair_html(user_info, tag, value); |
1527 } | |
1528 #endif /* if 0 */ | |
1527 | 1529 |
1528 tag = _("Full name"); | 1530 tag = _("Full name"); |
1529 value = nm_user_record_get_full_name(user_record); | 1531 value = nm_user_record_get_full_name(user_record); |
1530 if (value) { | 1532 if (value) { |
1531 purple_notify_user_info_add_pair(user_info, tag, value); | 1533 /* TODO: Check whether it's correct to call add_pair_html, |
1534 or if we should be using add_pair_plaintext */ | |
1535 purple_notify_user_info_add_pair_html(user_info, tag, value); | |
1532 } | 1536 } |
1533 | 1537 |
1534 count = nm_user_record_get_property_count(user_record); | 1538 count = nm_user_record_get_property_count(user_record); |
1535 for (i = 0; i < count; i++) { | 1539 for (i = 0; i < count; i++) { |
1536 property = nm_user_record_get_property(user_record, i); | 1540 property = nm_user_record_get_property(user_record, i); |
1537 if (property) { | 1541 if (property) { |
1538 tag = _map_property_tag(nm_property_get_tag(property)); | 1542 tag = _map_property_tag(nm_property_get_tag(property)); |
1539 value = nm_property_get_value(property); | 1543 value = nm_property_get_value(property); |
1540 if (tag && value) { | 1544 if (tag && value) { |
1541 purple_notify_user_info_add_pair(user_info, tag, value); | 1545 /* TODO: Check whether it's correct to call add_pair_html, |
1546 or if we should be using add_pair_plaintext */ | |
1547 purple_notify_user_info_add_pair_html(user_info, tag, value); | |
1542 } | 1548 } |
1543 nm_release_property(property); | 1549 nm_release_property(property); |
1544 } | 1550 } |
1545 } | 1551 } |
1546 | 1552 |
1618 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); | 1624 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
1619 | 1625 |
1620 buddy = (PurpleBuddy *) node; | 1626 buddy = (PurpleBuddy *) node; |
1621 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); | 1627 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
1622 | 1628 |
1623 user = gc->proto_data; | 1629 user = purple_connection_get_protocol_data(gc); |
1624 if (user == NULL) | 1630 if (user == NULL) |
1625 return; | 1631 return; |
1626 | 1632 |
1627 /* We should already have a userrecord for the buddy */ | 1633 /* We should already have a userrecord for the buddy */ |
1628 user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); | 1634 user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); |
1674 { | 1680 { |
1675 PurpleConnection *gc; | 1681 PurpleConnection *gc; |
1676 NMUser *user; | 1682 NMUser *user; |
1677 | 1683 |
1678 gc = data; | 1684 gc = data; |
1679 user = gc->proto_data; | 1685 user = purple_connection_get_protocol_data(gc); |
1680 user->conn->ssl_conn->data = NULL; | 1686 user->conn->ssl_conn->data = NULL; |
1681 | 1687 |
1682 purple_connection_ssl_error (gc, error); | 1688 purple_connection_ssl_error (gc, error); |
1683 } | 1689 } |
1684 | 1690 |
1691 NMERR_T rc; | 1697 NMERR_T rc; |
1692 | 1698 |
1693 if (gc == NULL) | 1699 if (gc == NULL) |
1694 return; | 1700 return; |
1695 | 1701 |
1696 user = gc->proto_data; | 1702 user = purple_connection_get_protocol_data(gc); |
1697 if (user == NULL) | 1703 if (user == NULL) |
1698 return; | 1704 return; |
1699 | 1705 |
1700 rc = nm_process_new_data(user); | 1706 rc = nm_process_new_data(user); |
1701 if (rc != NM_OK) { | 1707 if (rc != NM_OK) { |
1702 | 1708 |
1703 if (_is_disconnect_error(rc)) { | 1709 if (_is_disconnect_error(rc)) { |
1704 | 1710 |
1705 purple_connection_error_reason(gc, | 1711 purple_connection_error(gc, |
1706 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 1712 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
1707 _("Error communicating with server. Closing connection.")); | 1713 _("Error communicating with server. Closing connection.")); |
1708 } else { | 1714 } else { |
1709 purple_debug(PURPLE_DEBUG_INFO, "novell", | 1715 purple_debug(PURPLE_DEBUG_INFO, "novell", |
1710 "Error processing event or response (%d).\n", rc); | 1716 "Error processing event or response (%d).\n", rc); |
1725 char *ua = NULL; | 1731 char *ua = NULL; |
1726 | 1732 |
1727 if (gc == NULL || gsc == NULL) | 1733 if (gc == NULL || gsc == NULL) |
1728 return; | 1734 return; |
1729 | 1735 |
1730 user = gc->proto_data; | 1736 user = purple_connection_get_protocol_data(gc); |
1731 if ((user == NULL) || (conn = user->conn) == NULL) | 1737 if ((user == NULL) || (conn = user->conn) == NULL) |
1732 return; | 1738 return; |
1733 | 1739 |
1734 purple_connection_update_progress(gc, _("Authenticating..."), | 1740 purple_connection_update_progress(gc, _("Authenticating..."), |
1735 2, NOVELL_CONNECT_STEPS); | 1741 2, NOVELL_CONNECT_STEPS); |
1741 rc = nm_send_login(user, pwd, my_addr, ua, _login_resp_cb, NULL); | 1747 rc = nm_send_login(user, pwd, my_addr, ua, _login_resp_cb, NULL); |
1742 if (rc == NM_OK) { | 1748 if (rc == NM_OK) { |
1743 conn->connected = TRUE; | 1749 conn->connected = TRUE; |
1744 purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc); | 1750 purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc); |
1745 } else { | 1751 } else { |
1746 purple_connection_error_reason(gc, | 1752 purple_connection_error(gc, |
1747 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 1753 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
1748 _("Unable to connect")); | 1754 _("Unable to connect")); |
1749 } | 1755 } |
1750 | 1756 |
1751 purple_connection_update_progress(gc, _("Waiting for response..."), | 1757 purple_connection_update_progress(gc, _("Waiting for response..."), |
2026 gc = purple_account_get_connection(account); | 2032 gc = purple_account_get_connection(account); |
2027 if (gc) | 2033 if (gc) |
2028 { | 2034 { |
2029 if (!purple_account_get_remember_password(account)) | 2035 if (!purple_account_get_remember_password(account)) |
2030 purple_account_set_password(account, NULL); | 2036 purple_account_set_password(account, NULL); |
2031 purple_connection_error_reason(gc, | 2037 purple_connection_error(gc, |
2032 PURPLE_CONNECTION_ERROR_NAME_IN_USE, | 2038 PURPLE_CONNECTION_ERROR_NAME_IN_USE, |
2033 _("You have signed on from another location")); | 2039 _("You have signed on from another location")); |
2034 } | 2040 } |
2035 } | 2041 } |
2036 | 2042 |
2182 /* TODO: Would be nice to prompt if not set! | 2188 /* TODO: Would be nice to prompt if not set! |
2183 * purple_request_fields(gc, _("Server Address"),...); | 2189 * purple_request_fields(gc, _("Server Address"),...); |
2184 */ | 2190 */ |
2185 | 2191 |
2186 /* ...but for now just error out with a nice message. */ | 2192 /* ...but for now just error out with a nice message. */ |
2187 purple_connection_error_reason(gc, | 2193 purple_connection_error(gc, |
2188 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | 2194 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
2189 _("Unable to connect to server. Please enter the " | 2195 _("Unable to connect to server. Please enter the " |
2190 "address of the server to which you wish to connect.")); | 2196 "address of the server to which you wish to connect.")); |
2191 return; | 2197 return; |
2192 } | 2198 } |
2195 name = purple_account_get_username(account); | 2201 name = purple_account_get_username(account); |
2196 | 2202 |
2197 user = nm_initialize_user(name, server, port, account, _event_callback); | 2203 user = nm_initialize_user(name, server, port, account, _event_callback); |
2198 if (user && user->conn) { | 2204 if (user && user->conn) { |
2199 /* save user */ | 2205 /* save user */ |
2200 gc->proto_data = user; | 2206 purple_connection_set_protocol_data(gc, user); |
2201 | 2207 |
2202 /* connect to the server */ | 2208 /* connect to the server */ |
2203 purple_connection_update_progress(gc, _("Connecting"), | 2209 purple_connection_update_progress(gc, _("Connecting"), |
2204 1, NOVELL_CONNECT_STEPS); | 2210 1, NOVELL_CONNECT_STEPS); |
2205 | 2211 |
2211 | 2217 |
2212 user->conn->ssl_conn->data = purple_ssl_connect(user->client_data, | 2218 user->conn->ssl_conn->data = purple_ssl_connect(user->client_data, |
2213 user->conn->addr, user->conn->port, | 2219 user->conn->addr, user->conn->port, |
2214 novell_ssl_connected_cb, novell_ssl_connect_error, gc); | 2220 novell_ssl_connected_cb, novell_ssl_connect_error, gc); |
2215 if (user->conn->ssl_conn->data == NULL) { | 2221 if (user->conn->ssl_conn->data == NULL) { |
2216 purple_connection_error_reason(gc, | 2222 purple_connection_error(gc, |
2217 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, | 2223 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, |
2218 _("SSL support unavailable")); | 2224 _("SSL support unavailable")); |
2219 } | 2225 } |
2220 } | 2226 } |
2221 } | 2227 } |
2227 NMConn *conn; | 2233 NMConn *conn; |
2228 | 2234 |
2229 if (gc == NULL) | 2235 if (gc == NULL) |
2230 return; | 2236 return; |
2231 | 2237 |
2232 user = gc->proto_data; | 2238 user = purple_connection_get_protocol_data(gc); |
2233 if (user) { | 2239 if (user) { |
2234 conn = user->conn; | 2240 conn = user->conn; |
2235 if (conn && conn->ssl_conn) { | 2241 if (conn && conn->ssl_conn) { |
2236 purple_ssl_close(user->conn->ssl_conn->data); | 2242 purple_ssl_close(user->conn->ssl_conn->data); |
2237 } | 2243 } |
2238 nm_deinitialize_user(user); | 2244 nm_deinitialize_user(user); |
2239 } | 2245 } |
2240 gc->proto_data = NULL; | 2246 purple_connection_set_protocol_data(gc, NULL); |
2241 } | 2247 } |
2242 | 2248 |
2243 static int | 2249 static int |
2244 novell_send_im(PurpleConnection * gc, const char *name, | 2250 novell_send_im(PurpleConnection * gc, const char *name, |
2245 const char *message_body, PurpleMessageFlags flags) | 2251 const char *message_body, PurpleMessageFlags flags) |
2255 | 2261 |
2256 if (gc == NULL || name == NULL || | 2262 if (gc == NULL || name == NULL || |
2257 message_body == NULL || *message_body == '\0') | 2263 message_body == NULL || *message_body == '\0') |
2258 return 0; | 2264 return 0; |
2259 | 2265 |
2260 user = gc->proto_data; | 2266 user = purple_connection_get_protocol_data(gc); |
2261 if (user == NULL) | 2267 if (user == NULL) |
2262 return 0; | 2268 return 0; |
2263 | 2269 |
2264 /* Create a new message */ | 2270 /* Create a new message */ |
2265 plain = purple_unescape_html(message_body); | 2271 plain = purple_unescape_html(message_body); |
2341 NMERR_T rc = NM_OK; | 2347 NMERR_T rc = NM_OK; |
2342 | 2348 |
2343 if (gc == NULL || name == NULL) | 2349 if (gc == NULL || name == NULL) |
2344 return 0; | 2350 return 0; |
2345 | 2351 |
2346 user = gc->proto_data; | 2352 user = purple_connection_get_protocol_data(gc); |
2347 if (user == NULL) | 2353 if (user == NULL) |
2348 return 0; | 2354 return 0; |
2349 | 2355 |
2350 /* Need to get the DN for the buddy so we can look up the convo */ | 2356 /* Need to get the DN for the buddy so we can look up the convo */ |
2351 dn = nm_lookup_dn(user, name); | 2357 dn = nm_lookup_dn(user, name); |
2375 NMERR_T rc = NM_OK; | 2381 NMERR_T rc = NM_OK; |
2376 | 2382 |
2377 if (gc == NULL || who == NULL) | 2383 if (gc == NULL || who == NULL) |
2378 return; | 2384 return; |
2379 | 2385 |
2380 user = gc->proto_data; | 2386 user = purple_connection_get_protocol_data(gc); |
2381 if (user && (dn = nm_lookup_dn(user, who))) { | 2387 if (user && (dn = nm_lookup_dn(user, who))) { |
2382 conf = nm_find_conversation(user, dn); | 2388 conf = nm_find_conversation(user, dn); |
2383 if (conf) { | 2389 if (conf) { |
2384 rc = nm_send_leave_conference(user, conf, NULL, NULL); | 2390 rc = nm_send_leave_conference(user, conf, NULL, NULL); |
2385 _check_for_disconnect(user, rc); | 2391 _check_for_disconnect(user, rc); |
2397 NMERR_T rc = NM_OK; | 2403 NMERR_T rc = NM_OK; |
2398 | 2404 |
2399 if (gc == NULL) | 2405 if (gc == NULL) |
2400 return; | 2406 return; |
2401 | 2407 |
2402 user = gc->proto_data; | 2408 user = purple_connection_get_protocol_data(gc); |
2403 if (user == NULL) | 2409 if (user == NULL) |
2404 return; | 2410 return; |
2405 | 2411 |
2406 for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { | 2412 for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { |
2407 conference = cnode->data; | 2413 conference = cnode->data; |
2429 NMUserRecord *user_record = NULL; | 2435 NMUserRecord *user_record = NULL; |
2430 | 2436 |
2431 if (gc == NULL) | 2437 if (gc == NULL) |
2432 return; | 2438 return; |
2433 | 2439 |
2434 user = gc->proto_data; | 2440 user = purple_connection_get_protocol_data(gc); |
2435 if (user == NULL) | 2441 if (user == NULL) |
2436 return; | 2442 return; |
2437 | 2443 |
2438 user_record = nm_find_user_record(user, who); | 2444 user_record = nm_find_user_record(user, who); |
2439 if (user_record == NULL) { | 2445 if (user_record == NULL) { |
2468 char *str, *plain; | 2474 char *str, *plain; |
2469 | 2475 |
2470 if (gc == NULL || text == NULL) | 2476 if (gc == NULL || text == NULL) |
2471 return -1; | 2477 return -1; |
2472 | 2478 |
2473 user = gc->proto_data; | 2479 user = purple_connection_get_protocol_data(gc); |
2474 if (user == NULL) | 2480 if (user == NULL) |
2475 return -1; | 2481 return -1; |
2476 | 2482 |
2477 plain = purple_unescape_html(text); | 2483 plain = purple_unescape_html(text); |
2478 message = nm_create_message(plain); | 2484 message = nm_create_message(plain); |
2534 | 2540 |
2535 return -1; | 2541 return -1; |
2536 } | 2542 } |
2537 | 2543 |
2538 static void | 2544 static void |
2539 novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group) | 2545 novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group, const char *message) |
2540 { | 2546 { |
2541 NMFolder *folder = NULL; | 2547 NMFolder *folder = NULL; |
2542 NMContact *contact; | 2548 NMContact *contact; |
2543 NMUser *user; | 2549 NMUser *user; |
2544 NMERR_T rc = NM_OK; | 2550 NMERR_T rc = NM_OK; |
2608 NMERR_T rc = NM_OK; | 2614 NMERR_T rc = NM_OK; |
2609 | 2615 |
2610 if (gc == NULL || buddy == NULL || group == NULL) | 2616 if (gc == NULL || buddy == NULL || group == NULL) |
2611 return; | 2617 return; |
2612 | 2618 |
2613 user = (NMUser *) gc->proto_data; | 2619 user = purple_connection_get_protocol_data(gc); |
2614 if (user && (dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)))) { | 2620 if (user && (dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)))) { |
2615 gname = purple_group_get_name(group); | 2621 gname = purple_group_get_name(group); |
2616 if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { | 2622 if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { |
2617 gname = ""; | 2623 gname = ""; |
2618 } | 2624 } |
2640 NMERR_T rc = NM_OK; | 2646 NMERR_T rc = NM_OK; |
2641 | 2647 |
2642 if (gc == NULL || group == NULL) | 2648 if (gc == NULL || group == NULL) |
2643 return; | 2649 return; |
2644 | 2650 |
2645 user = (NMUser *) gc->proto_data; | 2651 user = purple_connection_get_protocol_data(gc); |
2646 if (user) { | 2652 if (user) { |
2647 NMFolder *folder = nm_find_folder(user, purple_group_get_name(group)); | 2653 NMFolder *folder = nm_find_folder(user, purple_group_get_name(group)); |
2648 | 2654 |
2649 if (folder) { | 2655 if (folder) { |
2650 rc = nm_send_remove_folder(user, folder, | 2656 rc = nm_send_remove_folder(user, folder, |
2665 NMERR_T rc = NM_OK; | 2671 NMERR_T rc = NM_OK; |
2666 | 2672 |
2667 if (gc == NULL || name == NULL || alias == NULL) | 2673 if (gc == NULL || name == NULL || alias == NULL) |
2668 return; | 2674 return; |
2669 | 2675 |
2670 user = (NMUser *) gc->proto_data; | 2676 user = purple_connection_get_protocol_data(gc); |
2671 if (user && (dn = nm_lookup_dn(user, name))) { | 2677 if (user && (dn = nm_lookup_dn(user, name))) { |
2672 | 2678 |
2673 /* Alias all of instances of the contact */ | 2679 /* Alias all of instances of the contact */ |
2674 contacts = nm_find_contacts(user, dn); | 2680 contacts = nm_find_contacts(user, dn); |
2675 for (cnode = contacts; cnode != NULL; cnode = cnode->next) { | 2681 for (cnode = contacts; cnode != NULL; cnode = cnode->next) { |
2724 | 2730 |
2725 if (gc == NULL || name == NULL || | 2731 if (gc == NULL || name == NULL || |
2726 old_group_name == NULL || new_group_name == NULL) | 2732 old_group_name == NULL || new_group_name == NULL) |
2727 return; | 2733 return; |
2728 | 2734 |
2729 user = (NMUser *) gc->proto_data; | 2735 user = purple_connection_get_protocol_data(gc); |
2730 if (user && (dn = nm_lookup_dn(user, name))) { | 2736 if (user && (dn = nm_lookup_dn(user, name))) { |
2731 | 2737 |
2732 /* Find the old folder */ | 2738 /* Find the old folder */ |
2733 if (strcmp(old_group_name, NM_ROOT_FOLDER_NAME) == 0) { | 2739 if (strcmp(old_group_name, NM_ROOT_FOLDER_NAME) == 0) { |
2734 old_folder = nm_get_root_folder(user); | 2740 old_folder = nm_get_root_folder(user); |
2782 | 2788 |
2783 if (gc == NULL || old_name == NULL || group == NULL || moved_buddies == NULL) { | 2789 if (gc == NULL || old_name == NULL || group == NULL || moved_buddies == NULL) { |
2784 return; | 2790 return; |
2785 } | 2791 } |
2786 | 2792 |
2787 user = gc->proto_data; | 2793 user = purple_connection_get_protocol_data(gc); |
2788 if (user) { | 2794 if (user) { |
2789 const char *gname = purple_group_get_name(group); | 2795 const char *gname = purple_group_get_name(group); |
2790 /* Does new folder exist already? */ | 2796 /* Does new folder exist already? */ |
2791 if (nm_find_folder(user, gname)) { | 2797 if (nm_find_folder(user, gname)) { |
2792 /* purple_blist_rename_group() adds the buddies | 2798 /* purple_blist_rename_group() adds the buddies |
2828 | 2834 |
2829 if (buddy == NULL) | 2835 if (buddy == NULL) |
2830 return; | 2836 return; |
2831 | 2837 |
2832 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); | 2838 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
2833 if (gc == NULL || (user = gc->proto_data) == NULL) | 2839 if (gc == NULL || (user = purple_connection_get_protocol_data(gc)) == NULL) |
2834 return; | 2840 return; |
2835 | 2841 |
2836 if (PURPLE_BUDDY_IS_ONLINE(buddy)) { | 2842 if (PURPLE_BUDDY_IS_ONLINE(buddy)) { |
2837 user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); | 2843 user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); |
2838 if (user_record) { | 2844 if (user_record) { |
2858 default: | 2864 default: |
2859 status_str = _("Unknown"); | 2865 status_str = _("Unknown"); |
2860 break; | 2866 break; |
2861 } | 2867 } |
2862 | 2868 |
2863 purple_notify_user_info_add_pair(user_info, _("Status"), status_str); | 2869 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), status_str); |
2864 | 2870 |
2865 if (text) | 2871 if (text) { |
2866 purple_notify_user_info_add_pair(user_info, _("Message"), text); | 2872 /* TODO: Check whether it's correct to call add_pair_html, |
2873 or if we should be using add_pair_plaintext */ | |
2874 purple_notify_user_info_add_pair_html(user_info, _("Message"), text); | |
2875 } | |
2867 } | 2876 } |
2868 } | 2877 } |
2869 } | 2878 } |
2870 | 2879 |
2871 static void | 2880 static void |
2877 PurpleStatus *status = NULL; | 2886 PurpleStatus *status = NULL; |
2878 | 2887 |
2879 if (gc == NULL) | 2888 if (gc == NULL) |
2880 return; | 2889 return; |
2881 | 2890 |
2882 user = gc->proto_data; | 2891 user = purple_connection_get_protocol_data(gc); |
2883 if (user == NULL) | 2892 if (user == NULL) |
2884 return; | 2893 return; |
2885 | 2894 |
2886 status = purple_account_get_active_status(purple_connection_get_account(gc)); | 2895 status = purple_account_get_active_status(purple_connection_get_account(gc)); |
2887 id = purple_status_get_id(status); | 2896 id = purple_status_get_id(status); |
2906 NMERR_T rc; | 2915 NMERR_T rc; |
2907 | 2916 |
2908 if (gc == NULL || name == NULL) | 2917 if (gc == NULL || name == NULL) |
2909 return; | 2918 return; |
2910 | 2919 |
2911 user = (NMUser *) gc->proto_data; | 2920 user = purple_connection_get_protocol_data(gc); |
2912 if (user) { | 2921 if (user) { |
2913 | 2922 |
2914 user_record = nm_find_user_record(user, name); | 2923 user_record = nm_find_user_record(user, name); |
2915 if (user_record) { | 2924 if (user_record) { |
2916 _show_info(gc, user_record, g_strdup(name)); | 2925 _show_info(gc, user_record, g_strdup(name)); |
2935 | 2944 |
2936 account = buddy ? purple_buddy_get_account(buddy) : NULL; | 2945 account = buddy ? purple_buddy_get_account(buddy) : NULL; |
2937 if (buddy && account) { | 2946 if (buddy && account) { |
2938 PurpleConnection *gc = purple_account_get_connection(account); | 2947 PurpleConnection *gc = purple_account_get_connection(account); |
2939 | 2948 |
2940 if (gc && gc->proto_data) { | 2949 if (gc) { |
2941 NMUser *user = gc->proto_data; | 2950 NMUser *user = purple_connection_get_protocol_data(gc); |
2942 | 2951 |
2943 dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); | 2952 if (user) { |
2944 if (dn) { | 2953 dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); |
2945 NMUserRecord *user_record = nm_find_user_record(user, dn); | 2954 if (dn) { |
2946 | 2955 NMUserRecord *user_record = nm_find_user_record(user, dn); |
2947 if (user_record) { | 2956 |
2948 text = nm_user_record_get_status_text(user_record); | 2957 if (user_record) { |
2949 if (text) | 2958 text = nm_user_record_get_status_text(user_record); |
2950 return g_strdup(text); | 2959 if (text) |
2960 return g_strdup(text); | |
2961 } | |
2951 } | 2962 } |
2952 } | 2963 } |
2953 } | 2964 } |
2954 } | 2965 } |
2955 | 2966 |
3021 | 3032 |
3022 if (!connected) | 3033 if (!connected) |
3023 return; | 3034 return; |
3024 | 3035 |
3025 gc = purple_account_get_connection(account); | 3036 gc = purple_account_get_connection(account); |
3026 user = gc->proto_data; | 3037 user = purple_connection_get_protocol_data(gc); |
3027 if (user == NULL) | 3038 if (user == NULL) |
3028 return; | 3039 return; |
3029 | 3040 |
3030 if (primitive == PURPLE_STATUS_AVAILABLE) { | 3041 if (primitive == PURPLE_STATUS_AVAILABLE) { |
3031 novellstatus = NM_STATUS_AVAILABLE; | 3042 novellstatus = NM_STATUS_AVAILABLE; |
3068 const char *name = who; | 3079 const char *name = who; |
3069 | 3080 |
3070 if (gc == NULL || who == NULL) | 3081 if (gc == NULL || who == NULL) |
3071 return; | 3082 return; |
3072 | 3083 |
3073 user = gc->proto_data; | 3084 user = purple_connection_get_protocol_data(gc); |
3074 if (user == NULL) | 3085 if (user == NULL) |
3075 return; | 3086 return; |
3076 | 3087 |
3077 /* Remove first -- we will add it back in when we get | 3088 /* Remove first -- we will add it back in when we get |
3078 * the okay from the server | 3089 * the okay from the server |
3079 */ | 3090 */ |
3080 purple_privacy_permit_remove(gc->account, who, TRUE); | 3091 purple_privacy_permit_remove(purple_connection_get_account(gc), who, TRUE); |
3081 | 3092 |
3082 if (nm_user_is_privacy_locked(user)) { | 3093 if (nm_user_is_privacy_locked(user)) { |
3083 _show_privacy_locked_error(gc, user); | 3094 _show_privacy_locked_error(gc, user); |
3084 _sync_privacy_lists(user); | 3095 _sync_privacy_lists(user); |
3085 return; | 3096 return; |
3112 const char *name = who; | 3123 const char *name = who; |
3113 | 3124 |
3114 if (gc == NULL || who == NULL) | 3125 if (gc == NULL || who == NULL) |
3115 return; | 3126 return; |
3116 | 3127 |
3117 user = gc->proto_data; | 3128 user = purple_connection_get_protocol_data(gc); |
3118 if (user == NULL) | 3129 if (user == NULL) |
3119 return; | 3130 return; |
3120 | 3131 |
3121 /* Remove first -- we will add it back in when we get | 3132 /* Remove first -- we will add it back in when we get |
3122 * the okay from the server | 3133 * the okay from the server |
3123 */ | 3134 */ |
3124 purple_privacy_deny_remove(gc->account, who, TRUE); | 3135 purple_privacy_deny_remove(purple_connection_get_account(gc), who, TRUE); |
3125 | 3136 |
3126 if (nm_user_is_privacy_locked(user)) { | 3137 if (nm_user_is_privacy_locked(user)) { |
3127 _show_privacy_locked_error(gc, user); | 3138 _show_privacy_locked_error(gc, user); |
3128 _sync_privacy_lists(user); | 3139 _sync_privacy_lists(user); |
3129 return; | 3140 return; |
3156 const char *dn = NULL; | 3167 const char *dn = NULL; |
3157 | 3168 |
3158 if (gc == NULL || who == NULL) | 3169 if (gc == NULL || who == NULL) |
3159 return; | 3170 return; |
3160 | 3171 |
3161 user = gc->proto_data; | 3172 user = purple_connection_get_protocol_data(gc); |
3162 if (user == NULL) | 3173 if (user == NULL) |
3163 return; | 3174 return; |
3164 | 3175 |
3165 if (nm_user_is_privacy_locked(user)) { | 3176 if (nm_user_is_privacy_locked(user)) { |
3166 _show_privacy_locked_error(gc, user); | 3177 _show_privacy_locked_error(gc, user); |
3186 const char *dn = NULL; | 3197 const char *dn = NULL; |
3187 | 3198 |
3188 if (gc == NULL || who == NULL) | 3199 if (gc == NULL || who == NULL) |
3189 return; | 3200 return; |
3190 | 3201 |
3191 user = gc->proto_data; | 3202 user = purple_connection_get_protocol_data(gc); |
3192 if (user == NULL) | 3203 if (user == NULL) |
3193 return; | 3204 return; |
3194 | 3205 |
3195 if (nm_user_is_privacy_locked(user)) { | 3206 if (nm_user_is_privacy_locked(user)) { |
3196 _show_privacy_locked_error(gc, user); | 3207 _show_privacy_locked_error(gc, user); |
3221 NMFolder *folder = NULL; | 3232 NMFolder *folder = NULL; |
3222 | 3233 |
3223 if (gc == NULL) | 3234 if (gc == NULL) |
3224 return; | 3235 return; |
3225 | 3236 |
3226 user = gc->proto_data; | 3237 user = purple_connection_get_protocol_data(gc); |
3227 if (user == NULL) | 3238 if (user == NULL) |
3228 return; | 3239 return; |
3229 | 3240 |
3230 if (user->privacy_synched == FALSE) { | 3241 if (user->privacy_synched == FALSE) { |
3231 _sync_privacy_lists(user); | 3242 _sync_privacy_lists(user); |
3237 _show_privacy_locked_error(gc, user); | 3248 _show_privacy_locked_error(gc, user); |
3238 _sync_privacy_lists(user); | 3249 _sync_privacy_lists(user); |
3239 return; | 3250 return; |
3240 } | 3251 } |
3241 | 3252 |
3242 switch (gc->account->perm_deny) { | 3253 switch (purple_account_get_privacy_type(purple_connection_get_account(gc))) { |
3243 | 3254 |
3244 case PURPLE_PRIVACY_ALLOW_ALL: | 3255 case PURPLE_PRIVACY_ALLOW_ALL: |
3245 rc = nm_send_set_privacy_default(user, FALSE, | 3256 rc = nm_send_set_privacy_default(user, FALSE, |
3246 _set_privacy_default_resp_cb, NULL); | 3257 _set_privacy_default_resp_cb, NULL); |
3247 _check_for_disconnect(user, rc); | 3258 _check_for_disconnect(user, rc); |
3293 for (node = user->allow_list; node; node = node->next) { | 3304 for (node = user->allow_list; node; node = node->next) { |
3294 user_record = nm_find_user_record(user, (char *)node->data); | 3305 user_record = nm_find_user_record(user, (char *)node->data); |
3295 if (user_record) { | 3306 if (user_record) { |
3296 name = nm_user_record_get_display_id(user_record); | 3307 name = nm_user_record_get_display_id(user_record); |
3297 | 3308 |
3298 if (!g_slist_find_custom(gc->account->permit, | 3309 if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, |
3299 name, (GCompareFunc)purple_utf8_strcasecmp)) { | 3310 name, (GCompareFunc)purple_utf8_strcasecmp)) { |
3300 purple_privacy_permit_add(gc->account, name , TRUE); | 3311 purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE); |
3301 } | 3312 } |
3302 } | 3313 } |
3303 } | 3314 } |
3304 | 3315 |
3305 for (node = gc->account->permit; node; node = node->next) { | 3316 for (node = purple_connection_get_account(gc)->permit; node; node = node->next) { |
3306 name = NULL; | 3317 name = NULL; |
3307 dn = nm_lookup_dn(user, (char *)node->data); | 3318 dn = nm_lookup_dn(user, (char *)node->data); |
3308 if (dn) { | 3319 if (dn) { |
3309 user_record = nm_find_user_record(user, dn); | 3320 user_record = nm_find_user_record(user, dn); |
3310 name = nm_user_record_get_display_id(user_record); | 3321 name = nm_user_record_get_display_id(user_record); |
3314 rc = nm_send_create_privacy_item(user, dn, TRUE, | 3325 rc = nm_send_create_privacy_item(user, dn, TRUE, |
3315 _create_privacy_item_deny_resp_cb, | 3326 _create_privacy_item_deny_resp_cb, |
3316 g_strdup(dn)); | 3327 g_strdup(dn)); |
3317 } | 3328 } |
3318 } else { | 3329 } else { |
3319 purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); | 3330 purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); |
3320 } | 3331 } |
3321 } | 3332 } |
3322 } | 3333 } |
3323 break; | 3334 break; |
3324 | 3335 |
3335 for (node = user->deny_list; node; node = node->next) { | 3346 for (node = user->deny_list; node; node = node->next) { |
3336 user_record = nm_find_user_record(user, (char *)node->data); | 3347 user_record = nm_find_user_record(user, (char *)node->data); |
3337 if (user_record) { | 3348 if (user_record) { |
3338 name = nm_user_record_get_display_id(user_record); | 3349 name = nm_user_record_get_display_id(user_record); |
3339 | 3350 |
3340 if (!g_slist_find_custom(gc->account->deny, | 3351 if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, |
3341 name, (GCompareFunc)purple_utf8_strcasecmp)) { | 3352 name, (GCompareFunc)purple_utf8_strcasecmp)) { |
3342 purple_privacy_deny_add(gc->account, name , TRUE); | 3353 purple_privacy_deny_add(purple_connection_get_account(gc), name , TRUE); |
3343 } | 3354 } |
3344 } | 3355 } |
3345 } | 3356 } |
3346 | 3357 |
3347 for (node = gc->account->deny; node; node = node->next) { | 3358 for (node = purple_connection_get_account(gc)->deny; node; node = node->next) { |
3348 | 3359 |
3349 name = NULL; | 3360 name = NULL; |
3350 dn = nm_lookup_dn(user, (char *)node->data); | 3361 dn = nm_lookup_dn(user, (char *)node->data); |
3351 if (dn) { | 3362 if (dn) { |
3352 user_record = nm_find_user_record(user, dn); | 3363 user_record = nm_find_user_record(user, dn); |
3357 rc = nm_send_create_privacy_item(user, dn, FALSE, | 3368 rc = nm_send_create_privacy_item(user, dn, FALSE, |
3358 _create_privacy_item_deny_resp_cb, | 3369 _create_privacy_item_deny_resp_cb, |
3359 g_strdup(name)); | 3370 g_strdup(name)); |
3360 } | 3371 } |
3361 } else { | 3372 } else { |
3362 purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); | 3373 purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); |
3363 } | 3374 } |
3364 } | 3375 } |
3365 | 3376 |
3366 } | 3377 } |
3367 break; | 3378 break; |
3449 NMERR_T rc = NM_OK; | 3460 NMERR_T rc = NM_OK; |
3450 | 3461 |
3451 if (gc == NULL) | 3462 if (gc == NULL) |
3452 return; | 3463 return; |
3453 | 3464 |
3454 user = gc->proto_data; | 3465 user = purple_connection_get_protocol_data(gc); |
3455 if (user == NULL) | 3466 if (user == NULL) |
3456 return; | 3467 return; |
3457 | 3468 |
3458 rc = nm_send_keepalive(user, NULL, NULL); | 3469 rc = nm_send_keepalive(user, NULL, NULL); |
3459 _check_for_disconnect(user, rc); | 3470 _check_for_disconnect(user, rc); |
3460 } | 3471 } |
3461 | 3472 |
3462 static PurplePluginProtocolInfo prpl_info = { | 3473 static PurplePluginProtocolInfo prpl_info = { |
3474 sizeof(PurplePluginProtocolInfo), /* struct_size */ | |
3463 0, | 3475 0, |
3464 NULL, /* user_splits */ | 3476 NULL, /* user_splits */ |
3465 NULL, /* protocol_options */ | 3477 NULL, /* protocol_options */ |
3466 NO_BUDDY_ICONS, /* icon_spec */ | 3478 NO_BUDDY_ICONS, /* icon_spec */ |
3467 novell_list_icon, /* list_icon */ | 3479 novell_list_icon, /* list_icon */ |
3498 NULL, /* chat_whisper */ | 3510 NULL, /* chat_whisper */ |
3499 novell_chat_send, /* chat_send */ | 3511 novell_chat_send, /* chat_send */ |
3500 novell_keepalive, /* keepalive */ | 3512 novell_keepalive, /* keepalive */ |
3501 NULL, /* register_user */ | 3513 NULL, /* register_user */ |
3502 NULL, /* get_cb_info */ | 3514 NULL, /* get_cb_info */ |
3503 NULL, /* get_cb_away */ | |
3504 novell_alias_buddy, /* alias_buddy */ | 3515 novell_alias_buddy, /* alias_buddy */ |
3505 novell_group_buddy, /* group_buddy */ | 3516 novell_group_buddy, /* group_buddy */ |
3506 novell_rename_group, /* rename_group */ | 3517 novell_rename_group, /* rename_group */ |
3507 NULL, /* buddy_free */ | 3518 NULL, /* buddy_free */ |
3508 novell_convo_closed, /* convo_closed */ | 3519 novell_convo_closed, /* convo_closed */ |
3523 NULL, /* send_raw */ | 3534 NULL, /* send_raw */ |
3524 NULL, /* roomlist_room_serialize */ | 3535 NULL, /* roomlist_room_serialize */ |
3525 NULL, /* unregister_user */ | 3536 NULL, /* unregister_user */ |
3526 NULL, /* send_attention */ | 3537 NULL, /* send_attention */ |
3527 NULL, /* get_attention_types */ | 3538 NULL, /* get_attention_types */ |
3528 sizeof(PurplePluginProtocolInfo), /* struct_size */ | |
3529 NULL, /* get_account_text_table */ | 3539 NULL, /* get_account_text_table */ |
3530 NULL, /* initiate_media */ | 3540 NULL, /* initiate_media */ |
3531 NULL, /* get_media_caps */ | 3541 NULL, /* get_media_caps */ |
3532 NULL, /* get_moods */ | 3542 NULL, /* get_moods */ |
3533 NULL, /* set_public_alias */ | 3543 NULL, /* set_public_alias */ |
3534 NULL, /* get_public_alias */ | 3544 NULL /* get_public_alias */ |
3535 NULL, /* add_buddy_with_invite */ | |
3536 NULL /* add_buddies_with_invite */ | |
3537 }; | 3545 }; |
3538 | 3546 |
3539 static PurplePluginInfo info = { | 3547 static PurplePluginInfo info = { |
3540 PURPLE_PLUGIN_MAGIC, | 3548 PURPLE_PLUGIN_MAGIC, |
3541 PURPLE_MAJOR_VERSION, | 3549 PURPLE_MAJOR_VERSION, |