Mercurial > pidgin
changeset 28969:757a386a5c93
merge of '7f93eb293109127d6a055f9a6aaa8baaa85207d1'
and '9028ac0daaa1f7e565726fa39aca22ce7d3ecc49'
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 04 Feb 2010 05:46:37 +0000 |
parents | 5f6571bb128d (current diff) 86ee7772936f (diff) |
children | 2afc3f95ab33 eb024bcff0c9 a32da45d80ba |
files | |
diffstat | 15 files changed, 185 insertions(+), 164 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Feb 03 19:45:23 2010 +0000 +++ b/ChangeLog Thu Feb 04 05:46:37 2010 +0000 @@ -5,6 +5,8 @@ * Fix 'make check' on OS X. (David Fang) * Fix a quirk in purple_markup_html_to_xhtml that caused some messages to be improperly converted to XHTML. + * Set "controlling-mode" correctly when initializing a media session. + Fixes receiving voice calls from Psi. General: * Correctly disable all missing dependencies when using the @@ -14,6 +16,10 @@ * Fix display of avatars after a server-side change. (Krzysztof Klinikowski) + AIM: + * Allow setting and displaying icons between 1x1 and 100x100 pixels. + Previously only icons between 48x48 and 50x50 were allowed. + MSN: * File transfer requests will no longer cause a crash if you delete the file before the other side accepts. @@ -33,6 +39,9 @@ with some clients. * Don't do an SRV lookup for a STUN server associated with the account if one is already set globally in prefs. + * Don't send custom smileys larger than the recommended maximum object size + specified in the BoB XEP. This prevents a client from being + disconnected by servers that dislike overly-large stanzas. Yahoo: * Don't send <span> and </span> tags. (Fartash Faghri)
--- a/libpurple/media.c Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/media.c Thu Feb 04 05:46:37 2010 +0000 @@ -2754,15 +2754,21 @@ FsStream *fsstream = NULL; const gchar *stun_ip = purple_network_get_stun_ip(); const gchar *turn_ip = purple_network_get_turn_ip(); - - if (stun_ip || turn_ip) { - guint new_num_params = + guint new_num_params = + !stun_ip && !turn_ip ? num_params + 1 : (stun_ip && is_nice) && turn_ip ? - num_params + 2 : num_params + 1; - guint next_param_index = num_params; - GParameter *param = g_new0(GParameter, new_num_params); - memcpy(param, params, sizeof(GParameter) * num_params); - + num_params + 3 : num_params + 2; + guint next_param_index = num_params; + GParameter *param = g_new0(GParameter, new_num_params); + memcpy(param, params, sizeof(GParameter) * num_params); + + /* set controlling mode according to direction */ + param[next_param_index].name = "controlling-mode"; + g_value_init(¶m[next_param_index].value, G_TYPE_BOOLEAN); + g_value_set_boolean(¶m[next_param_index].value, initiator); + next_param_index++; + + if (stun_ip || turn_ip) { if (stun_ip) { purple_debug_info("media", "setting property stun-ip on new stream: %s\n", stun_ip); @@ -2813,20 +2819,14 @@ return FALSE; } } - - fsstream = fs_session_new_stream(session->session, + } + + fsstream = fs_session_new_stream(session->session, participant, initiator == TRUE ? type_direction : (type_direction & FS_DIRECTION_RECV), transmitter, new_num_params, param, &err); - g_free(param); - } else { - fsstream = fs_session_new_stream(session->session, - participant, initiator == TRUE ? - type_direction : (type_direction & - FS_DIRECTION_RECV), transmitter, - num_params, params, &err); - } + g_free(param); if (fsstream == NULL) { purple_debug_error("media",
--- a/libpurple/prefs.h Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/prefs.h Thu Feb 04 05:46:37 2010 +0000 @@ -185,7 +185,16 @@ * * @param name The name of the pref * @param value The value to set + * + * @deprecated We're not really sure what purpose this function serves, so it + * will be removed in 3.0.0. Preferences values set using this + * function aren't serialized to prefs.xml, which could be + * misleading. There is also no purple_prefs_get_generic, which + * means that if you can't really get the value (other in a + * connected callback). If you think you have a use for this then + * please let us know. */ +/* TODO: When this is removed, also remove struct purple_pref->value.generic */ void purple_prefs_set_generic(const char *name, gpointer value); /**
--- a/libpurple/protocols/jabber/data.h Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/jabber/data.h Thu Feb 04 05:46:37 2010 +0000 @@ -26,6 +26,8 @@ #include <glib.h> +#define JABBER_DATA_MAX_SIZE 8192 + typedef struct { char *cid; char *type;
--- a/libpurple/protocols/jabber/message.c Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/jabber/message.c Thu Feb 04 05:46:37 2010 +0000 @@ -862,6 +862,7 @@ for (; smileys ; smileys = g_list_delete_link(smileys, smileys)) { PurpleSmiley *smiley = (PurpleSmiley *) smileys->data; + const gchar *shortcut = purple_smiley_get_shortcut(smiley); const gssize len = strlen(shortcut); @@ -983,36 +984,52 @@ if (found_smileys) { gchar *smileyfied_xhtml = NULL; const GList *iterator; - + GList *valid_smileys = NULL; + gboolean has_too_large_smiley = FALSE; + for (iterator = found_smileys; iterator ; iterator = g_list_next(iterator)) { - const PurpleSmiley *smiley = - (PurpleSmiley *) iterator->data; + PurpleSmiley *smiley = (PurpleSmiley *) iterator->data; const gchar *shortcut = purple_smiley_get_shortcut(smiley); const JabberData *data = jabber_data_find_local_by_alt(shortcut); + PurpleStoredImage *image = purple_smiley_get_stored_image(smiley); - /* the object has not been sent before */ - if (!data) { - PurpleStoredImage *image = - purple_smiley_get_stored_image(smiley); - const gchar *ext = purple_imgstore_get_extension(image); - JabberStream *js = jm->js; + if (purple_imgstore_get_size(image) <= JABBER_DATA_MAX_SIZE) { + /* the object has not been sent before */ + if (!data) { + const gchar *ext = purple_imgstore_get_extension(image); + JabberStream *js = jm->js; - JabberData *new_data = - jabber_data_create_from_data(purple_imgstore_get_data(image), - purple_imgstore_get_size(image), - jabber_message_get_mimetype_from_ext(ext), js); - purple_debug_info("jabber", - "cache local smiley alt = %s, cid = %s\n", - shortcut, jabber_data_get_cid(new_data)); - jabber_data_associate_local(new_data, shortcut); - } + JabberData *new_data = + jabber_data_create_from_data(purple_imgstore_get_data(image), + purple_imgstore_get_size(image), + jabber_message_get_mimetype_from_ext(ext), js); + purple_debug_info("jabber", + "cache local smiley alt = %s, cid = %s\n", + shortcut, jabber_data_get_cid(new_data)); + jabber_data_associate_local(new_data, shortcut); + } + valid_smileys = g_list_append(valid_smileys, smiley); + } else { + has_too_large_smiley = TRUE; + purple_debug_warning("jabber", "Refusing to send smiley %s " + "(too large, max is %d)\n", + purple_smiley_get_shortcut(smiley), + JABBER_DATA_MAX_SIZE); + } + } + + if (has_too_large_smiley) { + purple_conversation_write(conv, NULL, + _("A custom smiley in the message is too large to send."), + PURPLE_MESSAGE_ERROR, time(NULL)); } smileyfied_xhtml = - jabber_message_get_smileyfied_xhtml(xhtml, found_smileys); + jabber_message_get_smileyfied_xhtml(xhtml, valid_smileys); g_list_free(found_smileys); + g_list_free(valid_smileys); return smileyfied_xhtml; }
--- a/libpurple/protocols/msn/contact.c Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/msn/contact.c Thu Feb 04 05:46:37 2010 +0000 @@ -406,8 +406,8 @@ msn_user_set_network(user, nid); msn_user_set_invite_message(user, invite); - if (member_id) { - user->membership_id[list] = atoi(member_id); + if (list == MSN_LIST_PL && member_id) { + user->member_id_on_pending_list = atoi(member_id); } msn_got_lst_user(session, user, 1 << list, NULL); @@ -1567,11 +1567,11 @@ if (user && user->networkid != MSN_NETWORK_PASSPORT) member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, "EmailMember", "Email", - user->membership_id[MSN_LIST_PL]); + user->member_id_on_pending_list); else member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, "PassportMember", "Passport", - user->membership_id[MSN_LIST_PL]); + user->member_id_on_pending_list); } else { /* list == MSN_LIST_AL || list == MSN_LIST_BL */ partner_scenario = MSN_PS_BLOCK_UNBLOCK;
--- a/libpurple/protocols/msn/notification.c Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/msn/notification.c Thu Feb 04 05:46:37 2010 +0000 @@ -1144,7 +1144,7 @@ msn_user_set_object(user, msnobj); - user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->phone.mobile && user->phone.mobile[0] == '+'); + user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->phone && user->phone->mobile && user->phone->mobile[0] == '+'); msn_user_set_clientid(user, clientid); msn_user_set_network(user, networkid); @@ -1316,7 +1316,7 @@ } clientid = strtoul(cmd->params[4], NULL, 10); - user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->phone.mobile && user->phone.mobile[0] == '+'); + user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->phone && user->phone->mobile && user->phone->mobile[0] == '+'); msn_user_set_clientid(user, clientid); msn_user_set_network(user, networkid); @@ -1613,7 +1613,7 @@ MsnUser *user; const char *passport; char *psm_str, *str; - CurrentMedia media = {CURRENT_MEDIA_UNKNOWN, NULL, NULL, NULL}; + CurrentMedia *media = NULL; session = cmdproc->session; account = session->account; @@ -1634,19 +1634,12 @@ g_free(psm_str); str = msn_get_currentmedia(cmd->payload, len); - if (msn_parse_currentmedia(str, &media)) - msn_user_set_currentmedia(user, &media); - else - msn_user_set_currentmedia(user, NULL); - g_free(media.title); - g_free(media.album); - g_free(media.artist); + media = msn_parse_currentmedia(str); g_free(str); - } else { msn_user_set_statusline(user, NULL); - msn_user_set_currentmedia(user, NULL); } + msn_user_set_currentmedia(user, media); msn_user_update(user); }
--- a/libpurple/protocols/msn/state.c Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/msn/state.c Thu Feb 04 05:46:37 2010 +0000 @@ -86,17 +86,15 @@ return result; } -/* parse CurrentMedia string */ -gboolean -msn_parse_currentmedia(const char *cmedia, CurrentMedia *media) +CurrentMedia *msn_parse_currentmedia(const char *cmedia) { char **cmedia_array; int strings = 0; - gboolean parsed = FALSE; + CurrentMedia *media = NULL; - if ((cmedia == NULL) || (*cmedia == '\0')) { + if (!cmedia || cmedia[0] == '\0') { purple_debug_info("msn", "No currentmedia string\n"); - return FALSE; + return NULL; } purple_debug_info("msn", "Parsing currentmedia string: \"%s\"\n", cmedia); @@ -121,7 +119,7 @@ #endif if (strings >= 4 && !strcmp(cmedia_array[2], "1")) { - parsed = TRUE; + media = g_new(CurrentMedia, 1); if (!strcmp(cmedia_array[1], "Music")) media->type = CURRENT_MEDIA_MUSIC; @@ -132,30 +130,14 @@ else media->type = CURRENT_MEDIA_UNKNOWN; - g_free(media->title); - if (strings == 4) { - media->title = g_strdup(cmedia_array[3]); - } else { - media->title = g_strdup(cmedia_array[4]); - } - - g_free(media->artist); - if (strings > 5) - media->artist = g_strdup(cmedia_array[5]); - else - media->artist = NULL; - - g_free(media->album); - if (strings > 6) - media->album = g_strdup(cmedia_array[6]); - else - media->album = NULL; - + media->title = g_strdup(cmedia_array[strings == 4 ? 3 : 4]); + media->artist = strings > 5 ? g_strdup(cmedia_array[5]) : NULL; + media->album = strings > 6 ? g_strdup(cmedia_array[6]) : NULL; } g_strfreev(cmedia_array); - return parsed; + return media; } /* get the CurrentMedia info from the XML string */
--- a/libpurple/protocols/msn/state.h Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/msn/state.h Thu Feb 04 05:46:37 2010 +0000 @@ -61,8 +61,10 @@ void msn_set_psm(MsnSession *session); -/* Parse CurrentMedia string */ -gboolean msn_parse_currentmedia(const char *cmedia, CurrentMedia *media); +/** + * Parse CurrentMedia string. + */ +CurrentMedia *msn_parse_currentmedia(const char *cmedia); /* Get the CurrentMedia info from the XML string */ char * msn_get_currentmedia(char *xml_str,gsize len);
--- a/libpurple/protocols/msn/user.c Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/msn/user.c Thu Feb 04 05:46:37 2010 +0000 @@ -67,12 +67,18 @@ g_free(user->passport); g_free(user->friendly_name); g_free(user->uid); - g_free(user->phone.home); - g_free(user->phone.work); - g_free(user->phone.mobile); - g_free(user->media.artist); - g_free(user->media.title); - g_free(user->media.album); + if (user->phone) { + g_free(user->phone->home); + g_free(user->phone->work); + g_free(user->phone->mobile); + g_free(user->phone); + } + if (user->media) { + g_free(user->media->artist); + g_free(user->media->title); + g_free(user->media->album); + g_free(user->media); + } g_free(user->statusline); g_free(user->invite_message); @@ -107,24 +113,24 @@ purple_prpl_got_user_status_deactive(account, user->passport, "mobile"); } - if (!offline && user->media.type != CURRENT_MEDIA_UNKNOWN) { - if (user->media.type == CURRENT_MEDIA_MUSIC) { + if (!offline && user->media && user->media->type != CURRENT_MEDIA_UNKNOWN) { + if (user->media->type == CURRENT_MEDIA_MUSIC) { purple_prpl_got_user_status(account, user->passport, "tune", - PURPLE_TUNE_ARTIST, user->media.artist, - PURPLE_TUNE_ALBUM, user->media.album, - PURPLE_TUNE_TITLE, user->media.title, + PURPLE_TUNE_ARTIST, user->media->artist, + PURPLE_TUNE_ALBUM, user->media->album, + PURPLE_TUNE_TITLE, user->media->title, NULL); - } else if (user->media.type == CURRENT_MEDIA_GAMES) { + } else if (user->media->type == CURRENT_MEDIA_GAMES) { purple_prpl_got_user_status(account, user->passport, "tune", - "game", user->media.title, + "game", user->media->title, NULL); - } else if (user->media.type == CURRENT_MEDIA_OFFICE) { + } else if (user->media->type == CURRENT_MEDIA_OFFICE) { purple_prpl_got_user_status(account, user->passport, "tune", - "office", user->media.title, + "office", user->media->title, NULL); } else { purple_debug_warning("msn", "Got CurrentMedia with unknown type %d.\n", - user->media.type); + user->media->type); } } else { purple_prpl_got_user_status_deactive(account, user->passport, "tune"); @@ -205,18 +211,16 @@ } void -msn_user_set_currentmedia(MsnUser *user, const CurrentMedia *media) +msn_user_set_currentmedia(MsnUser *user, CurrentMedia *media) { - g_return_if_fail(user != NULL); + if (user->media) { + g_free(user->media->title); + g_free(user->media->album); + g_free(user->media->artist); + g_free(user->media); + } - g_free(user->media.title); - g_free(user->media.album); - g_free(user->media.artist); - - user->media.type = media ? media->type : CURRENT_MEDIA_UNKNOWN; - user->media.title = media ? g_strdup(media->title) : NULL; - user->media.artist = media ? g_strdup(media->artist) : NULL; - user->media.album = media ? g_strdup(media->album) : NULL; + user->media = media; } void @@ -366,8 +370,15 @@ { g_return_if_fail(user != NULL); - g_free(user->phone.home); - user->phone.home = g_strdup(number); + if (!number && !user->phone) + return; + + if (user->phone) + g_free(user->phone->home); + else + user->phone = g_new0(MsnUserPhoneInfo, 1); + + user->phone->home = g_strdup(number); } void @@ -375,8 +386,15 @@ { g_return_if_fail(user != NULL); - g_free(user->phone.work); - user->phone.work = g_strdup(number); + if (!number && !user->phone) + return; + + if (user->phone) + g_free(user->phone->work); + else + user->phone = g_new0(MsnUserPhoneInfo, 1); + + user->phone->work = g_strdup(number); } void @@ -384,8 +402,15 @@ { g_return_if_fail(user != NULL); - g_free(user->phone.mobile); - user->phone.mobile = g_strdup(number); + if (!number && !user->phone) + return; + + if (user->phone) + g_free(user->phone->mobile); + else + user->phone = g_new0(MsnUserPhoneInfo, 1); + + user->phone->mobile = g_strdup(number); } void @@ -460,7 +485,7 @@ { g_return_val_if_fail(user != NULL, NULL); - return user->phone.home; + return user->phone ? user->phone->home : NULL; } const char * @@ -468,7 +493,7 @@ { g_return_val_if_fail(user != NULL, NULL); - return user->phone.work; + return user->phone ? user->phone->work : NULL; } const char * @@ -476,7 +501,7 @@ { g_return_val_if_fail(user != NULL, NULL); - return user->phone.mobile; + return user->phone ? user->phone->mobile : NULL; } guint
--- a/libpurple/protocols/msn/user.h Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/msn/user.h Thu Feb 04 05:46:37 2010 +0000 @@ -61,6 +61,13 @@ char *album; /**< Album. */ } CurrentMedia; +typedef struct _MsnUserPhoneInfo +{ + char *home; /**< Home phone number. */ + char *work; /**< Work phone number. */ + char *mobile; /**< Mobile phone number. */ +} MsnUserPhoneInfo; + /** * A user. */ @@ -71,21 +78,15 @@ char *passport; /**< The passport account. */ char *friendly_name; /**< The friendly name. */ - char * uid; /*< User Id */ + char *uid; /*< User ID */ const char *status; /**< The state of the user. */ char *statusline; /**< The state of the user. */ - CurrentMedia media; /**< Current media of the user. */ + CurrentMedia *media; /**< Current media of the user. */ gboolean idle; /**< The idle state of the user. */ - struct - { - char *home; /**< Home phone number. */ - char *work; /**< Work phone number. */ - char *mobile; /**< Mobile phone number. */ - - } phone; + MsnUserPhoneInfo *phone; /**< This user's phone numbers. */ gboolean authorized; /**< Authorized to add this user. */ gboolean mobile; /**< Signed up with MSN Mobile. */ @@ -103,8 +104,11 @@ int list_op; /**< Which lists the user is in */ - guint membership_id[5]; /**< The membershipId sent by the contacts server, - indexed by the list it belongs to */ + /** + * The membershipId for this buddy on our pending list. Sent by + * the contact's server + */ + guint member_id_on_pending_list; char *invite_message; /**< Invite message of user request */ }; @@ -155,9 +159,10 @@ * Sets the current media of user. * * @param user The user. - * @param cmedia Current media. + * @param cmedia Current media. This function takes ownership of this + * object and its contents. */ -void msn_user_set_currentmedia(MsnUser *user, const CurrentMedia *cmedia); +void msn_user_set_currentmedia(MsnUser *user, CurrentMedia *cmedia); /** * Sets the new state of user.
--- a/libpurple/protocols/msn/userlist.c Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/msn/userlist.c Thu Feb 04 05:46:37 2010 +0000 @@ -119,26 +119,16 @@ if (group_id == NULL) return FALSE; - if (g_list_find_custom(user->group_ids, group_id, (GCompareFunc)strcmp)) - return TRUE; - - return FALSE; + return (g_list_find_custom(user->group_ids, group_id, (GCompareFunc)strcmp)) != NULL; } gboolean msn_userlist_user_is_in_list(MsnUser *user, MsnListId list_id) { - int list_op; - if (user == NULL) return FALSE; - list_op = 1 << list_id; - - if (user->list_op & list_op) - return TRUE; - else - return FALSE; + return (user->list_op & (1 << list_id)); } /************************************************************************** @@ -345,11 +335,11 @@ for (l = userlist->users; l != NULL; l = l->next) { MsnUser *user = (MsnUser *)l->data; - if (user->phone.mobile == NULL) { + if (!user->phone || !user->phone->mobile) { continue; } - if (!g_ascii_strcasecmp(number, user->phone.mobile)) { + if (!g_ascii_strcasecmp(number, user->phone->mobile)) { return user; } }
--- a/libpurple/protocols/msn/userlist.h Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/msn/userlist.h Thu Feb 04 05:46:37 2010 +0000 @@ -31,12 +31,11 @@ typedef enum { - MSN_LIST_FL, - MSN_LIST_AL, - MSN_LIST_BL, - MSN_LIST_RL, - MSN_LIST_PL - + MSN_LIST_FL, /**< Forward list */ + MSN_LIST_AL, /**< Allow list */ + MSN_LIST_BL, /**< Block list */ + MSN_LIST_RL, /**< Reverse list */ + MSN_LIST_PL /**< Pending list */ } MsnListId;
--- a/libpurple/protocols/myspace/user.c Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/myspace/user.c Thu Feb 04 05:46:37 2010 +0000 @@ -92,16 +92,13 @@ msim_find_user(MsimSession *session, const gchar *username) { PurpleBuddy *buddy; - MsimUser *user; buddy = purple_find_buddy(session->account, username); if (!buddy) { return NULL; } - user = msim_get_user_from_buddy(buddy, TRUE); - - return user; + return msim_get_user_from_buddy(buddy, TRUE); } /** @@ -355,14 +352,6 @@ return; } - if (user->temporary_user) { - /* This user will be destroyed soon; don't try to look up its image or avatar, - * since that won't return immediately and we will end up accessing freed data. - */ - g_free(value_str); - return; - } - g_free(user->image_url); user->image_url = value_str;
--- a/libpurple/protocols/oscar/libaim.c Wed Feb 03 19:45:23 2010 +0000 +++ b/libpurple/protocols/oscar/libaim.c Thu Feb 04 05:46:37 2010 +0000 @@ -32,8 +32,7 @@ NULL, /* user_splits */ NULL, /* protocol_options */ /* The mimimum icon size below is not needed in AIM 6.0 */ - {"gif,jpeg,bmp,ico", 48, 48, 50, 50, 7168, - PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ + {"gif,jpeg,bmp,ico", 0, 0, 100, 100, 7168, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ oscar_list_icon_aim, /* list_icon */ oscar_list_emblem, /* list_emblems */ oscar_status_text, /* status_text */