Changeset 3309:a01916b5b624

Show
Ignore:
Timestamp:
2003-03-03 00:26:20 (6 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Introduce a new option named $bounce, and fix some inconsistencies
in the messages created when bouncing. Based on work done by Thomas
Glanzmann <sithglan@…>.

Files:
6 modified

Legend:

Unmodified
Added
Removed
  • commands.c

    r3307 r3309  
    258258 
    259259#define extra_space (15 + 7 + 2) 
    260   /* 
    261    * This is the printing width of "...? ([y=yes]/n=no): ?" plus 2 
    262    * for good measure. This is not ideal. FIXME. 
    263    *  
    264    * While you fix this, please go to recvcmd.c, and do the same thing there. 
    265    */ 
    266   snprintf (prompt, sizeof (prompt) - 4, 
     260  snprintf (prompt, sizeof (prompt), 
    267261           (h ? _("Bounce message to %s") : _("Bounce messages to %s")), buf); 
    268   mutt_format_string (prompt, sizeof (prompt) - 4, 
    269                       0, COLS-extra_space, 0, 0, 
    270                       prompt, sizeof (prompt), 0); 
    271   strcat (prompt, "...?");      /* __STRCAT_CHECKED__ */ 
    272   if (mutt_yesorno (prompt, M_YES) != M_YES) 
     262 
     263  if (mutt_strwidth (prompt) > COLS - extra_space) 
     264  { 
     265    mutt_format_string (prompt, sizeof (prompt), 
     266                        0, COLS-extra_space, 0, 0, 
     267                        prompt, sizeof (prompt), 0); 
     268    strncat (prompt, "...?", sizeof (prompt)); 
     269  } 
     270  else 
     271    strncat (prompt, "?", sizeof (prompt)); 
     272 
     273  if (query_quadoption (OPT_BOUNCE, prompt) == M_NO) 
    273274  { 
    274275    rfc822_free_address (&adr); 
    275     CLEARLINE (LINES-1); 
     276    CLEARLINE (LINES - 1); 
     277    mutt_message (h ? _("Message not bounced.") : _("Messages not bounced.")); 
    276278    return; 
    277279  } 
    278280 
     281  CLEARLINE (LINES - 1); 
     282   
    279283  rc = mutt_bounce_message (NULL, h, adr); 
    280284  rfc822_free_address (&adr); 
  • contrib/sample.muttrc

    r3088 r3309  
    3434set edit_headers                # let me edit the message header when composing 
    3535#set editor="emacs -nw"         # editor to use when composing messages 
     36#set fast_bounce                # don't ask about bouncing messages, just do it 
    3637#set fast_reply                 # skip initial prompts when replying 
    3738#set fcc_attach                 # keep attachments in copies of sent messages? 
  • doc/manual.sgml.head

    r3297 r3309  
    492492you are replying to or forwarding a message.  See also <ref id="askcc" 
    493493name="&dollar;askcc">, <ref id="askbcc" name="&dollar;askbcc">, <ref 
    494 id="autoedit" name="&dollar;autoedit">, and <ref id="fast_reply" 
     494id="autoedit" name="&dollar;autoedit">, <ref id="bounce" 
     495name="&dollar;bounce">, and <ref id="fast_reply" 
    495496name="&dollar;fast&lowbar;reply"> for changing how Mutt asks these 
    496497questions. 
  • init.h

    r3289 r3309  
    268268  ** notifying you of new mail.  This is independent of the setting of the 
    269269  ** ``$$beep'' variable. 
     270  */ 
     271  { "bounce",   DT_QUAD, R_NONE, OPT_BOUNCE, M_ASKYES }, 
     272  /* 
     273  ** Controls whether you will be asked to confirm bouncing messages. 
     274  ** If set to \fIyes\fP you don't get asked if you want to bounce a 
     275  ** message. Setting this variable to \fIno\fP is not generally useful, 
     276  ** and thus not recommended, because your are unable to bounce message. 
    270277  */ 
    271278  { "bounce_delivered", DT_BOOL, R_NONE, OPTBOUNCEDELIVERED, 1 }, 
  • mutt.h

    r3281 r3309  
    289289  OPT_MIMEFWDREST, 
    290290  OPT_FORWEDIT, 
    291   OPT_MAX 
     291  OPT_MAX, 
     292  OPT_BOUNCE 
    292293}; 
    293294 
  • recvcmd.c

    r3307 r3309  
    127127{ 
    128128  short i; 
    129   short ntagged; 
    130129  char prompt[STRING]; 
    131130  char buf[HUGE_STRING]; 
    132131  ADDRESS *adr = NULL; 
     132  int ret = 0; 
     133  int p   = 0; 
    133134 
    134135  if (check_all_msg (idx, idxlen, cur, 1) == -1) 
    135136    return; 
    136137 
    137   ntagged = count_tagged (idx, idxlen); 
    138    
    139   if (cur || ntagged == 1) 
     138  /* one or more messages? */ 
     139  p = (cur || count_tagged (idx, idxlen) == 1); 
     140 
     141  if (p) 
    140142    strfcpy (prompt, _("Bounce message to: "), sizeof (prompt)); 
    141143  else 
     
    162164   */ 
    163165  snprintf (prompt, sizeof (prompt) - 4,  
    164             cur ? _("Bounce message to %s...?") :  _("Bounce messages to %s...?"), buf); 
    165  
    166   mutt_format_string (prompt, sizeof (prompt) - 4, 
    167                       0, COLS-extra_space, 0, 0, 
    168                       prompt, sizeof (prompt), 0); 
    169   strcat (prompt, "...?");      /* __STRCAT_CHECKED__ */ 
    170  
    171   if (mutt_yesorno (prompt, M_YES) != M_YES) 
    172     goto bail; 
    173  
     166   (p ? _("Bounce message to %s") : _("Bounce messages to %s")), buf); 
     167   
     168  if (mutt_strwidth (prompt) > COLS - extra_space) 
     169  { 
     170    mutt_format_string (prompt, sizeof (prompt) - 4, 
     171                        0, COLS-extra_space, 0, 0, 
     172                        prompt, sizeof (prompt), 0); 
     173    strncat (prompt, "...?", sizeof (prompt)); 
     174  } 
     175  else 
     176    strncat (prompt, "?", sizeof (prompt)); 
     177 
     178  if (query_quadoption (OPT_BOUNCE, prompt) == M_NO) 
     179  { 
     180    rfc822_free_address (&adr); 
     181    CLEARLINE (LINES - 1); 
     182    mutt_message (p ? _("Message not bounced.") : _("Messages not bounced.")); 
     183    return; 
     184  } 
     185   
     186  CLEARLINE (LINES - 1); 
     187   
    174188  if (cur) 
    175     mutt_bounce_message (fp, cur->hdr, adr); 
     189    ret = mutt_bounce_message (fp, cur->hdr, adr); 
    176190  else 
    177191  { 
     
    179193    { 
    180194      if (idx[i]->content->tagged) 
    181         mutt_bounce_message (fp, idx[i]->content->hdr, adr); 
    182     } 
    183   } 
    184  
    185 bail: 
    186  
    187   rfc822_free_address (&adr); 
    188   CLEARLINE (LINES - 1); 
     195        if (mutt_bounce_message (fp, idx[i]->content->hdr, adr)) 
     196          ret = 1; 
     197    } 
     198  } 
     199 
     200  if (!ret) 
     201    mutt_message (p ? _("Message bounced.") : _("Messages bounced.")); 
     202  else 
     203    mutt_error (p ? _("Error bouncing message!") : _("Error bouncing messages!")); 
    189204} 
    190205