Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 213639 | Differences between
and this patch

Collapse All | Expand All

(-)src/art_misc.c (+1 lines)
Lines 406-411 Link Here
406
   
406
   
407
   while (l != NULL)
407
   while (l != NULL)
408
     {
408
     {
409
        if(l->flags & HIDDEN_LINE) break;
409
        l->flags |= SIGNATURE_LINE;
410
        l->flags |= SIGNATURE_LINE;
410
        l->flags &= ~(
411
        l->flags &= ~(
411
		      QUOTE_LINE  /* if in a signature, not a quote */
412
		      QUOTE_LINE  /* if in a signature, not a quote */
(-)src/version.c (-1 / +25 lines)
Lines 43-49 Link Here
43
#include "art.h"
43
#include "art.h"
44
#include "snprintf.h"
44
#include "snprintf.h"
45
45
46
char *Slrn_Version_String = SLRN_VERSION_STRING;
46
#define SLRN_VERSION_STRING_TW SLRN_VERSION_STRING"/mm"
47
char *Slrn_Version_String = SLRN_VERSION_STRING_TW;
47
int Slrn_Version = SLRN_VERSION;
48
int Slrn_Version = SLRN_VERSION;
48
49
49
typedef struct 
50
typedef struct 
Lines 91-96 Link Here
91
   {NULL, 0}
92
   {NULL, 0}
92
};
93
};
93
94
95
static char *included_patches[] =
96
{
97
 "minimal_multipart",
98
 ""
99
};
100
94
static void print_options (FILE *fp, Compile_Option_Type *opts, char *title)
101
static void print_options (FILE *fp, Compile_Option_Type *opts, char *title)
95
{
102
{
96
   unsigned int len;
103
   unsigned int len;
Lines 121-126 Link Here
121
   print_options (fp, Feature_Options, _("Features"));
128
   print_options (fp, Feature_Options, _("Features"));
122
}
129
}
123
130
131
static void show_included_patches (FILE *fp)
132
{
133
  int i=0;
134
135
  while(*(included_patches[i]) != '\0')
136
  {
137
    fprintf (fp, _("  %s\n"),included_patches[i]);
138
    i++;
139
  }
140
}
141
124
void slrn_show_version (FILE *fp) /*{{{*/
142
void slrn_show_version (FILE *fp) /*{{{*/
125
{
143
{
126
   char *os;
144
   char *os;
Lines 150-155 Link Here
150
   
168
   
151
   fprintf (fp, _(" Default posting mechanism: %s\n"),
169
   fprintf (fp, _(" Default posting mechanism: %s\n"),
152
	    slrn_map_object_id_to_name (1, SLRN_DEFAULT_POST_OBJ));
170
	    slrn_map_object_id_to_name (1, SLRN_DEFAULT_POST_OBJ));
171
172
   if(*included_patches[0] != '\0')
173
   {
174
      fprintf (fp, _("\nPATCHES:\n"));
175
      show_included_patches (fp);
176
   }
153
}
177
}
154
178
155
/*}}}*/
179
/*}}}*/
(-)src/mime.c (-3 / +168 lines)
Lines 55-60 Link Here
55
int Slrn_Use_Meta_Mail = 1;
55
int Slrn_Use_Meta_Mail = 1;
56
int Slrn_Fold_Headers = 1;
56
int Slrn_Fold_Headers = 1;
57
char *Slrn_MetaMail_Cmd;
57
char *Slrn_MetaMail_Cmd;
58
int Slrn_Minimal_Multipart =1;
58
59
59
#ifndef SLRNPULL_CODE
60
#ifndef SLRNPULL_CODE
60
#define CONTENT_TYPE_TEXT		0x01
61
#define CONTENT_TYPE_TEXT		0x01
Lines 106-122 Link Here
106
	  }
107
	  }
107
	b += 5;
108
	b += 5;
108
     }
109
     }
109
   else if (0 == slrn_case_strncmp (b, "message/", 5))
110
   else if (0 == slrn_case_strncmp (b, "message/", 8))
110
     {
111
     {
111
	a->mime.content_type = CONTENT_TYPE_MESSAGE;
112
	a->mime.content_type = CONTENT_TYPE_MESSAGE;
112
	a->mime.content_subtype = CONTENT_SUBTYPE_UNKNOWN;
113
	a->mime.content_subtype = CONTENT_SUBTYPE_UNKNOWN;
113
	b += 8;
114
	b += 8;
114
     }
115
     }
115
   else if (0 == slrn_case_strncmp (b, "multipart/", 5))
116
     else if (0 == slrn_case_strncmp (b, "application/", 12))
117
      {
118
 	b += 12;
119
 	if (0 != slrn_case_strncmp (b, "pgp-signature", 13))
120
 	  {
121
 	     a->mime.content_type = CONTENT_TYPE_UNSUPPORTED;
122
 	     a->mime.content_subtype = CONTENT_SUBTYPE_UNSUPPORTED;
123
 	     return -1;
124
 	  }
125
 	a->mime.content_type = CONTENT_TYPE_TEXT;
126
 	a->mime.content_subtype = CONTENT_SUBTYPE_PLAIN;
127
      }
128
   else if (0 == slrn_case_strncmp (b, "multipart/", 10))
116
     {
129
     {
117
	a->mime.content_type = CONTENT_TYPE_MULTIPART;
130
	a->mime.content_type = CONTENT_TYPE_MULTIPART;
118
	a->mime.content_subtype = CONTENT_SUBTYPE_UNKNOWN;
131
	a->mime.content_subtype = CONTENT_SUBTYPE_UNKNOWN;
119
	b += 10;
132
	b += 10;
133
 	while (NULL != (b = slrn_strbyte(b, ';')))
134
 	  {
135
 	     char *boundary;
136
 	     unsigned int len;
137
 	     
138
 	     b = slrn_skip_whitespace (b + 1);
139
 	     
140
 	     if (0 != slrn_case_strncmp (b, "boundary", 8))
141
 	       continue;
142
 	     
143
 	     b = slrn_skip_whitespace (b + 8);
144
 
145
 	     if (*b != '=') continue;
146
 	     b++;
147
 	     if (*b == '"') b++;
148
 	     boundary = b;
149
 	     while (*b && (*b != ';')
150
 		    && (*b != ' ') && (*b != '\t') && (*b != '\n')
151
 		    && (*b != '"'))
152
 	       b++;
153
 	     len = b - boundary;
154
 
155
              /* add a "--" at the start of boundary */
156
 	     a->mime.boundary = slrn_safe_malloc(len+5);
157
              a->mime.boundary[0]='-';
158
              a->mime.boundary[1]='-';
159
              slrn_strncpy(a->mime.boundary+2, boundary, len+1);
160
              a->mime.boundary[len+2]='-';
161
              a->mime.boundary[len+3]='-';
162
 	     return 0;
163
 	  }
120
     }
164
     }
121
   else
165
   else
122
     {
166
     {
Lines 786-791 Link Here
786
   m->was_parsed = 0;
830
   m->was_parsed = 0;
787
   m->needs_metamail = 0;
831
   m->needs_metamail = 0;
788
   m->charset = NULL;
832
   m->charset = NULL;
833
   m->boundary = NULL;
789
   m->content_type = 0;
834
   m->content_type = 0;
790
   m->content_subtype = 0;
835
   m->content_subtype = 0;
791
}
836
}
Lines 798-803 Link Here
798
    {
843
    {
799
       slrn_free(m->charset);
844
       slrn_free(m->charset);
800
    }
845
    }
846
  if (m->boundary != NULL)
847
    {
848
       slrn_free(m->boundary);
849
    }
801
}
850
}
802
851
803
/*}}}*/
852
/*}}}*/
Lines 883-889 Link Here
883
	obj=tmp;
932
	obj=tmp;
884
     }
933
     }
885
}
934
}
935
/*}}}*/
886
936
937
int slrn_convert_multipart_article(Slrn_Article_Type *a, char *to_charset)/*{{{*/
938
{
939
   struct Slrn_Article_Line_Type *line, *first_line,  *line_start_part, *line_end_part, *line_tmp;
940
   int len;
941
   int j=1;
942
   int endfound=0;
943
944
   Slrn_Mime_Type mime_bak;
945
946
   first_line =a->lines;
947
   line       =a->lines;
948
   len = strlen(a->mime.boundary)-2;
949
   /* search 1st boundary */ 
950
   do
951
   {
952
      if((line->flags & HEADER_LINE) == 0)
953
      {
954
        line->flags |= HIDDEN_LINE;
955
      }
956
      line=line->next;
957
   } while ((line->next != NULL) && slrn_case_strncmp(line->buf, a->mime.boundary, len) != 0);
958
959
   while ((line->next != NULL) && (endfound == 0))
960
     {
961
       j++;
962
       line_start_part = line;
963
       do
964
       {
965
         line->flags |= HIDDEN_LINE;
966
         line->flags |= HEADER_LINE;
967
         line=line->next; 
968
969
       } while ((line->next != NULL) && (*(line->buf) != 0));
970
      
971
       /* search boundary */
972
       while ((line->next != NULL) && (slrn_case_strncmp(line->buf, a->mime.boundary, len) != 0))
973
       {
974
         line_end_part=line;
975
         line=line->next;
976
       }
977
       if(slrn_case_strncmp(line->buf, a->mime.boundary, len+2) == 0)
978
       {
979
         /* we found the normal ending boundary */
980
         endfound=1;
981
       }
982
       else if(line->next==NULL)
983
       {
984
         /* end of article, indicating a corrupted article */
985
         endfound=2;
986
       }
987
988
       /* pseudo article with only multipart */
989
       mime_bak = a->mime;
990
       slrn_mime_init(&a->mime);
991
       a->lines = line_start_part;
992
993
       /* start of pseudo article has no prev, save old prev value in line_start_part */
994
       line_start_part=line_start_part->prev;
995
       a->lines->prev = NULL;
996
997
       if(endfound != 2)
998
       {
999
         line_end_part->next = NULL;
1000
       }
1001
1002
       _slrn_art_unfold_header_lines(a);
1003
       slrn_mime_process_article (a);
1004
1005
       line->flags |= HIDDEN_LINE;
1006
       line_tmp = a->lines;
1007
       do 
1008
       {
1009
           if( line_tmp->flags & HEADER_LINE)
1010
             {
1011
               line_tmp->flags ^= HEADER_LINE;
1012
             }
1013
           else if(a->mime.content_type == CONTENT_TYPE_UNSUPPORTED)
1014
             {
1015
               /* hide not supported multiparts */
1016
               line_tmp->flags |= HIDDEN_LINE;
1017
             }
1018
           line_end_part=line_tmp;
1019
           line_tmp=line_tmp->next;
1020
       } while (line_tmp != NULL);
1021
1022
       /* set back article */ 
1023
       line_start_part->next=a->lines;
1024
       a->lines->prev=line_start_part;
1025
1026
       a->lines = first_line;
1027
       if(endfound != 2)
1028
       {
1029
         line_end_part->next = line;
1030
         line->prev          = line_end_part;
1031
       }
1032
       else
1033
       {
1034
         slrn_message (_("Multipart article is corrupted."));
1035
       }
1036
1037
       if(a->mime.content_type == CONTENT_TYPE_UNSUPPORTED)
1038
         slrn_message (_("Unsupported multiparts were hidden."));
1039
1040
       /* free space */
1041
       slrn_mime_free(&a->mime);
1042
1043
       a->mime=mime_bak;
1044
     }
1045
   return 0;
1046
}
887
/*}}}*/
1047
/*}}}*/
888
1048
889
static char *guess_body_charset (Slrn_Article_Type *a)
1049
static char *guess_body_charset (Slrn_Article_Type *a)
Lines 938-950 Link Here
938
	a->mime.needs_metamail = 1;
1098
	a->mime.needs_metamail = 1;
939
	return 0;
1099
	return 0;
940
     }
1100
     }
941
   
1101
942
   if ((a->mime.charset == NULL)
1102
   if ((a->mime.charset == NULL)
943
       && (NULL == (a->mime.charset = guess_body_charset (a))))
1103
       && (NULL == (a->mime.charset = guess_body_charset (a))))
944
     return -1;
1104
     return -1;
945
1105
946
   rfc1522_decode_headers (a);
1106
   rfc1522_decode_headers (a);
947
1107
1108
   if ((a->mime.content_type == CONTENT_TYPE_MULTIPART) && (Slrn_Minimal_Multipart != 0) )
1109
     {
1110
	return slrn_convert_multipart_article(a, Slrn_Display_Charset);
1111
     }
1112
   
948
   switch (parse_content_transfer_encoding_line (a))
1113
   switch (parse_content_transfer_encoding_line (a))
949
     {
1114
     {
950
      case ENCODED_RAW:
1115
      case ENCODED_RAW:
(-)src/mime.h (+1 lines)
Lines 34-39 Link Here
34
extern int Slrn_Fold_Headers;
34
extern int Slrn_Fold_Headers;
35
extern int Slrn_Use_Meta_Mail;
35
extern int Slrn_Use_Meta_Mail;
36
extern char *Slrn_MetaMail_Cmd;
36
extern char *Slrn_MetaMail_Cmd;
37
extern int Slrn_Minimal_Multipart;
37
38
38
39
39
#endif /* _SLRN_MIME_H */
40
#endif /* _SLRN_MIME_H */
(-)src/startup.c (+1 lines)
Lines 639-644 Link Here
639
     {"max_queued_groups", &Slrn_Max_Queued_Groups, NULL},
639
     {"max_queued_groups", &Slrn_Max_Queued_Groups, NULL},
640
     {"use_header_numbers", &Slrn_Use_Header_Numbers, NULL},
640
     {"use_header_numbers", &Slrn_Use_Header_Numbers, NULL},
641
     {"use_localtime", &Slrn_Use_Localtime, NULL},
641
     {"use_localtime", &Slrn_Use_Localtime, NULL},
642
     {"minimal_multipart", &Slrn_Minimal_Multipart},
642
#if SLRN_HAS_SPOILERS
643
#if SLRN_HAS_SPOILERS
643
     {"spoiler_char", &Slrn_Spoiler_Char, NULL},
644
     {"spoiler_char", &Slrn_Spoiler_Char, NULL},
644
     {"spoiler_display_mode", &Slrn_Spoiler_Display_Mode, NULL},
645
     {"spoiler_display_mode", &Slrn_Spoiler_Display_Mode, NULL},
(-)src/art.h (+1 lines)
Lines 185-190 Link Here
185
    int was_modified;
185
    int was_modified;
186
    int was_parsed;
186
    int was_parsed;
187
    int needs_metamail;
187
    int needs_metamail;
188
    char *boundary;
188
}
189
}
189
Slrn_Mime_Type;
190
Slrn_Mime_Type;
190
191

Return to bug 213639