updated on Thu Jan 5 13:17:10 UTC 2012
[aur-mirror.git] / mutt-great-dane / urlview.c.qpd-patch
blob44275b4673dd361d3d17a49c4372c40c04f3b277
2 # This patch enables urlview v0.9 to decode quoted-printables in selected URL.
4 --- urlview-0.9/urlview.c       Tue Jul  4 12:14:30 2000
5 +++ urlview-0.9.qpd-patch/urlview.c     Thu Aug  3 02:49:03 2000
6 @@ -18,6 +18,8 @@
7   *
8   * Created:       Thu Dec  4 02:13:11 PST 1997
9   * Last Modified: Tue Jul  4 11:23:49 CEST 2000
10 + * Last Modified: Thu Aug  3 02:46:37 CEST 2000 
11 + *     Eike Rathke, added 'd': decode quoted-printable
12   */ 
14  #ifdef USE_SLANG
15 @@ -58,7 +60,8 @@
16  {
17    FULL = 1,
18    INDEX,
19 -  MOTION
20 +  MOTION,
21 +  CURRENT
22  };
24  extern int mutt_enter_string (unsigned char *buf, size_t buflen, int y, int x,
25 @@ -397,6 +400,14 @@
26        }
27        clrtobot ();
28      }
29 +    else if (redraw == CURRENT)
30 +    {
31 +      mvaddstr (current - top + OFFSET, 0, "   ");
32 +      snprintf (buf, sizeof (buf), "%4d ", current + 1);
33 +      addstr (buf);
34 +      addstr (url[current]);
35 +      clrtoeol ();
36 +    }
37      else if (redraw == MOTION)
38        mvaddstr (oldcurrent - top + OFFSET, 0, "  ");
40 @@ -570,6 +581,42 @@
41         break;
42        case 'N':
43         search_backward (search, urlcount, url, &redraw, &current, &top);
44 +       break;
45 +      case 'd':
46 +       { /* erAck: decode quoted-printable */
47 +         char *p1, *p2;
48 +         p1 = p2 = url[current];
49 +         do 
50 +         {
51 +           while ( *p2 && *p2 != '=' )
52 +             *p1++ = *p2++;
53 +           if ( *p2 == '=' )
54 +           {
55 +             if ( isxdigit( *(p2+1) ) && isxdigit( *(p2+2) ) )
56 +             {
57 +               ++p2;
58 +               if ( 'A' <= *p2 && *p2 <= 'F' )
59 +                 *p1 = (((*p2 - 'A') + 10) << 4);
60 +               else if ( 'a' <= *p2 && *p2 <= 'f' )
61 +                 *p1 = (((*p2 - 'a') + 10) << 4);
62 +               else
63 +                 *p1 = ((*p2 - '0') << 4);
64 +               ++p2;
65 +               if ( 'A' <= *p2 && *p2 <= 'F' )
66 +                 *p1 += (*p2 - 'A') + 10;
67 +               else if ( 'a' <= *p2 && *p2 <= 'f' )
68 +                 *p1 += (*p2 - 'a') + 10;
69 +               else
70 +                 *p1 += (*p2 - '0');
71 +               p1++, p2++;
72 +             }
73 +             else
74 +               *p1++ = *p2++;
75 +           }
76 +         } while ( *p2 );
77 +         *p1 = 0;
78 +       }
79 +       redraw = CURRENT;
80         break;
81        default:
82         break;