From: Pierre Habouzit Date: Tue, 14 Aug 2007 21:53:11 +0000 (+0200) Subject: Remove lots of useless stupid, and code greedy options. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=7dcd7ee09b8760133ac8ec00562e4d60b2f0aebd;p=apps%2Fmadmutt.git Remove lots of useless stupid, and code greedy options. Signed-off-by: Pierre Habouzit --- diff --git a/compose.c b/compose.c index 643268e..7c7517a 100644 --- a/compose.c +++ b/compose.c @@ -1170,9 +1170,9 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ /* Draw formated compose status line */ if (menu->redraw & REDRAW_STATUS) { compose_status_line (buf, sizeof (buf), menu, NONULL (ComposeFormat)); - CLEARLINE(main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2); + CLEARLINE(main_w, 0); SETCOLOR(main_w, MT_COLOR_STATUS); - wmove (main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0); + wmove (main_w, 0, 0); wprintw (main_w, "%-*.*s", getmaxx(main_w), getmaxx(main_w), buf); SETCOLOR(main_w, MT_COLOR_NORMAL); menu->redraw &= ~REDRAW_STATUS; diff --git a/init.c b/init.c index b6ba98b..04f45e8 100644 --- a/init.c +++ b/init.c @@ -1728,13 +1728,6 @@ void mutt_init (int skip_sys_rc, string_list_t * commands) hash_map (ConfigOptions, mutt_restore_default, 0); CurrentMenu = MENU_MAIN; - -#ifdef HAVE_GETSID - /* Unset suspend by default if we're the session leader */ - if (getsid (0) == getpid ()) - unset_option (OPTSUSPEND); -#endif - mutt_init_history (); if (!Muttrc) { diff --git a/init.h b/init.h index bee8e9d..fdad666 100644 --- a/init.h +++ b/init.h @@ -108,17 +108,6 @@ struct option_t MuttVars[] = { ** Controls whether 8-bit data is converted to 7-bit using either ** \fTquoted-printable\fP or \fTbase64\fP encoding when sending mail. */ - {"allow_ansi", DT_BOOL, R_NONE, OPTALLOWANSI, "no" }, - /* - ** .pp - ** Controls whether ANSI color codes in messages (and color tags in - ** rich text messages) are to be interpreted. - ** Messages containing these codes are rare, but if this option is set, - ** their text will be colored accordingly. Note that this may override - ** your color choices, and even present a security problem, since a - ** message could include a line like ``\fT[-- PGP output follows ...\fP" and - ** give it the same color as your attachment color. - */ {"askbcc", DT_BOOL, R_NONE, OPTASKBCC, "no" }, /* ** .pp @@ -1003,21 +992,6 @@ struct option_t MuttVars[] = { ** This variable controls the number of lines of context that are given ** when scrolling through menus. (Similar to ``$$pager_context''.) */ - {"menu_move_off", DT_BOOL, R_NONE, OPTMENUMOVEOFF, "yes" }, - /* - ** .pp - ** When \fIunset\fP, the bottom entry of menus will never scroll up past - ** the bottom of the screen, unless there are less entries than lines. - ** When \fIset\fP, the bottom entry may move off the bottom. - */ - {"menu_scroll", DT_BOOL, R_NONE, OPTMENUSCROLL, "no" }, - /* - ** .pp - ** When \fIset\fP, menus will be scrolled up or down one line when you - ** attempt to move across a screen boundary. If \fIunset\fP, the screen - ** is cleared and the next or previous page of the menu is displayed - ** (useful for slow links to avoid many redraws). - */ {"mh_purge", DT_BOOL, R_NONE, OPTMHPURGE, "no" }, /* ** .pp @@ -1451,11 +1425,6 @@ struct option_t MuttVars[] = { ** .pp ** Also see the ``$$write_inc'' variable. */ - {"read_only", DT_BOOL, R_NONE, OPTREADONLY, "no" }, - /* - ** .pp - ** If set, all folders are opened in read-only mode. - */ {"realname", DT_STR, R_BOTH, UL &Realname, "" }, /* ** .pp @@ -1484,13 +1453,6 @@ struct option_t MuttVars[] = { ** and replying. The default value corresponds to the English ``Re:'' and ** the German ``Aw:''. */ - {"reply_self", DT_BOOL, R_NONE, OPTREPLYSELF, "no" }, - /* - ** .pp - ** If \fIunset\fP and you are replying to a message sent by you, Madmutt will - ** assume that you want to reply to the recipients of that message rather - ** than to yourself. - */ {"reply_to", DT_QUAD, R_NONE, OPT_REPLYTO, "ask-yes" }, /* ** .pp @@ -1783,12 +1745,6 @@ struct option_t MuttVars[] = { ** will replace any dots in the expansion by underscores. This might be helpful ** with IMAP folders that don't like dots in folder names. */ - {"status_on_top", DT_BOOL, R_BOTH, OPTSTATUSONTOP, "no" }, - /* - ** .pp - ** Setting this variable causes the ``status bar'' to be displayed on - ** the first line of the screen rather than near the bottom. - */ {"strict_mailto", DT_BOOL, R_NONE, OPTSTRICTMAILTO, "yes" }, /* ** @@ -1836,13 +1792,6 @@ struct option_t MuttVars[] = { ** i.e. a space will be inserted between the quote characters and the actual ** text. */ - {"suspend", DT_BOOL, R_NONE, OPTSUSPEND, "yes" }, - /* - ** .pp - ** When \fIunset\fP, Madmutt won't stop when the user presses the terminal's - ** \fIsusp\fP key, usually \fTCTRL+Z\fP. This is useful if you run Madmutt - ** inside an xterm using a command like ``\fTxterm -e madmutt\fP.'' - */ {"text_flowed", DT_BOOL, R_NONE, OPTTEXTFLOWED, "no" }, /* ** .pp @@ -1944,13 +1893,6 @@ struct option_t MuttVars[] = { ** This variable only affects decoding. */ #endif /* HAVE_LIBIDN */ - {"use_ipv6", DT_BOOL, R_NONE, OPTUSEIPV6, "yes" }, - /* - ** .pp - ** When \fIset\fP, Madmutt will look for IPv6 addresses of hosts it tries to - ** contact. If this option is \fIunset\fP, Madmutt will restrict itself to IPv4 addresses. - ** Normally, the default should work. - */ {"agent_string", DT_BOOL, R_NONE, OPTXMAILER, "yes" }, /* ** .pp diff --git a/lib-sys/mutt_signal.c b/lib-sys/mutt_signal.c index bdb8577..0c53567 100644 --- a/lib-sys/mutt_signal.c +++ b/lib-sys/mutt_signal.c @@ -39,8 +39,6 @@ static void sighandler (int sig) switch (sig) { case SIGTSTP: /* user requested a suspend */ - if (!option (OPTSUSPEND)) - break; IsEndwin = isendwin (); curs_set (1); if (!IsEndwin) diff --git a/lib-sys/mutt_socket.c b/lib-sys/mutt_socket.c index 3976f89..8616440 100644 --- a/lib-sys/mutt_socket.c +++ b/lib-sys/mutt_socket.c @@ -320,11 +320,7 @@ int raw_socket_open (CONNECTION * conn) /* we accept v4 or v6 STREAM sockets */ p_clear(&hints, 1); - if (option (OPTUSEIPV6)) - hints.ai_family = AF_UNSPEC; - else - hints.ai_family = AF_INET; - + hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; snprintf (port, sizeof (port), "%d", conn->account.port); diff --git a/lib-ui/curs_main.c b/lib-ui/curs_main.c index 140668c..257cd96 100644 --- a/lib-ui/curs_main.c +++ b/lib-ui/curs_main.c @@ -497,10 +497,10 @@ int mutt_index_menu (void) if (menu->redraw & REDRAW_STATUS) { menu_status_line (buf, sizeof (buf), menu, NONULL (Status)); - CLEARLINE(main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2); + CLEARLINE(main_w, 0); SETCOLOR(main_w, MT_COLOR_STATUS); BKGDSET(main_w, MT_COLOR_STATUS); - wmove(main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0); + wmove(main_w, 0, 0); mutt_paddstr (main_w, getmaxx(main_w), buf); SETCOLOR(main_w, MT_COLOR_NORMAL); BKGDSET(main_w, MT_COLOR_NORMAL); @@ -1082,7 +1082,7 @@ int mutt_index_menu (void) case OP_MAIN_CHANGE_GROUP: case OP_MAIN_CHANGE_GROUP_READONLY: #endif - if (attach_msg || option (OPTREADONLY) || + if (attach_msg || #ifdef USE_NNTP op == OP_MAIN_CHANGE_GROUP_READONLY || #endif diff --git a/lib-ui/menu.c b/lib-ui/menu.c index f8a2565..928834c 100644 --- a/lib-ui/menu.c +++ b/lib-ui/menu.c @@ -117,7 +117,7 @@ void menu_redraw_full (MUTTMENU * menu) wclrtobot (main_w); SETCOLOR(main_w, MT_COLOR_STATUS); - wmove (main_w, option (OPTSTATUSONTOP) ? LINES - 2 : 0, 0); + wmove (main_w, LINES - 2, 0); mutt_paddstr (main_w, getmaxx(main_w), ""); SETCOLOR(main_w, MT_COLOR_NORMAL); menu->offset = 1; @@ -133,7 +133,7 @@ void menu_redraw_status (MUTTMENU * menu) snprintf (buf, sizeof (buf), M_MODEFMT, menu->title); SETCOLOR(main_w, MT_COLOR_STATUS); - wmove (main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0); + wmove (main_w, 0, 0); mutt_paddstr (main_w, getmaxx(main_w), buf); SETCOLOR(main_w, MT_COLOR_NORMAL); menu->redraw &= ~REDRAW_STATUS; @@ -251,27 +251,18 @@ void menu_check_recenter (MUTTMENU * menu) int c = MIN (MenuContext, menu->pagelen / 2); int old_top = menu->top; - if (!option (OPTMENUMOVEOFF) && menu->max <= menu->pagelen) { /* less entries than lines */ - if (menu->top != 0) { - menu->top = 0; - set_option (OPTNEEDREDRAW); - } + if ((menu->pagelen <= 0) || (c < MenuContext)) { + if (menu->current < menu->top + c) + menu->top = menu->current - c; + else if (menu->current >= menu->top + menu->pagelen - c) + menu->top = menu->current - menu->pagelen + c + 1; } else { - if (option (OPTMENUSCROLL) || (menu->pagelen <= 0) || (c < MenuContext)) { - if (menu->current < menu->top + c) - menu->top = menu->current - c; - else if (menu->current >= menu->top + menu->pagelen - c) - menu->top = menu->current - menu->pagelen + c + 1; - } else { - if (menu->current < menu->top + c) - menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) / (menu->pagelen - c)) - c; - else if ((menu->current >= menu->top + menu->pagelen - c)) - menu->top += (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c; - } + if (menu->current < menu->top + c) + menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) / (menu->pagelen - c)) - c; + else if ((menu->current >= menu->top + menu->pagelen - c)) + menu->top += (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c; } - if (!option (OPTMENUMOVEOFF)) /* make entries stick to bottom */ - menu->top = MIN (menu->top, menu->max - menu->pagelen); menu->top = MAX (menu->top, 0); if (menu->top != old_top) @@ -305,20 +296,17 @@ void menu_next_line (MUTTMENU * menu) if (menu->max) { int c = MIN (MenuContext, menu->pagelen / 2); - if (menu->top + 1 < menu->max - c && (option (OPTMENUMOVEOFF) - || (menu->max > menu->pagelen - && menu->top < - menu->max - menu->pagelen))) { + if (menu->top + 1 < menu->max - c) { menu->top++; if (menu->current < menu->top + c && menu->current < menu->max - 1) menu->current++; menu->redraw = REDRAW_INDEX; - } - else + } else { mutt_error _("You cannot scroll down farther."); - } - else + } + } else { mutt_error _("No entries."); + } } void menu_prev_line (MUTTMENU * menu) @@ -353,7 +341,7 @@ static void menu_length_jump (MUTTMENU *menu, int jumplen) { menu->top += jumplen; /* jumped too long? */ - if ((neg || !option (OPTMENUMOVEOFF)) && DIRECTION * menu->top > tmp) + if (neg && DIRECTION * menu->top > tmp) menu->top = tmp; /* need to move the cursor? */ diff --git a/main.c b/main.c index 835f5f7..4d322dc 100644 --- a/main.c +++ b/main.c @@ -583,10 +583,9 @@ int main (int argc, char **argv) mutt_folder_hook (folder); - if ((Context = mx_open_mailbox (folder, ((flags & M_RO) - || option (OPTREADONLY)) ? - M_READONLY : 0, NULL)) - || !explicit_folder) { + if ((Context = mx_open_mailbox(folder, (flags & M_RO) ? M_READONLY : 0, + NULL)) || !explicit_folder) + { mutt_index_menu (); if (option (OPTXTERMSETTITLES)) printf("\033]2;%s\007", NONULL(XtermLeave)); diff --git a/mutt.h b/mutt.h index 9b532fc..bc599d2 100644 --- a/mutt.h +++ b/mutt.h @@ -199,7 +199,6 @@ enum { /* boolean vars */ enum { OPTALLOW8BIT, - OPTALLOWANSI, OPTASKBCC, OPTASKCC, OPTASKFOLLOWUP, @@ -246,8 +245,6 @@ enum { OPTMARKERS, OPTMARKOLD, OPTMBOXPANE, - OPTMENUSCROLL, /* scroll menu instead of implicit next-page */ - OPTMENUMOVEOFF, OPTMETOO, OPTMHPURGE, OPTMIMEFORWDECODE, @@ -261,21 +258,16 @@ enum { OPTPROMPTAFTER, OPTQUOTEEMPTY, OPTQUOTEQUOTED, - OPTREADONLY, - OPTREPLYSELF, OPTRESOLVE, OPTREVALIAS, OPTREVNAME, OPTREVREAL, OPTSIGDASHES, OPTSORTRE, - OPTSPAMSEP, - OPTSTATUSONTOP, OPTSTRICTMAILTO, OPTSTRICTTHREADS, OPTSTRIPWAS, OPTSTUFFQUOTED, - OPTSUSPEND, OPTTEXTFLOWED, OPTTHOROUGHSRC, OPTTHREADRECEIVED, @@ -285,7 +277,6 @@ enum { #ifdef HAVE_LIBIDN OPTUSEIDN, #endif - OPTUSEIPV6, OPTWAITKEY, OPTWEED, OPTWRAP, @@ -347,16 +338,15 @@ enum { OPTMAX }; -#define mutt_bit_alloc(n) p_new(char, (n + 7) / 8) -#define mutt_bit_set(v,n) v[n/8] |= (1 << (n % 8)) -#define mutt_bit_unset(v,n) v[n/8] &= ~(1 << (n % 8)) -#define mutt_bit_toggle(v,n) v[n/8] ^= (1 << (n % 8)) -#define mutt_bit_isset(v,n) (v[n/8] & (1 << (n % 8))) +#define mutt_bit_set(v,n) (v[n/8] |= (1 << (n % 8))) +#define mutt_bit_unset(v,n) (v[n/8] &= ~(1 << (n % 8))) +#define mutt_bit_toggle(v,n) (v[n/8] ^= (1 << (n % 8))) +#define mutt_bit_isset(v,n) (v[n/8] & (1 << (n % 8))) -#define set_option(x) mutt_bit_set(Options,x) -#define unset_option(x) mutt_bit_unset(Options,x) +#define set_option(x) mutt_bit_set(Options,x) +#define unset_option(x) mutt_bit_unset(Options,x) #define toggle_option(x) mutt_bit_toggle(Options,x) -#define option(x) mutt_bit_isset(Options,x) +#define option(x) mutt_bit_isset(Options,x) void mutt_init (int, string_list_t *); diff --git a/pager.c b/pager.c index 7132f32..eee9b83 100644 --- a/pager.c +++ b/pager.c @@ -745,73 +745,6 @@ static int check_attachment_marker(char *p) return (int)(*p - *q); } -static int grok_ansi (unsigned char *buf, int pos, ansi_attr * a) -{ - int x = pos; - - while (isdigit (buf[x]) || buf[x] == ';') - x++; - - /* Character Attributes */ - if (option (OPTALLOWANSI) && a != NULL && buf[x] == 'm') { - if (pos == x) { - if (a->pair != -1) - mutt_free_color (a->fg, a->bg); - a->attr = ANSI_OFF; - a->pair = -1; - } - a->bg = -2; - a->fg = -2; - while (pos < x) { - if (buf[pos] == '1' && (pos + 1 == x || buf[pos + 1] == ';')) { - a->attr |= ANSI_BOLD; - pos += 2; - } - else if (buf[pos] == '4' && (pos + 1 == x || buf[pos + 1] == ';')) { - a->attr |= ANSI_UNDERLINE; - pos += 2; - } - else if (buf[pos] == '5' && (pos + 1 == x || buf[pos + 1] == ';')) { - a->attr |= ANSI_BLINK; - pos += 2; - } - else if (buf[pos] == '7' && (pos + 1 == x || buf[pos + 1] == ';')) { - a->attr |= ANSI_REVERSE; - pos += 2; - } - else if (buf[pos] == '0' && (pos + 1 == x || buf[pos + 1] == ';')) { - a->bg = -2; - a->fg = -2; - pos += 2; - } - else if (buf[pos] == '3' && isdigit (buf[pos + 1])) { - if (a->pair != -1) - mutt_free_color (a->fg, a->bg); - a->pair = -1; - a->attr |= ANSI_COLOR; - if (buf[pos + 1] != '9') - a->fg = buf[pos + 1] - '0'; - pos += 3; - } - else if (buf[pos] == '4' && isdigit (buf[pos + 1])) { - if (a->pair != -1) - mutt_free_color (a->fg, a->bg); - a->pair = -1; - a->attr |= ANSI_COLOR; - if (buf[pos + 1] != '9') - a->bg = buf[pos + 1] - '0'; - pos += 3; - } else { - while (pos < x && buf[pos] != ';') - pos++; - pos++; - } - } - } - pos = x; - return pos; -} - /* trim tail of buf so that it contains complete multibyte characters */ static int trim_incomplete_mbyte(unsigned char *buf, size_t len) { mbstate_t mbstate; @@ -912,8 +845,10 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf, for (ch = 0, vch = 0; ch < cnt; ch += k, vch += k) { /* Handle ANSI sequences */ while (cnt - ch >= 2 && buf[ch] == '\033' && buf[ch + 1] == '[' && - is_ansi (buf + ch + 2)) - ch = grok_ansi (buf, ch + 2, pa) + 1; + is_ansi (buf + ch + 2)) { + while (isdigit(buf[ch]) || buf[ch] == ';') + ch++; + } while (cnt - ch >= 2 && buf[ch] == '\033' && buf[ch + 1] == ']' && check_attachment_marker ((char *) buf + ch) == 0) { @@ -1361,19 +1296,11 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) indicator = indexlen / 3; - if (option (OPTSTATUSONTOP)) { - indexoffset = 0; - statusoffset = IsHeader (extra) ? indexlen : 0; - bodyoffset = statusoffset + 1; - helpoffset = LINES - 2; - bodylen = helpoffset - bodyoffset; - } else { - helpoffset = 0; - indexoffset = 1; - statusoffset = LINES - 2; - bodyoffset = indexoffset + (IsHeader (extra) ? indexlen : 0); - bodylen = statusoffset - bodyoffset; - } + indexoffset = 0; + statusoffset = IsHeader (extra) ? indexlen : 0; + bodyoffset = statusoffset + 1; + helpoffset = LINES - 2; + bodylen = helpoffset - bodyoffset; SETCOLOR(main_w, MT_COLOR_STATUS); wmove(main_w, helpoffset, 0); @@ -1406,7 +1333,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) } SETCOLOR(main_w, MT_COLOR_NORMAL); - pager_index->offset = indexoffset + (option (OPTSTATUSONTOP) ? 1 : 0); + pager_index->offset = indexoffset + 1; pager_index->pagelen = indexlen - 1; @@ -1520,7 +1447,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) sidebar_draw (); /* print out the pager_index status bar */ menu_status_line (buffer, sizeof (buffer), pager_index, NONULL (Status)); - wmove(main_w, indexoffset + (option(OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0); + wmove(main_w, indexoffset + 0, 0); SETCOLOR(main_w, MT_COLOR_STATUS); BKGDSET(main_w, MT_COLOR_STATUS); mutt_paddstr(main_w, getmaxx(main_w), buffer); diff --git a/send.c b/send.c index 8659f21..e44222a 100644 --- a/send.c +++ b/send.c @@ -510,7 +510,7 @@ static int default_to (address_t ** to, ENVELOPE * env, int flags, int hmfupto) } } - if (!option (OPTREPLYSELF) && mutt_addr_is_user (env->from)) { + if (mutt_addr_is_user(env->from)) { /* mail is from the user, assume replying to recipients */ address_list_append(to, address_list_dup(env->to)); }