Commit: 15a7cafccd267ca9e6ade86ecf77c3d75b4ca8ac
Parent: 5d8d2a63e36662e37241978f202df18f51850e90
Author: opask
Date: Tue, 4 Dec 2018 16:41:12 -0700
remove mailto.c and related code
Diffstat:
7 files changed, 1 insertion(+), 163 deletions(-)
diff --git a/Makefile b/Makefile
@@ -26,7 +26,6 @@ SRC = \
kbd.c\
language.c\
listedit.c\
- mailto.c\
main.c\
memory.c\
menu.c\
diff --git a/links.1 b/links.1
@@ -11,8 +11,7 @@ colors, correct table rendering, background downloading, menu
driven configuration interface and slim code.
.P
Frames are supported. You can have different file formats
-associated with external viewers. mailto: and telnet:
-are supported via external clients.
+associated with external viewers.
.P
.I links
can handle local (file://) or remote (http://) URLs.
diff --git a/links.h b/links.h
@@ -891,10 +891,6 @@ void data_func(struct connection *);
void file_func(struct connection *);
-/* mailto.c */
-
-void mailto_func(struct session *, unsigned char *);
-
/* kbd.c */
#define BM_BUTT 15
@@ -3697,8 +3693,6 @@ struct protocol_program {
extern struct list assoc;
extern struct list extensions;
-extern struct list_head mailto_prog;
-
unsigned char *get_compress_by_extension(char *, char *);
unsigned char *get_content_type_by_extension(unsigned char *url);
unsigned char *get_content_type(unsigned char *, unsigned char *);
diff --git a/mailto.c b/mailto.c
@@ -1,42 +0,0 @@
-/* mailto.c
- * mailto:// processing
- * (c) 2002 Mikulas Patocka
- * This file is a part of the Links program, released under GPL.
- */
-
-#include "links.h"
-
-
-static void prog_func(struct terminal *term, struct list_head *list, unsigned char *param, unsigned char *name)
-{
- unsigned char *prog, *cmd;
- prog = get_prog(list);
- if (!*prog) {
- msg_box(term, NULL, TEXT_(T_NO_PROGRAM), AL_CENTER, TEXT_(T_NO_PROGRAM_SPECIFIED_FOR), cast_uchar " ", name, cast_uchar ".", MSG_BOX_END, NULL, 1, TEXT_(T_CANCEL), msg_box_null, B_ENTER | B_ESC);
- return;
- }
- if ((cmd = subst_file(prog, param, 0))) {
- exec_on_terminal(term, cmd, cast_uchar "", 1);
- free(cmd);
- }
-}
-
-void mailto_func(struct session *ses, unsigned char *url)
-{
- unsigned char *user, *host, *m;
- int f = 1;
- if (!(user = get_user_name(url))) goto fail;
- if (!(host = get_host_name(url))) goto fail1;
- f = 0;
- m = stracpy(user);
- add_to_strn(&m, cast_uchar "@");
- add_to_strn(&m, host);
- check_shell_security(&m);
- prog_func(ses->term, &mailto_prog, m, TEXT_(T_MAIL));
- free(m);
- free(host);
- fail1:
- free(user);
- fail:
- if (f) msg_box(ses->term, NULL, TEXT_(T_BAD_URL_SYNTAX), AL_CENTER, TEXT_(T_BAD_MAILTO_URL), MSG_BOX_END, NULL, 1, TEXT_(T_CANCEL), msg_box_null, B_ENTER | B_ESC);
-}
diff --git a/menu.c b/menu.c
@@ -1657,102 +1657,6 @@ static void dlg_http_options(struct terminal *term, void *xxx, void *yyy)
do_dialog(term, d, getml(d, NULL));
}
-static unsigned char * const prg_msg[] = {
- TEXT_(T_MAILTO_PROG),
- TEXT_(T_SHELL_PROG),
- cast_uchar ""
-};
-
-static void netprog_fn(struct dialog_data *dlg)
-{
- struct terminal *term = dlg->win->term;
- int max = 0, min = 0;
- int w, rw;
- int y = gf_val(-1, -G_BFU_FONT_SIZE);
- int a;
- a=0;
- max_text_width(term, prg_msg[a], &max, AL_LEFT);
- min_text_width(term, prg_msg[a++], &min, AL_LEFT);
-#ifdef G
- if (have_extra_exec()) {
- max_text_width(term, prg_msg[a], &max, AL_LEFT);
- min_text_width(term, prg_msg[a++], &min, AL_LEFT);
- }
-#endif
- max_buttons_width(term, dlg->items + a, 2, &max);
- min_buttons_width(term, dlg->items + a, 2, &min);
- w = dlg->win->term->x * 9 / 10 - 2 * DIALOG_LB;
- if (w > max) w = max;
- if (w < min) w = min;
- if (w > dlg->win->term->x - 2 * DIALOG_LB) w = dlg->win->term->x - 2 * DIALOG_LB;
- if (w < 1) w = 1;
- rw = 0;
- a=0;
- dlg_format_text_and_field(dlg, NULL, prg_msg[a], &dlg->items[a], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- a++;
-#ifdef G
- if (have_extra_exec()) {
- dlg_format_text_and_field(dlg, NULL, prg_msg[a], &dlg->items[a], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- a++;
- y += gf_val(1, G_BFU_FONT_SIZE);
- }
-#endif
- dlg_format_buttons(dlg, NULL, dlg->items + a, 2, 0, &y, w, &rw, AL_CENTER);
- w = rw;
- dlg->xw = w + 2 * DIALOG_LB;
- dlg->yw = y + 2 * DIALOG_TB;
- center_dlg(dlg);
- draw_dlg(dlg);
- y = dlg->y + DIALOG_TB;
- a=0;
- dlg_format_text_and_field(dlg, term, prg_msg[a], &dlg->items[a], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- a++;
-#ifdef G
- if (have_extra_exec()) {
- dlg_format_text_and_field(dlg, term, prg_msg[a], &dlg->items[a], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- a++;
- y += gf_val(1, G_BFU_FONT_SIZE);
- }
-#endif
- dlg_format_buttons(dlg, term, &dlg->items[a], 2, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
-}
-
-static void net_programs(struct terminal *term, void *xxx, void *yyy)
-{
- struct dialog *d;
- int a;
- d = mem_calloc(sizeof(struct dialog) + 8 * sizeof(struct dialog_item));
-#ifdef G
- if (have_extra_exec())
- d->title = TEXT_(T_MAIL_TELNET_AND_SHELL_PROGRAMS);
- else
-#endif
- d->title = TEXT_(T_MAIL_AND_TELNET_PROGRAMS);
-
- d->fn = netprog_fn;
- a=0;
- d->items[a].type = D_FIELD;
- d->items[a].dlen = MAX_STR_LEN;
- d->items[a++].data = get_prog(&mailto_prog);
-#ifdef G
- if (have_extra_exec()) {
- d->items[a].type = D_FIELD;
- d->items[a].dlen = MAX_STR_LEN;
- d->items[a++].data = drv->param->shell_term;
- }
-#endif
- d->items[a].type = D_BUTTON;
- d->items[a].gid = B_ENTER;
- d->items[a].fn = ok_dialog;
- d->items[a++].text = TEXT_(T_OK);
- d->items[a].type = D_BUTTON;
- d->items[a].gid = B_ESC;
- d->items[a].fn = cancel_dialog;
- d->items[a++].text = TEXT_(T_CANCEL);
- d->items[a].type = D_END;
- do_dialog(term, d, getml(d, NULL));
-}
-
static unsigned char mc_str[8];
#ifdef G
static unsigned char ic_str[8];
@@ -2773,7 +2677,6 @@ static const struct menu_item setup_menu_6[] = {
static const struct menu_item setup_menu_7[] = {
{ TEXT_(T_CACHE), cast_uchar "", TEXT_(T_HK_CACHE), cache_opt, NULL, 0, 1 },
- { TEXT_(T_MAIL_AND_TELNEL), cast_uchar "", TEXT_(T_HK_MAIL_AND_TELNEL), net_programs, NULL, 0, 1 },
{ TEXT_(T_ASSOCIATIONS), cast_uchar "", TEXT_(T_HK_ASSOCIATIONS), menu_assoc_manager, NULL, 0, 1 },
{ TEXT_(T_FILE_EXTENSIONS), cast_uchar "", TEXT_(T_HK_FILE_EXTENSIONS), menu_ext_manager, NULL, 0, 1 },
{ cast_uchar "", cast_uchar "", M_BAR, NULL, NULL, 0, 1 },
diff --git a/types.c b/types.c
@@ -864,10 +864,6 @@ void create_initial_extensions(void)
/* --------------------------- PROG -----------------------------*/
-
-struct list_head mailto_prog = { &mailto_prog, &mailto_prog };
-
-
static int is_in_list(unsigned char *list, unsigned char *str, int l)
{
unsigned char *l2, *l3;
@@ -1446,15 +1442,6 @@ unsigned char *get_filename_from_url(unsigned char *url, unsigned char *head, in
return f;
}
-static void free_prog_list(struct list_head *l)
-{
- struct list_head *lp;
- struct protocol_program *p = NULL;
- foreach(struct protocol_program, p, lp, *l)
- free(p->prog);
- free_list(struct protocol_program, *l);
-}
-
void free_types(void)
{
struct list *l = NULL;
@@ -1476,7 +1463,6 @@ void free_types(void)
del_from_list(&e->head);
free(e);
}
- free_prog_list(&mailto_prog);
free_history(ext_search_history);
free_history(assoc_search_history);
diff --git a/url.c b/url.c
@@ -23,7 +23,6 @@ static const struct {
{"https", 443, https_func, NULL, 0, 1, 1, 1, 0},
{"http", 80, http_func, NULL, 0, 1, 1, 1, 0},
{"proxy", 3128, proxy_func, NULL, 0, 1, 1, 1, 0},
- {"mailto", 0, NULL, mailto_func, 0, 0, 0, 0, 0},
{NULL, 0, NULL, NULL, 0, 0, 0, 0, 0}
};