changeset 20572:1933f2084eb3

Remove commented out code, and add soem notes.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 20 Sep 2007 20:18:57 +0000
parents 5913725cbcd6
children e2347dda167c
files libpurple/protocols/msn/state.c
diffstat 1 files changed, 10 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/state.c	Thu Sep 20 16:30:17 2007 +0000
+++ b/libpurple/protocols/msn/state.c	Thu Sep 20 20:18:57 2007 +0000
@@ -98,9 +98,17 @@
 
 	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 @@
 		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 */