#
# This patch enables urlview v0.9 to decode quoted-printables in selected URL.
#
--- urlview-0.9/urlview.c	Tue Jul  4 12:14:30 2000
+++ urlview-0.9.qpd-patch/urlview.c	Thu Aug  3 02:49:03 2000
@@ -18,6 +18,8 @@
  *
  * Created:       Thu Dec  4 02:13:11 PST 1997
  * Last Modified: Tue Jul  4 11:23:49 CEST 2000
+ * Last Modified: Thu Aug  3 02:46:37 CEST 2000 
+ *	Eike Rathke, added 'd': decode quoted-printable
  */ 
 
 #ifdef USE_SLANG
@@ -58,7 +60,8 @@
 {
   FULL = 1,
   INDEX,
-  MOTION
+  MOTION,
+  CURRENT
 };
 
 extern int mutt_enter_string (unsigned char *buf, size_t buflen, int y, int x,
@@ -397,6 +400,14 @@
       }
       clrtobot ();
     }
+    else if (redraw == CURRENT)
+    {
+      mvaddstr (current - top + OFFSET, 0, "   ");
+      snprintf (buf, sizeof (buf), "%4d ", current + 1);
+      addstr (buf);
+      addstr (url[current]);
+      clrtoeol ();
+    }
     else if (redraw == MOTION)
       mvaddstr (oldcurrent - top + OFFSET, 0, "  ");
 
@@ -570,6 +581,42 @@
 	break;
       case 'N':
 	search_backward (search, urlcount, url, &redraw, &current, &top);
+	break;
+      case 'd':
+	{ /* erAck: decode quoted-printable */
+	  char *p1, *p2;
+	  p1 = p2 = url[current];
+	  do 
+	  {
+	    while ( *p2 && *p2 != '=' )
+	      *p1++ = *p2++;
+	    if ( *p2 == '=' )
+	    {
+	      if ( isxdigit( *(p2+1) ) && isxdigit( *(p2+2) ) )
+	      {
+		++p2;
+		if ( 'A' <= *p2 && *p2 <= 'F' )
+		  *p1 = (((*p2 - 'A') + 10) << 4);
+		else if ( 'a' <= *p2 && *p2 <= 'f' )
+		  *p1 = (((*p2 - 'a') + 10) << 4);
+		else
+		  *p1 = ((*p2 - '0') << 4);
+		++p2;
+		if ( 'A' <= *p2 && *p2 <= 'F' )
+		  *p1 += (*p2 - 'A') + 10;
+		else if ( 'a' <= *p2 && *p2 <= 'f' )
+		  *p1 += (*p2 - 'a') + 10;
+		else
+		  *p1 += (*p2 - '0');
+		p1++, p2++;
+	      }
+	      else
+		*p1++ = *p2++;
+	    }
+	  } while ( *p2 );
+	  *p1 = 0;
+	}
+	redraw = CURRENT;
 	break;
       default:
 	break;
