Mercurial > pidgin.yaz
changeset 23245:9a8d1db61062
merge of '0fb7703e7d2acc0513e238c75408f521e61f6aab'
and 'a5a6fd56ee57e35a3e26f2a66d5615248a279d45'
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Thu, 29 May 2008 12:27:27 +0000 |
parents | c85c0fc775d8 (diff) 6c22faa7f919 (current diff) |
children | 1cf1f77169e5 |
files | |
diffstat | 2 files changed, 50 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Thu May 29 11:42:08 2008 +0000 +++ b/COPYRIGHT Thu May 29 12:27:27 2008 +0000 @@ -388,6 +388,7 @@ Richard Stellingwerff Charlie Stockman David Stoddard +Adam Strzelecki Andreas Stührk Oleg Sukhodolsky Sun Microsystems
--- a/libpurple/protocols/gg/gg.c Thu May 29 11:42:08 2008 +0000 +++ b/libpurple/protocols/gg/gg.c Thu May 29 12:27:27 2008 +0000 @@ -343,7 +343,8 @@ { PurpleConnection *gc = (PurpleConnection *)action->context; - purple_request_file(action, "Load buddylist from file...", NULL, FALSE, + purple_request_file(action, _("Load buddylist from file..."), NULL, + FALSE, G_CALLBACK(ggp_callback_buddylist_load_ok), NULL, purple_connection_get_account(gc), NULL, NULL, gc); @@ -926,8 +927,10 @@ /* ----- INTERNAL CALLBACKS --------------------------------------------- */ /* ---------------------------------------------------------------------- */ -/* just a prototype */ +/* Prototypes */ static void ggp_set_status(PurpleAccount *account, PurpleStatus *status); +static int ggp_to_gg_status(PurpleStatus *status, char **msg); + /** * Handle change of the status of the buddy. @@ -1488,23 +1491,12 @@ break; case GG_EVENT_CONN_SUCCESS: { - PurpleAccount *account; - PurplePresence *presence; - PurpleStatus *status; - purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); purple_input_remove(gc->inpa); gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, ggp_callback_recv, gc); - /* gg_change_status(info->session, GG_STATUS_AVAIL); */ - - account = purple_connection_get_account(gc); - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - - ggp_set_status(account, status); purple_connection_set_state(gc, PURPLE_CONNECTED); ggp_buddylist_send(gc); } @@ -1692,6 +1684,8 @@ static void ggp_login(PurpleAccount *account) { PurpleConnection *gc; + PurplePresence *presence; + PurpleStatus *status; struct gg_login_params *glp; GGPInfo *info; @@ -1714,8 +1708,11 @@ glp->uin = ggp_get_uin(account); glp->password = (char *)purple_account_get_password(account); + presence = purple_account_get_presence(account); + status = purple_presence_get_active_status(presence); + glp->async = 1; - glp->status = GG_STATUS_AVAIL; + glp->status = ggp_to_gg_status(status, &glp->status_descr); glp->tls = 0; info->session = gg_login(glp); @@ -1826,22 +1823,15 @@ /* }}} */ /* static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) {{{ */ -static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) +static int ggp_to_gg_status(PurpleStatus *status, char **msg) { - PurpleConnection *gc; - GGPInfo *info; - const char *status_id, *msg; + const char *status_id = purple_status_get_id(status); int new_status, new_status_descr; + const char *new_msg; - if (!purple_status_is_active(status)) - return; + g_return_val_if_fail(msg == NULL, 0); - gc = purple_account_get_connection(account); - info = gc->proto_data; - - status_id = purple_status_get_id(status); - - purple_debug_info("gg", "ggp_set_status: Requested status = %s\n", + purple_debug_info("gg", "ggp_to_gg_status: Requested status = %s\n", status_id); if (strcmp(status_id, "available") == 0) { @@ -1860,22 +1850,45 @@ new_status = GG_STATUS_AVAIL; new_status_descr = GG_STATUS_AVAIL_DESCR; purple_debug_info("gg", - "ggp_set_status: uknown status requested (status_id=%s)\n", + "ggp_set_status: unknown status requested (status_id=%s)\n", status_id); } - msg = purple_status_get_attr_string(status, "message"); + new_msg = purple_status_get_attr_string(status, "message"); + + if(new_msg) { + char *tmp = purple_markup_strip_html(new_msg); + *msg = charset_convert(tmp, "UTF-8", "CP1250"); + g_free(tmp); + + return new_status_descr; + } else { + *msg = NULL; + return new_status; + } +} +/* }}} */ - if (msg == NULL) { +/* static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) {{{ */ +static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) +{ + PurpleConnection *gc; + GGPInfo *info; + int new_status; + char *new_msg = NULL; + + if (!purple_status_is_active(status)) + return; + + gc = purple_account_get_connection(account); + info = gc->proto_data; + + new_status = ggp_to_gg_status(status, &new_msg); + + if (new_msg == NULL) { gg_change_status(info->session, new_status); } else { - gchar *tmp, *new_msg; - - tmp = charset_convert(msg, "UTF-8", "CP1250"); - new_msg = purple_markup_strip_html(tmp); - g_free(tmp); - - gg_change_status_descr(info->session, new_status_descr, new_msg); + gg_change_status_descr(info->session, new_status, new_msg); g_free(new_msg); }