1 diff -rc alpine-2.26/pith/conf.c alpine-2.26.longurl/pith/conf.c
2 *** alpine-2.26/pith/conf.c 2022-06-02 18:14:00.491274749 -0600
3 --- alpine-2.26.longurl/pith/conf.c 2022-06-02 18:15:09.259106132 -0600
7 F_VIEW_SEL_URL, h_config_enable_view_url, PREF_VIEW, 1},
8 {"enable-msg-view-web-hostnames", "Enable Message View Web Hostname Links",
9 F_VIEW_SEL_URL_HOST, h_config_enable_view_web_host, PREF_VIEW, 1},
10 + {"enable-msg-view-long-url", "Enable Recognition of Long URLS without Delimiter",
11 + F_VIEW_LONG_URL, h_config_enable_long_url, PREF_VIEW, 0},
12 {"enable-msg-view-forced-arrows", "Enable Message View Forced Arrows",
13 F_FORCE_ARROWS, h_config_enable_view_arrows, PREF_VIEW, 0},
14 {"external-command-loads-inline-images-only", NULL,
15 diff -rc alpine-2.26/pith/conftype.h alpine-2.26.longurl/pith/conftype.h
16 *** alpine-2.26/pith/conftype.h 2022-06-02 18:14:00.491274749 -0600
17 --- alpine-2.26.longurl/pith/conftype.h 2022-06-02 18:15:09.259106132 -0600
27 F_EXTERNAL_INLINE_IMAGES,
28 diff -rc alpine-2.26/pith/mailview.c alpine-2.26.longurl/pith/mailview.c
29 *** alpine-2.26/pith/mailview.c 2022-06-02 18:14:00.491274749 -0600
30 --- alpine-2.26.longurl/pith/mailview.c 2022-06-02 18:15:09.307106014 -0600
38 url_hilite(long int linenum, char *line, LT_INS_S **ins, void *local)
40 register char *lp, *up = NULL, *urlp = NULL,
41 *weburlp = NULL, *mailurlp = NULL;
42 ! int n, n1, n2, n3, l;
43 char buf[256], color[256];
47 ! for(lp = line; ; lp = up + n){
48 /* scan for all of them so we can choose the first */
49 if(F_ON(F_VIEW_SEL_URL,ps_global))
50 urlp = rfc1738_scan(lp, &n1);
56 + incomplete_url(char *up, int n, int delim)
61 + if(*(up + n) != '\0')
67 + if(F_ON(F_VIEW_LONG_URL, ps_global)){
69 + if(!strncmp(line, "http://", 7))
71 + else if(!strncmp(line, "https://", 8))
73 + if(strchr(line, '/') != NULL && (line = strrchr(line, '/')) != NULL){
75 + line2 = strrchr(line, '.');
76 + rv = (strpbrk(line,"+#?=&") != NULL)
77 + || (!line2 || line-line2 > 4);
85 url_hilite(long int linenum, char *line, LT_INS_S **ins, void *local)
87 register char *lp, *up = NULL, *urlp = NULL,
88 *weburlp = NULL, *mailurlp = NULL;
89 ! char *use_this_line, c, *begin_line, *end_line;
90 ! static int scannextline, delim = -1;
91 ! int n, n1, n2, n3, l, len;
92 ! int we_clear = 0, newhandle = 1, tie_off = 0;
93 char buf[256], color[256];
97 ! uh = (URL_HILITE_S *) local;
98 ! if(((uh && uh->handlesp && ((h = *(uh->handlesp)) == NULL)) || h->key == 0) ||
99 ! (!line || !*line) || linenum == 0)
100 ! scannextline = 0; /* initialize scannextline */
102 ! if(scannextline != 0){
103 ! up = rfc1738_scan(line, &n1);
105 ! /* if we found a url in the current line, but it is not at the beginning of
106 ! * the next line, or if there is no url in this line, we check if the url
107 ! * in the previous line continues in this line.
111 ! if(*uh->handlesp == NULL)
112 ! h = new_handle(uh->handlesp);
113 ! for(h = *uh->handlesp; h->next; h = h->next); /* get last handle */
114 ! len = h->h.url.path ? strlen(h->h.url.path) : 0;
115 ! use_this_line = (char *) fs_get((len + strlen(line) + 1)*sizeof(char));
116 ! sprintf(use_this_line,"%s%s", (h->h.url.path ? h->h.url.path : ""), line);
121 ! use_this_line = line;
124 ! use_this_line = line;
126 ! for(lp = use_this_line; ; lp = up + n){
127 /* scan for all of them so we can choose the first */
128 if(F_ON(F_VIEW_SEL_URL,ps_global))
129 urlp = rfc1738_scan(lp, &n1);
133 mailurlp = mail_addr_scan(lp, &n3);
135 if(urlp || weburlp || mailurlp){
136 + if(scannextline == 0){
141 weburlp ? weburlp : mailurlp;
142 if(up == urlp && weburlp && weburlp < up)
145 if(mailurlp && mailurlp < up)
150 weburlp = mailurlp = NULL;
152 else if(up == weburlp){
154 if(mailurlp && mailurlp < up)
157 ! if(scannextline != 0 && up == use_this_line){
162 + else if(up == urlp){
164 + delim = up > use_this_line && *(up - 1) == '<';
166 + if(incomplete_url(up,n, delim))
173 weburlp = mailurlp = NULL;
175 else if(up == weburlp){
179 uh = (URL_HILITE_S *) local;
181 ! h = new_handle(uh->handlesp);
183 ! h->h.url.path = (char *) fs_get((n + 10) * sizeof(char));
184 ! snprintf(h->h.url.path, n+10, "%s%.*s",
185 weburlp ? "http://" : (mailurlp ? "mailto:" : ""), n, up);
186 ! h->h.url.path[n+10-1] = '\0';
188 if(handle_start_color(color, sizeof(color), &l, uh->hdr_color))
189 ! ins = gf_line_test_new_ins(ins, up, color, l);
190 else if(F_OFF(F_SLCTBL_ITEM_NOBOLD, ps_global))
191 ! ins = gf_line_test_new_ins(ins, up, url_embed(TAG_BOLDON), 2);
195 snprintf(&buf[3], sizeof(buf)-3, "%d", h->key);
196 buf[sizeof(buf)-1] = '\0';
197 buf[2] = strlen(&buf[3]);
198 ! ins = gf_line_test_new_ins(ins, up, buf, (int) buf[2] + 3);
200 /* in case it was the current selection */
201 ! ins = gf_line_test_new_ins(ins, up + n, url_embed(TAG_INVOFF), 2);
203 if(scroll_handle_end_color(color, sizeof(color), &l, uh->hdr_color))
204 ! ins = gf_line_test_new_ins(ins, up + n, color, l);
206 ! ins = gf_line_test_new_ins(ins, up + n, url_embed(TAG_BOLDOFF), 2);
208 urlp = weburlp = mailurlp = NULL;
216 uh = (URL_HILITE_S *) local;
219 ! for(;h->next; h = h->next);
220 ! tie_off = 0; /* do only once */
222 ! end_line = line + n - strlen(h->h.url.path);
223 ! fs_give((void **)&(h->h.url.path));
224 ! c = *(use_this_line + n);
225 ! *(use_this_line+n) = '\0';
226 ! h->h.url.path = cpystr(use_this_line);
227 ! *(use_this_line+n) = c;
231 ! h = new_handle(uh->handlesp);
234 ! begin_line = newhandle ? (we_clear ? line + strlen(line) - strlen(up)
236 ! end_line = newhandle ? begin_line + n : line + strlen(line);
237 ! if(scannextline && h->h.url.path)
238 ! fs_give((void **)&(h->h.url.path));
239 ! h->h.url.path = (char *) fs_get((n + 10) * sizeof(char));
240 ! snprintf(h->h.url.path, n+10, "%s%.*s",
241 weburlp ? "http://" : (mailurlp ? "mailto:" : ""), n, up);
242 ! h->h.url.path[n+10-1] = '\0';
245 if(handle_start_color(color, sizeof(color), &l, uh->hdr_color))
246 ! ins = gf_line_test_new_ins(ins, begin_line, color, l);
247 else if(F_OFF(F_SLCTBL_ITEM_NOBOLD, ps_global))
248 ! ins = gf_line_test_new_ins(ins, begin_line, url_embed(TAG_BOLDON), 2);
252 snprintf(&buf[3], sizeof(buf)-3, "%d", h->key);
253 buf[sizeof(buf)-1] = '\0';
254 buf[2] = strlen(&buf[3]);
255 ! ins = gf_line_test_new_ins(ins, begin_line, buf, (int) buf[2] + 3);
257 /* in case it was the current selection */
258 ! ins = gf_line_test_new_ins(ins, end_line, url_embed(TAG_INVOFF), 2);
260 if(scroll_handle_end_color(color, sizeof(color), &l, uh->hdr_color))
261 ! ins = gf_line_test_new_ins(ins, end_line, color, l);
263 ! ins = gf_line_test_new_ins(ins, end_line, url_embed(TAG_BOLDOFF), 2);
265 urlp = weburlp = mailurlp = NULL;
269 + fs_give((void **)&use_this_line);
274 diff -rc alpine-2.26/pith/pine.hlp alpine-2.26.longurl/pith/pine.hlp
275 *** alpine-2.26/pith/pine.hlp 2022-06-02 18:14:00.491274749 -0600
276 --- alpine-2.26.longurl/pith/pine.hlp 2022-06-02 18:15:09.327105965 -0600
280 <End of help on this topic>
283 + ====== h_config_enable_long_url =====
286 + <TITLE>FEATURE: <!--#echo var="FEAT_enable-msg-view-long-url"--></TITLE>
289 + <H1>FEATURE: <!--#echo var="FEAT_enable-msg-view-long-url"--></H1>
291 + This feature modifies the behavior of Alpine's MESSAGE TEXT screen. When this feature
292 + is set alpine will attempt to recognize long urls (those that spread over several
293 + lines in the text) for the HTTP protocol, even when they have not been enclosed between
294 + delimiters "<" and ">".
296 + <P>The normal behavior in Alpine is that if a URL is preceeded by the "<"
297 + character and this URL was not finished before the end of the line, then a
298 + continuation of the URL is searched in the following line(s). Normally, this type of
299 + URLs will be ended by the ">" character, and if it is not, there is a
300 + possibility of including erroneous text into the URL.
302 + <P>Enabling this feature will make Alpine search for a continuation of certain URLs in
303 + lines following its location. This will be of great help most times, but in some cases
304 + the algorithm will catch some text into the URL that is not part of the URL.
306 + <P>If you find that Alpine failed to recognize correctly a URL simply edit the URL before
307 + passing it to your browser.
310 + <LI><A HREF="h_finding_help">Finding more information and requesting help</A>
312 + <End of help on this topic>
315 ====== h_config_enable_view_addresses =====
318 diff -rc alpine-2.26/pith/url.c alpine-2.26.longurl/pith/url.c
319 *** alpine-2.26/pith/url.c 2022-06-02 18:14:00.491274749 -0600
320 --- alpine-2.26.longurl/pith/url.c 2022-06-02 18:15:09.327105965 -0600
323 rfc1738_scan(char *line, int *len)
325 char *colon, *start, *end;
328 /* process each : in the line */
329 for(; (colon = strindex(line, ':')) != NULL; line = end){
331 rfc1738_scan(char *line, int *len)
333 char *colon, *start, *end;
336 /* process each : in the line */
337 for(; (colon = strindex(line, ':')) != NULL; line = end){
344 + delim = start > line && *(start - 1) == '<';
347 * Special case handling for comma.
350 * In most cases any way, that's why we have the
353 ! if(*(end - 1) == ','
354 ! || (*(end - 1) == '.' && (!*end || *end == ' ')))
357 if(*len - (colon - start) > 0)
359 * In most cases any way, that's why we have the
362 ! if(delim == 0 && (*(end - 1) == ','
363 ! || (*(end - 1) == '.' && (!*end || *end == ' '))))
366 if(*len - (colon - start) > 0)