changeset 7673:42e5d2f4e4b1

[gaim-migrate @ 8317] I'm gonna revert this to make it easier to applie the changed patch which includes the stuff I'm reverting. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 30 Nov 2003 18:15:22 +0000
parents 73c7b22cf9bb
children 3d49c33db741
files src/gtknotify.c src/util.c src/util.h
diffstat 3 files changed, 2 insertions(+), 145 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtknotify.c	Sun Nov 30 15:51:17 2003 +0000
+++ b/src/gtknotify.c	Sun Nov 30 18:15:22 2003 +0000
@@ -215,17 +215,13 @@
 		char *from_text = NULL, *subject_text = NULL;
 
 		if (froms != NULL) {
-			char *from_decoded = gaim_mime_decode_field(*froms);
 			from_text = g_strdup_printf(
-				_("<span weight=\"bold\">From:</span> %s\n"), from_decoded);
-			g_free(from_decoded);
+				_("<span weight=\"bold\">From:</span> %s\n"), *froms);
 		}
 
 		if (subjects != NULL) {
-			char *subject_decoded = gaim_mime_decode_field(*subjects);
 			subject_text = g_strdup_printf(
-				_("<span weight=\"bold\">Subject:</span> %s\n"), subject_decoded);
-			g_free(subject_decoded);
+				_("<span weight=\"bold\">Subject:</span> %s\n"), *subjects);
 		}
 
 		label_text = g_strdup_printf(
--- a/src/util.c	Sun Nov 30 15:51:17 2003 +0000
+++ b/src/util.c	Sun Nov 30 18:15:22 2003 +0000
@@ -244,142 +244,6 @@
 		*size = len;
 }
 
-/**************************************************************************
- * Quoted Printable Functions
- **************************************************************************/
-void
-gaim_quotedp_decode(const char *text, char **data, int *size)
-{
-	char *p, *n, *new;
-	
-	n = new = malloc(strlen (text));
-
-	for (p = (char *)text; *p; p++, n++) {
-		if (*p == '=') {
-			sscanf(p + 1, "%2x\n", (int *)n);
-			p += 2;
-		}
-		else if (*p == '_')
-			*n = ' ';
-		else
-			*n = *p;
-	}
-
-	*n = '\0';
-
-	if (size)
-		*size = n - new;
-
-	/* Resize to take less space */
-	/* new = realloc(new, n - new); */
-
-	*data = new;
-}
-
-/**************************************************************************
- * MIME Functions
- **************************************************************************/
-#define OUT_CHARSET "utf-8"
-
-char *
-gaim_mime_decode_word(const char *charset, const char *encoding, const char *text)
-{
-	/* TODO: We need to check for nulls */
-	char *decoded, *converted;
-	int len = 0;
-
-	if (g_ascii_strcasecmp(encoding, "Q") == 0)
-		gaim_quotedp_decode(text, &decoded, &len);
-	else if (g_ascii_strcasecmp(encoding, "B") == 0)
-		gaim_base64_decode(text, &decoded, &len);
-	else
-		return NULL;
-
-
-	converted = g_convert(decoded, len, OUT_CHARSET, charset, NULL, NULL, NULL);
-	g_free(decoded);
-
-	return converted;
-}
-
-char *
-gaim_mime_decode_field(const char *str)
-{
-	char *cur, *mark;
-	char *unencoded_start, *unencoded_end;
-	char *charset, *encoding, *text, *decoded;
-	char *new, *n;
-
-	n = new = malloc(strlen(str));
-	charset = text = NULL;
-
-	/* Here we will be looking for encoded words and if they seem to be
-	 * valid then decode them */
-
-	for (	unencoded_start = cur = (char *)str;
-		(unencoded_end = cur = strstr(cur, "=?"));
-		unencoded_start = cur)
-	{
-		int len;
-		char *token;
-		GQueue *tokens = g_queue_new();
-
-		for (cur += 2, mark = cur; *cur; cur++) {
-			if (*cur == '?') {
-				token = g_strndup(mark, cur - mark);
-				g_queue_push_head(tokens, token);
-
-				mark = (cur + 1);
-
-				if (*mark == '=')
-					break;
-			} else {
-				if ((tokens->length == 2) && (*cur == ' '))
-					break;
-				else if ((tokens->length < 2) && (strchr("()<>@,;:/[]", *cur)))
-					break;
-				else if (tokens->length > 2)
-					break;
-			}
-		}
-
-		cur += 2;
-
-		if ((tokens->length == 3) && (*mark == '=')) {
-			len = unencoded_end - unencoded_start;
-			n = strncpy(n, unencoded_start, len) + len;
-
-			charset = g_queue_pop_tail(tokens);
-			encoding = g_queue_pop_tail(tokens);
-			text = g_queue_pop_tail(tokens);
-
-			if ((decoded = gaim_mime_decode_word(charset, encoding, text))) {
-				len = strlen(decoded);
-				n = strncpy(n, decoded, len) + len;
-				g_free(decoded);
-			}
-
-			g_free(charset);
-			g_free(encoding);
-			g_free(text);
-		} else {
-			len = cur - unencoded_start;
-			n = strncpy(n, unencoded_start, len) + len;
-
-			while ((token = g_queue_pop_tail(tokens)))
-				g_free(token);
-		}
-
-		g_queue_free(tokens);
-	}
-
-	*n = '\0';
-
-	if (*unencoded_start)
-		n = strcpy(n, unencoded_start);
-
-	return new;
-}
 
 /**************************************************************************
  * Date/Time Functions
--- a/src/util.h	Sun Nov 30 15:51:17 2003 +0000
+++ b/src/util.h	Sun Nov 30 18:15:22 2003 +0000
@@ -96,9 +96,6 @@
 
 /*@}*/
 
-void gaim_quotedp_decode (const char *text, char **data, int *size);
-char *gaim_mime_decode_field (const char *str);
-
 
 /**************************************************************************/
 /** @name Date/Time Functions                                             */