summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@pidgin.im>2007-09-21 00:20:20 +0000
committerSadrul Habib Chowdhury <sadrul@pidgin.im>2007-09-21 00:20:20 +0000
commit42bbfd1f8498d91ceb8551ff5eebaff54f5f6b02 (patch)
tree74acc0771cfc111b4a472bb08fb7a6d56bf867c4
parenta701731d2d282011d107d3ad8b464153098e45b7 (diff)
parentd30fef7e3eb78833da53fbe9ded73f3f37855485 (diff)
downloadpidgin-42bbfd1f8498d91ceb8551ff5eebaff54f5f6b02.tar.gz
merge of 'c2da1eed951ee206abaae79ae14f1102cbc6fb6f'
and 'fd63ef5027d78d5f4276f03b215ca160367a0dd0'
-rw-r--r--libpurple/protocols/msn/state.c48
1 files changed, 10 insertions, 38 deletions
diff --git a/libpurple/protocols/msn/state.c b/libpurple/protocols/msn/state.c
index 30579541ab..dfc92ab052 100644
--- a/libpurple/protocols/msn/state.c
+++ b/libpurple/protocols/msn/state.c
@@ -98,9 +98,17 @@ msn_parse_currentmedia(const char *cmedia, CurrentMedia *media)
cmedia_array = g_strsplit(cmedia, "\\0", 0);
+ /*
+ * 0: Media Player
+ * 1: 'Music'
+ * 2: '1' if enabled, '0' if not
+ * 3: Format (eg. {0} by {1})
+ * 4: Title
+ * 5: Artist
+ * 6: Album
+ * 7: ?
+ */
strings = 0;
- /* Yes, we want to skip the first element here, as it is empty due to
- * the cmedia string starting with \0 -- see the examples below. */
while (cmedia_array[++strings] != NULL);
if (strings < 4)
@@ -125,42 +133,6 @@ msn_parse_currentmedia(const char *cmedia, CurrentMedia *media)
media->album = NULL;
return TRUE;
-
-#if 0
- /* The cmedia_array[2] field contains a 1 if enabled. */
- if ((strings > 3) && (!strcmp(cmedia_array[2], "1"))) {
- char *inptr = cmedia_array[3];
-
- buffer = g_string_new(NULL);
-
- while (*inptr != '\0') {
- if ((*inptr == '{') && ((*(inptr + 1) != '\0') && (*(inptr+2) == '}'))) {
- char *tmpptr;
- int tmp;
-
- errno = 0;
- tmp = strtol(inptr + 1, &tmpptr, 10);
-
- if (errno == 0 && tmpptr != inptr + 1 &&
- tmp + 4 < strings) {
- /* Replace {?} tag with appropriate text only when successful.
- * Skip otherwise. */
- buffer = g_string_append(buffer, cmedia_array[tmp + 4]);
- }
- inptr += 3; /* Skip to the next char after '}' */
- } else {
- buffer = g_string_append_c(buffer, *inptr++);
- }
- }
- purple_debug_info("msn", "Parsed currentmedia string, result: \"%s\"\n",
- buffer->str);
- } else {
- purple_debug_info("msn", "Current media marked disabled, not parsing.\n");
- }
-
- g_strfreev(cmedia_array);
- return buffer ? g_string_free(buffer, FALSE) : NULL;
-#endif
}
/* get the CurrentMedia info from the XML string */