Mercurial > pidgin.yaz
diff libpurple/protocols/msn/state.c @ 29368:746bf7d8b34e
Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes
MsnUser smaller by the size of one pointer.
Since both of these structs are used only rarely, this ends up saving
memory for most people.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 05 Feb 2010 02:19:22 +0000 |
parents | 99d1b433dba0 |
children | 462cb893521b 1830fa548302 |
line wrap: on
line diff
--- a/libpurple/protocols/msn/state.c Fri Feb 05 01:18:18 2010 +0000 +++ b/libpurple/protocols/msn/state.c Fri Feb 05 02:19:22 2010 +0000 @@ -86,60 +86,6 @@ return result; } -CurrentMedia *msn_parse_currentmedia(const char *cmedia) -{ - char **cmedia_array; - int strings = 0; - CurrentMedia *media = NULL; - - if (!cmedia || cmedia[0] == '\0') { - purple_debug_info("msn", "No currentmedia string\n"); - return NULL; - } - - purple_debug_info("msn", "Parsing currentmedia string: \"%s\"\n", cmedia); - - cmedia_array = g_strsplit(cmedia, "\\0", 0); - - /* - * 0: Application - * 1: 'Music'/'Games'/'Office' - * 2: '1' if enabled, '0' if not - * 3: Format (eg. {0} by {1}) - * 4: Title - * If 'Music': - * 5: Artist - * 6: Album - * 7: ? - */ -#if GLIB_CHECK_VERSION(2,6,0) - strings = g_strv_length(cmedia_array); -#else - while (cmedia_array[++strings] != NULL); -#endif - - if (strings >= 4 && !strcmp(cmedia_array[2], "1")) { - media = g_new(CurrentMedia, 1); - - if (!strcmp(cmedia_array[1], "Music")) - media->type = CURRENT_MEDIA_MUSIC; - else if (!strcmp(cmedia_array[1], "Games")) - media->type = CURRENT_MEDIA_GAMES; - else if (!strcmp(cmedia_array[1], "Office")) - media->type = CURRENT_MEDIA_OFFICE; - else - media->type = CURRENT_MEDIA_UNKNOWN; - - 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 media; -} - /* get the CurrentMedia info from the XML string */ char * msn_get_currentmedia(char *xml_str, gsize len)