/*
* Copyright (C) 2000-2007 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* remote host account manipulation (POP/IMAP) */
if (a1->type == MUTT_ACCT_TYPE_POP && PopUser)
user = PopUser;
#endif
-
+
if (a1->flags & a2->flags & MUTT_ACCT_USER)
return (!strcmp (a1->user, a2->user));
if (a1->flags & MUTT_ACCT_USER)
/* Determine the length of the keyed message digest, add 50 for
* overhead.
*/
- oalen = strlen (account->login) + strlen (account->host) + strlen (token) + 50;
+ oalen = strlen (account->login) + strlen (account->host) + strlen (token) + 50;
oauthbearer = safe_malloc (oalen);
snprintf (oauthbearer, oalen,
/*
* Copyright (C) 2000-2007,2012 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* remote host account manipulation (POP/IMAP) */
/*
* Copyright (C) 1996-2000,2007 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
{
ALIAS *cur = ((ALIAS **) menu->data)[n];
int ot = cur->tagged;
-
+
cur->tagged = (m >= 0 ? m : !cur->tagged);
-
+
return cur->tagged - ot;
}
else if (pb == NULL)
r = 1;
else if (pa->personal)
- {
+ {
if (pb->personal)
r = mutt_strcasecmp (pa->personal, pb->personal);
else
char helpstr[LONG_STRING];
int omax;
-
+
if (!aliases)
{
mutt_error _("You have no aliases!");
new_aliases:
omax = menu->max;
-
+
/* count the number of aliases */
for (aliasp = aliases; aliasp; aliasp = aliasp->next)
{
aliases = aliases->next;
goto new_aliases;
}
-
+
switch ((op = mutt_menuLoop (menu)))
{
case OP_DELETE:
mutt_pop_current_menu (menu);
mutt_menuDestroy (&menu);
FREE (&AliasTable);
-
+
}
/*
* Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
LIST *u;
char i;
const char *fqdn;
-
+
while (a)
{
if (!a->group && !a->personal && a->mailbox && strchr (a->mailbox, '@') == NULL)
t = mutt_lookup_alias (a->mailbox);
if (t)
- {
+ {
i = 0;
for (u = *expn; u; u = u->next)
{
if (pw)
{
char namebuf[STRING];
-
+
mutt_gecos_name (namebuf, sizeof (namebuf), pw);
mutt_str_replace (&a->personal, namebuf);
-
+
#ifdef EXACT_ADDRESS
FREE (&a->val);
#endif
}
-/*
+/*
* if someone has an address like
* From: Michael `/bin/rm -f ~` Elkins <me@mutt.org>
* and the user creates an alias for this, Mutt could wind up executing
* since that would get aliased as
* alias me Michael \\`/bin/rm -f ~\\` Elkins <me@mutt.org>
* which still gets evaluated because the double backslash is not a quote.
- *
+ *
* Additionally, we need to quote ' and " characters - otherwise, mutt will
* interpret them on the wrong parsing step.
- *
+ *
* $ wants to be quoted since it may indicate the start of an environment
* variable.
*/
/* Don't suggest a bad alias name in the event of a strange local part. */
mutt_check_alias_name (tmp, buf, sizeof (buf));
-
+
retry_name:
/* L10N: prompt to add a new alias */
if (mutt_get_field (_("Alias as: "), buf, sizeof (buf), 0) != 0 || !buf[0])
mutt_error _("You already have an alias defined with that name!");
return;
}
-
+
if (mutt_check_alias_name (buf, fixed, sizeof (fixed)))
{
switch (mutt_yesorno (_("Warning: This alias name may not work. Fix it?"), MUTT_YES))
case MUTT_YES:
strfcpy (buf, fixed, sizeof (buf));
goto retry_name;
- case -1:
+ case -1:
return;
}
}
-
+
new = safe_calloc (1, sizeof (ALIAS));
new->self = new;
new->name = safe_strdup (buf);
mutt_addrlist_to_local (adr);
-
+
if (adr)
strfcpy (buf, adr->mailbox, sizeof (buf));
else
buf[0] = 0;
mutt_addrlist_to_intl (adr, NULL);
-
+
do
{
if (mutt_get_field (_("Address: "), buf, sizeof (buf), 0) != 0 || !buf[0])
mutt_free_alias (&new);
return;
}
-
+
if((new->addr = rfc822_parse_adrlist (new->addr, buf)) == NULL)
BEEP ();
if (mutt_addrlist_to_intl (new->addr, &err))
}
}
while(new->addr == NULL);
-
+
if (adr && adr->personal && !mutt_is_mail_list (adr))
strfcpy (buf, adr->personal, sizeof (buf));
else
}
mutt_alias_add_reverse (new);
-
+
if ((t = Aliases))
{
while (t->next)
mutt_perror (buf);
return;
-
+
fseek_err:
mutt_perror (_("Error seeking in alias file"));
safe_fclose (&rc);
return;
}
-/*
+/*
* Sanity-check an alias name: Only characters which are non-special to both
* the RFC 822 and the mutt configuration parser are permitted.
*/
{
if (!a || !a->mailbox)
return NULL;
-
+
return hash_find (ReverseAlias, a->mailbox);
}
a_list->next = a_cur->next;
else
Aliases = a_cur->next;
-
+
a_cur->next = NULL;
mutt_free_alias (&a_cur);
-
+
if (a_list)
a_cur = a_list;
else
a_cur = a_cur->next;
}
}
-
+
return 0;
}
static int string_is_address(const char *str, const char *u, const char *d)
{
char buf[LONG_STRING];
-
+
snprintf(buf, sizeof(buf), "%s@%s", NONULL(u), NONULL(d));
if (ascii_strcasecmp(str, buf) == 0)
return 1;
-
+
return 0;
}
else
return 1;
}
-
+
dprint (5, (debugfile, "mutt_addr_is_user: no, all failed.\n"));
return 0;
}
/*
* Copyright (C) 2001 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- *
+ *
*/
-/*
+/*
* Versions of the string comparison functions which are
* locale-insensitive.
*/
{
if (ascii_islower (c))
return c & ~32;
-
+
return c;
}
{
if (ascii_isupper (c))
return c | 32;
-
+
return c;
}
int ascii_strcasecmp (const char *a, const char *b)
{
int i;
-
+
if (a == b)
return 0;
if (a == NULL && b)
return -1;
if (b == NULL && a)
return 1;
-
+
for (;; a++, b++)
{
if ((i = ascii_tolower (*a) - ascii_tolower (*b)))
if (!*a)
break;
}
-
+
return 0;
}
int ascii_strncasecmp (const char *a, const char *b, int n)
{
int i, j;
-
+
if (a == b)
return 0;
if (a == NULL && b)
return -1;
if (b == NULL && a)
return 1;
-
+
for (j = 0; (*a || *b) && j < n; a++, b++, j++)
{
if ((i = ascii_tolower (*a) - ascii_tolower (*b)))
return i;
}
-
+
return 0;
}
/*
* Copyright (C) 2001-2002 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- *
+ *
*/
-/*
+/*
* Versions of the string comparison functions which are
* locale-insensitive.
*/
/*
* Copyright (C) 1996-2000,2002,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2004,2006 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
rfc1524_entry *entry = NULL;
FILE *fpin = NULL, *fpout = NULL;
struct stat st;
-
+
if(a->unlink)
return 0;
}
else
mutt_perror(fpin ? mutt_b2s (tempfile) : a->filename);
-
+
if(fpin) safe_fclose (&fpin);
if(fpout) safe_fclose (&fpout);
mutt_buffer_pool_release (&tempfile);
-
+
return a->unlink ? 0 : -1;
}
{
if (entry->composetypecommand)
mutt_buffer_strcpy (command, entry->composetypecommand);
- else
+ else
mutt_buffer_strcpy (command, entry->composecommand);
if (mutt_buffer_rfc1524_expand_filename (entry->nametemplate,
}
else
mutt_buffer_strcpy (newfile, a->filename);
-
+
if (mutt_buffer_rfc1524_expand_command (a, mutt_b2s (newfile), type,
command))
{
mutt_endwin (NULL);
if ((r = mutt_system (mutt_b2s (command))) == -1)
mutt_error (_("Error running \"%s\"!"), mutt_b2s (command));
-
+
if (r != -1 && entry->composetypecommand)
{
BODY *b;
b->form_name = NULL;
}
- /* Remove headers by copying out data to another file, then
+ /* Remove headers by copying out data to another file, then
* copying the file back */
fseeko (fp, b->offset, 0);
mutt_buffer_mktemp (tempfile);
mutt_copy_stream (fp, tfp);
safe_fclose (&fp);
safe_fclose (&tfp);
- mutt_unlink (a->filename);
- if (mutt_rename_file (mutt_b2s (tempfile), a->filename) != 0)
+ mutt_unlink (a->filename);
+ if (mutt_rename_file (mutt_b2s (tempfile), a->filename) != 0)
{
mutt_perror _("Failure to rename file.");
goto bailout;
return rc;
}
-/*
- * Currently, this only works for send mode, as it assumes that the
+/*
+ * Currently, this only works for send mode, as it assumes that the
* BODY->filename actually contains the information. I'm not sure
* we want to deal with editing attachments we've already received,
* so this should be ok.
}
rc = 1;
-
+
bailout:
-
+
if(unlink_newfile)
unlink(mutt_b2s (newfile));
mutt_buffer_pool_release (&command);
mutt_buffer_pool_release (&newfile);
-
+
rfc1524_free_entry (&entry);
return rc;
}
for (; t; t = t->next) {
i = mutt_strlen (t->data) - 1;
- if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' &&
+ if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' &&
ascii_strncasecmp (type, t->data, i) == 0) ||
ascii_strcasecmp (type, t->data) == 0) {
n == TYPETEXT ? "text" :
n == TYPEVIDEO ? "video" : "other",
tmp.subtype);
- dprint(1, (debugfile, "mutt_check_lookup_list: \"%s\" -> %s\n",
+ dprint(1, (debugfile, "mutt_check_lookup_list: \"%s\" -> %s\n",
b->filename, type));
}
- if (tmp.subtype)
+ if (tmp.subtype)
FREE (&tmp.subtype);
- if (tmp.xtype)
+ if (tmp.xtype)
FREE (&tmp.xtype);
}
}
rfc1524_entry *entry = NULL;
int rc = -1;
int unlink_tempfile = 0;
-
+
is_message = mutt_is_message_type(a->type, a->subtype);
if (WithCrypto && is_message && a->hdr && (a->hdr->security & ENCRYPT) &&
!crypt_valid_passphrase(a->hdr->security))
use_mailcap = (flag == MUTT_MAILCAP ||
(flag == MUTT_REGULAR && mutt_needs_mailcap (a)));
snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
-
+
if (use_mailcap)
{
- entry = rfc1524_new_entry ();
+ entry = rfc1524_new_entry ();
if (!rfc1524_mailcap_lookup (a, type, entry, 0))
{
if (flag == MUTT_REGULAR)
goto return_error;
}
}
-
+
if (use_mailcap)
{
if (!entry->command)
goto return_error;
}
mutt_buffer_strcpy (command, entry->command);
-
+
if (fp)
{
fname = safe_strdup (a->filename);
}
else if (fp == NULL) /* send case */
mutt_buffer_strcpy (tempfile, a->filename);
-
+
if (fp)
{
/* recv case: we need to save the attachment to a file */
command);
use_pager = entry->copiousoutput;
}
-
+
if (use_pager)
{
if (fp && !use_mailcap && a->filename)
else
mutt_buffer_mktemp (pagerfile);
}
-
+
if (use_mailcap)
{
pid_t thepid = 0;
int tempfd = -1, pagerfd = -1;
-
+
if (!use_pager)
mutt_endwin (NULL);
{
if(pagerfd != -1)
close(pagerfd);
-
+
if(tempfd != -1)
close(tempfd);
}
unset_option (OPTVIEWATTACH);
}
-
+
if (a->description)
strfcpy (descrip, a->description, sizeof (descrip));
else if (a->filename)
else
snprintf (descrip, sizeof (descrip), _("---Attachment: %s"), type);
}
-
+
/* We only reach this point if there have been no errors */
if (use_pager)
{
pager_t info;
-
+
memset (&info, 0, sizeof (info));
info.fp = fp;
info.bdy = a;
rc = 0;
return_error:
-
+
if (entry)
rfc1524_free_entry (&entry);
if (fp && (mutt_b2s (tempfile))[0])
pid_t thepid;
int out = -1;
int rv = 0;
-
+
if (outfile && *outfile)
if ((out = safe_open (outfile, O_CREAT | O_EXCL | O_WRONLY)) < 0)
{
mutt_perror _("Can't create filter");
goto bail;
}
-
+
s.fpin = fp;
mutt_decode_attachment (b, &s);
safe_fclose (&s.fpout);
safe_fclose (&ifp);
goto bail;
}
-
+
mutt_copy_stream (ifp, ofp);
safe_fclose (&ofp);
safe_fclose (&ifp);
}
rv = 1;
-
+
bail:
-
+
if (outfile && *outfile)
close (out);
return fopen (path, "a");
if (flags == MUTT_SAVE_OVERWRITE)
return fopen (path, "w"); /* __FOPEN_CHECKED__ */
-
+
return safe_fopen (path, "w");
}
{
if (fp)
{
-
+
/* recv mode */
if(hdr &&
MESSAGE *msg;
int chflags = 0;
int r = -1;
-
+
hn = m->hdr;
hn->msgno = hdr->msgno; /* required for MH/maildir */
hn->read = 1;
if (ctx.magic == MUTT_MBOX || ctx.magic == MUTT_MMDF)
chflags = CH_FROM | CH_UPDATE_LEN;
chflags |= (ctx.magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE);
- if (_mutt_copy_message (msg->fp, fp, hn, hn->content, 0, chflags) == 0
+ if (_mutt_copy_message (msg->fp, fp, hn, hn->content, 0, chflags) == 0
&& mx_commit_message (msg, &ctx) == 0)
r = 0;
else
else
{
/* In recv mode, extract from folder and decode */
-
+
STATE s;
-
+
memset (&s, 0, sizeof (s));
if ((s.fpout = mutt_save_attachment_open (path, flags)) == NULL)
{
}
fseeko ((s.fpin = fp), m->offset, 0);
mutt_decode_attachment (m, &s);
-
+
if (fclose (s.fpout) != 0)
{
mutt_perror ("fclose");
mutt_perror ("fopen");
return (-1);
}
-
+
if ((nfp = mutt_save_attachment_open (path, flags)) == NULL)
{
mutt_perror ("fopen");
saved_encoding = m->encoding;
if (!is_multipart (m))
m->encoding = ENC8BIT;
-
+
m->length = st.st_size;
m->offset = 0;
saved_parts = m->parts;
/* Ok, the difference between send and receive:
* recv: BODY->filename is a suggested name, and Context|HEADER points
* to the attachment in mailbox which is encoded
- * send: BODY->filename points to the un-encoded file which contains the
+ * send: BODY->filename points to the un-encoded file which contains the
* attachment
*/
snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
- if (rfc1524_mailcap_lookup (a, type, NULL, MUTT_PRINT))
+ if (rfc1524_mailcap_lookup (a, type, NULL, MUTT_PRINT))
{
rfc1524_entry *entry;
int piped = FALSE;
dprint (2, (debugfile, "Using mailcap...\n"));
-
+
entry = rfc1524_new_entry ();
rfc1524_mailcap_lookup (a, type, entry, MUTT_PRINT);
if (mutt_buffer_rfc1524_expand_filename (entry->nametemplate, a->filename,
mutt_buffer_mktemp (newfile);
if (mutt_decode_save_attachment (fp, a, mutt_b2s (newfile), MUTT_PRINTING, 0) == 0)
{
-
+
dprint (2, (debugfile, "successfully decoded %s type attachment to %s\n",
type, mutt_b2s (newfile)));
-
+
if ((ifp = fopen (mutt_b2s (newfile), "r")) == NULL)
{
mutt_perror ("fopen");
}
dprint (2, (debugfile, "successfully opened %s read-only\n", mutt_b2s (newfile)));
-
+
mutt_endwin (NULL);
if ((thepid = mutt_create_filter (NONULL(PrintCmd), &fpout, NULL, NULL)) < 0)
{
}
dprint (2, (debugfile, "Filter created.\n"));
-
+
mutt_copy_stream (ifp, fpout);
safe_fclose (&fpout);
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* common protos for compose / attach menus */
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- *
+ *
*/
-/*
+/*
* Base64 handling elsewhere in mutt should be modified to call
* these routines. These routines were written because IMAP's
* AUTHENTICATE protocol required them, and base64 handling
* elsewhere wasn't sufficiently generic.
- *
+ *
*/
-/*
+/*
* This code is heavily modified from fetchmail (also GPL'd, of
* course) by Brendan Cully <brendan@kublai.com>.
- *
+ *
* Original copyright notice:
- *
+ *
* The code in the fetchmail distribution is Copyright 1997 by Eric
* S. Raymond. Portions are also copyrighted by Carl Harris, 1993
* and 1995. Copyright retained for the purpose of protecting free
- * redistribution of source.
- *
+ * redistribution of source.
+ *
*/
#if HAVE_CONFIG_H
/*
* Copyright (C) 1996-2000,2007,2010,2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
{
struct stat st;
char fullpath[_POSIX_PATH_MAX];
-
+
mutt_concat_path (fullpath, folder, path, sizeof (fullpath));
-
+
if (stat (fullpath, &st) == 0)
return (S_ISDIR (st.st_mode));
else
snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
snprintf (dest, destlen, tmp, folder->num + 1);
break;
-
+
case 'd':
case 'D':
if (folder->ff->local)
else
mutt_format_s (dest, destlen, fmt, "");
break;
-
+
case 'f':
{
char *s;
folder->ff->local ? (S_ISLNK (folder->ff->mode) ? "@" :
(S_ISDIR (folder->ff->mode) ? "/" :
((folder->ff->mode & S_IXUSR) != 0 ? "*" : ""))) : "");
-
+
mutt_format_s (dest, destlen, fmt, fn);
break;
}
snprintf (permission, sizeof (permission), "IMAP %c",
(folder->ff->inferiors && folder->ff->selectable) ? '+' : ' ');
mutt_format_s (dest, destlen, fmt, permission);
- }
+ }
#endif
else
mutt_format_s (dest, destlen, fmt, "");
break;
-
+
case 'g':
if (folder->ff->local)
{
else
mutt_format_s (dest, destlen, fmt, "");
break;
-
+
case 'l':
if (folder->ff->local)
{
(state->entry)[state->entrylen].gid = s->st_gid;
(state->entry)[state->entrylen].uid = s->st_uid;
(state->entry)[state->entrylen].nlink = s->st_nlink;
-
+
(state->entry)[state->entrylen].local = 1;
}
{
if (mutt_strcmp (de->d_name, ".") == 0)
continue; /* we don't need . */
-
+
if (prefix && *prefix && mutt_strncmp (prefix, de->d_name, mutt_strlen (prefix)) != 0)
continue;
if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not))
mutt_concat_path (buffer, d, de->d_name, sizeof (buffer));
if (lstat (buffer, &s) == -1)
continue;
-
+
/* No size for directories or symlinks */
if (S_ISDIR (s.st_mode) || S_ISLNK (s.st_mode))
s.st_size = 0;
else if (! S_ISREG (s.st_mode))
continue;
-
+
tmp = Incoming;
while (tmp && mutt_strcmp (buffer, tmp->path))
tmp = tmp->next;
}
add_folder (menu, state, de->d_name, &s, tmp);
}
- closedir (dp);
+ closedir (dp);
browser_sort (state);
return 0;
}
folder.ff = &((struct folder_file *) menu->data)[num];
folder.num = num;
-
- mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL(FolderFormat), folder_format_str,
+
+ mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL(FolderFormat), folder_format_str,
(unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR);
}
menu->top = 0;
menu->tagged = 0;
-
+
if (buffy)
snprintf (title, titlelen, _("Mailboxes [%d]"), mutt_buffy_check (0));
else
mutt_error _("Can't attach a directory!");
return 0;
}
-
+
ot = ff->tagged;
ff->tagged = (m >= 0 ? m : !ff->tagged);
-
+
return ff->tagged - ot;
}
int buffy = (flags & MUTT_SEL_BUFFY) ? 1 : 0;
buffy = buffy && folder;
-
+
memset (&state, 0, sizeof (struct browser_state));
if (!folder)
}
#endif
}
- else
+ else
{
if (!folder)
getcwd (LastDir, sizeof (LastDir));
else if (!LastDir[0])
strfcpy (LastDir, NONULL(Maildir), sizeof (LastDir));
-
+
#ifdef USE_IMAP
if (!buffy && mx_is_imap (LastDir))
{
if (S_ISDIR (state.entry[menu->current].mode) ||
(S_ISLNK (state.entry[menu->current].mode) &&
- link_is_dir (LastDir, state.entry[menu->current].name))
+ link_is_dir (LastDir, state.entry[menu->current].name))
#ifdef USE_IMAP
|| state.entry[menu->current].inferiors
#endif
{
int n;
ciss_url_t url;
-
+
strfcpy (LastDir, state.entry[menu->current].name,
sizeof (LastDir));
/* tack on delimiter here */
n = strlen (LastDir)+1;
-
+
/* special case "" needs no delimiter */
url_parse_ciss (&url, state.entry[menu->current].name);
if (url.path &&
goto bail;
}
}
- menu->current = 0;
- menu->top = 0;
+ menu->current = 0;
+ menu->top = 0;
init_menu (&state, menu, title, sizeof (title), buffy);
break;
}
imap_browse (LastDir, &state);
browser_sort (&state);
menu->data = state.entry;
- menu->current = 0;
- menu->top = 0;
+ menu->current = 0;
+ menu->top = 0;
init_menu (&state, menu, title, sizeof (title), buffy);
}
/* else leave error on screen */
}
break;
#endif
-
+
case OP_CHANGE_DIRECTORY:
strfcpy (buf, LastDir, sizeof (buf));
if (mutt_get_field (_("Chdir to: "), buf, sizeof (buf), MUTT_FILE) == 0 &&
buf[0])
{
- buffy = 0;
+ buffy = 0;
mutt_expand_path (buf, sizeof (buf));
#ifdef USE_IMAP
if (mx_is_imap (buf))
imap_browse (LastDir, &state);
browser_sort (&state);
menu->data = state.entry;
- menu->current = 0;
- menu->top = 0;
+ menu->current = 0;
+ menu->top = 0;
init_menu (&state, menu, title, sizeof (title), buffy);
}
else
}
}
break;
-
+
case OP_ENTER_MASK:
strfcpy (buf, NONULL(Mask.pattern), sizeof (buf));
{
int resort = 1;
int reverse = (i == OP_SORT_REVERSE);
-
+
switch (mutt_multi_choice ((reverse) ?
_("Reverse sort by (d)ate, (a)lpha, si(z)e, (c)ount, (u)nread, or do(n)'t sort? ") :
_("Sort by (d)ate, (a)lpha, si(z)e, (c)ount, (u)nread, or do(n)'t sort? "),
{
mutt_error _("Can't view a directory");
break;
- }
+ }
else
{
BODY *b;
char buf[_POSIX_PATH_MAX];
-
+
mutt_concat_path (buf, LastDir, state.entry[menu->current].name, sizeof (buf));
b = mutt_make_file_attach (buf);
if (b != NULL)
}
}
}
-
+
bail:
if (menu)
if (!folder)
strfcpy (LastDir, LastDirBackup, sizeof (LastDir));
-
+
}
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _BROWSER_H
#define _BROWSER_H 1
-/*
+/*
* Copyright (C) 1996-2000,2010,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2016-2017 Kevin J. McCarthy <kevin@8t8.us>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
static BUFFY* buffy_get (const char *path);
-/* Find the last message in the file.
+/* Find the last message in the file.
* upon success return 0. If no message found - return -1 */
static int fseek_last_message (FILE * f)
#else
ut.actime = st->st_atime;
ut.modtime = time (NULL);
- utime (buf, &ut);
+ utime (buf, &ut);
#endif
}
else
BUFFY *tmp = NULL;
struct stat sb;
struct stat tmp_sb;
-
+
if (stat (path,&sb) != 0)
return NULL;
for (tmp = Incoming; tmp; tmp = tmp->next)
{
- if (stat (tmp->path,&tmp_sb) ==0 &&
+ if (stat (tmp->path,&tmp_sb) ==0 &&
sb.st_dev == tmp_sb.st_dev && sb.st_ino == tmp_sb.st_ino)
break;
}
contex_sb.st_dev=0;
contex_sb.st_ino=0;
}
-
+
for (tmp = Incoming; tmp; tmp = tmp->next)
{
#ifdef USE_SIDEBAR
int first = 1;
int have_unnotified = BuffyNotify;
-
+
buffylist[0] = 0;
pos += strlen (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
for (tmp = Incoming; tmp; tmp = tmp->next)
strfcpy (path, tmp->path, sizeof (path));
mutt_pretty_mailbox (path, sizeof (path));
-
+
if (!first && (MuttMessageWindow->cols >= 7) &&
(pos + strlen (path) >= (size_t)MuttMessageWindow->cols - 7))
break;
-
+
if (!first)
pos += strlen (strncat(buffylist + pos, ", ", sizeof(buffylist)-1-pos)); /* __STRNCAT_CHECKED__ */
mutt_message ("%s", buffylist);
return (1);
}
- /* there were no mailboxes needing to be notified, so clean up since
+ /* there were no mailboxes needing to be notified, so clean up since
* BuffyNotify has somehow gotten out of sync
*/
BuffyNotify = 0;
return (0);
}
-/*
+/*
* mutt_buffy() -- incoming folders completion routine
*
* given a folder name, this routine gives the next incoming folder with new
mutt_expand_path (s, slen);
- if (mutt_buffy_check (0))
+ if (mutt_buffy_check (0))
{
for (pass = 0; pass < 2; pass++)
- for (tmp = Incoming; tmp; tmp = tmp->next)
+ for (tmp = Incoming; tmp; tmp = tmp->next)
{
mutt_expand_path (tmp->path, sizeof (tmp->path));
- if ((found || pass) && tmp->new)
+ if ((found || pass) && tmp->new)
{
strfcpy (s, tmp->path, slen);
mutt_pretty_mailbox (s, slen);
-/*
+/*
* Copyright (C) 1996-2000,2010,2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/*parameter to mutt_parse_mailboxes*/
#define MUTT_MAILBOXES 1
-#define MUTT_UNMAILBOXES 2
+#define MUTT_UNMAILBOXES 2
typedef struct buffy_t
{
# define EILSEQ EINVAL
#endif
-/*
+/*
* The following list has been created manually from the data under:
* http://www.isi.edu/in-notes/iana/assignments/character-sets
* Last update: 2000-09-07
* a preferred MIME name is given.
*/
-static const struct
+static const struct
{
const char *key;
const char *pref;
}
-PreferredMIMENames[] =
+PreferredMIMENames[] =
{
{ "ansi_x3.4-1968", "us-ascii" },
{ "iso-ir-6", "us-ascii" },
{ "ibm367", "us-ascii" },
{ "cp367", "us-ascii" },
{ "csASCII", "us-ascii" },
-
+
{ "csISO2022KR", "iso-2022-kr" },
{ "csEUCKR", "euc-kr" },
{ "csISO2022JP", "iso-2022-jp" },
{ "IBM819", "iso-8859-1" },
{ "CP819", "iso-8859-1" },
{ "csISOLatin1", "iso-8859-1" },
-
+
{ "ISO_8859-2:1987", "iso-8859-2" },
{ "iso-ir-101", "iso-8859-2" },
{ "iso_8859-2", "iso-8859-2" },
{ "latin2", "iso-8859-2" },
{ "l2", "iso-8859-2" },
{ "csISOLatin2", "iso-8859-2" },
-
+
{ "ISO_8859-3:1988", "iso-8859-3" },
{ "iso-ir-109", "iso-8859-3" },
{ "ISO_8859-3", "iso-8859-3" },
{ "ASMO-708", "iso-8859-6" },
{ "arabic", "iso-8859-6" },
{ "csISOLatinArabic", "iso-8859-6" },
-
+
{ "ISO_8859-7:1987", "iso-8859-7" },
{ "iso-ir-126", "iso-8859-7" },
{ "ISO_8859-7", "iso-8859-7" },
{ "greek", "iso-8859-7" },
{ "greek8", "iso-8859-7" },
{ "csISOLatinGreek", "iso-8859-7" },
-
+
{ "ISO_8859-8:1988", "iso-8859-8" },
{ "iso-ir-138", "iso-8859-8" },
{ "ISO_8859-8", "iso-8859-8" },
{ "latin5", "iso-8859-9" }, /* this is not a bug */
{ "l5", "iso-8859-9" },
{ "csISOLatin5", "iso-8859-9" },
-
+
{ "ISO_8859-10:1992", "iso-8859-10" },
{ "iso-ir-157", "iso-8859-10" },
{ "latin6", "iso-8859-10" }, /* this is not a bug */
{ "l6", "iso-8859-10" },
- { "csISOLatin6", "iso-8859-10" },
-
+ { "csISOLatin6", "iso-8859-10" },
+
{ "csKOI8r", "koi8-r" },
-
+
{ "MS_Kanji", "Shift_JIS" }, /* Note the underscore! */
{ "csShiftJis", "Shift_JIS" },
-
+
{ "Extended_UNIX_Code_Packed_Format_for_Japanese",
"euc-jp" },
- { "csEUCPkdFmtJapanese",
+ { "csEUCPkdFmtJapanese",
"euc-jp" },
-
+
{ "csGB2312", "gb2312" },
{ "csbig5", "big5" },
- /*
+ /*
* End of official brain damage. What follows has been taken
- * from glibc's localedata files.
+ * from glibc's localedata files.
*/
{ "iso_8859-13", "iso-8859-13" },
{ "iso-ir-179", "iso-8859-13" },
{ "latin7", "iso-8859-13" }, /* this is not a bug */
{ "l7", "iso-8859-13" },
-
+
{ "iso_8859-14", "iso-8859-14" },
{ "latin8", "iso-8859-14" }, /* this is not a bug */
{ "l8", "iso-8859-14" },
/* Suggested by Ionel Mugurel Ciobica <tgakic@sg10.chem.tue.nl> */
{ "latin0", "iso-8859-15" }, /* this is not a bug */
-
+
{ "iso_8859-16", "iso-8859-16" },
{ "latin10", "iso-8859-16" }, /* this is not a bug */
-
- /*
+
+ /*
* David Champion <dgc@uchicago.edu> has observed this with
- * nl_langinfo under SunOS 5.8.
+ * nl_langinfo under SunOS 5.8.
*/
-
+
{ "646", "us-ascii" },
-
- /*
+
+ /*
* http://www.sun.com/software/white-papers/wp-unicode/
*/
/*
* If you happen to encounter system-specific brain-damage with
* respect to character set naming, please add it above this
- * comment, and submit a patch to <mutt-dev@mutt.org>.
+ * comment, and submit a patch to <mutt-dev@mutt.org>.
*/
-
+
/* End of aliases. Please keep this line last. */
-
+
{ NULL, NULL }
};
{
char buff[LONG_STRING];
char buff2[LONG_STRING];
-
+
strfcpy (buff, nl_langinfo (CODESET), sizeof (buff));
mutt_canonical_charset (buff2, sizeof (buff2), buff);
-
+
/* finally, set $charset */
if (!(Charset = safe_strdup (buff2)))
Charset = safe_strdup ("iso-8859-1");
/* call system iconv with names it appreciates */
if ((cd = iconv_open (tocode2, fromcode2)) != (iconv_t) -1)
return cd;
-
+
return (iconv_t) -1;
}
inrepls = repls;
else
outrepl = "?";
-
+
len = strlen (s);
ib = s, ibl = len + 1;
obl = MB_LEN_MAX * ibl;
ob = buf = safe_malloc (obl + 1);
-
+
mutt_iconv (cd, &ib, &ibl, &ob, &obl, inrepls, outrepl);
iconv_close (cd);
FREE (ps); /* __FREE_CHECKED__ */
*ps = buf;
-
+
mutt_str_adjust (ps);
return 0;
}
{
int c;
size_t r;
-
+
for (r = 0; r + 1 < l;)
{
if ((c = fgetconv (_fc)) == EOF)
break;
buf[r++] = (char) c;
- if (c == '\n')
+ if (c == '\n')
break;
}
buf[r] = '\0';
-
- if (r)
+
+ if (r)
return buf;
- else
+ else
return NULL;
}
/*
* Copyright (C) 1996-2002,2012 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
COLOR_LINE *p = safe_calloc (1, sizeof (COLOR_LINE));
p->fg = p->bg = -1;
-
+
return (p);
}
-static void mutt_free_color_line(COLOR_LINE **l,
+static void mutt_free_color_line(COLOR_LINE **l,
int free_colors)
{
COLOR_LINE *tmp;
-
+
if(!l || !*l)
return;
/* we should really introduce a container
* type for regular expressions.
*/
-
+
regfree(&tmp->rx);
mutt_pattern_free(&tmp->color_pattern);
FREE (&tmp->pattern);
case COLOR_WHITE:
strfcpy (dest, missing[1], destlen);
return dest;
-
+
case COLOR_DEFAULT:
strfcpy (dest, missing[2], destlen);
return dest;
{
COLOR_LIST *p = ColorList;
int i;
-
+
#if defined (USE_SLANG_CURSES)
char fgc[SHORT_STRING], bgc[SHORT_STRING];
#endif
* unmono index pattern [pattern...]
*/
-static int
-_mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err,
+static int
+_mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err,
short parse_uncolor);
if(
#ifdef HAVE_COLOR
/* we're running without curses */
- option (OPTNOCURSES)
+ option (OPTNOCURSES)
|| /* we're parsing an uncolor command, and have no colors */
(parse_uncolor && !has_colors())
/* we're parsing an unmono command, and have colors */
}
-static int
+static int
add_pattern (COLOR_LINE **top, const char *s, int sensitive,
int fg, int bg, int attr, BUFFER *err,
int is_index)
{
/* is_index used to store compiled pattern
- * only for `index' color object
+ * only for `index' color object
* when called from mutt_parse_color() */
COLOR_LINE *tmp = *top;
char buf[LONG_STRING];
tmp = mutt_new_color_line ();
- if (is_index)
+ if (is_index)
{
strfcpy(buf, NONULL(s), sizeof(buf));
mutt_check_simple (buf, sizeof (buf), NONULL(SimpleSearch));
{
int q_level = 0;
char *eptr;
-
+
if(!MoreArgs(s))
{
strfcpy(err->data, _("Missing arguments."), err->dsize);
return -1;
}
-
+
mutt_extract_token(buf, s, 0);
if(!mutt_strncmp(buf->data, "quoted", 6))
{
}
else
*ql = 0;
-
+
*o = MT_COLOR_QUOTED;
}
else if (!ascii_strcasecmp(buf->data, "compose"))
strfcpy (err->data, _("color: too few arguments"), err->dsize);
return (-1);
}
-
+
mutt_extract_token (buf, s, 0);
if (parse_color_name (buf->data, bg, attr, 0, err) != 0)
return (-1);
-
+
return 0;
}
static int
parse_attr_spec(BUFFER *buf, BUFFER *s, int *fg, int *bg, int *attr, BUFFER *err)
{
-
- if(fg) *fg = -1;
+
+ if(fg) *fg = -1;
if(bg) *bg = -1;
if (! MoreArgs (s))
snprintf (err->data, err->dsize, _("%s: no such attribute"), buf->data);
return (-1);
}
-
+
return 0;
}
return attr;
}
-/* usage: color <object> <fg> <bg> [ <regexp> ]
+/* usage: color <object> <fg> <bg> [ <regexp> ]
* mono <object> <attr> [ <regexp> ]
*/
-static int
-_mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err,
+static int
+_mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err,
parser_callback_t callback, short dry_run)
{
int object = 0, attr = 0, fg = 0, bg = 0, q_level = 0;
return -1;
/* extract a regular expression if needed */
-
+
if (object == MT_COLOR_HEADER || object == MT_COLOR_BODY || object == MT_COLOR_INDEX)
{
if (!MoreArgs (s))
mutt_extract_token (buf, s, 0);
}
-
+
if (MoreArgs (s))
{
strfcpy (err->data, _("too many arguments"), err->dsize);
return (-1);
}
-
+
/* dry run? */
-
+
if(dry_run) return 0;
-
+
#ifdef HAVE_COLOR
# ifdef HAVE_USE_DEFAULT_COLORS
if (!option (OPTNOCURSES) && has_colors()
}
# endif /* HAVE_USE_DEFAULT_COLORS */
#endif
-
+
if (object == MT_COLOR_HEADER)
r = add_pattern (&ColorHdrList, buf->data, 0, fg, bg, attr, err,0);
else if (object == MT_COLOR_BODY)
if (q_level == 0)
{
ColorDefs[MT_COLOR_QUOTED] = fgbgattr_to_color(fg, bg, attr);
-
+
ColorQuote[0] = ColorDefs[MT_COLOR_QUOTED];
for (q_level = 1; q_level < ColorQuoteUsed; q_level++)
{
int mutt_parse_color(BUFFER *buff, BUFFER *s, unsigned long data, BUFFER *err)
{
int dry_run = 0;
-
+
if(option(OPTNOCURSES) || !has_colors())
dry_run = 1;
-
+
return _mutt_parse_color(buff, s, err, parse_color_pair, dry_run);
}
int mutt_parse_mono(BUFFER *buff, BUFFER *s, unsigned long data, BUFFER *err)
{
int dry_run = 0;
-
+
#ifdef HAVE_COLOR
if(option(OPTNOCURSES) || has_colors())
dry_run = 1;
return _mutt_parse_color(buff, s, err, parse_attr_spec, dry_run);
}
-
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2000-2004,2006 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
}
}
}
-
+
if (cmflags & MUTT_CM_VERIFY || cur->security & ENCRYPT)
{
if (cur->security & APPLICATION_PGP)
{
if (cur->env->from)
crypt_pgp_invoke_getkeys (cur->env->from);
-
+
crypt_invoke_message (APPLICATION_PGP);
}
return (0);
}
- if (DisplayFilter && *DisplayFilter)
+ if (DisplayFilter && *DisplayFilter)
{
fpfilterout = fpout;
fpout = NULL;
{
pager_t info;
- if (WithCrypto
+ if (WithCrypto
&& (cur->security & APPLICATION_SMIME) && (cmflags & MUTT_CM_VERIFY))
{
if (cur->security & GOODSIGN)
mutt_error ( _("S/MIME signature could NOT be verified."));
}
- if (WithCrypto
+ if (WithCrypto
&& (cur->security & APPLICATION_PGP) && (cmflags & MUTT_CM_VERIFY))
{
if (cur->security & GOODSIGN)
strfcpy(prompt, _("Bounce message to: "), sizeof(prompt));
else
strfcpy(prompt, _("Bounce tagged messages to: "), sizeof(prompt));
-
+
rc = mutt_get_field (prompt, buf, sizeof (buf), MUTT_ALIAS);
if (rc || !buf[0])
return;
}
mutt_window_clearline (MuttMessageWindow, 0);
-
+
rc = mutt_bounce_message (NULL, h, adr);
rfc822_free_address (&adr);
/* If no error, or background, display message. */
{
*cmflags |= MUTT_CM_DECODE | MUTT_CM_CHARCONV;
*chflags |= CH_DECODE | CH_REORDER;
-
+
if (option (OPTWEED))
{
*chflags |= CH_WEED;
*cmflags |= MUTT_CM_WEED;
}
}
-
+
if (print)
*cmflags |= MUTT_CM_PRINTING;
-
+
}
static void pipe_msg (HEADER *h, FILE *fp, int decode, int print)
{
int cmflags = 0;
int chflags = CH_FROM;
-
+
pipe_set_flags (decode, print, &cmflags, &chflags);
if (WithCrypto && decode && h->security & ENCRYPT)
int split,
char *sep)
{
-
+
int i, rc = 0;
pid_t thepid;
FILE *fpout;
-
-/* mutt_endwin (NULL);
- is this really needed here ?
+/* mutt_endwin (NULL);
+
+ is this really needed here ?
it makes the screen flicker on pgp and s/mime messages,
before asking for a passphrase...
Oliver Ehli */
return 1;
}
}
-
+
if (split)
{
for (i = 0; i < Context->vcount; i++)
mutt_expand_path (buffer, sizeof (buffer));
_mutt_pipe_message (h, buffer,
option (OPTPIPEDECODE),
- 0,
+ 0,
option (OPTPIPESPLIT),
PipeSep);
}
mutt_message (_("No printing command has been defined."));
return;
}
-
+
if (query_quadoption (OPT_PRINT,
h ? _("Print message?") : _("Print tagged messages?"))
!= MUTT_YES)
case 2: /* (f)rm */
Sort = SORT_FROM;
break;
-
+
case 3: /* (r)ecv */
Sort = SORT_RECEIVED;
break;
-
+
case 4: /* (s)ubj */
Sort = SORT_SUBJECT;
break;
-
+
case 5: /* t(o) */
Sort = SORT_TO;
break;
-
+
case 6: /* (t)hread */
Sort = SORT_THREADS;
break;
-
+
case 7: /* (u)nsort */
Sort = SORT_ORDER;
break;
-
+
case 8: /* si(z)e */
Sort = SORT_SIZE;
break;
-
- case 9: /* s(c)ore */
+
+ case 9: /* s(c)ore */
Sort = SORT_SCORE;
break;
adr = mutt_get_address (env, &pfx);
if (!adr) return;
-
- /*
+
+ /*
* Note: We don't convert IDNA to local representation this time.
* That is intentional, so the user has an opportunity to copy &
* paste the on-the-wire form of the address to other, IDN-unable
- * software.
+ * software.
*/
-
+
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), adr, 0);
mutt_message ("%s: %s", pfx, buf);
{
*cmflags = 0;
*chflags = CH_UPDATE_LEN;
-
+
if (WithCrypto && !decode && decrypt && (hdr->security & ENCRYPT))
{
if ((WithCrypto & APPLICATION_PGP)
{
int cmflags, chflags;
int rc;
-
+
set_copy_flags (h, decode, decrypt, &cmflags, &chflags);
if (decode || decrypt)
if (option (OPTDELETEUNTAG))
mutt_set_flag (Context, h, MUTT_TAG, 0);
}
-
+
return 0;
}
_("Decrypt-copy%s to mailbox")) :
(delete ? _("Save%s to mailbox") : _("Copy%s to mailbox"))),
h ? "" : _(" tagged"));
-
+
if (h)
{
if (!buf[0])
return (-1);
-
+
/* This is an undocumented feature of ELM pointed out to me by Felix von
* Leitner <leitner@prz.fu-berlin.de>
*/
if (WithCrypto && need_passphrase && (decode || decrypt)
&& !crypt_valid_passphrase(app))
return -1;
-
+
mutt_message (_("Copying to %s..."), buf);
-
+
#ifdef USE_IMAP
- if (Context->magic == MUTT_IMAP &&
+ if (Context->magic == MUTT_IMAP &&
!(decode || decrypt) && mx_is_imap (buf))
{
switch (imap_copy_messages (Context, h, buf, delete))
mutt_clear_error ();
return (0);
}
-
+
return -1;
}
short charset_changed = 0;
short type_changed = 0;
short structure_changed = 0;
-
+
cp = mutt_get_parameter ("charset", b->parameter);
strfcpy (charset, NONULL (cp), sizeof (charset));
if (b->parameter)
{
size_t l;
-
+
for (p = b->parameter; p; p = p->next)
{
l = strlen (buf);
snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp);
}
}
-
+
if (mutt_get_field ("Content-Type: ", buf, sizeof (buf), 0) != 0 ||
buf[0] == 0)
return 0;
-
+
/* clean up previous junk */
mutt_free_parameter (&b->parameter);
FREE (&b->subtype);
-
+
mutt_parse_content_type (buf, b);
-
+
snprintf (tmp, sizeof (tmp), "%s/%s", TYPE (b), NONULL (b->subtype));
type_changed = ascii_strcasecmp (tmp, obuf);
charset_changed = ascii_strcasecmp (charset, mutt_get_parameter ("charset", b->parameter));
}
/* inform the user */
-
+
snprintf (tmp, sizeof (tmp), "%s/%s", TYPE (b), NONULL (b->subtype));
if (type_changed)
mutt_message (_("Content-Type changed to %s."), tmp);
structure_changed = 1;
mutt_parse_part (fp, b);
}
-
+
if (WithCrypto && h)
{
if (h->content == b)
{
MESSAGE *msg;
int rv = 0;
-
+
h->security |= PGP_TRADITIONAL_CHECKED;
-
+
mutt_parse_mime_message (Context, h);
if ((msg = mx_open_message (Context, h->msgno)) == NULL)
return 0;
*redraw |= REDRAW_FULL;
rv = 1;
}
-
+
h->security |= PGP_TRADITIONAL_CHECKED;
mx_close_message (Context, &msg);
return rv;
else
{
for (i = 0; i < Context->vcount; i++)
- if (Context->hdrs[Context->v2r[i]]->tagged &&
+ if (Context->hdrs[Context->v2r[i]]->tagged &&
!(Context->hdrs[Context->v2r[i]]->security & PGP_TRADITIONAL_CHECKED))
rv = _mutt_check_traditional_pgp (Context->hdrs[Context->v2r[i]], redraw)
|| rv;
/*
* Copyright (C) 1996-2000,2007 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
if (mx_is_imap (imap_path))
return imap_complete (s, slen, imap_path);
#endif
-
+
if (*s == '=' || *s == '+' || *s == '!')
{
dirpart[0] = *s;
/*
* Copyright (C) 1996-2000,2002,2007,2010,2012 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2004 g10 Code GmbH
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
mutt_window_clrtoeol (MuttIndexWindow);
return;
}
-
+
for (c = 12; chain; chain = chain->next)
{
t = chain->data;
if (t && t[0] == '0' && t[1] == '\0')
t = "<random>";
-
+
if (c + mutt_strlen (t) + 2 >= MuttIndexWindow->cols)
break;
pretty, i+1);
return -1;
}
-
+
if(actx->idx[i]->content->stamp < st.st_mtime)
{
mutt_pretty_mailbox(pretty, sizeof (pretty));
snprintf(msg, sizeof(msg), _("%s [#%d] modified. Update encoding?"),
pretty, i+1);
-
+
if((r = mutt_yesorno(msg, MUTT_YES)) == MUTT_YES)
mutt_update_encoding(actx->idx[i]->content);
else if(r == -1)
{
char buf[HUGE_STRING] = ""; /* needs to be large for alias expansion */
char *err = NULL;
-
+
mutt_addrlist_to_local (*addr);
rfc822_write_address (buf, sizeof (buf), *addr, 0);
if (mutt_get_field (_(Prompts[line]), buf, sizeof (buf), MUTT_ALIAS) == 0)
}
-/*
+/*
* cum_attachs_size: Cumulative Attachments Size
*
* Returns the total number of bytes used by the attachments in the
* attachment list _after_ content-transfer-encodings have been
* applied.
- *
+ *
*/
static unsigned long cum_attachs_size (MUTTMENU *menu)
ATTACHPTR **idx = actx->idx;
CONTENT *info;
BODY *b;
-
+
for (i = 0, s = 0; i < actx->idxlen; i++)
{
b = idx[i]->content;
}
/* prototype for use below */
-static void compose_status_line (char *buf, size_t buflen, size_t col, int cols, MUTTMENU *menu,
+static void compose_status_line (char *buf, size_t buflen, size_t col, int cols, MUTTMENU *menu,
const char *p);
/*
* compose_format_str()
*
- * %a = total number of attachments
+ * %a = total number of attachments
* %h = hostname [option]
- * %l = approx. length of current message (in bytes)
- * %v = Mutt version
+ * %l = approx. length of current message (in bytes)
+ * %v = Mutt version
*
* This function is similar to status_format_str(). Look at that function for
* help when modifying this function.
static void compose_status_line (char *buf, size_t buflen, size_t col, int cols,
MUTTMENU *menu, const char *p)
{
- mutt_FormatString (buf, buflen, col, cols, p, compose_format_str,
+ mutt_FormatString (buf, buflen, col, cols, p, compose_format_str,
(unsigned long) menu, 0);
}
crypt_opportunistic_encrypt (msg);
redraw_crypt_lines (msg);
}
- mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
+ mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
case OP_COMPOSE_EDIT_SUBJECT:
if (msg->env->subject)
}
menu->redraw |= REDRAW_FULL;
- if (close == OP_QUIT)
+ if (close == OP_QUIT)
mx_close_mailbox (Context, NULL);
else
mx_fastclose_mailbox (Context);
}
mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
-
+
case OP_COMPOSE_TOGGLE_DISPOSITION:
/* toggle the content-disposition between inline/attachment */
CURATTACH->content->disposition = (CURATTACH->content->disposition == DISPINLINE) ? DISPATTACH : DISPINLINE;
/* Note: We don't invoke send2-hook here, since we want to leave
* users an opportunity to change settings from the ":" prompt.
*/
-
+
if(check_attachments(actx) != 0)
{
menu->redraw = REDRAW_FULL;
break;
}
-
+
#ifdef MIXMASTER
if (msg->chain && mix_check_message (msg) != 0)
break;
#endif
-
+
if (!fccSet && *fcc)
{
if ((i = query_quadoption (OPT_COPY,
mutt_expand_path (fname, sizeof (fname));
if(mutt_rename_file (CURATTACH->content->filename, fname))
break;
-
+
mutt_str_replace (&CURATTACH->content->filename, fname);
menu->redraw = REDRAW_CURRENT;
if(CURATTACH->content->stamp >= st.st_mtime)
mutt_stamp_attachment(CURATTACH->content);
-
+
}
mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
/* Call to lookup_mime_type () ? maybe later */
type[0] = 0;
- if (mutt_get_field ("Content-Type: ", type, sizeof (type), 0) != 0
+ if (mutt_get_field ("Content-Type: ", type, sizeof (type), 0) != 0
|| !type[0])
continue;
menu->redraw = REDRAW_FULL;
}
}
- mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
+ mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
case OP_COMPOSE_EDIT_MIME:
menu->redraw = REDRAW_FULL;
break;
}
-
+
loop = 0;
r = 1;
break;
#ifdef MIXMASTER
case OP_COMPOSE_MIX:
-
+
mix_make_chain (&msg->chain);
mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
return (r);
}
-
.msg_padding_size = compress_msg_padding_size,
.save_to_header_cache = NULL, /* compressed doesn't support maildir/mh */
};
-
/*
* Copyright (C) 1996-2000,2002,2014 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
/* Do we have anything pending? */
if (this_one)
{
- if (flags & CH_DECODE)
+ if (flags & CH_DECODE)
{
if (!address_header_decode (&this_one))
rfc2047_decode (&this_one);
if (!headers[x])
headers[x] = this_one;
- else
+ else
{
int hlen = mutt_strlen (headers[x]);
/* Do we have anything pending? -- XXX, same code as in above in the loop. */
if (this_one)
{
- if (flags & CH_DECODE)
+ if (flags & CH_DECODE)
{
if (!address_header_decode (&this_one))
rfc2047_decode (&this_one);
this_one_len = mutt_strlen (this_one);
}
-
+
if (!headers[x])
headers[x] = this_one;
- else
+ else
{
int hlen = mutt_strlen (headers[x]);
/* We couldn't do the prefixing when reading because RFC 2047
* decoding may have concatenated lines.
*/
-
+
if (flags & (CH_DECODE|CH_PREFIX))
{
- if (mutt_write_one_header (out, 0, headers[x],
+ if (mutt_write_one_header (out, 0, headers[x],
flags & CH_PREFIX ? prefix : 0,
mutt_window_wrap_cols (MuttIndexWindow, Wrap), flags) == -1)
{
}
}
else
- {
+ {
if (fputs (headers[x], out) == EOF)
{
error = TRUE;
if (ferror (out) || feof (out))
return -1;
-
+
return 0;
}
}
/* make a copy of a message
- *
+ *
* fpout where to write output
* fpin where to get input
* hdr header of message being copied
* MUTT_CM_PRINTING printing the message
* MUTT_CM_UPDATE update structures in memory after syncing
* MUTT_CM_DECODE_PGP used for decoding PGP messages
- * MUTT_CM_CHARCONV perform character set conversion
+ * MUTT_CM_CHARCONV perform character set conversion
* chflags flags to mutt_copy_header()
*/
}
#endif
- /* Update original message if we are sync'ing a mailfolder */
+ /* Update original message if we are sync'ing a mailfolder */
if (flags & MUTT_CM_UPDATE)
{
hdr->attach_del = 0;
s.flags |= MUTT_CHARCONV;
if (flags & MUTT_CM_REPLYING)
s.flags |= MUTT_REPLYING;
-
+
if (WithCrypto && flags & MUTT_CM_VERIFY)
s.flags |= MUTT_VERIFY;
{
int c;
size_t bytes = body->length;
-
+
fputs(prefix, fpout);
-
+
while((c = fgetc(fpin)) != EOF && bytes--)
{
fputc(c, fpout);
{
fputs(prefix, fpout);
}
- }
+ }
}
else if (mutt_copy_bytes (fpin, fpout, body->length) == -1)
return -1;
}
- if ((flags & MUTT_CM_UPDATE) && (flags & MUTT_CM_NOHEADER) == 0
+ if ((flags & MUTT_CM_UPDATE) && (flags & MUTT_CM_NOHEADER) == 0
&& new_offset != -1)
{
body->offset = new_offset;
{
MESSAGE *msg;
int r;
-
+
if ((msg = mx_open_message (src, hdr->msgno)) == NULL)
return -1;
- if ((r = _mutt_copy_message (fpout, msg->fp, hdr, hdr->content, flags, chflags)) == 0
+ if ((r = _mutt_copy_message (fpout, msg->fp, hdr, hdr->content, flags, chflags)) == 0
&& (ferror (fpout) || feof (fpout)))
{
dprint (1, (debugfile, "_mutt_copy_message failed to detect EOF!\n"));
fseeko (fpin, hdr->offset, 0);
if (fgets (buf, sizeof (buf), fpin) == NULL)
return -1;
-
+
if ((msg = mx_open_new_message (dest, hdr, is_from (buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM)) == NULL)
return -1;
if (dest->magic == MUTT_MBOX || dest->magic == MUTT_MMDF)
return 0;
}
-/*
+/*
* This function is the equivalent of mutt_write_address_list(),
* but writes to a buffer instead of writing to a stream.
* mutt_write_address_list could be re-used if we wouldn't store
- * all the decoded headers in a huge array, first.
+ * all the decoded headers in a huge array, first.
*
- * XXX - fix that.
+ * XXX - fix that.
*/
static void format_address_header (char **h, ADDRESS *a)
*buf = *cbuf = *c2buf = '\0';
l = rfc822_write_address (buf, sizeof (buf), a, 0);
a->next = tmp;
-
- if (count && linelen + l > 74)
+
+ if (count && linelen + l > 74)
{
strcpy (cbuf, "\n\t"); /* __STRCPY_CHECKED__ */
linelen = l + 8;
strcat (p + plen, c2buf); /* __STRCAT_CHECKED__ */
plen += c2buflen;
}
-
+
/* Space for this was allocated in the beginning of this function. */
strcat (p + plen, "\n"); /* __STRCAT_CHECKED__ */
}
switch (tolower ((unsigned char) *s))
{
- case 'r':
+ case 'r':
{
if (ascii_strncasecmp (s, "return-path:", 12) == 0)
{
}
return 0;
}
- case 'f':
+ case 'f':
{
- if (ascii_strncasecmp (s, "from:", 5))
- return 0;
+ if (ascii_strncasecmp (s, "from:", 5))
+ return 0;
l = 5;
break;
}
return 0;
l = 3;
break;
-
+
}
case 'b':
{
l = 17;
break;
}
- default: return 0;
+ default: return 0;
}
if ((a = rfc822_parse_adrlist (a, s + l)) == NULL)
return 0;
-
+
mutt_addrlist_to_local (a);
rfc2047_decode_adrlist (a);
for (cur = a; cur; cur = cur->next)
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* flags to _mutt_copy_message */
#define MUTT_CM_NOHEADER 1 /* don't copy the message header */
/*
* Copyright (C) 1996-2002,2010,2012-2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2004 g10 Code GmbH
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
int x;
ENTER_STATE *es = mutt_new_enter_state();
-
+
do
{
#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM)
void mutt_edit_file (const char *editor, const char *data)
{
char cmd[LONG_STRING];
-
+
mutt_endwin (NULL);
mutt_expand_file_fmt (cmd, sizeof (cmd), editor, data);
if (mutt_system (cmd))
char answer[2];
answer[1] = 0;
-
+
reyes_ok = (expr = nl_langinfo (YESEXPR)) && expr[0] == '^' &&
!REGCOMP (&reyes, expr, REG_NOSUB);
reno_ok = (expr = nl_langinfo (NOEXPR)) && expr[0] == '^' &&
#ifdef HAVE_LANGINFO_YESEXPR
answer[0] = ch.ch;
- if (reyes_ok ?
+ if (reyes_ok ?
(regexec (& reyes, answer, 0, 0, 0) == 0) :
#else
if (
FREE (&answer_string);
-#ifdef HAVE_LANGINFO_YESEXPR
+#ifdef HAVE_LANGINFO_YESEXPR
if (reyes_ok)
regfree (& reyes);
if (reno_ok)
{
if (option (OPTKEEPQUIET))
return;
-
+
SETCOLOR (option (OPTMSGERR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
mutt_window_mvaddstr (MuttMessageWindow, 0, 0, Errorbuf);
NORMAL_COLOR;
mutt_refresh();
endwin ();
}
-
+
if (msg && *msg)
{
puts (msg);
{
char *p = strerror (errno);
- dprint (1, (debugfile, "%s: %s (errno = %d)\n", s,
+ dprint (1, (debugfile, "%s: %s (errno = %d)\n", s,
p ? p : "unknown error", errno));
mutt_error ("%s: %s (errno = %d)", s, p ? p : _("unknown error"), errno);
}
pager_t *info)
{
int rc;
-
+
if (!Pager || mutt_strcmp (Pager, "builtin") == 0)
rc = mutt_pager (banner, tempfile, do_color, info);
else
{
char cmd[STRING];
-
+
mutt_endwin (NULL);
mutt_expand_file_fmt (cmd, sizeof(cmd), Pager, tempfile);
if (mutt_system (cmd) == -1)
{
mutt_refresh ();
buf[0] = 0;
- _mutt_select_file (buf, blen, MUTT_SEL_FOLDER | (multiple ? MUTT_SEL_MULTI : 0),
+ _mutt_select_file (buf, blen, MUTT_SEL_FOLDER | (multiple ? MUTT_SEL_MULTI : 0),
files, numfiles);
}
else
void mutt_curs_set (int cursor)
{
static int SavedCursor = 1;
-
+
if (cursor < 0)
cursor = SavedCursor;
else
SavedCursor = cursor;
-
+
if (curs_set (cursor) == ERR) {
if (cursor == 1) /* cnorm */
curs_set (2); /* cvvis */
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
}
tm->tm_mday += DaysPerMonth[tm->tm_mon] + isLeapYearFeb (tm);
}
- while (tm->tm_mday > (DaysPerMonth[tm->tm_mon] +
+ while (tm->tm_mday > (DaysPerMonth[tm->tm_mon] +
(nLeap = isLeapYearFeb (tm))))
{
tm->tm_mday -= DaysPerMonth[tm->tm_mon] + nLeap;
/*
* Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/**
** This program parses mutt's init.h and generates documentation in
**
** -> a commented muttrc configuration file
** -> nroff, suitable for inclusion in a manual page
- ** -> docbook-xml, suitable for inclusion in the
+ ** -> docbook-xml, suitable for inclusion in the
** SGML-based manual
**
**/
Progname++;
else
Progname = argv[0];
-
+
while ((c = getopt (argc, argv, "cmsd")) != EOF)
{
switch (c)
case 'm': OutputFormat = F_MAN; break;
case 's': OutputFormat = F_SGML; break;
case 'd': Debug++; break;
- default:
+ default:
{
fprintf (stderr, "%s: bad command line parameter.\n", Progname);
exit (1);
exit (1);
}
}
- else
+ else
f = stdin;
switch (OutputFormat)
{
- case F_CONF:
- case F_MAN:
+ case F_CONF:
+ case F_MAN:
case F_SGML: makedoc (f, stdout); break;
default:
{
exit (1);
}
}
-
+
if (f != stdin)
fclose (f);
fprintf (stderr, "%s: line %d. first token: \"%s\".\n",
Progname, line, token);
}
-
+
if (!strcmp (token, "/*++*/"))
active = 1;
else if (!strcmp (token, "/*--*/"))
if (Debug)
fprintf (stderr, "%s: get_token called for `%s'.\n",
Progname, s);
-
+
s = skip_ws (s);
if (Debug > 1)
{
fprintf (stderr, "%s: found quote character.\n", Progname);
}
-
+
s++;
is_quoted = 1;
}
fprintf (stderr, "%s: Remainder: `%s'.\n",
Progname, t);
}
-
+
return t;
}
/**
** Configuration line parser
- **
+ **
** The following code parses a line from init.h which declares
** a configuration variable.
**
* following string definitions!
*/
-enum
+enum
{
DT_NONE = 0,
DT_BOOL,
DT_MBCHARTBL
};
-struct
+struct
{
char *machine;
char *human;
}
-types[] =
+types[] =
{
{ "DT_NONE", "-none-" },
{ "DT_BOOL", "boolean" },
{ "DT_MBCHARTBL", "string" },
{ NULL, NULL }
};
-
+
static int buff2type (const char *s)
{
int type;
-
+
for (type = DT_NONE; types[type].machine; type++)
if (!strcmp (types[type].machine, s))
return type;
char buff[BUFFSIZE];
char tmp[BUFFSIZE];
int type;
-
+
char val[BUFFSIZE];
/* xxx - put this into an actual state machine? */
/* variable name */
if (!(s = get_token (varname, sizeof (varname), s))) return;
-
+
/* comma */
if (!(s = get_token (buff, sizeof (buff), s))) return;
-
+
/* type */
if (!(s = get_token (buff, sizeof (buff), s))) return;
}
/* redraw, comma */
-
+
while (1)
{
if (!(s = get_token (buff, sizeof (buff), s))) return;
if (!(s = get_token (buff, sizeof (buff), s))) return;
if (Debug) fprintf (stderr, "%s: Expecting default value.\n", Progname);
-
+
/* <default value> or UL <default value> */
if (!(s = get_token (buff, sizeof (buff), s))) return;
if (!strcmp (buff, "UL"))
memset (tmp, 0, sizeof (tmp));
- do
+ do
{
if (!strcmp (buff, "}"))
break;
switch (type)
{
case DT_QUAD:
- {
+ {
if (!strcasecmp (s, "MUTT_YES")) strncpy (t, "yes", l);
else if (!strcasecmp (s, "MUTT_NO")) strncpy (t, "no", l);
else if (!strcasecmp (s, "MUTT_ASKYES")) strncpy (t, "ask-yes", l);
conf_char_to_escape ((unsigned int) *v, out);
continue;
}
-
+
if (*v == '"')
fputs ("\\(rq", out);
else if (*v == '\\')
static void print_confline (const char *varname, int type, const char *val, FILE *out)
{
if (type == DT_SYN) return;
-
+
switch (OutputFormat)
{
/* configuration file */
}
else if (type != DT_SYN)
fprintf (out, "\n# set %s=%s", varname, val);
-
+
fprintf (out, "\n#\n# Name: %s", varname);
fprintf (out, "\n# Type: %s", type2human (type));
if (type == DT_STR || type == DT_RX || type == DT_ADDR || type == DT_PATH ||
break;
}
-
+
/* SGML based manual */
case F_SGML:
{
sgml_fputs (varname, out);
fprintf (out, "</title>\n<literallayout>Type: %s", type2human (type));
-
+
if (type == DT_STR || type == DT_RX || type == DT_ADDR || type == DT_PATH ||
type == DT_MBCHARTBL)
{
/**
** Documentation line parser
**
- ** The following code parses specially formatted documentation
+ ** The following code parses specially formatted documentation
** comments in init.h.
**
** The format is very remotely inspired by nroff. Most important, it's
- ** easy to parse and convert, and it was easy to generate from the SGML
+ ** easy to parse and convert, and it was easy to generate from the SGML
** source of mutt's original manual.
**
** - \fI switches to italics
static int print_it (int special, char *str, FILE *out, int docstat)
{
int onl = docstat & (D_NL|D_NP);
-
+
docstat &= ~(D_NL|D_NP|D_INIT);
switch (OutputFormat)
case SP_START_BF: docstat |= D_BF; break;
case SP_START_EM: docstat |= D_EM; break;
case SP_START_TT: docstat |= D_TT; break;
- case SP_NEWLINE:
+ case SP_NEWLINE:
{
if (onl)
docstat |= onl;
docstat |= D_NP;
break;
}
- case SP_START_TAB:
+ case SP_START_TAB:
{
- if (!onl)
+ if (!onl)
fputs ("\n# ", out);
docstat |= D_TAB;
break;
}
fputs (str, out);
if (docstat & D_DT)
- {
+ {
int i;
for (i = strlen (str) ; i < 8 ; i++)
{
switch (special)
{
- case SP_END_FT:
+ case SP_END_FT:
{
fputs ("\\fP", out);
docstat &= ~(D_EM|D_BF|D_TT);
break;
}
- case SP_START_BF:
+ case SP_START_BF:
{
fputs ("\\fB", out);
docstat |= D_BF;
{
switch (special)
{
- case SP_END_FT:
+ case SP_END_FT:
{
if (docstat & D_EM) fputs ("</emphasis>", out);
if (docstat & D_BF) fputs ("</emphasis>", out);
docstat &= ~(D_EM|D_BF|D_TT);
break;
}
- case SP_START_BF:
+ case SP_START_BF:
{
fputs ("<emphasis role=\"bold\">", out);
docstat |= D_BF;
if (Debug)
fprintf (stderr, "%s: handle_docline `%s'\n", Progname, l);
-
+
if (!strncmp (l, ".pp", 3))
return print_it (SP_NEWPAR, NULL, out, docstat);
else if (!strncmp (l, ".ts", 3))
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1998-2001,2007 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/*
* This module either be compiled into Mutt, or it can be
struct utsname utsname;
/* first, drop privileges */
-
+
if (dotlock_init_privs () == -1)
return DL_EX_ERROR;
/* determine the system's host name */
-
+
uname (&utsname);
if (!(Hostname = strdup (utsname.nodename))) /* __MEM_CHECKED__ */
return DL_EX_ERROR;
/* parse the command line options. */
DotlockFlags = 0;
-
+
while ((i = getopt (argc, argv, "dtfupr:")) != EOF)
{
switch (i)
case 'f': DotlockFlags |= DL_FL_FORCE; break;
case 'p': DotlockFlags |= DL_FL_USEPRIV; break;
case 'r': DotlockFlags |= DL_FL_RETRY; Retry = atoi (optarg); break;
-
+
default: usage (argv[0]);
}
}
}
-/*
- * Determine our effective group ID, and drop
+/*
+ * Determine our effective group ID, and drop
* privileges.
- *
+ *
* Return value:
- *
+ *
* 0 - everything went fine
* -1 - we couldn't drop privileges.
- *
+ *
*/
{
# ifdef USE_SETGID
-
+
UserGid = getgid ();
MailGid = getegid ();
return 0;
}
-
+
#else /* DL_STANDALONE */
-/*
+/*
* This function is intended to be invoked from within
* mutt instead of mx.c's invoke_dotlock ().
*/
int r;
DotlockFlags = flags;
-
+
if ((currdir = open (".", O_RDONLY)) == -1)
return DL_EX_ERROR;
Retry = MAXLOCKATTEMPT;
else
Retry = 0;
-
+
r = dotlock_dispatch (path, fd);
-
+
fchdir (currdir);
close (currdir);
-
+
return r;
}
* `dirname $f`. Additionally, f has been opened for
* reading to verify that the user has at least read
* permissions on that file.
- *
+ *
* For a more detailed explanation of all this, see the
* lengthy comment below.
*/
return dotlock_lock (realpath);
}
-
+
/*
- * Get privileges
- *
+ * Get privileges
+ *
* This function re-acquires the privileges we may have
* if the user told us to do so by giving the "-p"
* command line option.
- *
+ *
* BEGIN_PRIVILEGES () won't return if an error occurs.
- *
+ *
*/
static void
/*
* Drop privileges
- *
+ *
* This function drops the group privileges we may have.
- *
+ *
* END_PRIVILEGED () won't return if an error occurs.
*
*/
/*
* Usage information.
- *
+ *
* This function doesn't return.
- *
+ *
*/
-static void
+static void
usage (const char *av0)
{
fprintf (stderr, "dotlock [Mutt %s (%s)]\n", MUTT_VERSION, ReleaseDate);
#endif
"\n -r <retries>\tRetry locking"
"\n", stderr);
-
+
exit (DL_EX_ERROR);
}
/*
* Access checking: Let's avoid to lock other users' mail
* spool files if we aren't permitted to read them.
- *
+ *
* Some simple-minded access (2) checking isn't sufficient
* here: The problem is that the user may give us a
* deeply nested path to a file which has the same name
* as the file he wants to lock, but different
* permissions, say, e.g.
* /tmp/lots/of/subdirs/var/spool/mail/root.
- *
+ *
* He may then try to replace /tmp/lots/of/subdirs by a
* symbolic link to / after we have invoked access () to
* check the file's permissions. The lockfile we'd
* create or remove would then actually be
* /var/spool/mail/root.
- *
+ *
* To avoid this attack, we proceed as follows:
- *
+ *
* - First, follow symbolic links a la
* dotlock_deference_symlink ().
- *
+ *
* - get the result's dirname.
- *
+ *
* - chdir to this directory. If you can't, bail out.
- *
+ *
* - try to open the file in question, only using its
* basename. If you can't, bail out.
- *
+ *
* - fstat that file and compare the result to a
* subsequent lstat (only using the basename). If
* the comparison fails, bail out.
- *
+ *
* dotlock_prepare () is invoked from main () directly
* after the command line parsing has been done.
*
* Return values:
- *
+ *
* 0 - Evereything's fine. The program's new current
* directory is the contains the file to be locked.
* The string pointed to by bn contains the name of
* the file to be locked.
- *
+ *
* -1 - Something failed. Don't continue.
- *
+ *
* tlr, Jul 15 1998
*/
if (S_ISLNK (lsb->st_mode) || S_ISLNK (fsb->st_mode))
return -1;
-
+
if ((lsb->st_dev != fsb->st_dev) ||
(lsb->st_ino != fsb->st_ino) ||
(lsb->st_mode != fsb->st_mode) ||
/* something's fishy */
return -1;
}
-
+
return 0;
}
char *p;
int fd;
int r;
-
+
if (dotlock_deference_symlink (realpath, sizeof (realpath), f) == -1)
return -1;
-
+
if ((p = strrchr (realpath, '/')))
{
*p = '\0';
if (strlen (basename) + 1 > l)
return -1;
-
+
strfcpy (bn, basename, l);
-
+
if (chdir (dirname) == -1)
return -1;
fd = _fd;
else if ((fd = open (basename, O_RDONLY)) == -1)
return -1;
-
+
r = fstat (fd, &fsb);
-
+
if (_fd == -1)
close (fd);
-
+
if (r == -1)
return -1;
-
+
if (lstat (basename, &lsb) == -1)
return -1;
/*
* Expand a symbolic link.
- *
+ *
* This function expects newpath to have space for
* at least _POSIX_PATH_MAX characters.
*
*/
-static void
+static void
dotlock_expand_link (char *newpath, const char *path, const char *link)
{
const char *lb = NULL;
/*
* Deference a chain of symbolic links
- *
+ *
* The final path is written to d.
*
*/
char realpath[_POSIX_PATH_MAX];
const char *pathptr = path;
int count = 0;
-
+
while (count++ < MAXLINKS)
{
if (lstat (pathptr, &sb) == -1)
/* perror (pathptr); */
return -1;
}
-
+
if (S_ISLNK (sb.st_mode))
{
char linkfile[_POSIX_PATH_MAX];
/* perror (pathptr); */
return -1;
}
-
+
linkfile[len] = '\0';
dotlock_expand_link (linkpath, pathptr, linkfile);
strfcpy (realpath, linkpath, sizeof (realpath));
/*
* Dotlock a file.
- *
+ *
* realpath is assumed _not_ to be an absolute path to
* the file we are about to lock. Invoke
* dotlock_prepare () before using this function!
- *
+ *
*/
#define HARDMAXATTEMPTS 10
int hard_count = 0;
struct stat sb;
time_t t;
-
+
snprintf (nfslockfile, sizeof (nfslockfile), "%s.%s.%d",
realpath, Hostname, (int) getpid ());
snprintf (lockfile, sizeof (lockfile), "%s.lock", realpath);
-
+
BEGIN_PRIVILEGED ();
unlink (nfslockfile);
{
END_PRIVILEGED ();
-
+
if (errno != EAGAIN)
{
/* perror ("cannot open NFS lock file"); */
return DL_EX_ERROR;
}
-
+
BEGIN_PRIVILEGED ();
}
END_PRIVILEGED ();
-
+
close (fd);
-
+
while (hard_count++ < HARDMAXATTEMPTS)
{
return DL_EX_EXIST;
}
}
-
+
prev_size = sb.st_size;
-
+
/* don't trust sleep (3) as it may be interrupted
- * by users sending signals.
+ * by users sending signals.
*/
-
+
t = time (NULL);
do {
sleep (1);
/*
- * Unlock a file.
- *
+ * Unlock a file.
+ *
* The same comment as for dotlock_lock () applies here.
- *
+ *
*/
static int
snprintf (lockfile, sizeof (lockfile), "%s.lock",
realpath);
-
+
BEGIN_PRIVILEGED ();
i = unlink (lockfile);
END_PRIVILEGED ();
-
+
if (i == -1)
return DL_EX_ERROR;
-
+
return DL_EX_OK;
}
/*
* Check if a file can be locked at all.
- *
+ *
* The same comment as for dotlock_lock () applies here.
- *
+ *
*/
static int
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1998-2000 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _DOTLOCK_H
#define _DOTLOCK_H
/* exit values */
-#define DL_EX_OK 0
-#define DL_EX_ERROR 1
-#define DL_EX_EXIST 3
+#define DL_EX_OK 0
+#define DL_EX_ERROR 1
+#define DL_EX_EXIST 3
#define DL_EX_NEED_PRIVS 4
#define DL_EX_IMPOSSIBLE 5
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* Close approximation of the mailx(1) builtin editor for sending mail. */
FILE *f;
char tmp[LONG_STRING];
struct stat sb;
-
+
if ((f = fopen (path, "r")))
{
fstat (fileno (f), &sb);
{
FILE *f;
int i;
-
+
if ((f = fopen (path, "w")) == NULL) /* __FOPEN_CHECKED__ */
{
addstr (strerror (errno));
int done = 0;
int i;
char *p;
-
+
scrollok (stdscr, TRUE);
be_edit_header (msg->env, 0);
safe_realloc (&buf, sizeof (char *) * (bufmax += 25));
buf[buflen++] = safe_strdup (tmp[1] == '~' ? tmp + 1 : tmp);
}
-
+
tmp[0] = 0;
}
/*
* Copyright (C) 1999-2002 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- */
+ */
/* simple, editor-based message editing */
/*
* return value:
- *
+ *
* 1 message not modified
* 0 message edited successfully
* -1 error
unsigned short o_old;
int of, cf;
-
+
CONTEXT tmpctx;
MESSAGE *msg;
struct stat sb;
time_t mtime = 0;
-
+
mutt_mktemp (tmp, sizeof (tmp));
omagic = DefaultMagic;
mutt_error (_("Can't stat %s: %s"), tmp, strerror (errno));
goto bail;
}
-
+
if (sb.st_size == 0)
{
mutt_message (_("Message file is empty!"));
of = 0;
cf = ((tmpctx.magic == MUTT_MBOX || tmpctx.magic == MUTT_MMDF) ? 0 : CH_NOSTATUS);
-
+
if (fgets (buff, sizeof (buff), fp) && is_from (buff, NULL, 0, NULL))
{
if (tmpctx.magic == MUTT_MBOX || tmpctx.magic == MUTT_MMDF)
else
of = MUTT_ADD_FROM;
- /*
+ /*
* XXX - we have to play games with the message flags to avoid
* problematic behavior with maildir folders.
*
rc = mx_commit_message (msg, &tmpctx);
mx_close_message (&tmpctx, &msg);
-
+
mx_close_mailbox (&tmpctx, NULL);
-
+
bail:
if (fp) safe_fclose (&fp);
else if (rc == -1)
mutt_message (_("Error. Preserving temporary file: %s"), tmp);
-
+
return rc;
}
if (hdr)
return edit_one_message (ctx, hdr);
-
+
for (i = 0; i < ctx->vcount; i++)
{
j = ctx->v2r[i];
/*
* Copyright (C) 1996-2000,2007,2011,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2000-2001 Edmund Grimley Evans <edmundo@rano.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
for (; n; s++, n--)
if ((w += my_wcwidth (*s)) > w1)
break;
- return s - s0;
+ return s - s0;
}
static void my_wcstombs (char *dest, size_t dlen, const wchar_t *src, size_t slen)
size_t wbuflen;
wbuf = *pwbuf, wbuflen = *pwbuflen;
-
+
while (*buf)
{
memset (&st, 0, sizeof (st));
}
if (*buf && (k == (size_t) -1 || k == (size_t) -2))
{
- if (i >= wbuflen)
+ if (i >= wbuflen)
{
wbuflen = i + 20;
safe_realloc (&wbuf, wbuflen * sizeof (*wbuf));
int rv = 0;
memset (&mbstate, 0, sizeof (mbstate));
-
+
if (state->wbuf)
{
/* Coming back after return 1 */
hclass = HC_COMMAND;
else if (flags & MUTT_PATTERN)
hclass = HC_PATTERN;
- else
+ else
hclass = HC_OTHER;
-
+
for (;;)
{
if (redraw && !pass)
/* Go to end of line */
state->curpos = state->lastchar;
state->begin = width_ceiling (state->wbuf, state->lastchar, my_wcswidth (state->wbuf, state->lastchar) - width + 1);
- }
+ }
if (state->curpos < state->begin ||
my_wcswidth (state->wbuf + state->begin, state->curpos - state->begin) >= width)
state->begin = width_ceiling (state->wbuf, state->lastchar, my_wcswidth (state->wbuf, state->curpos) - width / 2);
mutt_select_file (buf, buflen, (flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0);
if (*buf)
replace_part (state, i, buf);
- rv = 1;
+ rv = 1;
goto bye;
}
if (!mutt_complete (buf, buflen))
else if (flags & MUTT_ALIAS && ch == OP_EDITOR_COMPLETE)
{
/* invoke the alias-menu to get more addresses */
- for (i = state->curpos; i && state->wbuf[i-1] != ',' &&
+ for (i = state->curpos; i && state->wbuf[i-1] != ',' &&
state->wbuf[i-1] != ':'; i--)
;
for (; i < state->lastchar && state->wbuf[i] == ' '; i++)
}
else if (flags & MUTT_LABEL && ch == OP_EDITOR_COMPLETE)
{
- for (i = state->curpos; i && state->wbuf[i-1] != ',' &&
+ for (i = state->curpos; i && state->wbuf[i-1] != ',' &&
state->wbuf[i-1] != ':'; i--)
;
for (; i < state->lastchar && state->wbuf[i] == ' '; i++)
mutt_query_complete (buf, buflen);
replace_part (state, i, buf);
- rv = 1;
+ rv = 1;
goto bye;
}
else if (flags & MUTT_COMMAND)
if ((!tempbuf && !state->lastchar) || (tempbuf && templen == state->lastchar &&
!memcmp (tempbuf, state->wbuf, state->lastchar * sizeof (wchar_t))))
{
- _mutt_select_file (buf, buflen,
- ((flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0) | (multiple ? MUTT_SEL_MULTI : 0),
+ _mutt_select_file (buf, buflen,
+ ((flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0) | (multiple ? MUTT_SEL_MULTI : 0),
files, numfiles);
if (*buf)
{
}
else
{
-
+
self_insert:
state->tabs = 0;
tfiles[0] = safe_strdup (buf);
*files = tfiles;
}
- rv = 0;
+ rv = 0;
goto bye;
}
else if (wc && (wc < ' ' || IsWPrint (wc))) /* why? */
}
}
}
-
+
bye:
mutt_reset_history_state (hclass);
void mutt_free_enter_state (ENTER_STATE **esp)
{
if (!esp) return;
-
+
FREE (&(*esp)->wbuf);
FREE (esp); /* __FREE_CHECKED__ */
}
/*
* Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- */
+ */
-/*
+/*
* Some simple dummies, so we can reuse the routines from
* lib.c in external programs.
*/
{
exit (code);
}
-
/*
* Copyright (C) 1996-2000 Michael R. Elkins.
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
close (pin[0]);
close (pin[1]);
}
-
+
if (out)
{
close (pout[0]);
int mutt_wait_filter (pid_t pid)
{
int rc;
-
+
waitpid (pid, &rc, 0);
mutt_unblock_signals_system (1);
rc = WIFEXITED (rc) ? WEXITSTATUS (rc) : -1;
-
+
return rc;
}
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
if (upd_ctx) ctx->deleted--;
#ifdef USE_IMAP
/* see my comment above */
- if (ctx->magic == MUTT_IMAP)
+ if (ctx->magic == MUTT_IMAP)
{
h->changed = 1;
if (upd_ctx) ctx->changed = 1;
}
#endif
- /*
+ /*
* If the user undeletes a message which is marked as
* "trash" in the maildir folder on disk, the folder has
* been changed, and is marked accordingly. However, we do
* _not_ mark the message itself changed, because trashing
* is checked in specific code in the maildir folder
- * driver.
+ * driver.
*/
if (ctx->magic == MUTT_MAILDIR && upd_ctx && h->trash)
ctx->changed = 1;
int mutt_thread_set_flag (HEADER *hdr, int flag, int bf, int subthread)
{
THREAD *start, *cur = hdr->thread;
-
+
if ((Sort & SORT_MASK) != SORT_THREADS)
{
mutt_error _("Threading is not enabled.");
while (cur->parent)
cur = cur->parent;
start = cur;
-
+
if (cur->message)
mutt_set_flag (Context, cur->message, flag, bf);
cur = cur->child;
else if (cur->next)
cur = cur->next;
- else
+ else
{
while (!cur->next)
{
/*
* Copyright (C) 1996-2000,2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
{
if (*p == '\\')
{
- if (*++p == '\0')
+ if (*++p == '\0')
return 0;
}
else if (*p == '"')
return 0;
}
}
-
+
if (path)
{
len = (size_t) (p - s);
path[len] = 0;
dprint (3, (debugfile, "is_from(): got return path: %s\n", path));
}
-
+
s = p + 1;
SKIPWS (s);
if (!*s)
/* year */
if (sscanf (s, "%d", &yr) != 1 || yr < 0) return 0;
tm.tm_year = yr > 1900 ? yr - 1900 : (yr < 70 ? yr + 100 : yr);
-
+
dprint (3,(debugfile, "is_from(): month=%d, day=%d, hr=%d, min=%d, sec=%d, yr=%d.\n",
tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year));
/*
* Copyright (C) 1996-2000,2002 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/*
* This file contains the structures needed to parse ``bind'' commands, as
{ "search-toggle", OP_SEARCH_TOGGLE, "\\" },
{ "display-address", OP_DISPLAY_ADDRESS, "@" },
{ "next-new", OP_MAIN_NEXT_NEW, NULL },
- { "next-new-then-unread",
+ { "next-new-then-unread",
OP_MAIN_NEXT_NEW_THEN_UNREAD, "\t" },
{ "pipe-message", OP_PIPE, "|" },
{ "help", OP_HELP, "?" },
#ifdef MIXMASTER
{ "mix", OP_COMPOSE_MIX, "M" },
#endif
-
+
{ NULL, 0, NULL }
};
{ "undelete-entry", OP_UNDELETE, "u" },
{ NULL, 0, NULL }
};
-
+
/* The file browser */
const struct binding_t OpBrowser[] = { /* map: browser */
/*
* Copyright (C) 1996-2002,2010,2016 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
WHERE void (*mutt_error) (const char *, ...);
WHERE void (*mutt_message) (const char *, ...);
#endif
#ifdef MAIN_C
-/* so that global vars get included */
+/* so that global vars get included */
#include "mx.h"
#include "mutt_regex.h"
#include "buffy.h"
/*
* NOTE
- *
+ *
* This code used to be the parser for GnuPG's output.
- *
- * Nowadays, we are using an external pubring lister with PGP which mimics
+ *
+ * Nowadays, we are using an external pubring lister with PGP which mimics
* gpg's output format.
- *
+ *
*/
#if HAVE_CONFIG_H
break;
case 12: /* key capabilities */
dprint (2, (debugfile, "capabilities info: %s\n", p));
-
+
while(*p)
{
switch(*p++)
}
}
- if (!is_uid &&
+ if (!is_uid &&
(!*is_subkey || !option (OPTPGPIGNORESUB)
|| !((flags & KEYFLAG_DISABLED)
|| (flags & KEYFLAG_REVOKED)
tmp.flags |= flags;
break;
-
+
default:
break;
}
return NULL;
mutt_str_replace (&_chs, Charset);
-
+
thepid = pgp_invoke_list_keys (NULL, &fp, NULL, -1, -1, devnull,
keyring, hints);
if (thepid == -1)
if (is_sub)
{
pgp_uid_t **l;
-
+
k->flags |= KEYFLAG_SUBKEY;
k->parent = mainkey;
for (l = &k->address; *l; l = &(*l)->next)
mutt_wait_filter (thepid);
close (devnull);
-
+
return db;
}
-
/*
* Copyright (C) 1996-2000,2002,2010,2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
c = ch;
len--;
}
- else
+ else
ungetc(ch, s->fpin);
}
/* soft line break */
if (*s == '=' && !(*(s+1)))
return 1;
-
+
/* quoted-printable triple */
if (*s == '=' &&
isxdigit ((unsigned char) *(s+1)) &&
*d = (hexval (*(s+1)) << 4) | hexval (*(s+2));
return 0;
}
-
+
/* something else */
return -1;
}
int soft = 0;
/* decode the line */
-
+
for (d = dest, s = src; *s;)
{
switch ((kind = qp_decode_triple (s, &c)))
else
*d++ = '\n';
}
-
+
*d = '\0';
*l = d - dest;
}
-/*
+/*
* Decode an attachment encoded with quoted-printable.
- *
+ *
* Why doesn't this overflow any buffers? First, it's guaranteed
* that the length of a line grows when you _en_-code it to
* quoted-printable. That means that we always can store the
* result in a buffer of at most the _same_ size.
- *
+ *
* Now, we don't special-case if the line we read with fgets()
* isn't terminated. We don't care about this, since STRING > 78,
* so corrupted input will just be corrupted a bit more. That
* implies that STRING+1 bytes are always sufficient to store the
* result of qp_decode_line.
- *
+ *
* Finally, at soft line breaks, some part of a multibyte character
* may have been left over by mutt_convert_to_state(). This shouldn't
* be more than 6 characters, so STRING + 7 should be sufficient
* memory to store the decoded data.
- *
+ *
* Just to make sure that I didn't make some off-by-one error
* above, we just use STRING*2 for the target buffer's size.
- *
+ *
*/
static void mutt_decode_quoted (STATE *s, long len, int istext, iconv_t cd)
size_t l = 0;
size_t linelen; /* number of input bytes in `line' */
size_t l3;
-
+
int last; /* store the last character in the input line */
-
+
if (istext)
state_set_prefix(s);
while (len > 0)
{
last = 0;
-
+
/*
* It's ok to use a fixed size buffer for input, even if the line turns
* out to be longer than this. Just process the line in chunks. This
buf[4] = 0;
- if (istext)
+ if (istext)
state_set_prefix(s);
while (len > 0)
c2 = base64val (buf[1]);
ch = (c1 << 2) | (c2 >> 4);
- if (cr && ch != '\n')
+ if (cr && ch != '\n')
bufi[l++] = '\r';
cr = 0;
-
+
if (istext && ch == '\r')
cr = 1;
else
cr = 1;
else
bufi[l++] = ch;
-
+
if (l + 8 >= sizeof (bufi))
mutt_convert_to_state (cd, bufi, &l, s);
}
if(istext)
state_set_prefix(s);
-
+
while(len > 0)
{
if ((fgets(tmps, sizeof(tmps), s->fpin)) == NULL)
mutt_convert_to_state (cd, bufi, &k, s);
mutt_convert_to_state (cd, 0, 0, s);
-
+
state_reset_prefix(s);
}
*/
#define IndentSize (4)
-
-enum { RICH_PARAM=0, RICH_BOLD, RICH_UNDERLINE, RICH_ITALIC, RICH_NOFILL,
+
+enum { RICH_PARAM=0, RICH_BOLD, RICH_UNDERLINE, RICH_ITALIC, RICH_NOFILL,
RICH_INDENT, RICH_INDENT_RIGHT, RICH_EXCERPT, RICH_CENTER, RICH_FLUSHLEFT,
RICH_FLUSHRIGHT, RICH_COLOR, RICH_LAST_TAG };
extra = stte->WrapMargin - stte->line_len - stte->indent_len -
(stte->tag_level[RICH_INDENT_RIGHT] * IndentSize);
- if (extra > 0)
+ if (extra > 0)
{
- if (stte->tag_level[RICH_CENTER])
+ if (stte->tag_level[RICH_CENTER])
{
x = extra / 2;
while (x)
state_putc (' ', stte->s);
x--;
}
- }
+ }
else if (stte->tag_level[RICH_FLUSHRIGHT])
{
x = extra-1;
if (stte->tag_level[RICH_EXCERPT])
{
x = stte->tag_level[RICH_EXCERPT];
- while (x)
+ while (x)
{
if (stte->s->prefix)
{
{
x = stte->tag_level[RICH_INDENT] * IndentSize;
stte->indent_len += x;
- while (x)
+ while (x)
{
state_putc (' ', stte->s);
x--;
static void enriched_flush (struct enriched_state *stte, int wrap)
{
- if (!stte->tag_level[RICH_NOFILL] && (stte->line_len + stte->word_len >
- (stte->WrapMargin - (stte->tag_level[RICH_INDENT_RIGHT] * IndentSize) -
+ if (!stte->tag_level[RICH_NOFILL] && (stte->line_len + stte->word_len >
+ (stte->WrapMargin - (stte->tag_level[RICH_INDENT_RIGHT] * IndentSize) -
stte->indent_len)))
enriched_wrap (stte);
static void enriched_putwc (wchar_t c, struct enriched_state *stte)
{
- if (stte->tag_level[RICH_PARAM])
+ if (stte->tag_level[RICH_PARAM])
{
- if (stte->tag_level[RICH_COLOR])
+ if (stte->tag_level[RICH_COLOR])
{
if (stte->param_used + 1 >= stte->param_len)
safe_realloc (&stte->param, (stte->param_len += STRING) * sizeof (wchar_t));
stte->word_len += 8 - (stte->line_len + stte->word_len) % 8;
else
stte->word_len++;
-
+
stte->buffer[stte->buff_used++] = c;
enriched_flush (stte, 0);
}
if (*tagptr == (wchar_t) '/')
tagptr++;
-
+
for (i = 0, j = -1; EnrichedTags[i].tag_name; i++)
if (wcscasecmp (EnrichedTags[i].tag_name, tagptr) == 0)
{
{
enriched_flush (&stte, 1);
}
- else
+ else
{
enriched_putwc ((wchar_t) ' ', &stte);
state = NEWLINE;
FREE (&(stte.param));
return 0;
-}
+}
/* for compatibility with metamail */
static int is_mmnoask (const char *buf)
mutt_check_lookup_list (b, type, sizeof (type));
for (; t; t = t->next) {
int i = mutt_strlen (t->data) - 1;
- if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' &&
+ if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' &&
ascii_strncasecmp (type, t->data, i) == 0) ||
ascii_strcasecmp (type, t->data) == 0)
is_autoview = 1;
btlen = mutt_strlen (t->data);
}
- if (a && a->parts)
+ if (a && a->parts)
b = a->parts;
else
b = a;
/* Next, look for an autoviewable type */
if (!choice)
{
- if (a && a->parts)
+ if (a && a->parts)
b = a->parts;
else
b = a;
/* Then, look for a text entry */
if (!choice)
{
- if (a && a->parts)
+ if (a && a->parts)
b = a->parts;
else
b = a;
/* Finally, look for other possibilities */
if (!choice)
{
- if (a && a->parts)
+ if (a && a->parts)
b = a->parts;
else
b = a;
int rc = 0;
off_start = ftello (s->fpin);
- if (a->encoding == ENCBASE64 || a->encoding == ENCQUOTEDPRINTABLE ||
+ if (a->encoding == ENCBASE64 || a->encoding == ENCQUOTEDPRINTABLE ||
a->encoding == ENCUUENCODED)
{
fstat (fileno (s->fpin), &st);
if (a->encoding == ENCBASE64 || a->encoding == ENCQUOTEDPRINTABLE ||
a->encoding == ENCUUENCODED)
mutt_free_body (&b);
-
+
return rc;
}
if (mutt_can_decode (p))
return (1);
}
-
+
}
else if (WithCrypto && a->type == TYPEAPPLICATION)
{
state_puts (" --]\n", s);
mutt_pretty_size (length, sizeof (length), p->length);
-
+
state_mark_attach (s);
state_printf (s, _("[-- Type: %s/%s, Encoding: %s, Size: %s --]\n"),
TYPE (p), p->subtype, ENCODING (p->encoding), length);
rc = mutt_body_handler (p, s);
state_putc ('\n', s);
-
+
if (rc)
{
mutt_error (_("One or more parts of this message could not be displayed"));
dprint (1, (debugfile, "Failed on attachment #%d, type %s/%s.\n", count, TYPE(p), NONULL (p->subtype)));
}
-
+
if ((s->flags & MUTT_REPLYING)
&& (option (OPTINCLUDEONLYFIRST)) && (s->flags & MUTT_FIRSTDONE))
break;
rfc1524_free_entry (&entry);
return -1;
}
-
+
mutt_copy_bytes (s->fpin, fpin, a->length);
if(!piped)
rc = -1;
goto bail;
}
-
+
if (s->prefix)
{
while (fgets (buffer, sizeof(buffer), fpout) != NULL)
state_puts (buffer, s);
}
/* check for data on stderr */
- if (fgets (buffer, sizeof(buffer), fperr))
+ if (fgets (buffer, sizeof(buffer), fperr))
{
if (s->flags & MUTT_DISPLAY)
{
if (s->flags & MUTT_DISPLAY)
{
state_mark_attach (s);
- state_printf (s, _("[-- Autoview stderr of %s --]\n"),
+ state_printf (s, _("[-- Autoview stderr of %s --]\n"),
command);
}
-
+
state_puts (buffer, s);
mutt_copy_stream (fperr, s->fpout);
}
else
mutt_unlink (tempfile);
- if (s->flags & MUTT_DISPLAY)
+ if (s->flags & MUTT_DISPLAY)
mutt_clear_error ();
}
rfc1524_free_entry (&entry);
{
char *length;
char pretty_size[10];
-
+
state_mark_attach (s);
state_printf (s, _("[-- This %s/%s attachment "),
TYPE(b->parts), b->parts->subtype);
_("[-- This %s/%s attachment is not included, --]\n"),
TYPE (b->parts), b->parts->subtype);
state_mark_attach (s);
- state_printf (s,
+ state_printf (s,
_("[-- and the indicated access-type %s is unsupported --]\n"),
access_type);
mutt_copy_hdr (s->fpin, s->fpout, ftello (s->fpin), b->parts->offset,
CH_DECODE | CH_DISPLAY, NULL);
}
}
-
+
return 0;
}
int rc = 0;
int oflags = s->flags;
-
+
/* first determine which handler to use to process this part */
if (mutt_is_autoview (b))
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
/* table hash table to update
* key key to hash on
* data data to associate with `key'
- * allow_dup if nonzero, duplicate keys are allowed in the table
+ * allow_dup if nonzero, duplicate keys are allowed in the table
*/
static int union_hash_insert (HASH * table, union hash_key key, void *data)
{
}
/* ptr pointer to the hash table to be freed
- * destroy() function to call to free the ->data member (optional)
+ * destroy() function to call to free the ->data member (optional)
*/
void hash_destroy (HASH **ptr, void (*destroy) (void *))
{
return state->last;
}
state->index++;
- }
+ }
state->index = 0;
state->last = NULL;
return NULL;
}
-
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
char* s;
int ret, plen;
#ifndef HAVE_ICONV
- const char *chs = Charset && *Charset ? Charset :
+ const char *chs = Charset && *Charset ? Charset :
mutt_get_default_charset ();
#endif
);
#endif
}
-
+
if (ret <= 0)
return path;
mutt_hcache_free (&data);
return NULL;
}
-
+
return data;
}
strncpy(path, h->folder, sizeof (path));
safe_strcat(path, sizeof (path), filename);
- ksize = strlen (h->folder) + keylen (path + strlen (h->folder));
+ ksize = strlen (h->folder) + keylen (path + strlen (h->folder));
#endif
#ifdef HAVE_QDBM
char* data;
int dlen;
int ret;
-
+
if (!h)
return -1;
-
+
data = mutt_hcache_dump(h, header, &dlen, uidvalidity, flags);
ret = mutt_hcache_store_raw (h, filename, data, dlen, keylen);
-
+
FREE(&data);
-
+
return ret;
}
/*
* Copyright (C) 1996-2000,2002,2007 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
if(!h->recip_valid)
{
h->recip_valid = 1;
-
+
if (mutt_addr_is_user (env->from))
h->recipient = 4;
else if (user_in_addr (env->to))
else
h->recipient = 0;
}
-
+
return h->recipient;
}
else
strfcpy (dest, ctx->path, destlen);
}
- else
+ else
strfcpy(dest, "(null)", destlen);
strfcpy (buf2, dest, sizeof(buf2));
mutt_format_s (dest, destlen, prefix, buf2);
break;
-
+
case 'c':
mutt_pretty_size (buf2, sizeof (buf2), (long) hdr->content->length);
mutt_format_s (dest, destlen, prefix, buf2);
/* preprocess $date_format to handle %Z */
{
const char *cp;
- struct tm *tm;
+ struct tm *tm;
time_t T;
p = dest;
len = destlen - 1;
while (len > 0 && (((op == 'd' || op == 'D') && *cp) ||
- (op == '{' && *cp != '}') ||
+ (op == '{' && *cp != '}') ||
(op == '[' && *cp != ']') ||
(op == '(' && *cp != ')') ||
(op == '<' && *cp != '>')))
break;
case 'v':
- if (mutt_addr_is_user (hdr->env->from))
+ if (mutt_addr_is_user (hdr->env->from))
{
if (hdr->env->to)
mutt_format_s (buf2, sizeof (buf2), prefix, mutt_get_name (hdr->env->to));
break;
case 'Z':
-
+
ch = ' ';
if (WithCrypto && hdr->security & GOODSIGN)
mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->x_label));
break;
-
+
case 'Y':
if (hdr->env->x_label)
{
-/*
+/*
* Copyright (C) 1996-2009,2012 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
mutt_perror (path);
return;
}
-
+
mutt_env_to_local (msg->env);
mutt_write_rfc822_header (ofp, msg->env, NULL, MUTT_WRITE_HEADER_EDITHDRS, 0, 0);
fputc ('\n', ofp); /* tie off the header. */
mutt_perror (path);
return;
}
-
+
if ((ofp = safe_fopen (body, "w")) == NULL)
{
/* intentionally leak a possible temporary file here */
mutt_perror (body);
return;
}
-
+
n = mutt_read_rfc822_header (ifp, NULL, 1, 0);
while ((i = fread (buffer, 1, sizeof (buffer), ifp)) > 0)
fwrite (buffer, 1, i, ofp);
mutt_expand_aliases_env (msg->env);
- /* search through the user defined headers added to see if
+ /* search through the user defined headers added to see if
* fcc: or attach: or pgp: was specified
*/
/*
* Copyright (C) 1996-2000,2009 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#define HELP_C
/* first look in the generic map for the function */
for (i = 0; OpGeneric[i].name; i++)
if (OpGeneric[i].op == op)
- return (&OpGeneric[i]);
+ return (&OpGeneric[i]);
}
if ((map = km_get_table(menu)))
if (map[i].op == op)
return (&map[i]);
}
-
+
return (NULL);
}
int i;
size_t len;
char *pbuf = buf;
-
+
for (i = 0; items[i].name && buflen > 2; i++)
{
if (i)
desc = mutt_getnamebyvalue (menu, Menus);
if (!desc)
desc = _("<UNKNOWN>");
-
+
do {
if ((f = safe_fopen (t, "w")) == NULL)
{
mutt_perror (t);
return;
}
-
+
dump_menu (f, menu);
if (menu != MENU_EDITOR && menu != MENU_PAGER)
{
fputs (_("\nGeneric bindings:\n\n"), f);
dump_menu (f, MENU_GENERIC);
}
-
+
fputs (_("\nUnbound functions:\n\n"), f);
if (funcs)
dump_unbound (f, funcs, Keymaps[menu], NULL);
if (menu != MENU_PAGER)
dump_unbound (f, OpGeneric, Keymaps[MENU_GENERIC], Keymaps[menu]);
-
+
safe_fclose (&f);
-
+
snprintf (buf, sizeof (buf), _("Help for %s"), desc);
}
while
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
char **hist;
short cur;
short last;
-};
+};
static const struct mapping_t HistoryHelp[] = {
{ N_("Exit"), OP_EXIT },
FREE (&h->hist);
}
}
-
+
if (HistSize)
h->hist = safe_calloc (HistSize + 1, sizeof (char *));
-
+
h->cur = 0;
h->last = 0;
}
void mutt_init_history(void)
{
history_class_t hclass;
-
+
if (HistSize == OldSize)
return;
-
+
for(hclass = HC_FIRST; hclass < HC_LAST; hclass++)
init_history(&History[hclass]);
OldSize = HistSize;
}
-
+
void mutt_history_add (history_class_t hclass, const char *s, int save)
{
int prev;
}
FREE(&matches);
}
-
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _HISTORY_H
#define _HISTORY_H
-/*
+/*
* Copyright (C) 1996-2002,2004,2007 Michael R. Elkins <me@mutt.org>, and others
*
* This program is free software; you can redistribute it and/or modify
}
FREE (&token.data);
FREE (&err.data);
-
+
current_hook_type = 0;
}
* Copyright (C) 1996-1998 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1996-1999 Brandon Long <blong@fiction.net>
* Copyright (C) 1999-2001 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* IMAP login/authentication code */
*delim++ = '\0';
if (! method[0])
continue;
-
+
dprint (2, (debugfile, "imap_authenticate: Trying method %s\n", method));
authenticator = imap_authenticators;
FREE (&methods);
return r;
}
-
+
authenticator++;
}
}
mutt_error (_("No authenticators available"));
mutt_sleep (1);
}
-
+
return r;
}
/*
* Copyright (C) 2000-2001 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* common defs for authenticators. A good place to set up a generic callback
* system */
/*
* Copyright (C) 1999-2001,2005 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* IMAP login/authentication code */
do
rc = imap_cmd_step (idata);
while (rc == IMAP_CMD_CONTINUE);
-
+
if (rc != IMAP_CMD_OK)
{
dprint (1, (debugfile, "Error receiving server response.\n"));
/*
* Copyright (C) 1999-2001,2005 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* IMAP login/authentication code */
do
rc = imap_cmd_step (idata);
while (rc == IMAP_CMD_CONTINUE);
-
+
if (rc != IMAP_CMD_RESPOND)
{
dprint (1, (debugfile, "Invalid response from server: %s\n", ibuf));
* computed by applying the keyed MD5 algorithm from [KEYED-MD5] where the
* key is a shared secret and the digested text is the timestamp (including
* angle-brackets).
- *
+ *
* Note: The user name shouldn't be quoted. Since the digest can't contain
* spaces, there is no ambiguity. Some servers get this wrong, we'll work
* around them when the bug report comes in. Until then, we'll remain
hmac_response[12], hmac_response[13], hmac_response[14], hmac_response[15]);
dprint(2, (debugfile, "CRAM response: %s\n", obuf));
- /* XXX - ibuf must be long enough to store the base64 encoding of obuf,
+ /* XXX - ibuf must be long enough to store the base64 encoding of obuf,
* plus the additional debris
*/
-
+
mutt_to_base64 ((unsigned char*) ibuf, (unsigned char*) obuf, strlen (obuf),
sizeof (ibuf) - 2);
safe_strcat (ibuf, sizeof (ibuf), "\r\n");
/*
* Copyright (C) 1999-2001,2005,2009 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* GSS login/authentication code
*
#define GSS_AUTH_P_PRIVACY 4
static void print_gss_error(OM_uint32 err_maj, OM_uint32 err_min)
{
- OM_uint32 maj_stat, min_stat;
+ OM_uint32 maj_stat, min_stat;
OM_uint32 msg_ctx = 0;
gss_buffer_desc status_string;
char buf_maj[512];
char buf_min[512];
size_t status_len;
-
+
do
{
maj_stat = gss_display_status (&min_stat,
strncpy(buf_maj, (char*) status_string.value, status_len);
buf_maj[status_len] = '\0';
gss_release_buffer(&min_stat, &status_string);
-
+
maj_stat = gss_display_status (&min_stat,
err_min,
GSS_C_MECH_CODE,
gss_release_buffer(&min_stat, &status_string);
}
} while (!GSS_ERROR(maj_stat) && msg_ctx != 0);
-
+
dprint (2, (debugfile, "((%s:%d )(%s:%d))", buf_maj, err_maj, buf_min, err_min));
}
if (mutt_account_getuser (&idata->conn->account))
return IMAP_AUTH_FAILURE;
-
+
/* get an IMAP service ticket for the server */
snprintf (buf1, sizeof (buf1), "imap@%s", idata->conn->account.host);
request_buf.value = buf1;
dprint (2, (debugfile, "Couldn't get service name for [%s]\n", buf1));
return IMAP_AUTH_UNAVAIL;
}
-#ifdef DEBUG
+#ifdef DEBUG
else if (debuglevel >= 2)
{
maj_stat = gss_display_name (&min_stat, target_name, &request_buf,
/* build token */
maj_stat = gss_init_sec_context (&min_stat, GSS_C_NO_CREDENTIAL, &context,
- target_name, GSS_C_NO_OID, GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG, 0,
+ target_name, GSS_C_NO_OID, GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG, 0,
GSS_C_NO_CHANNEL_BINDINGS, sec_token, NULL, &send_token,
(unsigned int*) &cflags, NULL);
if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED)
/* Write client data */
maj_stat = gss_init_sec_context (&min_stat, GSS_C_NO_CREDENTIAL, &context,
- target_name, GSS_C_NO_OID, GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG, 0,
+ target_name, GSS_C_NO_OID, GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG, 0,
GSS_C_NO_CHANNEL_BINDINGS, sec_token, NULL, &send_token,
(unsigned int*) &cflags, NULL);
if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED)
/*
* Copyright (C) 1999-2001,2005,2009 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* plain LOGIN support */
snprintf (buf, sizeof (buf), "LOGIN %s %s", q_user, q_pass);
rc = imap_exec (idata, buf, IMAP_CMD_FAIL_OK | IMAP_CMD_PASS);
-
+
if (!rc)
{
mutt_clear_error(); /* clear "Logging in...". fixes #3524 */
/*
* Copyright (C) 1999-2001,2005 Brendan Cully <brendan@kublai.com>
* Copyright (C) 2018 Brandon Long <blong@fiction.net>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* IMAP login/authentication code */
FREE (&oauthbearer);
FREE (&ibuf);
-
+
if (rc)
{
/* The error response was in SASL continuation, so continue the SASL
/*
* Copyright (C) 2000-2006,2012 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* SASL login/authentication code */
if (mutt_bit_isset (idata->capabilities, AUTH_ANON) &&
(!idata->conn->account.user[0] ||
!ascii_strncmp (idata->conn->account.user, "anonymous", 9)))
- rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen,
+ rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen,
&mech);
} else if (!ascii_strcasecmp ("login", method) &&
!strstr (NONULL (idata->capstr), "AUTH=LOGIN")) {
sasl_dispose (&saslconn);
return IMAP_AUTH_UNAVAIL;
}
-
+
if (rc != SASL_OK && rc != SASL_CONTINUE)
do
{
goto bail;
}
}
-
+
if (irc == IMAP_CMD_RESPOND)
{
strfcpy (buf + olen, "\r\n", bufsize - olen);
mutt_socket_write (idata->conn, "*\r\n");
dprint (1, (debugfile, "imap_auth_sasl: sasl_client_step error %d\n",rc));
}
-
+
olen = 0;
}
/*
* Copyright (C) 1996-1999 Brandon Long <blong@fiction.net>
* Copyright (C) 1999-2008 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* Mutt browser support routines */
* Note: UW-IMAP servers return folder + delimiter when asked to list
* folder + delimiter. Cyrus servers don't. So we ask for folder,
* and tack on delimiter ourselves.
- * Further note: UW-IMAP servers return nothing when asked for
+ * Further note: UW-IMAP servers return nothing when asked for
* NAMESPACES without delimiters at the end. Argh! */
for (n--; n >= 0 && mbox[n] != list.delim ; n--);
if (n > 0) /* "aaaa/bbbb/" -> "aaaa" */
state->folder = safe_strdup (buf);
}
mbox[n] = ctmp;
- }
+ }
/* "/bbbb/" -> add "/", "aaaa/" -> add "" */
else
{
/* folder may be "/" */
snprintf (relpath, sizeof (relpath), "%c" , n < 0 ? '\0' : idata->delim);
if (showparents)
- imap_add_folder (idata->delim, relpath, 1, 0, state, 1);
+ imap_add_folder (idata->delim, relpath, 1, 0, state, 1);
if (!state->folder)
{
imap_qualify_path (buf, sizeof (buf), &mx, relpath);
dprint (1, (debugfile, "imap_mailbox_create: Couldn't find open connection to %s", mx.account.host));
goto fail;
}
-
+
strfcpy (buf, NONULL (mx.mbox), sizeof (buf));
/* append a delimiter if necessary */
buf[n++] = idata->delim;
buf[n] = '\0';
}
-
+
if (mutt_get_field (_("Create mailbox: "), buf, sizeof (buf), MUTT_FILE) < 0)
goto fail;
mutt_sleep(1);
goto fail;
}
-
+
if (imap_create_mailbox (idata, buf) < 0)
goto fail;
snprintf(buf, sizeof (buf), _("Rename mailbox %s to: "), mx.mbox);
strfcpy (newname, mx.mbox, sizeof (newname));
-
+
if (mutt_get_field (buf, newname, sizeof (newname), MUTT_FILE) < 0)
goto fail;
relpath[strlen (relpath) + 1] = '\0';
relpath[strlen (relpath)] = delim;
}
-
+
(state->entry)[state->entrylen].desc = safe_strdup (relpath);
(state->entry)[state->entrylen].imap = 1;
FREE (&mx.mbox);
}
-static int compare_names(struct folder_file *a, struct folder_file *b)
+static int compare_names(struct folder_file *a, struct folder_file *b)
{
return mutt_strcmp(a->name, b->name);
}
* Copyright (C) 1996-1998,2010,2012 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1996-1999 Brandon Long <blong@fiction.net>
* Copyright (C) 1999-2009,2011 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* command.c: routines for sending commands to an IMAP server and parsing
* responses */
"IMAP4",
"IMAP4rev1",
"STATUS",
- "ACL",
+ "ACL",
"NAMESPACE",
"AUTH=CRAM-MD5",
"AUTH=GSSAPI",
dprint (3, (debugfile, "IMAP queue drained\n"));
imap_cmd_finish (idata);
}
-
+
return rc;
}
if (!(idata->state >= IMAP_SELECTED) || idata->ctx->closing)
return;
-
+
if (idata->reopen & IMAP_REOPEN_ALLOW)
{
unsigned int count = idata->newMailCount;
dprint (1, (debugfile, "imap_cmd_idle: error starting IDLE\n"));
return -1;
}
-
+
return 0;
}
static int cmd_status (const char *s)
{
s = imap_next_word((char*)s);
-
+
if (!ascii_strncasecmp("OK", s, 2))
return IMAP_CMD_OK;
if (!ascii_strncasecmp("NO", s, 2))
/* See draft-gahrns-imap-child-mailbox-?? */
else if (!ascii_strncasecmp (s, "\\HasNoChildren", 14))
list->noinferiors = 1;
-
+
s = imap_next_word (s);
if (*(s - 2) == ')')
break;
if (ascii_strncasecmp (s, "NIL", 3))
{
delimbuf[0] = '\0';
- safe_strcat (delimbuf, 5, s);
+ safe_strcat (delimbuf, 5, s);
imap_unquote_string (delimbuf);
list->delim = delimbuf[0];
}
while (*s && !isspace((unsigned char) *s))
{
- switch (*s)
+ switch (*s)
{
case 'l':
mutt_bit_set (idata->ctx->rights, MUTT_ACL_LOOKUP);
{
if (inc->magic != MUTT_IMAP)
continue;
-
+
if (imap_parse_path (inc->path, &mx) < 0)
{
dprint (1, (debugfile, "Error parsing mailbox %s, skipping\n", inc->path));
continue;
}
/* dprint (2, (debugfile, "Buffy entry: [%s] mbox: [%s]\n", inc->path, NONULL(mx.mbox))); */
-
+
if (imap_account_match (&idata->conn->account, &mx.account))
{
if (mx.mbox)
{
dprint (3, (debugfile, "Found %s in buffy list (OV: %u ON: %u U: %d)\n",
mailbox, olduv, oldun, status->unseen));
-
+
if (option(OPTMAILCHECKRECENT))
{
if (olduv && olduv == status->uidvalidity)
/*
* Copyright (C) 1996-1999 Brandon Long <blong@fiction.net>
* Copyright (C) 1999-2009 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _IMAP_PRIVATE_H
#define _IMAP_PRIVATE_H 1
IMAP_CONNECTED,
IMAP_AUTHENTICATED,
IMAP_SELECTED,
-
+
/* and pseudo-states */
IMAP_IDLE
};
time_t lastread; /* last time we read a command for the server */
char* buf;
unsigned int blen;
-
+
/* If nonzero, we can send UTF-8, and the server will use UTF8 rather
* than mUTF7 */
int unicode;
void imap_error (const char* where, const char* msg);
IMAP_DATA* imap_new_idata (void);
void imap_free_idata (IMAP_DATA** idata);
-char* imap_fix_path (IMAP_DATA* idata, const char* mailbox, char* path,
+char* imap_fix_path (IMAP_DATA* idata, const char* mailbox, char* path,
size_t plen);
void imap_cachepath(IMAP_DATA* idata, const char* mailbox, char* dest,
size_t dlen);
/*
* Copyright (C) 1996-1999 Brandon Long <blong@fiction.net>
* Copyright (C) 1999-2000,2005 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* message.c data structures */
/*
* Copyright (C) 2000,2003 Edmund Grimley Evans <edmundo@rano.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
FREE (&iter->full_seqset);
FREE (p_iter); /* __FREE_CHECKED__ */
}
-
/*
* Copyright (C) 1996-2002,2010,2013,2016 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
/* if we got output, make a new string consisting of the shell output
plus whatever else was left on the original line */
- /* BUT: If this is inside a quoted string, directly add output to
+ /* BUT: If this is inside a quoted string, directly add output to
* the token */
if (expn.data && qc)
{
mutt_extract_token (buf, s, 0);
/* don't add "*" to the unignore list */
- if (strcmp (buf->data, "*"))
+ if (strcmp (buf->data, "*"))
add_to_list (&UnIgnore, buf->data);
remove_from_list (&Ignore, buf->data);
static void _alternates_clean (void)
{
int i;
- if (Context && Context->msgcount)
+ if (Context && Context->msgcount)
{
for (i = 0; i < Context->msgcount; i++)
Context->hdrs[i]->recip_valid = 0;
static int parse_alternates (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
group_context_t *gc = NULL;
-
+
_alternates_clean();
do
goto bail;
}
while (MoreArgs (s));
-
+
mutt_group_context_destroy (&gc);
return 0;
-
+
bail:
mutt_group_context_destroy (&gc);
return -1;
static void clear_subject_mods (void)
{
int i;
- if (Context && Context->msgcount)
+ if (Context && Context->msgcount)
{
for (i = 0; i < Context->msgcount; i++)
FREE(&Context->hdrs[i]->env->disp_subj);
do
{
mutt_extract_token (buf, s, 0);
-
+
if (parse_group_context (&gc, buf, s, data, err) == -1)
goto bail;
-
+
mutt_remove_from_rx_list (&UnMailLists, buf->data);
-
+
if (mutt_add_to_rx_list (&MailLists, buf->data, REG_ICASE, err) != 0)
goto bail;
-
+
if (mutt_group_context_add_rx (gc, buf->data, REG_ICASE, err) != 0)
goto bail;
}
mutt_group_context_destroy (&gc);
return 0;
-
+
bail:
mutt_group_context_destroy (&gc);
return -1;
static void _attachments_clean (void)
{
int i;
- if (Context && Context->msgcount)
+ if (Context && Context->msgcount)
{
for (i = 0; i < Context->msgcount; i++)
Context->hdrs[i]->attach_valid = 0;
if (!buf->data || *buf->data == '\0')
continue;
-
+
a = safe_malloc(sizeof(ATTACH_MATCH));
/* some cheap hacks that I expect to remove */
lastp = listp;
}
while (MoreArgs (s));
-
+
_attachments_clean();
return 0;
}
}
while (MoreArgs (s));
-
+
FREE(&tmp);
_attachments_clean();
return 0;
mutt_extract_token (buf, s, 0);
mutt_remove_from_rx_list (&SubscribedLists, buf->data);
mutt_remove_from_rx_list (&MailLists, buf->data);
-
- if (mutt_strcmp (buf->data, "*") &&
+
+ if (mutt_strcmp (buf->data, "*") &&
mutt_add_to_rx_list (&UnMailLists, buf->data, REG_ICASE, err) != 0)
return -1;
}
static int parse_subscribe (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
group_context_t *gc = NULL;
-
+
do
{
mutt_extract_token (buf, s, 0);
if (parse_group_context (&gc, buf, s, data, err) == -1)
goto bail;
-
+
mutt_remove_from_rx_list (&UnMailLists, buf->data);
mutt_remove_from_rx_list (&UnSubscribedLists, buf->data);
goto bail;
}
while (MoreArgs (s));
-
+
mutt_group_context_destroy (&gc);
return 0;
-
+
bail:
mutt_group_context_destroy (&gc);
return -1;
{
mutt_extract_token (buf, s, 0);
mutt_remove_from_rx_list (&SubscribedLists, buf->data);
-
+
if (mutt_strcmp (buf->data, "*") &&
mutt_add_to_rx_list (&UnSubscribedLists, buf->data, REG_ICASE, err) != 0)
return -1;
return 0;
}
-
+
static int parse_unalias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
ALIAS *tmp, *last = NULL;
{
if (CurrentMenu == MENU_ALIAS)
{
- for (tmp = Aliases; tmp ; tmp = tmp->next)
+ for (tmp = Aliases; tmp ; tmp = tmp->next)
tmp->del = 1;
mutt_set_current_menu_redraw_full ();
}
ALIAS *last = NULL;
char *estr = NULL;
group_context_t *gc = NULL;
-
+
if (!MoreArgs (s))
{
strfcpy (err->data, _("alias: no address"), err->dsize);
if (parse_group_context (&gc, buf, s, data, err) == -1)
return -1;
-
+
/* check to see if an alias with this name already exists */
for (; tmp; tmp = tmp->next)
{
mutt_alias_add_reverse (tmp);
#ifdef DEBUG
- if (debuglevel >= 2)
+ if (debuglevel >= 2)
{
ADDRESS *a;
/* A group is terminated with an empty address, so check a->mailbox */
#endif
mutt_group_context_destroy (&gc);
return 0;
-
+
bail:
mutt_group_context_destroy (&gc);
return -1;
s += 8;
flags = SORT_REVERSE;
}
-
+
if (mutt_strncmp ("last-", s, 5) == 0)
{
s += 5;
switch (p->type & DT_MASK)
{
case DT_STR:
- mutt_str_replace ((char **) p->data, (char *) p->init);
+ mutt_str_replace ((char **) p->data, (char *) p->init);
break;
case DT_MBCHARTBL:
free_mbchar_table ((mbchar_table **)p->data);
snprintf (err->data, err->dsize, "%s", _("value is illegal with reset"));
return (-1);
}
-
+
if (!mutt_strcmp ("all", tmp->data))
{
if (CurrentMenu == MENU_PAGER)
else
mutt_restore_default (&MuttVars[idx]);
}
- }
+ }
else if (!myvar && DTYPE (MuttVars[idx].type) == DT_BOOL)
- {
+ {
if (s && *s->dptr == '=')
{
if (unset || inv || query)
else if (DTYPE (MuttVars[idx].type) == DT_MBCHARTBL)
free_mbchar_table ((mbchar_table **) MuttVars[idx].data);
else
- /* MuttVars[idx].data is already 'char**' (or some 'void**') or...
+ /* MuttVars[idx].data is already 'char**' (or some 'void**') or...
* so cast to 'void*' is okay */
FREE ((void *) MuttVars[idx].data); /* __FREE_CHECKED__ */
}
}
else
val = *((char **) MuttVars[idx].data);
-
+
/* user requested the value of this variable */
pretty_var (err->data, err->dsize, MuttVars[idx].option, NONULL(val));
break;
}
else if (DTYPE (MuttVars[idx].type) == DT_PATH)
{
- /* MuttVars[idx].data is already 'char**' (or some 'void**') or...
+ /* MuttVars[idx].data is already 'char**' (or some 'void**') or...
* so cast to 'void*' is okay */
FREE ((void *) MuttVars[idx].data); /* __FREE_CHECKED__ */
r = -1;
break;
}
-
+
CHECK_PAGER;
s->dptr++;
p++;
}
}
-
+
rx = (regex_t *) safe_malloc (sizeof (regex_t));
if ((e = REGCOMP (rx, p, flags)) != 0)
{
ptr->not = not;
/* $reply_regexp and $alterantes require special treatment */
-
+
if (Context && Context->msgcount &&
mutt_strcmp (MuttVars[idx].option, "reply_regexp") == 0)
{
regmatch_t pmatch[1];
int i;
-
+
#define CUR_ENV Context->hdrs[i]->env
for (i = 0; i < Context->msgcount; i++)
{
{
CUR_ENV->real_subj = (regexec (ReplyRegexp.rx,
CUR_ENV->subject, 1, pmatch, 0)) ?
- CUR_ENV->subject :
+ CUR_ENV->subject :
CUR_ENV->subject + pmatch[0].rm_eo;
}
}
r = -1;
break;
}
-
+
if (query || *s->dptr != '=')
{
p = mutt_getnamebyvalue (*((short *) MuttVars[idx].data) & SORT_MASK, map);
dprint (2, (debugfile, "Reading configuration file '%s'.\n",
rcfile));
-
+
if ((f = mutt_open_read (rcfile, &pid)) == NULL)
{
snprintf (err->data, err->dsize, "%s: %s", rcfile, strerror (errno));
while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line, MUTT_CONT)) != NULL)
{
conv=ConfigCharset && (*ConfigCharset) && Charset;
- if (conv)
+ if (conv)
{
currentline=safe_strdup(linebuf);
if (!currentline) continue;
mutt_convert_string(¤tline, ConfigCharset, Charset, 0);
- }
- else
+ }
+ else
currentline=linebuf;
if (mutt_parse_rc_line (currentline, &token, err) == -1)
{
mutt_error (_("Error in %s, line %d: %s"), rcfile, line, err->data);
- if (--rc < -MAXERRS)
+ if (--rc < -MAXERRS)
{
if (conv) FREE(¤tline);
break;
if (rc < 0)
rc = -1;
}
- if (conv)
+ if (conv)
FREE(¤tline);
}
FREE (&token.data);
#define NUMVARS (sizeof (MuttVars)/sizeof (MuttVars[0]))
#define NUMCOMMANDS (sizeof (Commands)/sizeof (Commands[0]))
-/* initial string that starts completion. No telling how much crap
+/* initial string that starts completion. No telling how much crap
* the user has typed so far. Allocate LONG_STRING just to be sure! */
-static char User_typed [LONG_STRING] = {0};
+static char User_typed [LONG_STRING] = {0};
static int Num_matched = 0; /* Number of matches for completion */
static char Completed [STRING] = {0}; /* completed string (command or variable) */
if (current > Matches_listsize - 2)
{
- base_space = MAX(NUMVARS,NUMCOMMANDS) + 1;
+ base_space = MAX(NUMVARS,NUMCOMMANDS) + 1;
extra_space = Matches_listsize - base_space;
extra_space *= 2;
space = base_space + extra_space;
snprintf(Completed, sizeof(Completed),"%s", Matches[0]);
else if (numtabs > 1 && Num_matched > 2)
/* cycle thru all the matches */
- snprintf(Completed, sizeof(Completed), "%s",
+ snprintf(Completed, sizeof(Completed), "%s",
Matches[(numtabs - 2) % Num_matched]);
/* return the completed command */
|| !mutt_strncmp (buffer, "toggle", 6))
{ /* complete variables */
static const char * const prefixes[] = { "no", "inv", "?", "&", 0 };
-
+
pt++;
/* loop through all the possible prefixes (no, inv, ...) */
if (!mutt_strncmp (buffer, "set", 3))
}
}
}
-
+
/* first TAB. Collect all the matches */
if (numtabs == 1)
{
snprintf(Completed, sizeof(Completed),"%s", Matches[0]);
else if (numtabs > 1 && Num_matched > 2)
/* cycle thru all the matches */
- snprintf(Completed, sizeof(Completed), "%s",
+ snprintf(Completed, sizeof(Completed), "%s",
Matches[(numtabs - 2) % Num_matched]);
strncpy (pt, Completed, buffer + len - pt - spaces);
if (!menu && CurrentMenu != MENU_PAGER)
menu = OpGeneric;
-
+
pt++;
/* first TAB. Collect all the matches */
if (numtabs == 1)
for (num = 0; menu[num].name; num++)
candidate (Completed, User_typed, menu[num].name, sizeof (Completed));
/* try the generic menu */
- if (Completed[0] == 0 && CurrentMenu != MENU_PAGER)
+ if (Completed[0] == 0 && CurrentMenu != MENU_PAGER)
{
menu = OpGeneric;
for (num = 0; menu[num].name; num++)
snprintf(Completed, sizeof(Completed),"%s", Matches[0]);
else if (numtabs > 1 && Num_matched > 2)
/* cycle thru all the matches */
- snprintf(Completed, sizeof(Completed), "%s",
+ snprintf(Completed, sizeof(Completed), "%s",
Matches[(numtabs - 2) % Num_matched]);
strncpy (pt, Completed, buffer + len - pt - spaces);
{
char var[STRING], *pt = buffer;
int spaces;
-
+
if (buffer[0] == 0)
return 0;
int mutt_query_variables (LIST *queries)
{
LIST *p;
-
+
char command[STRING];
-
+
BUFFER err, token;
mutt_buffer_init (&err);
err.dsize = STRING;
err.data = safe_malloc (err.dsize);
-
+
for (p = queries; p; p = p->next)
{
snprintf (command, sizeof (command), "set ?%s\n", p->data);
}
printf ("%s\n", err.data);
}
-
+
FREE (&token.data);
FREE (&err.data);
int mutt_dump_variables (void)
{
int i;
-
+
char command[STRING];
-
+
BUFFER err, token;
mutt_buffer_init (&err);
err.dsize = STRING;
err.data = safe_malloc (err.dsize);
-
+
for (i = 0; MuttVars[i].option; i++)
{
if (MuttVars[i].type == DT_SYN)
}
printf("%s\n", err.data);
}
-
+
FREE (&token.data);
FREE (&err.data);
/* reverse alias keys need to be strdup'ed because of idna conversions */
ReverseAlias = hash_create (1031, MUTT_HASH_STRCASECMP | MUTT_HASH_STRDUP_KEYS |
MUTT_HASH_ALLOW_DUPS);
-
+
mutt_menu_init ();
mutt_srandom ();
mutt_buffer_pool_init ();
- /*
+ /*
* XXX - use something even more difficult to predict?
*/
snprintf (AttachmentMarker, sizeof (AttachmentMarker),
Shell = safe_strdup (pw->pw_shell);
endpwent ();
}
- else
+ else
{
if (!Homedir)
{
if ((p = getenv ("EMAIL")) != NULL)
From = rfc822_parse_adrlist (NULL, p);
-
+
mutt_set_langinfo_charset ();
mutt_set_charset (Charset);
-
+
Matches = safe_calloc (Matches_listsize, sizeof (char *));
-
+
/* Set standard defaults */
for (i = 0; MuttVars[i].option; i++)
{
{
while (!mutt_strcasecmp (buf->data, "-group"))
{
- if (!MoreArgs (s))
+ if (!MoreArgs (s))
{
strfcpy (err->data, _("-group: no group name"), err->dsize);
goto bail;
}
-
+
mutt_extract_token (buf, s, 0);
mutt_group_context_add (ctx, mutt_pattern_group (buf->data));
-
+
if (!MoreArgs (s))
{
strfcpy (err->data, _("out of arguments"), err->dsize);
goto bail;
}
-
+
mutt_extract_token (buf, s, 0);
}
-
+
return 0;
-
+
bail:
mutt_group_context_destroy (ctx);
return -1;
if (!*cur)
*cur = safe_calloc (1, sizeof (myvar_t));
-
+
if (!(*cur)->name)
(*cur)->name = safe_strdup (var);
-
+
mutt_str_replace (&(*cur)->value, val);
}
{
myvar_t **cur;
myvar_t *tmp;
-
+
for (cur = &MyVars; *cur; cur = &((*cur)->next))
if (!mutt_strcmp ((*cur)->name, var))
break;
-
- if (*cur)
+
+ if (*cur)
{
tmp = (*cur)->next;
FREE (&(*cur)->name);
snprintf(Completed, sizeof(Completed), "%s", Matches[0]);
else if (numtabs > 1 && Num_matched > 2)
/* cycle thru all the matches */
- snprintf(Completed, sizeof(Completed), "%s",
+ snprintf(Completed, sizeof(Completed), "%s",
Matches[(numtabs - 2) % Num_matched]);
/* return the completed label */
return 1;
}
-
static void set_binding_values PARAMS ((const char *domainname,
const char **dirnamep,
const char **codesetp));
-
+
/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
to be used for the DOMAINNAME message catalog.
If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not
/*
* Copyright (C) 1996-2000,2002,2010-2011 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
#ifdef MIXMASTER
{ "mix", MENU_MIX },
#endif
-
+
{ "query", MENU_QUERY },
{ "generic", MENU_GENERIC },
#endif
#ifdef KEY_NEXT
{ "<Next>", KEY_NEXT },
-#endif
+#endif
#ifdef NCURSES_VERSION
/* extensions supported by ncurses. values are filled in during initialization */
strfcpy(buff, str, sizeof(buff));
s = buff;
-
+
while (*s && len)
{
*d = '\0';
if(*s == '<' && (t = strchr(s, '>')))
{
t++; c = *t; *t = '\0';
-
+
if ((n = mutt_getvaluebyname (s, KeyNames)) != -1)
{
s = t;
s = t;
*d = n;
}
-
+
*t = c;
}
for (i = 0; bindings[i].name; i++)
{
- if (!ascii_strncasecmp (start, bindings[i].name, len) &&
+ if (!ascii_strncasecmp (start, bindings[i].name, len) &&
mutt_strlen (bindings[i].name) == len)
return bindings[i].op;
}
if (menu != MENU_EDITOR && menu != MENU_PAGER)
{
/* check generic menu */
- bindings = OpGeneric;
+ bindings = OpGeneric;
if ((func = get_func (bindings, tmp.op)))
return tmp.op;
}
#ifdef MIXMASTER
create_bindings (OpMix, MENU_MIX);
-
+
km_bindkey ("<space>", MENU_MIX, OP_GENERIC_SELECT_ENTRY);
km_bindkey ("h", MENU_MIX, OP_MIX_CHAIN_PREV);
km_bindkey ("l", MENU_MIX, OP_MIX_CHAIN_NEXT);
#endif
-
+
/* bindings for the line editor */
create_bindings (OpEditor, MENU_EDITOR);
-
+
km_bindkey ("<up>", MENU_EDITOR, OP_EDITOR_HISTORY_UP);
km_bindkey ("<down>", MENU_EDITOR, OP_EDITOR_HISTORY_DOWN);
km_bindkey ("<left>", MENU_EDITOR, OP_EDITOR_BACKWARD_CHAR);
km_bindkey ("<backspace>", MENU_EDITOR, OP_EDITOR_BACKSPACE);
km_bindkey ("<delete>", MENU_EDITOR, OP_EDITOR_BACKSPACE);
km_bindkey ("\177", MENU_EDITOR, OP_EDITOR_BACKSPACE);
-
+
/* generic menu keymap */
create_bindings (OpGeneric, MENU_GENERIC);
-
+
km_bindkey ("<home>", MENU_GENERIC, OP_FIRST_ENTRY);
km_bindkey ("<end>", MENU_GENERIC, OP_LAST_ENTRY);
km_bindkey ("<pagedown>", MENU_GENERIC, OP_NEXT_PAGE);
km_bindkey ("<enter>", MENU_GENERIC, OP_GENERIC_SELECT_ENTRY);
/* Miscellaneous extra bindings */
-
+
km_bindkey (" ", MENU_MAIN, OP_DISPLAY_MESSAGE);
km_bindkey ("<up>", MENU_MAIN, OP_MAIN_PREV_UNDELETED);
km_bindkey ("<down>", MENU_MAIN, OP_MAIN_NEXT_UNDELETED);
km_bindkey ("9", MENU_PAGER, OP_JUMP);
km_bindkey ("<enter>", MENU_PAGER, OP_NEXT_LINE);
-
+
km_bindkey ("<return>", MENU_ALIAS, OP_GENERIC_SELECT_ENTRY);
km_bindkey ("<enter>", MENU_ALIAS, OP_GENERIC_SELECT_ENTRY);
km_bindkey ("<space>", MENU_ALIAS, OP_TAG);
try_bind (char *key, int menu, char *func, const struct binding_t *bindings)
{
int i;
-
+
for (i = 0; bindings[i].name; i++)
if (mutt_strcmp (func, bindings[i].name) == 0)
{
/* exec function-name */
int mutt_parse_exec (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
- int ops[128];
+ int ops[128];
int nops = 0;
const struct binding_t *bindings = NULL;
char *function;
mutt_extract_token (buf, s, 0);
function = buf->data;
- if ((bindings = km_get_table (CurrentMenu)) == NULL
+ if ((bindings = km_get_table (CurrentMenu)) == NULL
&& CurrentMenu != MENU_PAGER)
bindings = OpGeneric;
/*
* Copyright (C) 1996-2000,2002,2010 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef KEYMAP_H
#define KEYMAP_H
MENU_POST,
MENU_QUERY,
-
+
MENU_PGP,
MENU_SMIME,
MENU_KEY_SELECT_PGP,
MENU_KEY_SELECT_SMIME,
#endif
-
+
#ifdef MIXMASTER
MENU_MIX,
#endif
/*
* Copyright (C) 1996-2000,2007,2010 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2004,2006-2007 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- */
+ */
/*
* This file used to contain some more functions, namely those
{
int v;
const char *str;
-}
-sysexits_h[] =
+}
+sysexits_h[] =
{
#ifdef EX_USAGE
{ 0xff & EX_USAGE, "Bad usage." },
sleep (1);
mutt_exit (1);
}
-
+
if (!(p = calloc (nmemb, size)))
{
mutt_error _("Out of memory!");
int safe_fclose (FILE **f)
{
int r = 0;
-
+
if (*f)
r = fclose (*f);
-
+
*f = NULL;
return r;
}
{
char *p = d;
- if (!l)
+ if (!l)
return d;
l--; /* Space for the trailing '\0'. */
-
+
for (; *d && l; l--)
d++;
for (; *s && l; l--)
*d++ = *s++;
*d = '\0';
-
+
return p;
}
if (!l)
return d;
-
+
l--; /* Space for the trailing '\0'. */
-
+
for (; *d && l; l--)
d++;
for (; *s && l && sl; l--, sl--)
*d++ = *s++;
*d = '\0';
-
+
return p;
}
char buf[2048];
/* Defend against symlink attacks */
-
-#ifdef O_NOFOLLOW
+
+#ifdef O_NOFOLLOW
flags = O_RDWR | O_NOFOLLOW;
#else
flags = O_RDWR;
#endif
-
+
if (lstat (s, &sb) == 0 && S_ISREG(sb.st_mode))
{
if ((fd = open (s, flags)) < 0)
return;
-
- if ((fstat (fd, &sb2) != 0) || !S_ISREG (sb2.st_mode)
+
+ if ((fstat (fd, &sb2) != 0) || !S_ISREG (sb2.st_mode)
|| (sb.st_dev != sb2.st_dev) || (sb.st_ino != sb2.st_ino))
{
close (fd);
return;
}
-
+
if ((f = fdopen (fd, "r+")))
{
unlink (s);
return 0;
}
-int
+int
compare_stat (struct stat *osb, struct stat *nsb)
{
if (osb->st_dev != nsb->st_dev || osb->st_ino != nsb->st_ino ||
if(!oldpath || !newpath)
return -1;
-
+
if(unlink(newpath) == -1 && errno != ENOENT)
return -1;
-
+
if (oldpath[0] == '/')
{
if (symlink (oldpath, newpath) == -1)
if ((getcwd (abs_oldpath, sizeof abs_oldpath) == NULL) ||
(strlen (abs_oldpath) + 1 + strlen (oldpath) + 1 > sizeof abs_oldpath))
return -1;
-
+
strcat (abs_oldpath, "/"); /* __STRCAT_CHECKED__ */
strcat (abs_oldpath, oldpath); /* __STRCAT_CHECKED__ */
if (symlink (abs_oldpath, newpath) == -1)
unlink(newpath);
return -1;
}
-
+
return 0;
}
-/*
+/*
* This function is supposed to do nfs-safe renaming of files.
- *
+ *
* Warning: We don't check whether src and target are equal.
*/
/*
* Coda does not allow cross-directory links, but tells
* us it's a cross-filesystem linking attempt.
- *
+ *
* However, the Coda rename call is allegedly safe to use.
- *
- * With other file systems, rename should just fail when
+ *
+ * With other file systems, rename should just fail when
* the files reside on different file systems, so it's safe
* to try it here.
*
*/
-
+
dprint (1, (debugfile, "safe_rename: link (%s, %s) failed: %s (%d)\n", src, target, strerror (errno), errno));
/*
)
{
dprint (1, (debugfile, "safe_rename: trying rename...\n"));
- if (rename (src, target) == -1)
+ if (rename (src, target) == -1)
{
dprint (1, (debugfile, "safe_rename: rename (%s, %s) failed: %s (%d)\n", src, target, strerror (errno), errno));
return -1;
}
dprint (1, (debugfile, "safe_rename: rename succeeded.\n"));
-
+
return 0;
}
return -1;
}
- /*
+ /*
* pretend that the link failed because the target file
* did already exist.
*/
* Unlink the original link. Should we really ignore the return
* value here? XXX
*/
- if (unlink (src) == -1)
+ if (unlink (src) == -1)
{
dprint (1, (debugfile, "safe_rename: unlink (%s) failed: %s (%d)\n",
src, strerror (errno), errno));
}
-
+
return 0;
}
/* Create a temporary directory next to a file name */
-static int mutt_mkwrapdir (const char *path, char *newfile, size_t nflen,
+static int mutt_mkwrapdir (const char *path, char *newfile, size_t nflen,
char *newdir, size_t ndlen)
{
const char *basename;
char *p;
strfcpy (parent, NONULL (path), sizeof (parent));
-
+
if ((p = strrchr (parent, '/')))
{
*p = '\0';
dprint(1, (debugfile, "mutt_mkwrapdir: mkdtemp() failed\n"));
return -1;
}
-
+
if (snprintf (newfile, nflen, "%s/%s", newdir, NONULL(basename)) >= nflen)
{
rmdir(newdir);
dprint(1, (debugfile, "mutt_mkwrapdir: string was truncated\n"));
return -1;
}
- return 0;
+ return 0;
}
/* remove a directory and everything under it */
static int mutt_put_file_in_place (const char *path, const char *safe_file, const char *safe_dir)
{
int rv;
-
+
rv = safe_rename (safe_file, path);
unlink (safe_file);
rmdir (safe_dir);
struct stat osb, nsb;
int fd;
- if (flags & O_EXCL)
+ if (flags & O_EXCL)
{
char safe_file[_POSIX_PATH_MAX];
char safe_dir[_POSIX_PATH_MAX];
if (mutt_mkwrapdir (path, safe_file, sizeof (safe_file),
safe_dir, sizeof (safe_dir)) == -1)
return -1;
-
+
if ((fd = open (safe_file, flags, 0600)) < 0)
{
rmdir (safe_dir);
if ((fd = open (path, flags & ~O_EXCL, 0600)) < 0)
return fd;
-
+
/* make sure the file is not symlink */
if (lstat (path, &osb) < 0 || fstat (fd, &nsb) < 0 ||
compare_stat(&osb, &nsb) == -1)
}
*dest++ = *src++;
}
-
+
*dest = '\0';
-
+
if (*src)
return -1;
else
{
size_t i, j = 0;
- if(!f)
+ if(!f)
{
*d = '\0';
return 0;
/* leave some space for the trailing characters. */
l -= 6;
-
+
d[j++] = '\'';
-
+
for(i = 0; j < l && f[i]; i++)
{
if(f[i] == '\'' || f[i] == '`')
else
d[j++] = f[i];
}
-
+
d[j++] = '\'';
d[j] = '\0';
-
+
return j;
}
void mutt_remove_trailing_ws (char *s)
{
char *p;
-
+
for (p = s + mutt_strlen (s) - 1 ; p >= s && ISSPACE (*p) ; p--)
*p = 0;
}
char *mutt_concat_path (char *d, const char *dir, const char *fname, size_t l)
{
const char *fmt = "%s/%s";
-
+
if (!*fname || (*dir && dir[strlen(dir)-1] == '/'))
fmt = "%s%s";
-
+
snprintf (d, l, fmt, dir, fname);
return d;
}
mutt_strsysexit(int e)
{
int i;
-
+
for(i = 0; sysexits_h[i].str; i++)
{
if(e == sysexits_h[i].v)
break;
}
-
+
return sysexits_h[i].str;
}
/*
* Copyright (C) 1996-2000,2007,2010,2012 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2005,2007 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- */
+ */
/* mutt functions which are generally useful. */
/*
* Create a format string to be used with scanf.
* To use it, write, for instance, MUTT_FORMAT(HUGE_STRING).
- *
+ *
* See K&R 2nd ed, p. 231 for an explanation.
*/
# define _MUTT_FORMAT_2(a,b) "%" a b
# endif
# ifdef _LIB_C
-# define MUTT_LIB_WHERE
+# define MUTT_LIB_WHERE
# define MUTT_LIB_INITVAL(x) = x
# else
# define MUTT_LIB_WHERE extern
/*
* Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _MAILBOX_H
#define _MAILBOX_H
* Copyright (C) 1996-2007,2010,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2007 Thomas Roessler <roessler@does-not-exist.org>
* Copyright (C) 2004 g10 Code GmbH
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#define MAIN_C 1
-m <type>\tspecify a default mailbox type\n\
-n\t\tcauses Mutt not to read the system Muttrc\n\
-p\t\trecall a postponed message");
-
+
puts _("\
-Q <variable>\tquery a configuration variable\n\
-R\t\topen mailbox in read-only mode\n\
#endif
#ifdef HAVE_LIBIDN
- printf ("\nlibidn: %s (compiled with %s)", stringprep_check_version (NULL),
+ printf ("\nlibidn: %s (compiled with %s)", stringprep_check_version (NULL),
STRINGPREP_VERSION);
#endif
#else
puts ("-DEBUG");
#endif
-
-
+
+
puts (
#ifdef HOMESPOOL
"-USE_SMTP "
#endif
"\n"
-
+
#ifdef USE_SSL_OPENSSL
"+USE_SSL_OPENSSL "
#else
"-HAVE_GETADDRINFO "
#endif
);
-
+
puts (
#ifdef HAVE_REGCOMP
"+HAVE_REGCOMP "
#endif
"\n"
-
+
#ifdef HAVE_COLOR
"+HAVE_COLOR "
#else
"-HAVE_COLOR "
#endif
-
+
#ifdef HAVE_START_COLOR
"+HAVE_START_COLOR "
#else
"-HAVE_START_COLOR "
#endif
-
+
#ifdef HAVE_TYPEAHEAD
"+HAVE_TYPEAHEAD "
#else
"-HAVE_TYPEAHEAD "
#endif
-
+
#ifdef HAVE_BKGDSET
"+HAVE_BKGDSET "
#else
#endif
"\n"
-
+
#ifdef HAVE_CURS_SET
"+HAVE_CURS_SET "
#else
"-HAVE_CURS_SET "
#endif
-
+
#ifdef HAVE_META
"+HAVE_META "
#else
"-HAVE_META "
#endif
-
+
#ifdef HAVE_RESIZETERM
"+HAVE_RESIZETERM "
#else
"-HAVE_RESIZETERM "
#endif
-
+
#ifdef HAVE_FUTIMENS
"+HAVE_FUTIMENS "
#else
"-HAVE_FUTIMENS "
#endif
- );
-
+ );
+
puts (
#ifdef CRYPT_BACKEND_CLASSIC_PGP
"+CRYPT_BACKEND_CLASSIC_PGP "
"-CRYPT_BACKEND_GPGME "
#endif
);
-
+
puts (
#ifdef EXACT_ADDRESS
"+EXACT_ADDRESS "
#endif
"\n"
-
+
#ifdef ENABLE_NLS
"+ENABLE_NLS "
#else
#else
"-LOCALES_HACK "
#endif
-
+
#ifdef HAVE_WC_FUNCS
"+HAVE_WC_FUNCS "
#else
"-HAVE_WC_FUNCS "
#endif
-
+
#ifdef HAVE_LANGINFO_CODESET
"+HAVE_LANGINFO_CODESET "
#else
"-HAVE_LANGINFO_CODESET "
#endif
-
+
#ifdef HAVE_LANGINFO_YESEXPR
"+HAVE_LANGINFO_YESEXPR "
#else
"-HAVE_LANGINFO_YESEXPR "
#endif
-
+
"\n"
#if HAVE_ICONV
puts(_(ReachingUs));
mutt_print_patchlist();
-
+
exit (0);
}
const char *exit_endwin_msg = NULL;
/* sanity check against stupid administrators */
-
+
if(getegid() != getgid())
{
fprintf(stderr, "%s: I don't want to run with privileges!\n",
for (optind = 1; optind < double_dash; )
{
/* We're getopt'ing POSIXLY, so we'll be here every time getopt()
- * encounters a non-option. That could be a file to attach
+ * encounters a non-option. That could be a file to attach
* (all non-options between -a and --) or it could be an address
* (which gets collapsed to the front of argv).
*/
case 'm':
/* should take precedence over .muttrc setting, so save it for later */
- newMagic = optarg;
+ newMagic = optarg;
break;
case 'n':
case 'Q':
queries = mutt_add_list (queries, optarg);
break;
-
+
case 'R':
flags |= MUTT_RO; /* read-only mode */
break;
char *bodytext = NULL, *bodyfile = NULL;
int rv = 0;
char expanded_infile[_POSIX_PATH_MAX];
-
+
if (!option (OPTNOCURSES))
mutt_flushinp ();
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef MAPPING_H
#define MAPPING_H
/*
* Copyright (C) 1996-2002,2010,2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* This file contains code to parse ``mbox'' and ``mmdf'' style mailboxes */
ctx->readonly = 1;
return 0;
}
-
+
return (r);
}
mutt_error _("Mailbox is corrupt!");
return (-1);
}
- }
+ }
else
hdr->received = t - mutt_local_tz (t);
if (ctx->msgcount == ctx->hdrmax)
mx_alloc_memory (ctx);
-
+
curhdr = ctx->hdrs[ctx->msgcount] = mutt_new_header ();
curhdr->received = t - mutt_local_tz (t);
curhdr->offset = loc;
curhdr->index = ctx->msgcount;
-
+
curhdr->env = mutt_read_rfc822_header (ctx->fp, curhdr, 0, 0);
/* if we know how long this message is, either just skip over the body,
}
else
lines++;
-
+
loc = ftello (ctx->fp);
}
-
+
/*
* Only set the content-length of the previous message if we have read more
* than one message during _this_ invocation. If this routine is called
}
/*
- * Check to make sure that the only change to the mailbox is that
+ * Check to make sure that the only change to the mailbox is that
* message(s) were appended to this file. My heuristic is that we should
* see the message separator at *exactly* what used to be the end of the
* folder.
/* find the first deleted/changed message. we save a lot of time by only
* rewriting the mailbox from the point where it has actually changed.
*/
- for (i = 0 ; i < ctx->msgcount && !ctx->hdrs[i]->deleted &&
+ for (i = 0 ; i < ctx->msgcount && !ctx->hdrs[i]->deleted &&
!ctx->hdrs[i]->changed && !ctx->hdrs[i]->attach_del; i++)
;
if (i == ctx->msgcount)
- {
+ {
/* this means ctx->changed or ctx->deleted was set, but no
* messages were found to be changed or deleted. This should
* never happen, is we presume it is a bug in mutt.
}
/* save the index of the first changed/deleted message */
- first = i;
+ first = i;
/* where to start overwriting */
- offset = ctx->hdrs[i]->offset;
+ offset = ctx->hdrs[i]->offset;
/* the offset stored in the header does not include the MMDF_SEP, so make
* sure we seek to the correct location
*/
if (ctx->magic == MUTT_MMDF)
offset -= (sizeof MMDF_SEP - 1);
-
+
/* allocate space for the new offsets */
newOffset = safe_calloc (ctx->msgcount - first, sizeof (struct m_update_t));
oldOffset = safe_calloc (ctx->msgcount - first, sizeof (struct m_update_t));
* back up some information which is needed to restore offsets when
* something fails.
*/
-
+
oldOffset[i-first].valid = 1;
oldOffset[i-first].hdr = ctx->hdrs[i]->offset;
oldOffset[i-first].body = ctx->hdrs[i]->content->offset;
unlink (tempfile);
goto bail;
}
-
+
}
/* save the new offset for this message. we add `offset' because the
switch(ctx->magic)
{
- case MUTT_MMDF:
- if(fputs(MMDF_SEP, fp) == EOF)
+ case MUTT_MMDF:
+ if(fputs(MMDF_SEP, fp) == EOF)
{
mutt_perror (tempfile);
mutt_sleep (5);
unlink (tempfile);
- goto bail;
+ goto bail;
}
break;
default:
- if(fputs("\n", fp) == EOF)
+ if(fputs("\n", fp) == EOF)
{
mutt_perror (tempfile);
mutt_sleep (5);
}
}
}
-
+
if (fclose (fp) != 0)
{
fp = NULL;
/* error occurred while writing the mailbox back, so keep the temp copy
* around
*/
-
+
char savefile[_POSIX_PATH_MAX];
-
+
snprintf (savefile, sizeof (savefile), "%s/mutt.%s-%s-%u",
NONULL (Tempdir), NONULL(Username), NONULL(Hostname), (unsigned int)getpid ());
rename (tempfile, savefile);
ctx->hdrs[i]->content->length = oldOffset[i-first].length;
}
}
-
+
/* this is ok to call even if we haven't locked anything */
mbox_unlock_mailbox (ctx);
/* silent operations */
ctx->quiet = 1;
-
+
if (!ctx->quiet)
mutt_message _("Reopening mailbox...");
-
+
/* our heuristics require the old mailbox to be unsorted */
if (Sort != SORT_ORDER)
{
old_hdrs = NULL;
old_msgcount = 0;
-
+
/* simulate a close */
if (ctx->id_hash)
hash_destroy (&ctx->id_hash, NULL);
rc = -1;
break;
}
-
+
if (rc == -1)
{
/* free the old headers */
}
}
-static void menu_make_entry (char *s, int l, MUTTMENU *menu, int i)
+static void menu_make_entry (char *s, int l, MUTTMENU *menu, int i)
{
- if (menu->dialog)
+ if (menu->dialog)
{
strncpy (s, menu->dialog[i], l);
menu->current = -1; /* hide menubar */
char buf[LONG_STRING];
int old_color, cur_color;
- if (menu->dialog)
+ if (menu->dialog)
{
menu->redraw &= ~REDRAW_MOTION;
return;
static void menu_redraw_prompt (MUTTMENU *menu)
{
- if (menu->dialog)
+ if (menu->dialog)
{
- if (option (OPTMSGERR))
+ if (option (OPTMSGERR))
{
mutt_sleep (1);
unset_option (OPTMSGERR);
if (!option (OPTMENUMOVEOFF) && menu->max <= menu->pagelen) /* less entries than lines */
{
- if (menu->top != 0)
+ if (menu->top != 0)
{
menu->top = 0;
menu->redraw |= REDRAW_INDEX;
}
}
- else
+ else
{
if (option (OPTMENUSCROLL) || (menu->pagelen <= 0) || (c < MenuContext))
{
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;
+ menu->top += (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c;
}
}
mutt_error _("You cannot scroll up farther.");
}
-/*
+/*
* pageup: jumplen == -pagelen
* pagedown: jumplen == pagelen
* halfup: jumplen == -pagelen/2
{
switch (i)
{
- case OP_NEXT_ENTRY:
+ case OP_NEXT_ENTRY:
return OP_NEXT_LINE;
- case OP_PREV_ENTRY:
+ case OP_PREV_ENTRY:
return OP_PREV_LINE;
- case OP_CURRENT_TOP: case OP_FIRST_ENTRY:
+ case OP_CURRENT_TOP: case OP_FIRST_ENTRY:
return OP_TOP_PAGE;
- case OP_CURRENT_BOTTOM: case OP_LAST_ENTRY:
+ case OP_CURRENT_BOTTOM: case OP_LAST_ENTRY:
return OP_BOTTOM_PAGE;
- case OP_CURRENT_MIDDLE:
- return OP_MIDDLE_PAGE;
+ case OP_CURRENT_MIDDLE:
+ return OP_MIDDLE_PAGE;
}
-
+
return i;
}
/* allow the caller to do any local configuration */
return (OP_REDRAW);
}
-
+
if (!menu->dialog)
menu_check_recenter (menu);
-
+
if (menu->redraw & REDRAW_STATUS)
menu_redraw_status (menu);
#ifdef USE_SIDEBAR
menu_redraw_motion (menu);
else if (menu->redraw == REDRAW_CURRENT)
menu_redraw_current (menu);
-
+
if (menu->dialog)
menu_redraw_prompt (menu);
-
+
return OP_NULL;
}
mutt_clear_error ();
/* Convert menubar movement to scrolling */
- if (menu->dialog)
+ if (menu->dialog)
i = menu_dialog_translate_op (i);
switch (i)
* Copyright (C) 1996-2002,2007,2009 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2005 Thomas Roessler <roessler@does-not-exist.org>
* Copyright (C) 2010,2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
if ((p = strrchr (path, ':')) != NULL && mutt_strncmp (p + 1, "2,", 2) == 0)
{
p += 3;
-
+
mutt_str_replace (&h->maildir_flags, p);
q = h->maildir_flags;
h->deleted = 1;
}
break;
-
+
default:
*q++ = *p;
break;
p++;
}
}
-
+
if (q == h->maildir_flags)
FREE (&h->maildir_flags);
else if (q)
mutt_buffer_pool_release (&buf);
}
-/*
+/*
* Actually parse a maildir message. This may also be used to fill
* out a fake header structure generated by lazy maildir parsing.
*/
if (magic == MUTT_MAILDIR)
{
- /*
+ /*
* maildir stores its flags in the filename, so ignore the
- * flags in the header of the message
+ * flags in the header of the message
*/
h->old = is_old;
struct maildir* head;
struct maildir* tail;
- if (left && right)
+ if (left && right)
{
if (cmp (left, right) < 0)
{
head = left;
left = left->next;
}
- else
+ else
{
head = right;
right = right->next;
}
- }
- else
+ }
+ else
{
- if (left)
+ if (left)
return left;
- else
+ else
return right;
}
-
+
tail = head;
- while (left && right)
+ while (left && right)
{
if (cmp (left, right) < 0)
{
tail->next = left;
left = left->next;
- }
- else
+ }
+ else
{
tail->next = right;
right = right->next;
tail = tail->next;
}
- if (left)
+ if (left)
{
tail->next = left;
}
struct maildir* right = list;
size_t c = 0;
- if (!list || !list->next)
+ if (!list || !list->next)
{
return list;
}
return maildir_ins_sort (list, cmp);
list = list->next;
- while (list && list->next)
+ while (list && list->next)
{
right = right->next;
list = list->next->next;
}
#endif
-/*
+/*
* This function does the second parsing pass
*/
static void maildir_delayed_parsing (CONTEXT * ctx, struct maildir **md,
progress_t *progress)
-{
+{
struct maildir *p, *last = NULL;
BUFFER *fn = NULL;
int count;
* will end up in the cur directory, so we include it in the following
* test even though there is no associated flag.
*/
-
+
if (hdr && (hdr->flagged || hdr->replied || hdr->read || hdr->deleted || hdr->old || hdr->maildir_flags))
{
char tmp[LONG_STRING];
/*
* Open a new (temporary) message in a maildir folder.
- *
+ *
* Note that this uses _almost_ the maildir file name format, but
* with a {cur,new} prefix.
*
/*
* Commit a message to a maildir folder.
- *
+ *
* msg->path contains the file name of a file in tmp/. We take the
- * flags from this file's name.
+ * flags from this file's name.
*
* ctx is the mail folder we commit to.
- *
+ *
* hdr is a header structure to which we write the message's new
* file name. This is used in the mh and maildir folder synch
* routines. When this routine is invoked from mx_commit_message,
- * hdr is NULL.
+ * hdr is NULL.
*
* msg->path looks like this:
- *
+ *
* tmp/{cur,new}.mutt-HOSTNAME-PID-COUNTER:flags
- *
+ *
* See also maildir_open_new_message().
- *
+ *
*/
static int _maildir_commit_message (CONTEXT * ctx, MESSAGE * msg, HEADER * hdr)
return _maildir_commit_message (ctx, msg, NULL);
}
-/*
+/*
* commit a message to an MH folder.
- *
+ *
*/
}
closedir (dirp);
- /*
+ /*
* Now try to rename the file to the proper name.
- *
+ *
* Note: We may have to try multiple times, until we find a free
* slot.
*/
/* Sync a message in an MH folder.
- *
+ *
* This code is also used for attachment deletion in maildir
* folders.
*/
restore = 0;
}
- /*
+ /*
* Try to move the new message to the old place.
* (MH only.)
*
* Note that there is a race condition against programs which
* use the first free slot instead of the maximum message
* number. Mutt does _not_ behave like this.
- *
+ *
* Anyway, if this fails, the message is in the folder, so
* all what happens is that a concurrently running mutt will
* lose flag modifications.
if (ctx->magic == MUTT_MH)
i = mh_check_mailbox (ctx, index_hint);
- else
+ else
i = maildir_check_mailbox (ctx, index_hint);
-
+
if (i != 0)
return i;
short old_sort;
int old_count;
int i, j;
-
+
if (Sort != SORT_ORDER)
{
old_sort = Sort;
mutt_sort_headers (ctx, 1);
Sort = old_sort;
}
-
+
old_count = ctx->msgcount;
for (i = 0, j = 0; i < old_count; i++)
{
if (ctx->hdrs[i]->active && index_hint && *index_hint == i)
*index_hint = j;
-
+
if (ctx->hdrs[i]->active)
ctx->hdrs[i]->index = j++;
}
*/
int context_changed = ctx->changed;
int header_changed;
-
+
/* user didn't modify this message. alter the flags to match the
* current state on disk. This may not actually do
* anything. mutt_set_flag() will just ignore the call if the status
*/
header_changed = o->changed;
o->changed = 0;
-
+
/* if the mailbox was not modified before we made these
* changes, unset the changed flag since nothing needs to
* be synchronized.
/* If we didn't just get new mail, update the tables. */
if (occult)
maildir_update_tables (ctx, index_hint);
-
+
/* do any delayed parsing we need to do. */
maildir_delayed_parsing (ctx, &md, NULL);
return 0;
}
-/*
+/*
* This function handles arrival of new mail and reopening of
* mh/maildir folders. Things are getting rather complex because we
* don't have a well-defined "mailbox order", so the tricks from
mutt_buffer_pool_release (&buf);
return -1;
}
-
+
/* create .mh_sequences when there isn't one. */
mutt_buffer_printf (buf, "%s/.mh_sequences", ctx->path);
if ((i = stat (mutt_b2s (buf), &st_cur)) == -1 && errno == ENOENT)
{
char *tmp;
FILE *fp = NULL;
-
+
if (mh_mkstemp (ctx, &fp, &tmp) == 0)
{
safe_fclose (&fp);
DIR *dp;
struct dirent *de;
int r = 1; /* assume empty until we find a message */
-
+
if ((dp = opendir (path)) == NULL)
return -1;
while ((de = readdir (dp)))
}
}
closedir (dp);
-
+
return r;
}
/*
* Copyright (C) 1996-2000,2010 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* Content-Type */
enum
/*
* Copyright (C) 1996-2002,2010,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2004 g10 Code GmbH
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef MUTT_H
-#define MUTT_H
+#define MUTT_H
#include <stdio.h>
#include <stdlib.h>
/* nifty trick I stole from ELM 2.5alpha. */
#ifdef MAIN_C
-#define WHERE
+#define WHERE
#define INITVAL(x) = x
#else
#define WHERE extern
-#define INITVAL(x)
+#define INITVAL(x)
#endif
#define WHERE_DEFINED 1
MUTT_XLABEL,
MUTT_MIMEATTACH,
MUTT_MIMETYPE,
-
+
/* Options for Mailcap lookup */
MUTT_EDIT,
MUTT_COMPOSE,
#endif
OPT_SUBJECT,
OPT_VERIFYSIG, /* verify PGP signatures */
-
+
/* THIS MUST BE THE LAST VALUE. */
OPT_MAX
};
OPTCRYPTUSEPKA,
/* PGP options */
-
+
OPTCRYPTAUTOSIGN,
OPTCRYPTAUTOENCRYPT,
OPTCRYPTAUTOPGP,
char *filename; /* when sending a message, this is the file
* to which this structure refers
*/
- char *d_filename; /* filename to be used for the
+ char *d_filename; /* filename to be used for the
* content-disposition header.
- * If NULL, filename is used
+ * If NULL, filename is used
* instead.
*/
char *charset; /* charset of attached file */
unsigned int deleted : 1; /* attachment marked for deletion */
unsigned int noconv : 1; /* don't do character set conversion */
- unsigned int force_charset : 1;
+ unsigned int force_charset : 1;
/* send mode: don't adjust the character
* set when in send-mode.
*/
* This flag is used by the maildir_trash
* option.
*/
-
+
/* timezone of the sender of this message */
unsigned int zhours : 5;
unsigned int zminutes : 6;
size_t num_hidden; /* number of hidden messages in this view */
short recipient; /* user_is_recipient()'s return value, cached */
-
+
int pair; /* color-pair to use when displaying in the index */
time_t date_sent; /* time when the message was sent (UTC) */
ENVELOPE *env; /* envelope information */
BODY *content; /* list of MIME parts */
char *path;
-
+
char *tree; /* character string to print thread tree */
THREAD *thread;
#if defined USE_POP || defined USE_IMAP
void *data; /* driver-specific data */
#endif
-
+
char *maildir_flags; /* unknown maildir flags */
} HEADER;
int max;
struct pattern_t *next;
struct pattern_t *child; /* arguments to logical op */
- union
+ union
{
regex_t *rx;
group_t *g;
/*
* Copyright (C) 2003 Werner Koch <wk@gnupg.org>
* Copyright (C) 2004 g10code GmbH
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/*
Common definitions and prototypes for the crypt functions. They are
#define PGPENCRYPT (APPLICATION_PGP | ENCRYPT)
#define PGPSIGN (APPLICATION_PGP | SIGN)
#define PGPGOODSIGN (APPLICATION_PGP | GOODSIGN)
-#define PGPKEY (APPLICATION_PGP | KEYBLOCK)
+#define PGPKEY (APPLICATION_PGP | KEYBLOCK)
#define PGPINLINE (APPLICATION_PGP | INLINE)
#define SMIMEENCRYPT (APPLICATION_SMIME | ENCRYPT)
-/*-- crypt.c --*/
+/*-- crypt.c --*/
-/* Print the current time. */
+/* Print the current time. */
void crypt_current_time(STATE *s, char *app_name);
/* Check out the type of encryption used and set the cached status
void crypt_extract_keys_from_messages (HEADER *h);
/* Do a quick check to make sure that we can find all of the
- encryption keys if the user has requested this service.
+ encryption keys if the user has requested this service.
Return the list of keys in KEYLIST.
If oppenc_mode is true, only keys that can be determined without
prompting will be used. */
int crypt_write_signed(BODY *a, STATE *s, const char *tempf);
/* Obtain pointers to fingerprint or short or long key ID, if any.
-
+
Upon return, at most one of return, *ppl and *pps pointers is non-NULL,
indicating the longest fingerprint or ID found, if any.
Return: Copy of fingerprint, if any, stripped of all spaces, else NULL.
Must be FREE'd by caller.
- *pphint Start of string to be passed to pgp_add_string_to_hints() or
+ *pphint Start of string to be passed to pgp_add_string_to_hints() or
crypt_add_string_to_hints().
*ppl Start of long key ID if detected, else NULL.
*pps Start of short key ID if detected, else NULL. */
/*
* Copyright (C) 1996-2000,2012 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2004 g10 Code GmbH
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _MUTT_CURSES_H_
#define _MUTT_CURSES_H_ 1
/*
* Copyright (C) 2003,2005,2008-2009 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
/*
* Copyright (C) 2003,2005 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _MUTT_IDNA_H
# define _MUTT_IDNA_H
mutt_window_t *helpwin;
mutt_window_t *messagewin;
- /* Setting dialog != NULL overrides normal menu behavior.
+ /* Setting dialog != NULL overrides normal menu behavior.
* In dialog mode menubar is hidden and prompt keys are checked before
- * normal menu movement keys. This can cause problems with scrolling, if
+ * normal menu movement keys. This can cause problems with scrolling, if
* prompt keys override movement keys.
*/
char **dialog; /* dialog lines themselves */
char *prompt; /* prompt for user, similar to mutt_multi_choice */
char *keys; /* keys used in the prompt */
-
+
/* callback to generate an index line for the requested element */
void (*make_entry) (char *, size_t, struct menu_t *, int);
-
+
/* how to search the menu */
int (*search) (struct menu_t *, regex_t *re, int n);
void (*custom_menu_redraw) (struct menu_t *);
void *redraw_data;
- /* color pair to be used for the requested element
+ /* color pair to be used for the requested element
* (default function returns ColorDefs[MT_COLOR_NORMAL])
*/
int (*color) (int i);
-
+
/* the following are used only by mutt_menuLoop() */
int top; /* entry that is the top of the current page */
int oldcurrent; /* for driver use only. */
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/*
* A (more) generic interface to regular expression matching
/*
* Copyright (C) 2000-2008,2012,2014 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* common SASL helper routines */
/* arbitrary. SASL will probably use a smaller buffer anyway. OTOH it's
* been a while since I've had access to an SASL server which negotiated
- * a protection buffer. */
+ * a protection buffer. */
#define MUTT_SASL_MAXBUF 65536
#define IP_PORT_BUFLEN 1024
}
else
dprint (2, (debugfile, "SASL failed to get local IP address\n"));
-
+
size = sizeof (remote);
if (!getpeername (conn->fd, (struct sockaddr *)&remote, &size)){
if (iptostring((struct sockaddr *)&remote, size, ipremoteport,
dprint (2, (debugfile, "SASL local ip: %s, remote ip:%s\n", NONULL(plp),
NONULL(prp)));
-
+
rc = sasl_client_new (service, conn->account.host, plp, prp,
mutt_sasl_get_callbacks (&conn->account), 0, saslconn);
* abstraction problem is that there is more in CONNECTION than there
* needs to be. Ideally it would have only (void*)data and methods. */
-/* mutt_sasl_setup_conn: replace connection methods, sockdata with
+/* mutt_sasl_setup_conn: replace connection methods, sockdata with
* SASL wrappers, for protection layers. Also get ssf, as a fastpath
* for the read/write methods. */
void mutt_sasl_setup_conn (CONNECTION* conn, sasl_conn_t* saslconn)
return SASL_FAIL;
*result = account->user;
}
-
+
if (len)
*len = strlen (*result);
return olen;
}
-
+
conn->sockdata = sasldata->sockdata;
sasldata->bpos = 0;
else
/* just write using the underlying socket function */
rc = (sasldata->msasl_write) (conn, buf, len);
-
+
conn->sockdata = sasldata;
return rc;
/*
* Copyright (C) 2000-2005,2008 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/* common SASL helper routines */
void mutt_sasl_setup_conn (CONNECTION*, sasl_conn_t*);
void mutt_sasl_done (void);
-typedef struct
+typedef struct
{
sasl_conn_t* saslconn;
const sasl_ssf_t* ssf;
* Copyright (C) 1998,2000 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2006,2008 Brendan Cully <brendan@kublai.com>
* Copyright (C) 1999-2000 Tommi Komulainen <Tommi.Komulainen@iki.fi>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
static CONNECTION* socket_new_conn (void);
/* Wrappers */
-int mutt_socket_open (CONNECTION* conn)
+int mutt_socket_open (CONNECTION* conn)
{
int rc;
if (len < 0)
len = mutt_strlen (buf);
-
+
while (sent < len)
{
if ((rc = conn->conn_write (conn, buf + sent, len - sent)) < 0)
dprint (3, (debugfile,
"mutt_socket_write: short write (%d of %d bytes)\n", rc,
len - sent));
-
+
sent += rc;
}
buf[i] = '\0';
dprint (dbg, (debugfile, "%d< %s\n", conn->fd, buf));
-
+
/* number of bytes read, not strlen */
return i + 1;
}
if (Tunnel && *Tunnel)
mutt_tunnel_socket_setup (conn);
- else if (account->flags & MUTT_ACCT_SSL)
+ else if (account->flags & MUTT_ACCT_SSL)
{
#if defined(USE_SSL)
if (mutt_ssl_socket_setup (conn) < 0)
save_errno = errno;
mutt_perror (_("Preconnect command failed."));
mutt_sleep (1);
-
+
return save_errno;
}
}
int fd;
char *host_idna = NULL;
-
+
#ifdef HAVE_GETADDRINFO
/* --- IPv4/6 --- */
hints.ai_socktype = SOCK_STREAM;
snprintf (port, sizeof (port), "%d", conn->account.port);
-
+
# if defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
if (idna_to_ascii_lz (conn->account.host, &host_idna, 1) != IDNA_SUCCESS)
{
if (!option(OPTNOCURSES))
mutt_message (_("Looking up %s..."), conn->account.host);
-
+
rc = getaddrinfo (host_idna, port, &hints, &res);
# if defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
}
if (!option(OPTNOCURSES))
- mutt_message (_("Connecting to %s..."), conn->account.host);
+ mutt_message (_("Connecting to %s..."), conn->account.host);
rc = -1;
for (cur = res; cur != NULL; cur = cur->ai_next)
if (! he) {
mutt_error (_("Could not find the host \"%s\""), conn->account.host);
-
+
return -1;
}
if (!option(OPTNOCURSES))
- mutt_message (_("Connecting to %s..."), conn->account.host);
+ mutt_message (_("Connecting to %s..."), conn->account.host);
rc = -1;
for (i = 0; he->h_addr_list[i] != NULL; i++)
mutt_sleep (2);
return -1;
}
-
+
return 0;
}
/*
* Copyright (C) 1998 Brandon Long <blong@fiction.net>
* Copyright (C) 1999-2005 Brendan Cully <brendan@kublai.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _MUTT_SOCKET_H_
#define _MUTT_SOCKET_H_ 1
/*
* Copyright (C) 1999-2000 Tommi Komulainen <Tommi.Komulainen@iki.fi>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _MUTT_SSL_H_
#define _MUTT_SSL_H_ 1
/*
* Copyright (C) 1996-2000,2007,2010,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2008 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
BODY *mutt_new_body (void)
{
BODY *p = (BODY *) safe_calloc (1, sizeof (BODY));
-
+
p->disposition = DISPATTACH;
p->use_disp = 1;
return (p);
}
/* Modified by blong to accept a "suggestion" for file name. If
- * that file exists, then construct one with unique name but
+ * that file exists, then construct one with unique name but
* keep any extension. This might fail, I guess.
* Renamed to mutt_adv_mktemp so I only have to change where it's
* called, and not all possible cases.
BODY *b;
PARAMETER *par, **ppar;
-
+
short use_disp;
if (src->filename)
mutt_adv_mktemp (tmp, sizeof (tmp));
if (mutt_save_attachment (fp, src, tmp, 0, NULL) == -1)
return -1;
-
+
*tgt = mutt_new_body ();
b = *tgt;
b->d_filename = safe_strdup (src->filename);
b->description = safe_strdup (b->description);
- /*
+ /*
* we don't seem to need the HEADER structure currently.
* XXX - this may change in the future
*/
if (b->hdr) b->hdr = NULL;
-
+
/* copy parameters */
for (par = b->parameter, ppar = &b->parameter; par; ppar = &(*ppar)->next, par = par->next)
{
}
mutt_stamp_attachment (b);
-
+
return 0;
}
while (a)
{
b = a;
- a = a->next;
+ a = a->next;
if (b->parameter)
mutt_free_parameter (&b->parameter);
LIST *mutt_add_list_n (LIST *head, const void *data, size_t len)
{
LIST *tmp;
-
+
for (tmp = head; tmp && tmp->next; tmp = tmp->next)
;
if (tmp)
}
else
head = tmp = safe_malloc (sizeof (LIST));
-
+
tmp->data = safe_malloc (len);
if (len)
memcpy (tmp->data, data, len);
void mutt_free_list (LIST **list)
{
LIST *p;
-
+
if (!list) return;
while (*list)
{
t->data = safe_strdup (p->data);
t->next = NULL;
if (l)
- {
+ {
r->next = t;
r = r->next;
}
char tmp[_POSIX_PATH_MAX];
char *t;
- char *tail = "";
+ char *tail = "";
int recurse = 0;
-
- do
+
+ do
{
recurse = 0;
else
{
struct passwd *pw;
- if ((t = strchr (s + 1, '/')))
+ if ((t = strchr (s + 1, '/')))
*t = 0;
if ((pw = getpwnam (s + 1)))
}
}
break;
-
+
case '=':
- case '+':
+ case '+':
{
#ifdef USE_IMAP
/* if folder = {host} or imap[s]://host/: don't append slash */
strfcpy (p, NONULL (Maildir), sizeof (p));
else
snprintf (p, sizeof (p), "%s/", NONULL (Maildir));
-
+
tail = s + 1;
}
break;
-
+
/* elm compatibility, @ expands alias to user name */
-
+
case '@':
{
HEADER *h;
ADDRESS *alias;
-
+
if ((alias = mutt_lookup_alias (s + 1)))
{
h = mutt_new_header();
/* Avoid infinite recursion if the resulting folder starts with '@' */
if (*p != '@')
recurse = 1;
-
+
tail = "";
}
}
break;
-
+
case '>':
{
strfcpy (p, NONULL(Inbox), sizeof (p));
tail = s + 1;
}
break;
-
+
case '<':
{
strfcpy (p, NONULL(Outbox), sizeof (p));
tail = s + 1;
}
break;
-
+
case '!':
{
if (*(s+1) == '!')
strfcpy (p, NONULL(LastFolder), sizeof (p));
tail = s + 2;
}
- else
+ else
{
strfcpy (p, NONULL(Spoolfile), sizeof (p));
tail = s + 1;
}
}
break;
-
+
case '-':
{
strfcpy (p, NONULL(LastFolder), sizeof (p));
tail = s + 1;
}
break;
-
- case '^':
+
+ case '^':
{
strfcpy (p, NONULL(CurrentFolder), sizeof (p));
tail = s + 1;
}
else
snprintf (tmp, sizeof (tmp), "%s%s", p, tail);
-
+
strfcpy (s, tmp, slen);
}
while (recurse);
/* Extract the real name from /etc/passwd's GECOS field.
* When set, honor the regular expression in GecosMask,
- * otherwise assume that the GECOS field is a
+ * otherwise assume that the GECOS field is a
* comma-separated list.
* Replace "&" by a capitalized version of the user's login
* name.
size_t pwnl;
int idx;
char *p;
-
- if (!pw || !pw->pw_gecos)
+
+ if (!pw || !pw->pw_gecos)
return NULL;
memset (dest, 0, destlen);
-
+
if (GecosMask.rx)
{
if (regexec (GecosMask.rx, pw->pw_gecos, 1, pat_match, 0) == 0)
- strfcpy (dest, pw->pw_gecos + pat_match[0].rm_so,
+ strfcpy (dest, pw->pw_gecos + pat_match[0].rm_so,
MIN (pat_match[0].rm_eo - pat_match[0].rm_so + 1, destlen));
}
else if ((p = strchr (pw->pw_gecos, ',')))
dest[idx] = toupper ((unsigned char) dest[idx]);
}
}
-
+
return dest;
}
-
+
char *mutt_get_parameter (const char *s, PARAMETER *p)
{
mutt_delete_parameter (attribute, p);
return;
}
-
+
for(q = *p; q; q = q->next)
{
if (ascii_strcasecmp (attribute, q->attribute) == 0)
return;
}
}
-
+
q = mutt_new_parameter();
q->attribute = safe_strdup(attribute);
q->value = safe_strdup(value);
void mutt_delete_parameter (const char *attribute, PARAMETER **p)
{
PARAMETER *q;
-
+
for (q = *p; q; p = &q->next, q = q->next)
{
if (ascii_strcasecmp (attribute, q->attribute) == 0)
{
int t = b->type;
char *s = b->subtype;
-
+
if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b))
return 0;
{
MOVE_ELEM(in_reply_to);
}
-
+
/* real_subj is subordinate to subject */
if (!base->subject)
{
MOVE_ELEM(spam);
MOVE_ELEM(userhdrs);
#undef MOVE_ELEM
-
+
mutt_free_envelope(extra);
}
}
*q = 0;
}
- else if (strstr (p, "..") &&
+ else if (strstr (p, "..") &&
(scheme == U_UNKNOWN || scheme == U_FILE) &&
realpath (p, tmp))
strfcpy (p, tmp, buflen - (p - s));
void mutt_expand_file_fmt (char *dest, size_t destlen, const char *fmt, const char *src)
{
char tmp[LONG_STRING];
-
+
mutt_quote_filename (tmp, sizeof (tmp), src);
mutt_expand_fmt (dest, destlen, fmt, tmp);
}
slen = mutt_strlen (src);
destlen--;
-
+
for (p = fmt, d = dest; destlen && *p; p++)
{
- if (*p == '%')
+ if (*p == '%')
{
switch (p[1])
{
p++;
break;
default:
- *d++ = *p;
+ *d++ = *p;
destlen--;
break;
}
destlen--;
}
}
-
+
*d = '\0';
-
+
if (!found && destlen > 0)
{
safe_strcat (dest, destlen, " ");
safe_strcat (dest, destlen, src);
}
-
+
}
/* return 0 on success, -1 on abort, 1 on error */
int mutt_check_overwrite (const char *attname, const char *path,
- char *fname, size_t flen, int *append, char **directory)
+ char *fname, size_t flen, int *append, char **directory)
{
int rc = 0;
char tmp[_POSIX_PATH_MAX];
return (-1);
mutt_concat_path (fname, path, tmp, flen);
}
-
+
if (*append == 0 && access (fname, F_OK) == 0)
{
switch (mutt_multi_choice
{
short tolower = 0;
short nodots = 0;
-
- while (ch == '_' || ch == ':')
+
+ while (ch == '_' || ch == ':')
{
if (ch == '_')
tolower = 1;
- else if (ch == ':')
+ else if (ch == ':')
nodots = 1;
-
+
ch = *src++;
}
-
+
/* use callback function to handle this case */
src = callback (buf, sizeof (buf), col, cols, ch, src, prefix, ifstring, elsestring, data, flags);
if (tolower)
mutt_strlower (buf);
- if (nodots)
+ if (nodots)
{
char *p = buf;
for (; *p; p++)
if (*p == '.')
*p = '_';
}
-
+
if ((len = mutt_strlen (buf)) + wlen > destlen)
len = mutt_wstr_trunc (buf, destlen - wlen, cols - col, NULL);
va_start (ap, fmt);
rv = vfprintf (s->fpout, fmt, ap);
va_end (ap);
-
+
return rv;
}
*s = '?';
}
}
-
+
void mutt_sleep (short s)
{
if (SleepTime > s)
struct utimbuf utim;
struct stat _st;
time_t mtime;
-
+
if (!st)
{
if (stat (f, &_st) == -1)
utim.modtime = mtime;
utime (f, &utim);
}
-
+
return mtime;
}
void mutt_free_rx_list (RX_LIST **list)
{
RX_LIST *p;
-
+
if (!list) return;
while (*list)
{
void mutt_free_replace_list (REPLACE_LIST **list)
{
REPLACE_LIST *p;
-
+
if (!list) return;
while (*list)
{
int mutt_match_rx_list (const char *s, RX_LIST *l)
{
if (!s) return 0;
-
+
for (; l; l = l->next)
{
if (regexec (l->rx->rx, s, (size_t) 0, (regmatch_t *) 0, (int) 0) == 0)
/*
* Copyright (C) 1996-2002,2010,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2003 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
#define mutt_is_spool(s) (mutt_strcmp (Spoolfile, s) == 0)
#ifdef USE_DOTLOCK
-/* parameters:
+/* parameters:
* path - file to lock
* retry - should retry if unable to lock?
*/
char cmd[LONG_STRING + _POSIX_PATH_MAX];
char f[SHORT_STRING + _POSIX_PATH_MAX];
char r[SHORT_STRING];
-
+
if (flags & DL_FL_RETRY)
snprintf (r, sizeof (r), "-r %d ", retry ? MAXLOCKATTEMPT : 0);
-
+
mutt_quote_filename (f, sizeof (f), path);
-
+
snprintf (cmd, sizeof (cmd),
"%s %s%s%s%s%s%s%s",
NONULL (MuttDotlock),
flags & DL_FL_UNLINK ? "-d " : "",
flags & DL_FL_RETRY ? r : "",
f);
-
+
return mutt_system (cmd);
}
-#else
+#else
#define invoke_dotlock dotlock_invoke
if (!option (OPTNOCURSES))
{
char msg[LONG_STRING];
-
+
snprintf(msg, sizeof(msg), _("Lock count exceeded, remove lock for %s?"),
path);
if(retry && mutt_yesorno(msg, MUTT_YES) == MUTT_YES)
mutt_clear_error ();
goto retry_lock;
}
- }
+ }
else
{
mutt_error ( _("Can't dotlock %s.\n"), path);
static int undotlock_file (const char *path, int fd)
{
- return (invoke_dotlock(path, fd, DL_FL_USEPRIV | DL_FL_UNLOCK, 0) == DL_EX_OK ?
+ return (invoke_dotlock(path, fd, DL_FL_USEPRIV | DL_FL_UNLOCK, 0) == DL_EX_OK ?
0 : -1);
}
#ifdef USE_FCNTL
struct flock lck;
-
+
memset (&lck, 0, sizeof (struct flock));
lck.l_type = excl ? F_WRLCK : F_RDLCK;
lck.l_whence = SEEK_SET;
if (fstat (fd, &sb) != 0)
sb.st_size = 0;
-
+
if (count == 0)
prev_sb = sb;
if (fstat(fd, &sb) != 0)
sb.st_size = 0;
-
+
if (count == 0)
prev_sb = sb;
if (dot)
undotlock_file (path, fd);
#endif
-
+
return 0;
}
struct utimbuf ut;
#endif /* HAVE_UTIMENSAT */
- if(!ctx)
+ if(!ctx)
return;
/* fix up the times so buffy won't get confused */
FREE (&ctx->path);
FREE (&ctx->realpath);
FREE (&ctx->pattern);
- if (ctx->limit_pattern)
+ if (ctx->limit_pattern)
mutt_pattern_free (&ctx->limit_pattern);
safe_fclose (&ctx->fp);
memset (ctx, 0, sizeof (CONTEXT));
for (i = 0; i < ctx->msgcount; i++)
{
- if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read
+ if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read
&& !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED)))
read_msgs++;
}
}
}
- /*
+ /*
* There is no point in asking whether or not to purge if we are
* just marking messages as "trash".
*/
#ifdef USE_IMAP
/* try to use server-side copy first */
i = 1;
-
+
if (ctx->magic == MUTT_IMAP && mx_is_imap (mbox))
{
/* tag messages for moving, and clear old tags, if any */
for (i = 0; i < ctx->msgcount; i++)
if (ctx->hdrs[i]->read && !ctx->hdrs[i]->deleted
- && !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED)))
+ && !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED)))
ctx->hdrs[i]->tagged = 1;
else
ctx->hdrs[i]->tagged = 0;
-
+
i = imap_copy_messages (ctx, NULL, mbox, 1);
}
-
+
if (i == 0) /* success */
mutt_clear_error ();
else if (i == -1) /* horrible error, bail */
}
}
}
-
+
mx_close_mailbox (&f, NULL);
}
-
+
}
else if (!ctx->changed && ctx->deleted == 0)
{
void mx_update_tables(CONTEXT *ctx, int committing)
{
int i, j, padding;
-
+
/* update memory to reflect the new state of the mailbox */
ctx->vcount = 0;
ctx->vsize = 0;
#define this_body ctx->hdrs[j]->content
for (i = 0, j = 0; i < ctx->msgcount; i++)
{
- if ((committing && (!ctx->hdrs[i]->deleted ||
+ if ((committing && (!ctx->hdrs[i]->deleted ||
(ctx->magic == MUTT_MAILDIR && option (OPTMAILDIRTRASH)))) ||
(!committing && ctx->hdrs[i]->active))
{
}
else if (ctx->hdrs[j]->changed)
ctx->changed = 1;
-
+
if (!committing || (ctx->magic == MUTT_MAILDIR && option (OPTMAILDIRTRASH)))
{
if (ctx->hdrs[j]->deleted)
if (ctx->hdrs[j]->flagged)
ctx->flagged++;
if (!ctx->hdrs[j]->read)
- {
+ {
ctx->unread++;
if (!ctx->hdrs[j]->old)
ctx->new++;
- }
+ }
j++;
}
}
mutt_sleep (0);
-
+
if (ctx->msgcount == ctx->deleted &&
(ctx->magic == MUTT_MBOX || ctx->magic == MUTT_MMDF) &&
!mutt_is_spool (ctx->path) && !option (OPTSAVEEMPTY))
}
/* if we haven't deleted any messages, we don't need to resort */
- /* ... except for certain folder formats which need "unsorted"
+ /* ... except for certain folder formats which need "unsorted"
* sort order in order to synchronize folders.
- *
+ *
* MH and maildir are safe. mbox-style seems to need re-sorting,
* at least with the new threading code.
*/
{
int i;
size_t s = MAX (sizeof (HEADER *), sizeof (int));
-
+
if ((ctx->hdrmax + 25) * s < ctx->hdrmax * s)
{
mutt_error _("Integer overflow -- can't allocate memory.");
sleep (1);
mutt_exit (1);
}
-
+
if (ctx->hdrs)
{
safe_realloc (&ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25));
{
HEADER *h2;
- if (!ctx->id_hash)
+ if (!ctx->id_hash)
ctx->id_hash = mutt_make_id_hash (ctx);
h2 = hash_find (ctx->id_hash, h->env->supersedes);
if (h2)
{
h2->superseded = 1;
- if (option (OPTSCORE))
+ if (option (OPTSCORE))
mutt_score_message (ctx, h2, 1);
}
}
hash_insert (ctx->subj_hash, h->env->real_subj, h);
mutt_label_hash_add (ctx, h);
- if (option (OPTSCORE))
+ if (option (OPTSCORE))
mutt_score_message (ctx, h, 0);
if (h->changed)
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/*
* This header file contains prototypes for internal functions used by the
/*
* Copyright (C) 1996-2002,2007,2010,2012-2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
else
color ^= A_UNDERLINE;
}
- else if (a->attr & ANSI_REVERSE)
+ else if (a->attr & ANSI_REVERSE)
{
color ^= A_REVERSE;
}
- else if (a->attr & ANSI_BLINK)
+ else if (a->attr & ANSI_BLINK)
{
color ^= A_BLINK;
}
if (lineInfo[m].continuation == 0) break;
(lineInfo[n+1].syntax)[0].first = m;
- (lineInfo[n+1].syntax)[0].last = (lineInfo[n].continuation) ?
+ (lineInfo[n+1].syntax)[0].last = (lineInfo[n].continuation) ?
cnt + (lineInfo[n].syntax)[0].last : cnt;
}
else
{
/* case 2: try subclassing the current top level node */
-
+
/* tmp != NULL means we already found a shorter prefix at case 1 */
if (tmp == NULL && mutt_strncmp (qptr, q_list->prefix, q_list->length) == 0)
{
if (tmp == NULL)
{
/* add a node above q_list */
- tmp = (struct q_class_t *) safe_calloc (1,
+ tmp = (struct q_class_t *) safe_calloc (1,
sizeof (struct q_class_t));
tmp->prefix = (char *) safe_calloc (1, length + 1);
strncpy (tmp->prefix, qptr, length);
tmp->length = length;
-
+
/* replace q_list by tmp */
if (q_list->next)
{
/* q_list has no siblings */
q_list->next = NULL;
q_list->prev = NULL;
-
+
index = q_list->index;
/* tmp should be the return class too */
if (lineInfo[i].chunks)
{
lineInfo[i].chunks = 0;
- safe_realloc (&(lineInfo[n].syntax),
+ safe_realloc (&(lineInfo[n].syntax),
sizeof (struct syntax_t));
}
lineInfo[i++].type = MT_COLOR_SIGNATURE;
break;
}
if (++(lineInfo[n].chunks) > 1)
- safe_realloc (&(lineInfo[n].syntax),
+ safe_realloc (&(lineInfo[n].syntax),
(lineInfo[n].chunks) * sizeof (struct syntax_t));
}
i = lineInfo[n].chunks - 1;
{
a->attr |= ANSI_BOLD;
pos += 2;
- }
+ }
else if (buf[pos] == '4' && (pos+1 == x || buf[pos+1] == ';'))
{
a->attr |= ANSI_UNDERLINE;
a->bg = buf[pos+1] - '0';
pos += 3;
}
- else
+ else
{
while (pos < x && buf[pos] != ';') pos++;
pos++;
/* is anything left to do? */
if (ch >= cnt)
break;
-
+
k = mbrtowc (&wc, (char *)buf+ch, cnt-ch, &mbstate);
if (k == (size_t)(-2) || k == (size_t)(-1))
{
*/
static int
-display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n,
+display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n,
int *last, int *max, int flags, struct q_class_t **QuoteList,
int *q_level, int *force_redraw, regex_t *SearchRE,
mutt_window_t *pager_window)
flags = 0; /* MUTT_NOSHOW */
}
- /* At this point, (*lineInfo[n]).quote may still be undefined. We
+ /* At this point, (*lineInfo[n]).quote may still be undefined. We
* don't want to compute it every time MUTT_TYPES is set, since this
* would slow down the "bottom" function unacceptably. A compromise
* solution is hence to call regexec() again, just to find out the
force_redraw, q_level);
}
- if ((flags & MUTT_SEARCH) && !(*lineInfo)[n].continuation && (*lineInfo)[n].search_cnt == -1)
+ if ((flags & MUTT_SEARCH) && !(*lineInfo)[n].continuation && (*lineInfo)[n].search_cnt == -1)
{
if (fill_buffer (f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0)
{
goto out; /* fake display */
}
- if ((b_read = fill_buffer (f, last_pos, (*lineInfo)[n].offset, &buf, &fmt,
+ if ((b_read = fill_buffer (f, last_pos, (*lineInfo)[n].offset, &buf, &fmt,
&buflen, &buf_ready)) < 0)
{
if (change_last)
}
if (!(flags & MUTT_PAGER_NSKIP))
/* skip leading blanks on the next line too */
- while (*buf_ptr == ' ' || *buf_ptr == '\t')
+ while (*buf_ptr == ' ' || *buf_ptr == '\t')
buf_ptr++;
}
/* end the last color pattern (needed by S-Lang) */
if (special || (col != pager_window->cols && (flags & (MUTT_SHOWCOLOR | MUTT_SEARCH))))
resolve_color (*lineInfo, n, vch, flags, 0, &a);
-
+
/*
* Fill the blank space at the end of the line with the prevailing color.
* ncurses does an implicit clrtoeol() when you do addch('\n') so we have
while (rd->lines < rd->pager_window->rows &&
rd->lineInfo[rd->curline].offset <= rd->sb.st_size - 1)
{
- if (display_line (rd->fp, &rd->last_pos, &rd->lineInfo, rd->curline, &rd->lastLine,
+ if (display_line (rd->fp, &rd->last_pos, &rd->lineInfo, rd->curline, &rd->lastLine,
&rd->maxLine,
(rd->flags & MUTT_DISPLAYFLAGS) | rd->hideQuoted | rd->SearchFlag | (rd->flags & MUTT_PAGER_NOWRAP),
&rd->QuoteList, &rd->q_level, &rd->force_redraw, &rd->SearchRE,
can be distinguished by whether or not ``hdr'' is NULL. The ``hdr'' arg
is there so that we can do operations on the current message without the
need to pop back out to the main-menu. */
-int
+int
mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
{
static char searchbuf[STRING] = "";
}
else
OldHdr = NULL;
-
+
ch = km_dokey (MENU_PAGER);
if (ch >= 0)
mutt_clear_error ();
/* searching forward */
for (i = wrapped ? 0 : rd.topline + searchctx + 1; i < rd.lastLine; i++)
{
- if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) &&
+ if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) &&
!rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0)
break;
}
/* searching backward */
for (i = wrapped ? rd.lastLine : rd.topline + searchctx - 1; i >= 0; i--)
{
- if ((!rd.hideQuoted || (rd.has_types &&
- rd.lineInfo[i].type != MT_COLOR_QUOTED)) &&
+ if ((!rd.hideQuoted || (rd.has_types &&
+ rd.lineInfo[i].type != MT_COLOR_QUOTED)) &&
!rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0)
break;
}
goto search_next;
}
}
-
+
if (!buffer[0])
break;
-
+
strfcpy (searchbuf, buffer, sizeof (searchbuf));
/* leave SearchBack alone if ch == OP_SEARCH_NEXT */
rd.SearchCompiled = 1;
/* update the search pointers */
i = 0;
- while (display_line (rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine,
+ while (display_line (rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine,
&rd.maxLine, MUTT_SEARCH | (flags & MUTT_PAGER_NSKIP) | (flags & MUTT_PAGER_NOWRAP),
&rd.QuoteList, &rd.q_level,
&rd.force_redraw, &rd.SearchRE, rd.pager_window) == 0)
/* searching forward */
for (i = rd.topline; i < rd.lastLine; i++)
{
- if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) &&
+ if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) &&
!rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0)
break;
}
/* searching backward */
for (i = rd.topline; i >= 0; i--)
{
- if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) &&
+ if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) &&
!rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0)
break;
}
if (dretval < 0)
{
mutt_error _("No more unquoted text after quoted text.");
- break;
+ break;
}
rd.topline = new_topline;
}
{
i = rd.curline;
/* make sure the types are defined to the end of file */
- while (display_line (rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine,
+ while (display_line (rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine,
&rd.maxLine, rd.has_types | (flags & MUTT_PAGER_NOWRAP),
&rd.QuoteList, &rd.q_level, &rd.force_redraw,
&rd.SearchRE, rd.pager_window) == 0)
CHECK_MODE (IsHeader (extra));
if (!(WithCrypto & APPLICATION_PGP))
break;
- if (!(extra->hdr->security & PGP_TRADITIONAL_CHECKED))
+ if (!(extra->hdr->security & PGP_TRADITIONAL_CHECKED))
{
ch = -1;
rc = OP_CHECK_TRADITIONAL;
case OP_MAIL:
CHECK_MODE(IsHeader (extra) && !IsAttach (extra));
- CHECK_ATTACH;
+ CHECK_ATTACH;
ci_send_message (0, NULL, NULL, extra->ctx, NULL);
pager_menu->redraw = REDRAW_FULL;
break;
case OP_REPLY:
CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
- CHECK_ATTACH;
- if (IsMsgAttach (extra))
+ CHECK_ATTACH;
+ if (IsMsgAttach (extra))
mutt_attach_reply (extra->fp, extra->hdr, extra->actx,
extra->bdy, SENDREPLY);
else
case OP_LIST_REPLY:
CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
- CHECK_ATTACH;
+ CHECK_ATTACH;
if (IsMsgAttach (extra))
mutt_attach_reply (extra->fp, extra->hdr, extra->actx,
extra->bdy, SENDREPLY|SENDLISTREPLY);
break;
}
}
-
+
cleanup_quote (&rd.QuoteList);
-
+
for (i = 0; i < rd.maxLine ; i++)
{
FREE (&(rd.lineInfo[i].syntax));
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#include "attach.h"
/*
* Copyright (C) 1996-2000,2012-2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
FOREVER
{
if (fgets (buf, *linelen - offset, f) == NULL || /* end of file or */
- (ISSPACE (*line) && !offset)) /* end of headers */
+ (ISSPACE (*line) && !offset)) /* end of headers */
{
*line = 0;
return (line);
size_t i;
dprint (2, (debugfile, "parse_parameters: `%s'\n", s));
-
+
while (*s)
{
if ((p = strpbrk (s, "=;")) == NULL)
s = skip_email_wsp(s + 1);
}
while (*s == ';'); /* skip empty parameters */
- }
+ }
bail:
return TYPETEXT;
else if (ascii_strcasecmp ("multipart", s) == 0)
return TYPEMULTIPART;
-#ifdef SUN_ATTACHMENT
+#ifdef SUN_ATTACHMENT
else if (ascii_strcasecmp ("x-sun-attachment", s) == 0)
return TYPEMULTIPART;
#endif
* let that take precedence, and don't set it here */
if ((pc = mutt_get_parameter( "name", ct->parameter)) && !ct->filename)
ct->filename = safe_strdup(pc);
-
+
#ifdef SUN_ATTACHMENT
/* this is deep and utter perversion */
if ((pc = mutt_get_parameter ("conversions", ct->parameter)))
ct->encoding = mutt_check_encoding (pc);
#endif
-
+
}
-
+
/* Now get the subtype */
if ((subtype = strchr(s, '/')))
{
char *c;
char *line = safe_malloc (LONG_STRING);
size_t linelen = LONG_STRING;
-
+
p->hdr_offset = ftello (fp);
p->encoding = ENC7BIT; /* default from RFC1521 */
p->type = digest ? TYPEMESSAGE : TYPETEXT;
p->disposition = DISPINLINE;
-
+
while (*(line = mutt_read_rfc822_line (fp, line, &linelen)) != 0)
{
/* Find the value of the current header */
mutt_str_replace (&p->description, c);
rfc2047_decode (&p->description);
}
- }
+ }
#ifdef SUN_ATTACHMENT
else if (!ascii_strncasecmp ("x-sun-", line, 6))
{
bound = mutt_get_parameter ("boundary", b->parameter);
fseeko (fp, b->offset, SEEK_SET);
- b->parts = mutt_parse_multipart (fp, bound,
+ b->parts = mutt_parse_multipart (fp, bound,
b->offset + b->length,
ascii_strcasecmp ("digest", b->subtype) == 0);
break;
break;
}
#endif
-
+
/*
* Consistency checking - catch
* bad attachment end boundaries
*/
-
+
if(new->offset > end_off)
{
mutt_free_body(&new);
/* parse recursive MIME parts */
for(last = head; last; last = last->next)
mutt_parse_part(fp, last);
-
+
return (head);
}
char scratch[SHORT_STRING];
/* Don't modify our argument. Fixed-size buffer is ok here since
- * the date format imposes a natural limit.
+ * the date format imposes a natural limit.
*/
strfcpy (scratch, s, sizeof (scratch));
-
+
/* kill the day of the week, if it exists. */
if ((t = strchr (scratch, ',')))
t++;
{
if (*p == '<')
{
- s = p;
+ s = p;
o = onull = NULL;
continue;
}
}
/* some idiotic clients break their message-ids between lines */
- if (s == p)
+ if (s == p)
/* step past another whitespace */
s = p + 1;
else if (o)
short do_2047, LIST **lastp)
{
int matched = 0;
-
+
switch (ascii_tolower (line[0]))
{
case 'a':
matched = 1;
}
break;
-
+
case 'b':
if (ascii_strcasecmp (line+1, "cc") == 0)
{
matched = 1;
}
break;
-
+
case 'c':
if (ascii_strcasecmp (line+1, "c") == 0)
{
}
}
break;
-
+
case 'd':
if (!ascii_strcasecmp ("ate", line + 1))
{
matched = 1;
}
break;
-
+
case 'e':
if (!ascii_strcasecmp ("xpires", line + 1) &&
hdr && mutt_parse_date (p, NULL) < time (NULL))
hdr->expired = 1;
break;
-
+
case 'f':
if (!ascii_strcasecmp ("rom", line + 1))
{
matched = 1;
}
break;
-
+
case 'i':
if (!ascii_strcasecmp (line+1, "n-reply-to"))
{
matched = 1;
}
break;
-
+
case 'l':
if (!ascii_strcasecmp (line + 1, "ines"))
{
if (hdr)
{
- /*
+ /*
* HACK - mutt has, for a very short time, produced negative
- * Lines header values. Ignore them.
+ * Lines header values. Ignore them.
*/
if (mutt_atoi (p, &hdr->lines) < 0 || hdr->lines < 0)
hdr->lines = 0;
++beg;
if (!(end = strchr (beg, '>')))
break;
-
+
/* Take the first mailto URL */
if (url_check_scheme (beg) == U_MAILTO)
{
matched = 1;
}
break;
-
+
case 'm':
if (!ascii_strcasecmp (line + 1, "ime-version"))
{
}
}
break;
-
+
case 'r':
if (!ascii_strcasecmp (line + 1, "eferences"))
{
if (hdr && !hdr->received)
{
char *d = strrchr (p, ';');
-
+
if (d)
hdr->received = mutt_parse_date (d + 1, NULL);
}
}
break;
-
+
case 's':
if (!ascii_strcasecmp (line + 1, "ubject"))
{
e->supersedes = safe_strdup (p);
}
break;
-
+
case 't':
if (ascii_strcasecmp (line+1, "o") == 0)
{
matched = 1;
}
break;
-
+
case 'x':
if (ascii_strcasecmp (line+1, "-status") == 0)
{
e->x_label = safe_strdup(p);
matched = 1;
}
-
+
default:
break;
}
-
+
/* Keep track of the user-defined headers */
if (!matched && user_hdrs)
{
done:
return matched;
}
-
-
+
+
/* mutt_read_rfc822_header() -- parses a RFC822 header
*
* Args:
* f stream to read from
*
* hdr header structure of current message (optional).
- *
+ *
* user_hdrs If set, store user headers. Used for recall-message and
* postpone modes.
- *
+ *
* weed If this parameter is set and the user has activated the
* $weed option, honor the header weed list for user headers.
* Used for recall-message.
- *
+ *
* Returns: newly allocated envelope structure. You should free it by
* mutt_free_envelope() when envelope stay unneeded.
*/
}
else
p = rfc822_parse_adrlist (p, s);
-
+
return p;
}
if (hdr->attach_valid)
return hdr->attach_total;
-
+
if (hdr->content->parts)
keep_parts = 1;
else
mutt_parse_mime_message (ctx, hdr);
-
+
if (AttachAllow || AttachExclude || InlineAllow || InlineExclude)
hdr->attach_total = count_body_parts(hdr->content, MUTT_PARTS_TOPLEVEL);
else
hdr->attach_total = 0;
hdr->attach_valid = 1;
-
+
if (!keep_parts)
mutt_free_body (&hdr->content->parts);
-
+
return hdr->attach_total;
}
/*
* Copyright (C) 1996-2000,2006-2007,2010 Michael R. Elkins <me@mutt.org>, and others
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
wchar_t w;
mbstate_t mb;
size_t l;
-
+
memset (&mb, 0, sizeof (mb));
-
+
for (; (l = mbrtowc (&w, s, MB_CUR_MAX, &mb)) != 0; s += l)
{
if (l == (size_t) -2)
}
FREE (&buf);
-
+
mx_close_message (ctx, &msg);
if (option (OPTTHOROUGHSRC))
char *tmp;
int do_exclusive = 0;
int skip_quote = 0;
-
+
/*
- * If simple_search is set to "~m %s", the range will have double quotes
+ * If simple_search is set to "~m %s", the range will have double quotes
* around it...
*/
if (*s->dptr == '"')
s->dptr++;
tmp = s->dptr;
}
-
+
if (isdigit ((unsigned char) *tmp))
{
/* range maximum */
&& min->tm_mday > max->tm_mday))
{
int tmp;
-
+
tmp = min->tm_year;
min->tm_year = max->tm_year;
max->tm_year = tmp;
-
+
tmp = min->tm_mon;
min->tm_mon = max->tm_mon;
max->tm_mon = tmp;
-
+
tmp = min->tm_mday;
min->tm_mday = max->tm_mday;
max->tm_mday = tmp;
-
+
min->tm_hour = min->tm_min = min->tm_sec = 0;
max->tm_hour = 23;
max->tm_min = max->tm_sec = 59;
static const char * parse_date_range (const char* pc, struct tm *min,
struct tm *max, int haveMin, struct tm *baseMin, BUFFER *err)
{
- int flag = MUTT_PDR_NONE;
+ int flag = MUTT_PDR_NONE;
while (*pc && ((flag & MUTT_PDR_DONE) == 0))
{
const char *pt;
static void quote_simple(char *tmp, size_t len, const char *p)
{
int i = 0;
-
+
tmp[i++] = '"';
while (*p && i < len - 3)
{
tmp[i++] = '"';
tmp[i] = 0;
}
-
+
/* convert a simple search into a real request */
void mutt_check_simple (char *s, size_t len, const char *simple)
{
return (-1);
mutt_message _("Compiling search pattern...");
-
+
simple = safe_strdup (buf);
mutt_check_simple (buf, sizeof (buf), NONULL (SimpleSearch));
mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], MUTT_PURGE,
0);
case MUTT_DELETE:
- mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], MUTT_DELETE,
+ mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], MUTT_DELETE,
(op == MUTT_DELETE));
break;
case MUTT_TAG:
case MUTT_UNTAG:
- mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], MUTT_TAG,
+ mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], MUTT_TAG,
(op == MUTT_TAG));
break;
}
else
set_option (OPTSEARCHREVERSE);
- /* compare the *expanded* version of the search pattern in case
+ /* compare the *expanded* version of the search pattern in case
$simple_search has changed while we were searching */
strfcpy (temp, buf, sizeof (temp));
mutt_check_simple (temp, sizeof (temp), NONULL (SimpleSearch));
i = 0;
if (option (OPTWRAPSEARCH))
msg = _("Search wrapped to top.");
- else
+ else
{
mutt_message _("Search hit bottom without finding match");
return (-1);
i = Context->vcount - 1;
if (option (OPTWRAPSEARCH))
msg = _("Search wrapped to bottom.");
- else
+ else
{
mutt_message _("Search hit top without finding match");
return (-1);
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/*
* This file contains all of the PGP routines necessary to sign, encrypt,
if (now < PgpExptime)
/* Use cached copy. */
return 1;
-
+
pgp_void_passphrase ();
if (mutt_get_password (_("Enter PGP passphrase:"), PgpPass, sizeof (PgpPass)) == 0)
char *line = NULL;
int lineno = 0;
size_t linelen;
-
+
while ((line = mutt_read_line (line, &linelen, fpin, &lineno, 0)) != NULL)
{
if (regexec (PgpGoodSign.rx, line, 0, NULL, 0) == 0)
else
dprint (2, (debugfile, "pgp_copy_checksig: \"%s\" doesn't match regexp.\n",
line));
-
+
if (strncmp (line, "[GNUPG:] ", 9) == 0)
continue;
fputs (line, fpout);
return rv;
}
-/*
+/*
* Copy a clearsigned message, and strip the signature and PGP's
* dash-escaping.
- *
+ *
* XXX - charset handling: We assume that it is safe to do
* character set decoding first, dash decoding second here, while
* we do it the other way around in the main handler.
- *
+ *
* (Note that we aren't worse than Outlook &c in this, and also
* note that we can successfully handle anything produced by any
- * existing versions of mutt.)
+ * existing versions of mutt.)
*/
static void pgp_copy_clearsigned (FILE *fpin, STATE *s, char *charset)
{
char buf[HUGE_STRING];
short complete, armor_header;
-
+
FGETCONV *fc;
-
+
rewind (fpin);
/* fromcode comes from the MIME Content-Type charset label. It might
* charset-hooks. Therefore we set flags to MUTT_ICONV_HOOK_FROM.
*/
fc = fgetconv_open (fpin, charset, Charset, MUTT_ICONV_HOOK_FROM);
-
+
for (complete = 1, armor_header = 1;
fgetconvs (buf, sizeof (buf), fc) != NULL;
complete = strchr (buf, '\n') != NULL)
if (mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
break;
-
+
if (armor_header)
{
char *p = mutt_skip_whitespace (buf);
- if (*p == '\0')
+ if (*p == '\0')
armor_header = 0;
continue;
}
-
- if (s->prefix)
+
+ if (s->prefix)
state_puts (s->prefix, s);
-
+
if (buf[0] == '-' && buf[1] == ' ')
state_puts (buf + 2, s);
else
state_puts (buf, s);
}
-
+
fgetconv_close (&fc);
}
fseeko (s->fpin, m->offset, 0);
last_pos = m->offset;
-
+
for (bytes = m->length; bytes > 0;)
{
if (fgets (buf, sizeof (buf), s->fpin) == NULL)
break;
-
+
offset = ftello (s->fpin);
bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */
last_pos = offset;
-
+
if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0)
{
clearsign = 0;
{
needpass = 0;
pgp_keyblock = 1;
- }
+ }
else
{
/* XXX - we may wish to recode here */
mutt_perror (tmpfname);
return -1;
}
-
+
fputs (buf, tmpfp);
while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL)
{
offset = ftello (s->fpin);
bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */
last_pos = offset;
-
+
fputs (buf, tmpfp);
if ((needpass && mutt_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0) ||
- (!needpass
+ (!needpass
&& (mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0
|| mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",buf) == 0)))
break;
* gpg_good_sign="" && pgp_decode_command returned 0
*/
if (rc == -1 || rv) maybe_goodsig = 0;
-
+
state_attach_puts (_("[-- End of PGP output --]\n\n"), s);
}
if (pgp_use_gpg_agent())
mutt_need_hard_redraw ();
}
-
+
/* treat empty result as sign of failure */
/* TODO: maybe on failure mutt should include the original undecoded text. */
if (pgpout)
could_not_decrypt = 1;
pgp_void_passphrase ();
}
-
+
if ((could_not_decrypt || (decrypt_okay_rc <= -3)) &&
!(s->flags & MUTT_DISPLAY))
{
goto out;
}
}
-
+
/*
* Now, copy cleartext to the screen.
*/
if (clearsign)
{
rewind (tmpfp);
- if (tmpfp)
+ if (tmpfp)
pgp_copy_clearsigned (tmpfp, s, body_charset);
}
else if (pgpout)
state_attach_puts (_("[-- Error: could not find beginning of PGP message! --]\n\n"), s);
return -1;
}
-
+
return rc;
}
char tempfile[_POSIX_PATH_MAX];
char buf[HUGE_STRING];
FILE *tfp;
-
+
short sgn = 0;
short enc = 0;
short key = 0;
-
+
if (b->type != TYPETEXT)
return 0;
unlink (tempfile);
return 0;
}
-
+
if ((tfp = fopen (tempfile, "r")) == NULL)
{
unlink (tempfile);
return 0;
}
-
+
while (fgets (buf, sizeof (buf), tfp))
{
if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0)
return 0;
/* fix the content type */
-
+
mutt_set_parameter ("format", "fixed", &b->parameter);
if (enc)
mutt_set_parameter ("x-action", "pgp-encrypted", &b->parameter);
mutt_set_parameter ("x-action", "pgp-signed", &b->parameter);
else if (key)
mutt_set_parameter ("x-action", "pgp-keys", &b->parameter);
-
+
return 1;
}
return rv;
}
-
+
pid_t thepid;
int badsig = -1;
int rv;
-
+
snprintf (sigfile, sizeof (sigfile), "%s.asc", tempfile);
-
+
if(!(fp = safe_fopen (sigfile, "w")))
{
mutt_perror(sigfile);
return -1;
}
-
+
fseeko (s->fpin, sigbdy->offset, 0);
mutt_copy_bytes (s->fpin, fp, sigbdy->length);
safe_fclose (&fp);
-
+
mutt_mktemp (pgperrfile, sizeof (pgperrfile));
if(!(pgperr = safe_fopen(pgperrfile, "w+")))
{
unlink(sigfile);
return -1;
}
-
+
crypt_current_time (s, "PGP");
-
- if((thepid = pgp_invoke_verify (NULL, &pgpout, NULL,
+
+ if((thepid = pgp_invoke_verify (NULL, &pgpout, NULL,
-1, -1, fileno(pgperr),
tempfile, sigfile)) != -1)
{
if (pgp_copy_checksig (pgpout, s->fpout) >= 0)
badsig = 0;
-
-
+
+
safe_fclose (&pgpout);
fflush (pgperr);
rewind (pgperr);
-
+
if (pgp_copy_checksig (pgperr, s->fpout) >= 0)
badsig = 0;
if ((rv = mutt_wait_filter (thepid)))
badsig = -1;
-
+
dprint (1, (debugfile, "pgp_verify_one: mutt_wait_filter returned %d.\n", rv));
}
mutt_unlink (pgperrfile);
dprint (1, (debugfile, "pgp_verify_one: returning %d.\n", badsig));
-
+
return badsig;
}
}
memset (&s, 0, sizeof (STATE));
-
+
s.fpin = fp;
s.fpout = tempfp;
-
+
mutt_body_handler (top, &s);
safe_fclose (&tempfp);
mutt_endwin (NULL);
set_option(OPTDONTHANDLEPGPKEYS);
-
+
for(; top; top = top->next)
{
if(!tag || top->tagged)
pgp_extract_keys_from_attachment (fp, top);
-
+
if(!tag)
break;
}
-
+
unset_option(OPTDONTHANDLEPGPKEYS);
}
char pgptmpfile[_POSIX_PATH_MAX];
pid_t thepid;
int rv;
-
+
mutt_mktemp (pgperrfile, sizeof (pgperrfile));
if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL)
{
fputs (PgpPass, pgpin);
fputc ('\n', pgpin);
safe_fclose (&pgpin);
-
+
/* Read the output from PGP, and make sure to change CRLF to LF, otherwise
* read_mime_header has a hard time parsing the message.
*/
}
rewind (fpout);
-
+
if ((tattach = mutt_read_mime_header (fpout, 0)) != NULL)
{
/*
tattach->parts->mime_headers = NULL;
}
- /*
+ /*
* if a multipart/signed is the _only_ sub-part of a
* multipart/encrypted, cache signature verification
* status.
*
*/
-
+
if (mutt_is_multipart_signed (tattach) && !tattach->next)
a->goodsig |= tattach->goodsig;
-
+
if (s->flags & MUTT_DISPLAY)
{
state_puts ("\n", s);
int err = 0;
int empty = 1;
pid_t thepid;
-
+
convert_to_7bit (a); /* Signed data _must_ be in 7-bit format. */
mutt_mktemp (sigfile, sizeof (sigfile));
unlink(sigfile);
return NULL;
}
-
+
mutt_write_mime_header (a, sfp);
fputc ('\n', sfp);
mutt_write_mime_body (a, sfp);
safe_fclose (&sfp);
-
+
if ((thepid = pgp_invoke_sign (&pgpin, &pgpout, &pgperr,
-1, -1, -1, signedfile)) == -1)
{
unlink(signedfile);
return NULL;
}
-
+
if (!pgp_use_gpg_agent())
fputs(PgpPass, pgpin);
fputc('\n', pgpin);
safe_fclose (&pgpin);
-
+
/*
* Read back the PGP signature. Also, change MESSAGE=>SIGNATURE as
* recommended for future releases of PGP.
safe_fclose (&pgperr);
safe_fclose (&pgpout);
unlink (signedfile);
-
+
if (fclose (fp) != 0)
{
mutt_perror ("fclose");
int err = 0;
int empty = 0;
pid_t thepid;
-
+
mutt_mktemp (tempfile, sizeof (tempfile));
if ((fpout = safe_fopen (tempfile, "w+")) == NULL)
{
safe_fclose (&pgperr);
return NULL;
}
-
+
if (sign)
convert_to_7bit (a);
-
+
mutt_write_mime_header (a, fptmp);
fputc ('\n', fptmp);
mutt_write_mime_body (a, fptmp);
safe_fclose (&fptmp);
-
- if ((thepid = pgp_invoke_encrypt (&pgpin, NULL, NULL, -1,
+
+ if ((thepid = pgp_invoke_encrypt (&pgpin, NULL, NULL, -1,
fileno (fpout), fileno (pgperr),
pgpinfile, keylist, sign)) == -1)
{
fputc ('\n', pgpin);
}
safe_fclose (&pgpin);
-
+
if(mutt_wait_filter (thepid) && option(OPTPGPCHECKEXIT))
empty=1;
unlink(pgpinfile);
-
+
fflush (fpout);
rewind (fpout);
if(!empty)
mutt_generate_boundary(&t->parameter);
mutt_set_parameter("protocol", "application/pgp-encrypted", &t->parameter);
-
+
t->parts = mutt_new_body ();
t->parts->type = TYPEAPPLICATION;
t->parts->subtype = safe_strdup ("pgp-encrypted");
char pgpoutfile[_POSIX_PATH_MAX];
char pgperrfile[_POSIX_PATH_MAX];
char pgpinfile[_POSIX_PATH_MAX];
-
+
char body_charset[STRING];
char *from_charset;
const char *send_charset;
-
+
FILE *pgpout = NULL, *pgperr = NULL, *pgpin = NULL;
FILE *fp;
return NULL;
if (ascii_strcasecmp (a->subtype, "plain"))
return NULL;
-
+
if ((fp = fopen (a->filename, "r")) == NULL)
{
mutt_perror (a->filename);
return NULL;
}
-
+
mutt_mktemp (pgpinfile, sizeof (pgpinfile));
if ((pgpin = safe_fopen (pgpinfile, "w")) == NULL)
{
* we have to convert from that to utf-8. If noconv is not set,
* we have to convert from $charset to utf-8.
*/
-
+
mutt_get_body_charset (body_charset, sizeof (body_charset), a);
if (a->noconv)
from_charset = body_charset;
- else
+ else
from_charset = Charset;
-
+
if (!mutt_is_us_ascii (body_charset))
{
int c;
FGETCONV *fc;
-
+
if (flags & ENCRYPT)
send_charset = "us-ascii";
else
fc = fgetconv_open (fp, from_charset, "utf-8", 0);
while ((c = fgetconv (fc)) != EOF)
fputc (c, pgpin);
-
+
fgetconv_close (&fc);
}
else
{
mutt_perror (pgpout ? pgperrfile : pgpoutfile);
unlink (pgpinfile);
- if (pgpout)
+ if (pgpout)
{
safe_fclose (&pgpout);
unlink (pgpoutfile);
}
return NULL;
}
-
+
unlink (pgperrfile);
- if ((thepid = pgp_invoke_traditional (&pgpin, NULL, NULL,
+ if ((thepid = pgp_invoke_traditional (&pgpin, NULL, NULL,
-1, fileno (pgpout), fileno (pgperr),
pgpinfile, keylist, flags)) == -1)
{
rewind (pgpout);
rewind (pgperr);
-
+
if(!empty)
empty = (fgetc (pgpout) == EOF);
safe_fclose (&pgpout);
-
+
err = 0;
-
+
while (fgets (buff, sizeof (buff), pgperr))
{
err = 1;
fputs (buff, stdout);
}
-
+
safe_fclose (&pgperr);
-
+
if (err)
mutt_any_key_to_continue (NULL);
-
+
if (empty)
{
if (flags & SIGN)
unlink (pgpoutfile);
return NULL;
}
-
+
b = mutt_new_body ();
-
+
b->encoding = ENC7BIT;
b->type = TYPETEXT;
b->subtype = safe_strdup ("plain");
-
+
mutt_set_parameter ("x-action", flags & ENCRYPT ? "pgp-encrypted" : "pgp-signed",
&b->parameter);
mutt_set_parameter ("charset", send_charset, &b->parameter);
-
+
b->filename = safe_strdup (pgpoutfile);
-
+
b->disposition = DISPNONE;
b->unlink = 1;
b->noconv = 1;
b->use_disp = 0;
-
+
if (!(flags & ENCRYPT))
b->encoding = a->encoding;
-
+
return b;
}
return msg->security;
/* If autoinline and no crypto options set, then set inline. */
- if (option (OPTPGPAUTOINLINE) &&
+ if (option (OPTPGPAUTOINLINE) &&
!((msg->security & APPLICATION_PGP) && (msg->security & (SIGN|ENCRYPT))))
msg->security |= INLINE;
if (msg->security & (ENCRYPT | SIGN))
{
- snprintf (promptbuf, sizeof (promptbuf),
+ snprintf (promptbuf, sizeof (promptbuf),
_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, %s format, (c)lear, or (o)ppenc mode? "),
(msg->security & INLINE) ? _("PGP/M(i)ME") : _("(i)nline"));
prompt = promptbuf;
if (msg->security & (ENCRYPT | SIGN))
{
- snprintf (promptbuf, sizeof (promptbuf),
+ snprintf (promptbuf, sizeof (promptbuf),
_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, %s format, or (c)lear? "),
(msg->security & INLINE) ? _("PGP/M(i)ME") : _("(i)nline"));
prompt = promptbuf;
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/* The PGP invocation interface - not really beautiful. */
pid_t pgp_invoke_decode (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname, short need_passphrase);
pid_t pgp_invoke_verify (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname, const char *sig_fname);
pid_t pgp_invoke_decrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname);
pid_t pgp_invoke_sign (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname);
pid_t pgp_invoke_encrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr,
int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname, const char *uids, int sign);
pid_t pgp_invoke_export (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *uids);
pid_t pgp_invoke_verify_key (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *uids);
pid_t pgp_invoke_list_keys (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
pgp_ring_t keyring, LIST *hints);
pid_t pgp_invoke_traditional (FILE **pgpin, FILE **pgpout, FILE **pgperr,
int pgpinfd, int pgpoutfd, int pgperrfd,
/*
* Copyright (C) 1997-2003 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- */
+ */
/* This file contains the new pgp invocation code. Note that this
* is almost entirely format based.
char fmt[16];
struct pgp_command_context *cctx = (struct pgp_command_context *) data;
int optional = (flags & MUTT_FORMAT_OPTIONAL);
-
+
switch (op)
{
case 'r':
optional = 0;
break;
}
-
+
case 'a':
{
if (!optional)
optional = 0;
break;
}
-
+
case 's':
{
if (!optional)
optional = 0;
break;
}
-
+
case 'f':
{
if (!optional)
optional = 0;
break;
}
-
+
case 'p':
{
if (!optional)
{
struct pgp_command_context cctx;
char cmd[HUGE_STRING];
-
+
memset (&cctx, 0, sizeof (cctx));
if (!format || !*format)
return (pid_t) -1;
-
+
cctx.need_passphrase = need_passphrase;
cctx.fname = fname;
cctx.sig_fname = sig_fname;
else
cctx.signas = PgpDefaultKey;
cctx.ids = ids;
-
+
mutt_pgp_command (cmd, sizeof (cmd), &cctx, format);
-
+
return mutt_create_filter_fd (cmd, pgpin, pgpout, pgperr,
pgpinfd, pgpoutfd, pgperrfd);
}
/*
* The exported interface.
- *
+ *
* This is historic and may be removed at some point.
*
*/
pid_t pgp_invoke_decode (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname, short need_passphrase)
{
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
}
pid_t pgp_invoke_verify (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname, const char *sig_fname)
{
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
}
pid_t pgp_invoke_decrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname)
{
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
}
pid_t pgp_invoke_sign (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *fname)
{
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
char _fname[_POSIX_PATH_MAX + SHORT_STRING];
char cmd[HUGE_STRING];
struct pgp_command_context cctx;
-
+
memset (&cctx, 0, sizeof (cctx));
-
+
mutt_quote_filename (_fname, sizeof (_fname), fname);
cctx.fname = _fname;
if (PgpSignAs && *PgpSignAs)
cctx.signas = PgpSignAs;
else
cctx.signas = PgpDefaultKey;
-
+
mutt_pgp_command (cmd, sizeof (cmd), &cctx, PgpImportCommand);
mutt_system (cmd);
}
int devnull;
char *personal;
-
+
struct pgp_command_context cctx;
if (!PgpGetkeysCommand) return;
-
+
memset (&cctx, 0, sizeof (cctx));
personal = addr->personal;
addr->personal = NULL;
-
+
*tmp = '\0';
mutt_addrlist_to_local (addr);
rfc822_write_address_single (tmp, sizeof (tmp), addr, 0);
mutt_quote_filename (buff, sizeof (buff), tmp);
addr->personal = personal;
-
+
cctx.ids = buff;
-
+
mutt_pgp_command (cmd, sizeof (cmd), &cctx, PgpGetkeysCommand);
devnull = open ("/dev/null", O_RDWR);
}
pid_t pgp_invoke_export (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *uids)
{
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
}
pid_t pgp_invoke_verify_key (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
const char *uids)
{
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
}
pid_t pgp_invoke_list_keys (FILE **pgpin, FILE **pgpout, FILE **pgperr,
- int pgpinfd, int pgpoutfd, int pgperrfd,
+ int pgpinfd, int pgpoutfd, int pgperrfd,
pgp_ring_t keyring, LIST *hints)
{
BUFFER *uids;
/*
* Copyright (C) 1996-1997,2007 Michael R. Elkins <me@mutt.org>
* Copyright (c) 1998-2003 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
return 'd';
else if (flags & KEYFLAG_CRITICAL)
return 'c';
- else
+ else
return ' ';
}
/*
* Format an entry on the PGP key selection menu.
- *
+ *
* %n number
* %k key id %K key id of the principal key
* %u user id
entry.uid = KeyTable[num];
entry.num = num + 1;
- mutt_FormatString (s, l, 0, MuttIndexWindow->cols, NONULL (PgpEntryFormat), pgp_entry_fmt,
+ mutt_FormatString (s, l, 0, MuttIndexWindow->cols, NONULL (PgpEntryFormat), pgp_entry_fmt,
(unsigned long) &entry, MUTT_FORMAT_ARROWCURSOR);
}
pgp_uid_t **s = (pgp_uid_t **) a;
pgp_uid_t **t = (pgp_uid_t **) b;
- if ((r = mutt_strcasecmp (pgp_fpr_or_lkeyid ((*s)->parent),
+ if ((r = mutt_strcasecmp (pgp_fpr_or_lkeyid ((*s)->parent),
pgp_fpr_or_lkeyid ((*t)->parent))))
return r > 0;
else
return r < 0;
if ((r = mutt_strcasecmp ((*s)->addr, (*t)->addr)))
return r > 0;
- return (mutt_strcasecmp (pgp_fpr_or_lkeyid ((*s)->parent),
+ return (mutt_strcasecmp (pgp_fpr_or_lkeyid ((*s)->parent),
pgp_fpr_or_lkeyid ((*t)->parent))) > 0;
}
safe_fclose (&fp);
safe_fclose (&devnull);
mutt_clear_error ();
- snprintf (cmd, sizeof (cmd), _("Key ID: 0x%s"),
+ snprintf (cmd, sizeof (cmd), _("Key ID: 0x%s"),
pgp_keyid (pgp_principal_key (KeyTable[menu->current]->parent)));
mutt_do_pager (cmd, tempfile, 0, NULL);
menu->redraw = REDRAW_FULL;
{
char *s = "";
char buff[LONG_STRING];
-
+
if (KeyTable[menu->current]->flags & KEYFLAG_CANTUSE)
s = N_("ID is expired/disabled/revoked.");
else switch (KeyTable[menu->current]->trust & 0x03)
mutt_message _("Invoking PGP...");
- if ((thepid =
+ if ((thepid =
pgp_invoke_export (NULL, NULL, NULL, -1,
fileno (tempfp), fileno (devnull), tmp)) == -1)
{
{
/*
* There was precisely one strong match on a valid ID.
- *
+ *
* Proceed without asking the user.
*/
pgp_remove_key (&matches, the_strong_valid_key);
k = the_strong_valid_key;
}
- else
+ else
{
- /*
+ /*
* Else: Ask the user.
*/
if ((k = pgp_select_key (matches, a, NULL)))
/*
* Copyright (C) 1997-2002 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
}
}
-/* return values:
+/* return values:
* 1 = sign only
* 2 = encrypt only
void pgp_free_sig (pgp_sig_t **sigp)
{
pgp_sig_t *sp, *q;
-
+
if (!sigp || !*sigp)
return;
-
+
for (sp = *sigp; sp; sp = q)
{
q = sp->next;
FREE (&sp);
}
-
+
*sigp = NULL;
}
if ((*kpp)->parent && (*kpp)->parent != *kpp)
*kpp = (*kpp)->parent;
-
+
/* Order is important here:
*
* - First free all children.
*kpp = NULL;
}
-
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/*
* Copyright (C) 2001 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#include <string.h>
#include <ctype.h>
-static const struct
+static const struct
{
short id;
const char *name;
-}
-HashAlgorithms[] =
+}
+HashAlgorithms[] =
{
{ 1, "pgp-md5" },
{ 2, "pgp-sha1" },
static const char *pgp_hash_to_micalg (short id)
{
int i;
-
+
for (i = 0; HashAlgorithms[i].id >= 0; i++)
if (HashAlgorithms[i].id == id)
return HashAlgorithms[i].name;
char *r;
STATE state;
-
+
memset (&state, 0, sizeof (STATE));
state.fpin = in;
state.fpout = out;
-
+
/* find the beginning of ASCII armor */
-
+
while ((r = fgets (line, sizeof (line), in)) != NULL)
{
if (!strncmp (line, "-----BEGIN", 10))
}
/* skip the armor header */
-
+
while ((r = fgets (line, sizeof (line), in)) != NULL)
{
SKIPWS (r);
dprint (1, (debugfile, "pgp_dearmor: Armor header doesn't end.\n"));
return;
}
-
+
/* actual data starts here */
start = ftello (in);
-
+
/* find the checksum */
-
+
while ((r = fgets (line, sizeof (line), in)) != NULL)
{
if (*line == '=' || !strncmp (line, "-----END", 8))
dprint (1, (debugfile, "pgp_dearmor: Can't find end of ASCII armor.\n"));
return;
}
-
+
if ((end = ftello (in) - strlen (line)) < start)
{
dprint (1, (debugfile, "pgp_dearmor: end < start???\n"));
return;
}
-
+
if (fseeko (in, start, SEEK_SET) == -1)
{
dprint (1, (debugfile, "pgp_dearmor: Can't seekto start.\n"));
p[0]&0x3f, PT_SIG));
return -1;
}
-
+
if (len >= 18 && p[1] == 3)
/* version 3 signature */
return (short) p[17];
{
FILE *in = NULL;
FILE *out = NULL;
-
+
char tempfile[_POSIX_PATH_MAX];
-
+
unsigned char *p;
size_t l;
-
+
short rv = -1;
-
+
mutt_mktemp (tempfile, sizeof (tempfile));
if ((out = safe_fopen (tempfile, "w+")) == NULL)
{
goto bye;
}
unlink (tempfile);
-
+
if ((in = fopen (fname, "r")) == NULL)
{
mutt_perror (fname);
goto bye;
}
-
+
pgp_dearmor (in, out);
rewind (out);
{
dprint (1, (debugfile, "pgp_find_hash: No packet.\n"));
}
-
+
bye:
-
+
safe_fclose (&in);
safe_fclose (&out);
pgp_release_packet ();
{
return pgp_hash_to_micalg (pgp_find_hash (fname));
}
-
/*
* Copyright (C) 2001-2002,2007 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
plen = 0;
FREE (&pbuf);
}
-
/*
* Copyright (C) 2001 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
-/*
+/*
* Definitions for a rudimentary PGP packet parser which is shared
* by mutt proper and the PGP public key ring lister.
*/
/*
* Copyright (C) 1997-2003 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
/*
* This is a "simple" PGP key ring dumper.
- *
+ *
* The output format is supposed to be compatible to the one GnuPG
* emits and Mutt expects.
- *
+ *
* Note that the code of this program could be considerably less
* complex, but most of it was taken from mutt's second generation
* key ring parser.
- *
+ *
* You can actually use this to put together some fairly general
* PGP key management applications.
*
int main (int argc, char * const argv[])
{
int c;
-
+
short version = 2;
short secring = 0;
-
+
const char *_kring = NULL;
char *env_pgppath, *env_home;
_kring = optarg;
break;
}
-
+
case '2': case '5':
{
version = c - '0';
break;
}
-
+
case 's':
{
secring = 1;
break;
}
-
+
default:
{
fprintf (stderr, "usage: %s [-k <key ring> | [-2 | -5] [ -s] [-S] [-f]] [hints]\n",
fprintf (stderr, "%s: Can't determine your PGPPATH.\n", argv[0]);
exit (1);
}
-
+
if (secring)
snprintf (kring, sizeof (kring), "%s/secring.%s", pgppath, version == 2 ? "pgp" : "skr");
else
snprintf (kring, sizeof (kring), "%s/pubring.%s", pgppath, version == 2 ? "pgp" : "pkr");
}
-
+
pgpring_find_candidates (kring, (const char**) argv + optind, argc - optind);
-
+
return 0;
}
pgp_make_pgp2_fingerprint (&buff[j], digest);
p->fingerprint = binary_fingerprint_to_string (digest, MD5_DIGEST_LENGTH);
}
-
+
expl = 0;
for (i = 0; i < 2; i++)
expl = (expl << 8) + buff[j++];
{
p->fingerprint = binary_fingerprint_to_string (digest, SHA_DIGEST_LENGTH);
}
-
+
for (k = 0; k < 2; k++)
{
for (id = 0, i = SHA_DIGEST_LENGTH - 8 + k * 4;
for (i = 0; i < 4; i++)
signerid2 = (signerid2 << 8) + buff[j++];
-
+
if (sigtype == 0x20 || sigtype == 0x28)
p->flags |= KEYFLAG_REVOKED;
s->sid1 = signerid1;
s->sid2 = signerid2;
}
-
+
return 0;
}
signerid1 = (signerid1 << 8) + buff[j++];
for (i = 0; i < 4; i++)
signerid2 = (signerid2 << 8) + buff[j++];
-
+
break;
}
case 10: /* CMR key */
s->sid2 = signerid2;
}
-
+
return 0;
}
{
case 2:
case 3:
- return pgp_parse_pgp2_sig (buff, l, p, sig);
+ return pgp_parse_pgp2_sig (buff, l, p, sig);
case 4:
return pgp_parse_pgp3_sig (buff, l, p, sig);
default:
pgp_sig_t **lsig = NULL;
FGETPOS(fp,pos);
-
+
while (!err && (buff = pgp_read_packet (fp, &l)) != NULL)
{
last_pt = pt;
pt = buff[0] & 0x3f;
/* check if we have read the complete key block. */
-
+
if ((pt == PT_SECKEY || pt == PT_PUBKEY) && root)
{
FSETPOS(fp, pos);
return root;
}
-
+
switch (pt)
{
case PT_SECKEY:
last = &p->next;
addr = &p->address;
lsig = &p->sigs;
-
+
if (pt == PT_SUBKEY || pt == PT_SUBSECKEY)
{
p->flags |= KEYFLAG_SUBKEY;
while (*addr) addr = &(*addr)->next;
}
}
-
+
if (pt == PT_SECKEY || pt == PT_SUBSECKEY)
p->flags |= KEYFLAG_SECRET;
pgp_sig_t *signature = safe_calloc (sizeof (pgp_sig_t), 1);
*lsig = signature;
lsig = &signature->next;
-
+
pgp_parse_sig (buff, l, p, signature);
}
break;
uid->trust = 0;
addr = &uid->next;
lsig = &uid->sigs;
-
+
/* the following tags are generated by
* pgp 2.6.3in.
*/
if (err)
pgp_free_key (&root);
-
- return root;
+
+ return root;
}
static int pgpring_string_matches_hint (const char *s, const char *hints[], int nhints)
return 0;
}
-/*
+/*
* Go through the key ring file and look for keys with
* matching IDs.
*/
size_t l = 0;
short err = 0;
-
+
if ((rfp = fopen (ringfile, "r")) == NULL)
{
char *error_buf;
while (!err && (buff = pgp_read_packet (rfp, &l)) != NULL)
{
pt = buff[0] & 0x3f;
-
+
if (l < 1)
continue;
-
+
if ((pt == PT_SECKEY) || (pt == PT_PUBKEY))
{
keypos = pos;
if ((p = pgp_parse_keyblock (rfp)) == NULL)
err = 1;
-
+
pgpring_dump_keyblock (p);
pgp_free_key (&p);
}
}
}
-static void print_fingerprint (pgp_key_t p)
+static void print_fingerprint (pgp_key_t p)
{
if (!p->fingerprint)
return;
short first;
struct tm *tp;
time_t t;
-
+
for (; p; p = p->next)
{
first = 1;
else
printf ("sec:");
}
- else
+ else
{
if (p->flags & KEYFLAG_SUBKEY)
printf ("sub:");
else
printf ("pub:");
}
-
+
if (p->flags & KEYFLAG_REVOKED)
putchar ('r');
if (p->flags & KEYFLAG_EXPIRED)
printf (":%d:%d:%s:%04d-%02d-%02d::::", p->keylen, p->numalg, p->keyid,
1900 + tp->tm_year, tp->tm_mon + 1, tp->tm_mday);
-
+
print_userid (uid->addr);
printf ("::");
putchar ('D');
printf (":\n");
- if (dump_fingerprints)
+ if (dump_fingerprints)
print_fingerprint (p);
}
-
+
if (dump_signatures)
{
if (first) pgpring_dump_signatures (p->sigs);
/*
* Copyright (C) 2000-2002 Vsevolod Volkov <vvv@mutt.org.ua>
* Copyright (C) 2006-2007,2009 Rocco Rutte <pdmef@gmx.net>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
msg->fp = fopen (cache->path, "r");
if (msg->fp)
return 0;
-
+
mutt_perror (cache->path);
mutt_sleep (2);
return -1;
/*
* Copyright (C) 2000-2003 Vsevolod Volkov <vvv@mutt.org.ua>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _POP_H
#define _POP_H 1
/*
* Copyright (C) 2000-2001 Vsevolod Volkov <vvv@mutt.org.ua>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
if (ret == 0)
{
snprintf (buf, sizeof (buf), "PASS %s\r\n", pop_data->conn->account.pass);
- ret = pop_query_d (pop_data, buf, sizeof (buf),
+ ret = pop_query_d (pop_data, buf, sizeof (buf),
#ifdef DEBUG
/* don't print the password unless we're at the ungodly debugging level */
debuglevel < MUTT_SOCK_LOG_FULL ? "PASS *\r\n" :
snprintf (auth_cmd, auth_cmd_len, "AUTH OAUTHBEARER %s\r\n", oauthbearer);
FREE (&oauthbearer);
- ret = pop_query_d (pop_data, auth_cmd, strlen (auth_cmd),
+ ret = pop_query_d (pop_data, auth_cmd, strlen (auth_cmd),
#ifdef DEBUG
/* don't print the bearer token unless we're at the ungodly debugging level */
debuglevel < MUTT_SOCK_LOG_FULL ? "AUTH OAUTHBEARER *\r\n" :
/*
* Copyright (C) 2000-2003 Vsevolod Volkov <vvv@mutt.org.ua>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/*
* Copyright (C) 1996-2000,2007,2010,2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifdef HAVE_INTTYPES_H
#define mutt_collapse_thread(x,y) _mutt_traverse_thread (x,y,MUTT_THREAD_COLLAPSE)
#define mutt_uncollapse_thread(x,y) _mutt_traverse_thread (x,y,MUTT_THREAD_UNCOLLAPSE)
-#define mutt_get_hidden(x,y)_mutt_traverse_thread (x,y,MUTT_THREAD_GET_HIDDEN)
+#define mutt_get_hidden(x,y)_mutt_traverse_thread (x,y,MUTT_THREAD_GET_HIDDEN)
#define mutt_thread_contains_unread(x,y) _mutt_traverse_thread (x,y,MUTT_THREAD_UNREAD)
#define mutt_thread_next_unread(x,y) _mutt_traverse_thread(x,y,MUTT_THREAD_NEXT_UNREAD)
int _mutt_traverse_thread (CONTEXT *ctx, HEADER *hdr, int flag);
int mutt_parse_unscore (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_parse_unhook (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_pattern_func (int, char *);
-int mutt_pipe_attachment (FILE *, BODY *, const char *, char *);
+int mutt_pipe_attachment (FILE *, BODY *, const char *, char *);
int mutt_print_attachment (FILE *, BODY *);
int mutt_query_complete (char *, size_t);
int mutt_query_variables (LIST *queries);
/*
* Copyright (C) 1996-2000,2003,2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
static ADDRESS *result_to_addr (QUERY *r)
{
static ADDRESS *tmp;
-
+
if (!(tmp = rfc822_cpy_adr (r->addr, 0)))
return NULL;
-
+
if(!tmp->next && !tmp->personal)
tmp->personal = safe_strdup (r->name);
-
+
mutt_addrlist_to_intl (tmp, NULL);
return tmp;
}
if (!quiet)
mutt_message ("%s", msg);
}
-
+
return first;
}
return 0;
if (table[n].data->addr)
{
- if (table[n].data->addr->personal &&
+ if (table[n].data->addr->personal &&
!regexec (re, table[n].data->addr->personal, 0, NULL, 0))
return 0;
if (table[n].data->addr->mailbox &&
return 0;
#endif
}
-
+
return REG_NOMATCH;
}
{
ENTRY *cur = &((ENTRY *) menu->data)[n];
int ot = cur->tagged;
-
+
cur->tagged = m >= 0 ? m : !cur->tagged;
return cur->tagged - ot;
}
if (op == OP_QUERY)
{
- menu->data = QueryTable =
+ menu->data = QueryTable =
(ENTRY *) safe_calloc (menu->max, sizeof (ENTRY));
- for (i = 0, queryp = results; queryp;
+ for (i = 0, queryp = results; queryp;
queryp = queryp->next, i++)
QueryTable[i].data = queryp;
}
menu->data = QueryTable;
- for (i = 0, queryp = results; queryp;
+ for (i = 0, queryp = results; queryp;
queryp = queryp->next, i++)
{
/* once we hit new entries, clear/init the tag */
int tagged = 0;
size_t curpos = 0;
- memset (buf, 0, buflen);
+ memset (buf, 0, buflen);
/* check for tagged entries */
for (i = 0; i < menu->max; i++)
rfc822_write_address (buf, buflen, tmpa, 0);
rfc822_free_address (&tmpa);
}
-
+
}
free_query (&results);
/*
* Copyright (C) 1996-2000,2002,2007,2010 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2006 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
* %M = MIME subtype
* %n = attachment number
* %s = size
- * %u = unlink
+ * %u = unlink
*/
const char *mutt_attach_fmt (char *dest,
size_t destlen,
ATTACHPTR *aptr = (ATTACHPTR *) data;
int optional = (flags & MUTT_FORMAT_OPTIONAL);
size_t l;
-
+
switch (op)
{
case 'C':
break;
}
}
- else if(aptr->content->description ||
+ else if(aptr->content->description ||
(mutt_is_message_type (aptr->content->type, aptr->content->subtype)
&& MsgFmt && aptr->content->hdr))
break;
if (aptr->content->filename && *aptr->content->filename == '/')
{
char path[_POSIX_PATH_MAX];
-
+
strfcpy (path, aptr->content->filename, sizeof (path));
mutt_pretty_mailbox (path, sizeof (path));
mutt_format_s (dest, destlen, prefix, path);
}
else
l = aptr->content->length;
-
+
if(!optional)
{
mutt_pretty_size (tmp, sizeof(tmp), l);
default:
*dest = 0;
}
-
+
if (optional)
mutt_FormatString (dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0);
else if (flags & MUTT_FORMAT_OPTIONAL)
int is_message;
int append = 0;
int rc;
-
- if (body->filename)
+
+ if (body->filename)
{
if (directory && *directory)
mutt_concat_path (buf, *directory, mutt_basename (body->filename), sizeof (buf));
mutt_clear_error ();
return -1;
}
-
+
prompt = NULL;
mutt_expand_path (buf, sizeof (buf));
-
- is_message = (fp &&
- body->hdr &&
- body->encoding != ENCBASE64 &&
- body->encoding != ENCQUOTEDPRINTABLE &&
+
+ is_message = (fp &&
+ body->hdr &&
+ body->encoding != ENCBASE64 &&
+ body->encoding != ENCQUOTEDPRINTABLE &&
mutt_is_message_type (body->type, body->subtype));
-
+
if (is_message)
{
struct stat st;
-
+
/* check to make sure that this file is really the one the user wants */
if ((rc = mutt_save_confirm (buf, &st)) == 1)
{
prompt = _("Save to file: ");
continue;
- }
+ }
else if (rc == -1)
return -1;
strfcpy(tfile, buf, sizeof(tfile));
continue;
}
}
-
+
mutt_message _("Saving...");
if (mutt_save_attachment (fp, body, tfile, append, (hdr || !is_message) ? hdr : body->hdr) == 0)
{
}
return 0;
}
-
+
void mutt_save_attachment_list (ATTACH_CONTEXT *actx, FILE *fp, int tag, BODY *top, HEADER *hdr, MUTTMENU *menu)
{
char buf[_POSIX_PATH_MAX], tfile[_POSIX_PATH_MAX];
}
}
}
- else
+ else
{
if (tag && menu && top->aptr)
{
menu_check_recenter (menu);
menu->redraw |= REDRAW_MOTION;
}
-
+
if (!option (OPTATTACHSPLIT) && (rc == 0))
mutt_message _("Attachment saved.");
}
void mutt_print_attachment_list (ATTACH_CONTEXT *actx, FILE *fp, int tag, BODY *top)
{
STATE state;
-
+
pid_t thepid;
if (query_quadoption (OPT_PRINT, tag ? _("Print tagged attachment(s)?") : _("Print attachment?")) != MUTT_YES)
return;
/*
* Copyright (C) 1999-2004 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * Boston, MA 02110-1301, USA.
*/
#if HAVE_CONFIG_H
{
short count = 0;
short i;
-
+
for (i = 0; i < actx->idxlen; i++)
if (actx->idx[i]->content->tagged)
count++;
-
+
return count;
}
strfcpy (prompt, _("Bounce tagged messages to: "), sizeof (prompt));
buf[0] = '\0';
- if (mutt_get_field (prompt, buf, sizeof (buf), MUTT_ALIAS)
+ if (mutt_get_field (prompt, buf, sizeof (buf), MUTT_ALIAS)
|| buf[0] == '\0')
return;
}
adr = mutt_expand_aliases (adr);
-
+
if (mutt_addrlist_to_intl (adr, &err) < 0)
{
mutt_error (_("Bad IDN: '%s'"), err);
rfc822_free_address (&adr);
return;
}
-
+
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), adr, 1);
/*
* See commands.c.
*/
- snprintf (prompt, sizeof (prompt) - 4,
+ snprintf (prompt, sizeof (prompt) - 4,
(p ? _("Bounce message to %s") : _("Bounce messages to %s")), buf);
-
+
if (mutt_strwidth (prompt) > MuttMessageWindow->cols - extra_space)
{
mutt_format_string (prompt, sizeof (prompt) - 4,
mutt_message (p ? _("Message not bounced.") : _("Messages not bounced."));
return;
}
-
+
mutt_window_clearline (MuttMessageWindow, 0);
-
+
if (cur)
ret = mutt_bounce_message (fp, cur->hdr, adr);
else
\f
/**
**
- ** resend-message, from the attachment menu
+ ** resend-message, from the attachment menu
**
**
**/
\f
/**
**
- ** forward-message, from the attachment menu
+ ** forward-message, from the attachment menu
**
**/
-
+
/* try to find a common parent message for the tagged attachments. */
static ATTACHPTR *find_common_parent (ATTACH_CONTEXT *actx, short nattach)
for (i = 0; i < actx->idxlen; i++)
if (actx->idx[i]->content->tagged)
break;
-
+
while (--i >= 0)
{
if (mutt_is_message_type (actx->idx[i]->content->type, actx->idx[i]->content->subtype))
return NULL;
}
-/*
+/*
* check whether attachment #i is a parent of the attachment
* pointed to by cur
- *
- * Note: This and the calling procedure could be optimized quite a
+ *
+ * Note: This and the calling procedure could be optimized quite a
* bit. For now, it's not worth the effort.
*/
{
short i;
ATTACHPTR *parent = NULL;
-
+
if (cur)
{
for (i = 0; i < actx->idxlen; i++)
{
- if (mutt_is_message_type (actx->idx[i]->content->type, actx->idx[i]->content->subtype)
+ if (mutt_is_message_type (actx->idx[i]->content->type, actx->idx[i]->content->subtype)
&& is_parent (i, actx, cur))
parent = actx->idx[i];
if (actx->idx[i]->content == cur)
}
else if (nattach)
parent = find_common_parent (actx, nattach);
-
+
return parent;
}
{
int chflags = CH_DECODE;
char prefix[SHORT_STRING];
-
+
if (option (OPTWEED))
chflags |= CH_WEED | CH_REORDER;
if (_prefix)
strfcpy (prefix, _prefix, sizeof (prefix));
else if (!option (OPTTEXTFLOWED))
- _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix),
+ _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix),
Context, hdr, 0);
else
strfcpy (prefix, ">", sizeof (prefix));
chflags |= CH_PREFIX;
}
-
+
mutt_copy_header (ifp, hdr, ofp, chflags, quote ? prefix : NULL);
}
-/* Attach all the body parts which can't be decoded.
+/* Attach all the body parts which can't be decoded.
* This code is shared by forwarding and replying. */
-static BODY ** copy_problematic_attachments (BODY **last,
+static BODY ** copy_problematic_attachments (BODY **last,
ATTACH_CONTEXT *actx,
short force)
{
short i;
-
+
for (i = 0; i < actx->idxlen; i++)
{
- if (actx->idx[i]->content->tagged &&
+ if (actx->idx[i]->content->tagged &&
(force || !mutt_can_decode (actx->idx[i]->content)))
{
if (mutt_copy_body (actx->idx[i]->fp, last, actx->idx[i]->content) == -1)
return last;
}
-/*
- * forward one or several MIME bodies
+/*
+ * forward one or several MIME bodies
* (non-message types)
*/
STATE st;
- /*
+ /*
* First, find the parent message.
* Note: This could be made an option by just
* putting the following lines into an if block.
else
strfcpy (prefix, ">", sizeof (prefix));
}
-
+
include_header (option (OPTFORWQUOTE), parent_fp, parent_hdr,
tmpfp, prefix);
- /*
+ /*
* Now, we have prepared the first part of the message body: The
- * original message's header.
+ * original message's header.
*
* The next part is more interesting: either include the message bodies,
* or attach them.
*/
if ((!cur || mutt_can_decode (cur)) &&
- (rc = query_quadoption (OPT_MIMEFWD,
+ (rc = query_quadoption (OPT_MIMEFWD,
_("Forward as attachments?"))) == MUTT_YES)
mime_fwd_all = 1;
else if (rc == -1)
goto bail;
- /*
- * shortcut MIMEFWDREST when there is only one attachment. Is
+ /*
+ * shortcut MIMEFWDREST when there is only one attachment. Is
* this intuitive?
*/
- if (!mime_fwd_all && !cur && (nattach > 1)
+ if (!mime_fwd_all && !cur && (nattach > 1)
&& !check_can_decode (actx, cur))
{
if ((rc = query_quadoption (OPT_MIMEFWDREST,
}
/* initialize a state structure */
-
+
memset (&st, 0, sizeof (st));
-
+
if (option (OPTFORWQUOTE))
st.prefix = prefix;
st.flags = MUTT_CHARCONV;
}
}
- if (mime_fwd_any &&
+ if (mime_fwd_any &&
copy_problematic_attachments (last, actx, mime_fwd_all) == NULL)
goto bail;
}
-
+
mutt_forward_trailer (Context, parent_hdr, tmpfp);
-
+
safe_fclose (&tmpfp);
tmpfp = NULL;
/* now that we have the template, send it. */
ci_send_message (0, tmphdr, tmpbody, NULL, parent_hdr);
return;
-
+
bail:
-
+
if (tmpfp)
{
safe_fclose (&tmpfp);
}
-/*
- * Forward one or several message-type attachments. This
+/*
+ * Forward one or several message-type attachments. This
* is different from the previous function
* since we want to mimic the index menu's behavior.
*
* Code reuse from ci_send_message is not possible here -
* ci_send_message relies on a context structure to find messages,
* while, on the attachment menu, messages are referenced through
- * the attachment index.
+ * the attachment index.
*/
-static void attach_forward_msgs (FILE * fp, HEADER * hdr,
+static void attach_forward_msgs (FILE * fp, HEADER * hdr,
ATTACH_CONTEXT *actx, BODY * cur)
{
HEADER *curhdr = NULL;
int cmflags = 0;
int chflags = CH_XMIT;
-
+
if (cur)
curhdr = cur->hdr;
else
tmpbody[0] = '\0';
- if ((rc = query_quadoption (OPT_MIMEFWD,
+ if ((rc = query_quadoption (OPT_MIMEFWD,
_("Forward MIME encapsulated?"))) == MUTT_NO)
{
-
+
/* no MIME encapsulation */
-
+
mutt_mktemp (tmpbody, sizeof (tmpbody));
if (!(tmpfp = safe_fopen (tmpbody, "w")))
{
cmflags |= MUTT_CM_WEED;
}
}
-
-
+
+
if (cur)
{
- /* mutt_message_hook (cur->hdr, MUTT_MESSAGEHOOK); */
+ /* mutt_message_hook (cur->hdr, MUTT_MESSAGEHOOK); */
mutt_forward_intro (Context, cur->hdr, tmpfp);
_mutt_copy_message (tmpfp, fp, cur->hdr, cur->hdr->content, cmflags, chflags);
mutt_forward_trailer (Context, cur->hdr, tmpfp);
{
if (actx->idx[i]->content->tagged)
{
- /* mutt_message_hook (idx[i]->content->hdr, MUTT_MESSAGEHOOK); */
+ /* mutt_message_hook (idx[i]->content->hdr, MUTT_MESSAGEHOOK); */
mutt_forward_intro (Context, actx->idx[i]->content->hdr, tmpfp);
_mutt_copy_message (tmpfp, actx->idx[i]->fp, actx->idx[i]->content->hdr,
actx->idx[i]->content->hdr->content, cmflags, chflags);
else
mutt_free_header (&tmphdr);
- ci_send_message (0, tmphdr, *tmpbody ? tmpbody : NULL,
+ ci_send_message (0, tmphdr, *tmpbody ? tmpbody : NULL,
NULL, curhdr);
}
-void mutt_attach_forward (FILE * fp, HEADER * hdr,
+void mutt_attach_forward (FILE * fp, HEADER * hdr,
ATTACH_CONTEXT *actx, BODY * cur)
{
short nattach;
-
+
if (check_all_msg (actx, cur, 0) == 0)
attach_forward_msgs (fp, hdr, actx, cur);
\f
/**
- **
+ **
** the various reply functions, from the attachment menu
**
**
/* Create the envelope defaults for a reply.
*
* This function can be invoked in two ways.
- *
+ *
* Either, parent is NULL. In this case, all tagged bodies are of a message type,
* and the header information is fetched from them.
- *
+ *
* Or, parent is non-NULL. In this case, cur is the common parent of all the
* tagged attachments.
- *
+ *
* Note that this code is horribly similar to envelope_defaults () from send.c.
*/
-
+
static int
attach_reply_envelope_defaults (ENVELOPE *env, ATTACH_CONTEXT *actx,
HEADER *parent, int flags)
ENVELOPE *curenv = NULL;
HEADER *curhdr = NULL;
short i;
-
+
if (!parent)
{
for (i = 0; i < actx->idxlen; i++)
return -1;
}
}
-
+
if ((flags & SENDLISTREPLY) && !env->to)
{
mutt_error _("No mailing lists found!");
return (-1);
}
-
+
mutt_fix_reply_recipients (env);
mutt_make_misc_reply_headers (env, Context, curhdr, curenv);
else
{
LIST **p = NULL, **q = NULL;
-
+
for (i = 0; i < actx->idxlen; i++)
{
if (actx->idx[i]->content->tagged)
mutt_add_to_reference_headers (env, actx->idx[i]->content->hdr->env, &p, &q);
}
}
-
+
return 0;
}
int cmflags = MUTT_CM_PREFIX | MUTT_CM_DECODE | MUTT_CM_CHARCONV;
int chflags = CH_DECODE;
- /* mutt_message_hook (cur, MUTT_MESSAGEHOOK); */
-
+ /* mutt_message_hook (cur, MUTT_MESSAGEHOOK); */
+
mutt_make_attribution (Context, cur, tmpfp);
-
+
if (!option (OPTHEADER))
cmflags |= MUTT_CM_NOHEADER;
if (option (OPTWEED))
_mutt_copy_message (tmpfp, fp, cur, cur->content, cmflags, chflags);
mutt_make_post_indent (Context, cur, tmpfp);
}
-
+
void mutt_attach_reply (FILE * fp, HEADER * hdr,
ATTACH_CONTEXT *actx, BODY * cur,
int flags)
{
short mime_reply_any = 0;
-
+
short nattach = 0;
ATTACHPTR *parent = NULL;
HEADER *parent_hdr = NULL;
STATE st;
char tmpbody[_POSIX_PATH_MAX];
FILE *tmpfp;
-
+
char prefix[SHORT_STRING];
int rc;
-
+
if (check_all_msg (actx, cur, 0) == -1)
{
nattach = count_tagged (actx);
mutt_free_header (&tmphdr);
return;
}
-
+
mutt_mktemp (tmpbody, sizeof (tmpbody));
if ((tmpfp = safe_fopen (tmpbody, "w")) == NULL)
{
else
{
mutt_make_attribution (Context, parent_hdr, tmpfp);
-
+
memset (&st, 0, sizeof (STATE));
st.fpout = tmpfp;
if (!option (OPTTEXTFLOWED))
- _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix),
+ _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix),
Context, parent_hdr, 0);
else
strfcpy (prefix, ">", sizeof (prefix));
st.prefix = prefix;
st.flags = MUTT_CHARCONV;
-
- if (option (OPTWEED))
+
+ if (option (OPTWEED))
st.flags |= MUTT_WEED;
if (option (OPTHEADER))
mutt_make_post_indent (Context, parent_hdr, tmpfp);
- if (mime_reply_any && !cur &&
+ if (mime_reply_any && !cur &&
copy_problematic_attachments (&tmphdr->content, actx, 0) == NULL)
{
mutt_free_header (&tmphdr);
}
safe_fclose (&tmpfp);
-
+
if (ci_send_message (flags, tmphdr, tmpbody, NULL,
parent_hdr ? parent_hdr : (cur ? cur->hdr : NULL)) == 0)
mutt_set_flag (Context, hdr, MUTT_REPLIED, 1);
}
-
* version 0.12.
* (Implements POSIX draft P1003.2/D11.2, except for some of the
* internationalization features.)
- *
+ *
* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
- *
+ *
* This file is part of the GNU C Library. Its master source is NOT part of
* the C library, however. The master source lives in /gd/gnu/lib.
- *
+ *
* The GNU C Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* The GNU C Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with the GNU C Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * Boston, MA 02110-1301, USA.
*/
/*
* Modifications:
- *
+ *
* Use _regex.h instead of regex.h. tlr, 1999-01-06
* Make REGEX_MALLOC depend on HAVE_ALLOCA &c.
* tlr, 1999-02-14
/*
* Copyright (C) 1999-2001 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- */
+ */
/*
* Mixmaster support for Mutt
case 'C':
caps |= MIX_CAP_COMPRESS;
break;
-
+
case 'M':
caps |= MIX_CAP_MIDDLEMAN;
break;
-
+
case 'N':
{
switch (*++capstr)
case 'm':
caps |= MIX_CAP_NEWSMAIL;
break;
-
+
case 'p':
caps |= MIX_CAP_NEWSPOST;
break;
-
+
}
}
}
-
+
if (*capstr) capstr++;
}
-
+
return caps;
}
*slots += 5;
safe_realloc (type2_list, sizeof (REMAILER *) * (*slots));
}
-
+
(*type2_list)[(*used)++] = entry;
if (entry) entry->num = *used;
}
FREE (&(*r)->shortname);
FREE (&(*r)->addr);
FREE (&(*r)->ver);
-
+
FREE (r); /* __FREE_CHECKED__ */
}
char cmd[HUGE_STRING + _POSIX_PATH_MAX];
char line[HUGE_STRING];
char *t;
-
+
REMAILER **type2_list = NULL, *p;
size_t slots = 0, used = 0;
if (!l)
return NULL;
-
+
if ((devnull = open ("/dev/null", O_RDWR)) == -1)
return NULL;
-
+
snprintf (cmd, sizeof (cmd), "%s -T", Mixmaster);
-
+
if ((mm_pid = mutt_create_filter_fd (cmd, NULL, &fp, NULL, devnull, -1, devnull)) == -1)
{
close (devnull);
}
/* first, generate the "random" remailer */
-
+
p = mix_new_remailer ();
p->shortname = safe_strdup ("<random>");
mix_add_entry (&type2_list, p, &slots, &used);
-
+
while (fgets (line, sizeof (line), fp))
{
p = mix_new_remailer ();
-
+
if (!(t = strtok (line, " \t\n")))
goto problem;
-
+
p->shortname = safe_strdup (t);
-
+
if (!(t = strtok (NULL, " \t\n")))
goto problem;
p->addr = safe_strdup (t);
-
+
if (!(t = strtok (NULL, " \t\n")))
goto problem;
goto problem;
p->ver = safe_strdup (t);
-
+
if (!(t = strtok (NULL, " \t\n")))
goto problem;
p->caps = mix_get_caps (t);
-
+
mix_add_entry (&type2_list, p, &slots, &used);
continue;
-
+
problem:
mix_free_remailer (&p);
}
-
+
*l = used;
mix_add_entry (&type2_list, NULL, &slots, &used);
mutt_wait_filter (mm_pid);
close (devnull);
-
+
return type2_list;
}
{
int i;
REMAILER **type2_list = *ttlp;
-
+
for (i = 0; type2_list[i]; i++)
mix_free_remailer (&type2_list[i]);
-
+
FREE (type2_list); /* __FREE_CHECKED__ */
}
if (!chain->cl)
return;
-
+
safe_realloc (coordsp, sizeof (struct coord) * chain->cl);
-
+
coords = *coordsp;
-
+
if (i)
{
c = coords[i-1].c + strlen (type2_list[chain->ch[i-1]]->shortname) + 2;
r = MIX_VOFFSET;
c = MIX_HOFFSET;
}
-
-
+
+
for (; i < chain->cl; i++)
{
oc = c;
oc = c = MIX_HOFFSET;
r++;
}
-
+
coords[i].c = oc;
coords[i].r = r;
-
+
}
-
+
}
static void mix_redraw_ce (REMAILER **type2_list,
{
if (!coords || !chain)
return;
-
+
if (coords[i].r < MIX_MAXROW)
{
-
+
if (selected)
SETCOLOR (MT_COLOR_INDICATOR);
else
NORMAL_COLOR;
-
+
mutt_window_mvaddstr (MuttIndexWindow, coords[i].r, coords[i].c,
type2_list[chain->ch[i]]->shortname);
NORMAL_COLOR;
int cur)
{
int i;
-
+
for (i = MIX_VOFFSET; i < MIX_MAXROW; i++)
{
mutt_window_move (MuttIndexWindow, i, 0);
{
static char capbuff[10];
char *t = capbuff;
-
+
if (r->caps & MIX_CAP_COMPRESS)
*t++ = 'C';
else
*t++ = ' ';
-
+
if (r->caps & MIX_CAP_MIDDLEMAN)
*t++ = 'M';
else
*t++ = ' ';
-
+
if (r->caps & MIX_CAP_NEWSPOST)
{
*t++ = 'N';
*t++ = ' ';
*t++ = ' ';
}
-
+
if (r->caps & MIX_CAP_NEWSMAIL)
{
*t++ = 'N';
*t++ = ' ';
*t++ = ' ';
}
-
+
*t = '\0';
-
+
return capbuff;
}
/*
* Format an entry for the remailer menu.
- *
+ *
* %n number
* %c capabilities
* %s short name
else if (!remailer->addr)
optional = 0;
break;
-
+
default:
*dest = '\0';
}
}
-
+
static void mix_entry (char *b, size_t blen, MUTTMENU *menu, int num)
{
REMAILER **type2_list = (REMAILER **) menu->data;
(unsigned long) type2_list[num], MUTT_FORMAT_ARROWCURSOR);
}
-static int mix_chain_add (MIXCHAIN *chain, const char *s,
+static int mix_chain_add (MIXCHAIN *chain, const char *s,
REMAILER **type2_list)
{
int i;
-
+
if (chain->cl >= MAXMIXES)
return -1;
-
+
if (!mutt_strcmp (s, "0") || !ascii_strcasecmp (s, "<random>"))
{
chain->ch[chain->cl++] = 0;
return 0;
}
}
-
+
/* replace unknown remailers by <random> */
-
+
if (!type2_list[i])
chain->ch[chain->cl++] = 0;
return 0;
}
-static const struct mapping_t RemailerHelp[] =
+static const struct mapping_t RemailerHelp[] =
{
{ N_("Append"), OP_MIX_APPEND },
{ N_("Insert"), OP_MIX_INSERT },
{ N_("OK"), OP_MIX_USE },
{ NULL, 0 }
};
-
+
void mix_make_chain (LIST **chainp)
{
MIXCHAIN *chain;
int c_cur = 0, c_old = 0;
short c_redraw = 1;
-
+
REMAILER **type2_list = NULL;
size_t ttll = 0;
-
+
struct coord *coords = NULL;
-
+
MUTTMENU *menu;
char helpstr[LONG_STRING];
short loop = 1;
int op;
-
+
int i, j;
char *t;
mix_chain_add (chain, (char *) p->data, type2_list);
mutt_free_list (chainp);
-
+
/* safety check */
for (i = 0; i < chain->cl; i++)
{
if (chain->ch[i] >= ttll)
chain->ch[i] = 0;
}
-
+
mix_screen_coordinates (type2_list, &coords, chain, 0);
-
+
menu = mutt_new_menu (MENU_MIX);
menu->max = ttll;
menu->make_entry = mix_entry;
menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MIX, RemailerHelp);
menu->pagelen = MIX_VOFFSET - 1;
mutt_push_current_menu (menu);
-
- while (loop)
+
+ while (loop)
{
if (menu->pagelen != MIX_VOFFSET - 1)
{
menu->pagelen = MIX_VOFFSET - 1;
menu->redraw = REDRAW_FULL;
}
-
+
if (c_redraw)
{
mix_redraw_head (chain);
mix_redraw_ce (type2_list, coords, chain, c_old, 0);
mix_redraw_ce (type2_list, coords, chain, c_cur, 1);
}
-
+
c_old = c_cur;
-
+
switch ((op = mutt_menuLoop (menu)))
{
case OP_REDRAW:
menu->pagelen = MIX_VOFFSET - 1;
break;
}
-
+
case OP_EXIT:
{
chain->cl = 0;
mix_screen_coordinates (type2_list, &coords, chain, c_cur);
c_redraw = 1;
}
-
- if (chain->cl && chain->ch[chain->cl - 1] &&
+
+ if (chain->cl && chain->ch[chain->cl - 1] &&
(type2_list[chain->ch[chain->cl-1]]->caps & MIX_CAP_MIDDLEMAN))
{
mutt_error ( _("Error: %s can't be used as the final remailer of a chain."),
chain->cl++;
for (i = chain->cl - 1; i > c_cur; i--)
chain->ch[i] = chain->ch[i-1];
-
+
chain->ch[c_cur] = menu->current;
mix_screen_coordinates (type2_list, &coords, chain, c_cur);
c_redraw = 1;
else
mutt_error ( _("Mixmaster chains are limited to %d elements."),
MAXMIXES);
-
+
break;
}
-
+
case OP_MIX_DELETE:
{
if (chain->cl)
{
chain->cl--;
-
+
for (i = c_cur; i < chain->cl; i++)
chain->ch[i] = chain->ch[i+1];
if (c_cur == chain->cl && c_cur)
c_cur--;
-
+
mix_screen_coordinates (type2_list, &coords, chain, c_cur);
c_redraw = 1;
}
}
break;
}
-
+
case OP_MIX_CHAIN_PREV:
{
- if (c_cur)
+ if (c_cur)
c_cur--;
else
mutt_error _("You already have the first chain element selected.");
-
+
break;
}
-
+
case OP_MIX_CHAIN_NEXT:
{
if (chain->cl && c_cur < chain->cl - 1)
c_cur++;
else
mutt_error _("You already have the last chain element selected.");
-
+
break;
}
}
}
-
+
mutt_pop_current_menu (menu);
mutt_menuDestroy (&menu);
/* construct the remailer list */
-
+
if (chain->cl)
{
for (i = 0; i < chain->cl; i++)
t = type2_list[j]->shortname;
else
t = "*";
-
+
*chainp = mutt_add_list (*chainp, t);
}
}
-
+
mix_free_type2_list (&type2_list);
FREE (&coords);
FREE (&chain);
const char *fqdn;
short need_hostname = 0;
ADDRESS *p;
-
+
if (msg->env->cc || msg->env->bcc)
{
mutt_error _("Mixmaster doesn't accept Cc or Bcc headers.");
/* When using mixmaster, we MUST qualify any addresses since
* the message will be delivered through remote systems.
- *
+ *
* use_domain won't be respected at this point, hidden_host will.
*/
break;
}
}
-
+
if (need_hostname)
{
-
+
if (!(fqdn = mutt_fqdn (1)))
{
mutt_error _("Please set the hostname variable to a proper value when using mixmaster!");
return (-1);
}
-
+
/* Cc and Bcc are empty at this point. */
rfc822_qualify (msg->env->to, fqdn);
rfc822_qualify (msg->env->reply_to, fqdn);
/*
* Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/*
* Mixmaster support for Mutt
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
/*
* Copyright (C) 1996-2000,2003,2012 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
-/*
+/*
* rfc1524 defines a format for the Multimedia Mail Configuration, which
- * is the standard mailcap file format under Unix which specifies what
+ * is the standard mailcap file format under Unix which specifies what
* external programs should be used to view/compose/edit multimedia files
* based on content type.
*
- * This file contains various functions for implementing a fair subset of
+ * This file contains various functions for implementing a fair subset of
* rfc1524.
*/
int needspipe = TRUE;
char buf[LONG_STRING];
char type[LONG_STRING];
-
+
strfcpy (type, _type, sizeof (type));
-
+
if (option (OPTMAILCAPSANITIZE))
mutt_sanitize_filename (type, 0);
x++;
buf[y++] = command[x++];
}
- else if (command[x] == '%')
+ else if (command[x] == '%')
{
x++;
- if (command[x] == '{')
+ if (command[x] == '{')
{
char param[STRING];
char pvalue[STRING];
while (command[x] && command[x] != '}' && z < sizeof (param) - 1)
param[z++] = command[x++];
param[z] = '\0';
-
+
_pvalue = mutt_get_parameter (param, a->parameter);
strfcpy (pvalue, NONULL(_pvalue), sizeof (pvalue));
if (option (OPTMAILCAPSANITIZE))
mutt_sanitize_filename (pvalue, 0);
-
+
y += mutt_quote_filename (buf + y, sizeof (buf) - y, pvalue);
}
else if (command[x] == 's' && filename != NULL)
}
return 1;
}
- else
+ else
{
mutt_error (_("Improperly formatted entry for type %s in \"%s\" line %d"),
type, filename, line);
static int rfc1524_mailcap_parse (BODY *a,
char *filename,
- char *type,
+ char *type,
rfc1524_entry *entry,
int opt)
{
}
else if (!ascii_strncasecmp (field, "test", 4))
{
- /*
+ /*
* This routine executes the given test command to determine
* if this is the right entry.
*/
if (!printcommand)
found = FALSE;
}
-
+
if (!found)
{
/* reset */
char *curr = MailcapPath;
/* rfc1524 specifies that a path of mailcap files should be searched.
- * joy. They say
+ * joy. They say
* $HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap, etc
* and overridden by the MAILCAPS environment variable, and, just to be nice,
* we'll make it specifiable in .muttrc
if (!x)
continue;
-
+
path[x] = '\0';
mutt_expand_path (path, sizeof (path));
/* This routine will create a _temporary_ filename matching the
* name template given if this needs to be done.
- *
+ *
* Please note that only the last path element of the
* template and/or the old file name will be used for the
* comparison and the temporary file name.
- *
+ *
* Returns 0 if oldfile is fine as is.
* Returns 1 if newfile specified
*/
{
int i, j, k, ps;
char *s;
- short lmatch = 0, rmatch = 0;
+ short lmatch = 0, rmatch = 0;
char left[_POSIX_PATH_MAX];
char right[_POSIX_PATH_MAX];
-
+
newfile[0] = 0;
/* first, ignore leading path components.
*/
-
+
if (nametemplate && (s = strrchr (nametemplate, '/')))
nametemplate = s + 1;
if (oldfile && (s = strrchr (oldfile, '/')))
oldfile = s + 1;
-
+
if (!nametemplate)
{
if (oldfile)
else /* oldfile && nametemplate */
{
- /* first, compare everything left from the "%s"
+ /* first, compare everything left from the "%s"
* (if there is one).
*/
-
+
lmatch = 1; ps = 0;
for(i = 0; nametemplate[i]; i++)
{
if(nametemplate[i] == '%' && nametemplate[i+1] == 's')
- {
+ {
ps = 1;
break;
}
if(ps)
{
-
+
/* If we had a "%s", check the rest. */
-
- /* now, for the right part: compare everything right from
+
+ /* now, for the right part: compare everything right from
* the "%s" to the final part of oldfile.
- *
+ *
* The logic here is as follows:
- *
+ *
* - We start reading from the end.
* - There must be a match _right_ from the "%s",
- * thus the i + 2.
+ * thus the i + 2.
* - If there was a left hand match, this stuff
* must not be counted again. That's done by the
* condition (j >= (lmatch ? i : 0)).
*/
-
+
rmatch = 1;
for(j = mutt_strlen(oldfile) - 1, k = mutt_strlen(nametemplate) - 1 ;
break;
}
}
-
+
/* Now, check if we had a full match. */
-
+
if(k >= i + 2)
rmatch = 0;
-
+
if(lmatch) *left = 0;
else strnfcpy(left, nametemplate, sizeof(left), i);
-
+
if(rmatch) *right = 0;
else strfcpy(right, nametemplate + i + 2, sizeof(right));
-
+
snprintf(newfile, nflen, "%s%s%s", left, oldfile, right);
}
else
strfcpy(newfile, nametemplate, nflen);
}
}
-
+
mutt_adv_mktemp(newfile, nflen);
if(rmatch && lmatch)
return 0;
- else
+ else
return 1;
-
+
}
/* If rfc1524_expand_command() is used on a recv'd message, then
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef _RFC1524_H
#define _RFC1524_H
/*
* Copyright (C) 1996-2000,2010 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2000-2002 Edmund Grimley Evans <edmundo@rano.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
return (size_t)(-1);
}
*ob = '\0';
-
+
*tlen = ob - buf;
safe_realloc (&buf, ob - buf + 1);
*d = e;
if (dlen)
*dlen = elen;
-
+
mutt_canonical_charset (canonical_buff, sizeof (canonical_buff), tocode);
mutt_str_replace (&tocode, canonical_buff);
}
/* Try to convert to UTF-8. */
if (convert_string (d, dlen, fromcode, icode, &u, &ulen))
{
- ret = 1;
+ ret = 1;
icode = 0;
safe_realloc (&u, (ulen = dlen) + 1);
memcpy (u, d, dlen);
s0 = s1 = t0 = t1 = 0;
for (t = u; t < u + ulen; t++)
{
- if ((*t & 0x80) ||
+ if ((*t & 0x80) ||
(*t == '=' && t[1] == '?' && (t == u || HSPACE(*(t-1)))))
{
if (!t0) t0 = t;
/* Hack to avoid labelling 8-bit data as us-ascii. */
if (!icode && mutt_is_us_ascii (tocode))
tocode = "unknown-8bit";
-
+
/* Adjust t0 for maximum length of line. */
t = u + (ENCWORD_LEN_MAX + 1) - col - ENCWORD_LEN_MIN;
if (t < u) t = u;
if (t < t0) t0 = t;
-
+
/* Adjust t0 until we can encode a character after a space. */
for (; t0 > u; t0--)
FREE (&u);
buf[buflen] = '\0';
-
+
*e = buf;
*elen = buflen + 1;
return ret;
{
ADDRESS *ptr = addr;
int col = tag ? strlen (tag) + 2 : 32;
-
+
while (ptr)
{
if (ptr->personal)
switch (count)
{
case 2:
- /* ignore language specification a la RFC 2231 */
+ /* ignore language specification a la RFC 2231 */
t = pp1;
if ((t1 = memchr (pp, '*', t - pp)))
t = t1;
break;
}
}
-
+
mutt_buffer_addstr (d, d0);
rv = 0;
error_out_0:
{
while (a)
{
- if (a->personal && ((strstr (a->personal, "=?") != NULL) ||
+ if (a->personal && ((strstr (a->personal, "=?") != NULL) ||
(AssumedCharset && *AssumedCharset)))
rfc2047_decode (&a->personal);
else if (a->group && a->mailbox && (strstr (a->mailbox, "=?") != NULL))
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
char *mutt_choose_charset (const char *fromcode, const char *charsets,
char *u, size_t ulen, char **d, size_t *dlen);
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
- *
+ *
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Yet another MIME encoding for header data. This time, it's
* parameters, specified in RFC 2231, and modeled after the
* encoding used in URLs.
- *
+ *
* Additionally, continuations and encoding are mixed in an, errrm,
* interesting manner.
*
char *value;
int index;
int encoded;
- struct rfc2231_parameter
+ struct rfc2231_parameter
*next;
};
static void purge_empty_parameters (PARAMETER **headp)
{
PARAMETER *p, *q, **last;
-
+
for (last = headp, p = *headp; p; p = q)
{
q = p->next;
short dirty = 0; /* set to 1 when we may have created
* empty parameters.
*/
-
+
if (!headp) return;
purge_empty_parameters (headp);
-
+
for (last = &head, p = *headp; p; p = q)
{
q = p->next;
if (!(s = strchr (p->attribute, '*')))
{
- /*
+ /*
* Using RFC 2047 encoding in MIME parameters is explicitly
* forbidden by that document. Nevertheless, it's being
- * generated by some software, including certain Lotus Notes to
+ * generated by some software, including certain Lotus Notes to
* Internet Gateways. So we actually decode it.
*/
else if (*(s + 1) == '\0')
{
*s = '\0';
-
+
s = rfc2231_get_charset (p->value, charset, sizeof (charset));
rfc2231_decode_one (p->value, s);
mutt_convert_string (&p->value, charset, Charset, MUTT_ICONV_HOOK_FROM);
*last = p;
last = &p->next;
p->next = NULL;
-
+
dirty = 1;
}
else
conttmp->value = p->value;
conttmp->encoded = encoded;
conttmp->index = index;
-
+
p->attribute = NULL;
p->value = NULL;
FREE (&p);
rfc2231_join_continuations (last, conthead);
dirty = 1;
}
-
+
*headp = head;
-
+
if (dirty)
purge_empty_parameters (headp);
}
-
+
static struct rfc2231_parameter *rfc2231_new_parameter (void)
{
return safe_calloc (sizeof (struct rfc2231_parameter), 1);
static char *rfc2231_get_charset (char *value, char *charset, size_t chslen)
{
char *t, *u;
-
+
if (!(t = strchr (value, '\'')))
{
charset[0] = '\0';
return value;
}
-
+
*t = '\0';
strfcpy (charset, value, chslen);
-
+
if ((u = strchr (t + 1, '\'')))
return u + 1;
else
else
*d++ = *src;
}
-
+
*d = '\0';
}
/* insert parameter into an ordered list.
- *
+ *
* Primary sorting key: attribute
* Secondary sorting key: index
*/
int encoded;
size_t l, vl;
-
+
while (par)
{
value = NULL; l = 0;
-
+
strfcpy (attribute, par->attribute, sizeof (attribute));
if ((encoded = par->encoded))
else
valp = par->value;
- do
+ do
{
if (encoded && par->encoded)
rfc2231_decode_one (par->value, valp);
-
+
vl = strlen (par->value);
-
+
safe_realloc (&value, l + vl + 1);
strcpy (value + l, par->value); /* __STRCPY_CHECKED__ */
l += vl;
if ((par = q))
valp = par->value;
} while (par && !strcmp (par->attribute, attribute));
-
+
if (value)
{
if (encoded)
char *charset, *s, *t, *e, *d = 0;
size_t slen, dlen = 0;
- /*
+ /*
* A shortcut to detect pure 7bit data.
- *
+ *
* This should prevent the worst when character set handling
* is flawed.
*/
for (s = *pd; *s; s++)
if (*s & 0x80)
break;
-
+
if (!*s)
return 0;
-
+
if (!Charset || !SendCharset ||
!(charset = mutt_choose_charset (Charset, SendCharset,
*pd, strlen (*pd), &d, &dlen)))
FREE (pd); /* __FREE_CHECKED__ */
*pd = d;
}
-
+
FREE (&charset);
-
+
return encode;
}
-
void rfc2231_decode_parameters (PARAMETER **);
int rfc2231_encode_string (char **);
-
* Copyright (C) 2005 Peter J. Holzer <hjp@hjp.net>
* Copyright (C) 2005-2009 Rocco Rutte <pdmef@gmx.net>
* Copyright (C) 2010 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- */
+ */
/* This file was originally part of mutt-ng */
* Copyright (C) 2005 Andreas Krennmair <ak@synflood.at>
* Copyright (C) 2005 Peter J. Holzer <hjp@hjp.net>
* Copyright (C) 2005,2007 Rocco Rutte <pdmef@gmx.net>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- */
+ */
/* This file was originally part of mutt-ng */
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2011-2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
char *comment, size_t *commentlen, size_t commentmax)
{
int level = 1;
-
+
while (*s && level)
{
if (*s == '(')
char *comment, size_t *commentlen, size_t commentmax)
{
ADDRESS *cur = rfc822_new_address ();
-
+
if (parse_addr_spec (phrase, comment, commentlen, commentmax, cur) == NULL)
{
rfc822_free_address (&cur);
char comment[LONG_STRING], phrase[LONG_STRING];
size_t phraselen = 0, commentlen = 0;
ADDRESS *cur, *last = NULL;
-
+
RFC822Error = 0;
last = top;
ws_pending = is_email_wsp (*s);
if ((nl = mutt_strlen (s)))
nl = s[nl - 1] == '\n';
-
+
s = skip_email_wsp(s);
#ifdef EXACT_ADDRESS
begin = s;
ws_pending = is_email_wsp(*s);
s = skip_email_wsp(s);
}
-
+
if (phraselen)
{
terminate_buffer (phrase, phraselen);
size_t len;
char *pbuf = buf;
char *pc;
-
+
if (!addr)
return;
{
char *pbuf = buf;
size_t len = mutt_strlen (buf);
-
+
buflen--; /* save room for the terminal nul */
if (len > 0)
ADDRESS *rfc822_cpy_adr (ADDRESS *addr, int prune)
{
ADDRESS *top = NULL, *last = NULL;
-
+
for (; addr; addr = addr->next)
{
if (prune && addr->group && (!addr->next || !addr->next->mailbox))
# else
char *str = "a b c ";
# endif
-
+
list = rfc822_parse_adrlist (NULL, str);
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), list);
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2012 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#ifndef rfc822_h
#define rfc822_h
/*
* Copyright (C) 2010 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#include <stdio.h>
#include "lib.h"
/* not reached */
}
#endif /* HAVE_ASPRINTF */
-
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
}
if (hdr->score < 0)
hdr->score = 0;
-
+
if (hdr->score <= ScoreThresholdDelete)
_mutt_set_flag (ctx, hdr, MUTT_DELETE, 1, upd_ctx);
if (hdr->score <= ScoreThresholdRead)
/*
* Copyright (C) 1996-2002,2004,2010,2012-2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
else
{
ADDRESS *tmp = a;
-
+
a = a->next;
if (!leave_only || a || last)
{
char buf[HUGE_STRING];
char *err = NULL;
int idna_ok = 0;
-
+
do
{
buf[0] = 0;
mutt_sleep (2);
FREE (&err);
}
- }
+ }
while (idna_ok != 0);
return 0;
}
}
}
}
-
+
if (mutt_get_field (_("Subject: "), buf, sizeof (buf), 0) != 0 ||
(!buf[0] && query_quadoption (OPT_SUBJECT, _("No subject, abort?")) != MUTT_NO))
{
static int include_forward (CONTEXT *ctx, HEADER *cur, FILE *out)
{
int chflags = CH_DECODE, cmflags = 0;
-
+
mutt_parse_mime_message (ctx, cur);
mutt_message_hook (ctx, cur, MUTT_MESSAGEHOOK);
mutt_parse_mime_message (ctx, cur);
mutt_message_hook (ctx, cur, MUTT_MESSAGEHOOK);
-
+
mutt_make_attribution (ctx, cur, out);
-
+
if (!option (OPTHEADER))
cmflags |= MUTT_CM_NOHEADER;
if (option (OPTWEED))
mutt_copy_message (out, ctx, cur, cmflags, chflags);
mutt_make_post_indent (ctx, cur, out);
-
+
return 0;
}
{
char prompt[STRING];
- if (flags && env->mail_followup_to && hmfupto == MUTT_YES)
+ if (flags && env->mail_followup_to && hmfupto == MUTT_YES)
{
rfc822_append (to, env->mail_followup_to, 1);
return 0;
{
/* If the Reply-To: address is a mailing list, assume that it was
* put there by the mailing list, and use the From: address
- *
+ *
* We also take the from header if our correspondent has a reply-to
* header which is identical to the electronic mail address given
* in his From header, and the reply-to has no display-name.
- *
+ *
*/
rfc822_append (to, env->from, 0);
}
- else if (!(mutt_addrcmp (env->from, env->reply_to) &&
+ else if (!(mutt_addrcmp (env->from, env->reply_to) &&
!env->reply_to->next) &&
quadoption (OPT_REPLYTO) != MUTT_YES)
{
Asks whether the user respects the reply-to header.
If she says no, mutt will reply to the from header's address instead. */
snprintf (prompt, sizeof (prompt), _("Reply to %s%s?"),
- env->reply_to->mailbox,
+ env->reply_to->mailbox,
env->reply_to->next?",...":"");
switch (query_quadoption (OPT_REPLYTO, prompt))
{
l = mutt_copy_list (e->references);
else
l = mutt_copy_list (e->in_reply_to);
-
+
if (e->message_id)
{
t = mutt_new_list();
t->next = l;
l = t;
}
-
+
return l;
}
env->cc = remove_user (env->cc, (env->to == NULL));
env->to = remove_user (env->to, (env->cc == NULL) || option (OPTREPLYSELF));
}
-
+
/* the CC field can get cluttered, especially with lists */
env->to = mutt_remove_duplicates (env->to);
env->cc = mutt_remove_duplicates (env->cc);
env->cc = mutt_remove_xrefs (env->to, env->cc);
-
+
if (env->cc && !env->to)
{
env->to = env->cc;
if (pp) p = *pp;
if (qq) q = *qq;
-
+
if (!p) p = &env->references;
if (!q) q = &env->in_reply_to;
-
+
while (*p) p = &(*p)->next;
while (*q) q = &(*q)->next;
-
+
*p = mutt_make_references (curenv);
-
+
if (curenv->message_id)
{
*q = mutt_new_list();
(*q)->data = safe_strdup (curenv->message_id);
}
-
+
if (pp) *pp = p;
if (qq) *qq = q;
-
+
}
-static void
+static void
mutt_make_reference_headers (ENVELOPE *curenv, ENVELOPE *env, CONTEXT *ctx)
{
env->references = NULL;
env->in_reply_to = NULL;
-
+
if (!curenv)
{
HEADER *h;
LIST **p = NULL, **q = NULL;
int i;
-
+
for(i = 0; i < ctx->vcount; i++)
{
h = ctx->hdrs[ctx->v2r[i]];
BODY *last = msg->content;
mutt_message _("Preparing forwarded message...");
-
+
while (last && last->next)
last = last->next;
return -1;
}
/* if (WithCrypto && (flags & SENDKEY)) */
- else if ((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY))
+ else if ((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY))
{
BODY *tmp;
ADDRESS *t = NULL;
ADDRESS *from;
- /*
+ /*
* Only generate the Mail-Followup-To if the user has requested it, and
* it hasn't already been set
*/
{
if (mutt_is_list_cc (0, e->to, e->cc))
{
- /*
+ /*
* this message goes to known mailing lists, so create a proper
* mail-followup-to header
*/
/*
* If we are not subscribed to any of the lists in question,
- * re-add ourselves to the mail-followup-to header. The
+ * re-add ourselves to the mail-followup-to header. The
* mail-followup-to header generated is a no-op with group-reply,
* but makes sure list-reply has the desired effect.
*/
from = rfc822_cpy_adr (e->from, 0);
else
from = mutt_default_from ();
-
+
if (from)
{
/* Normally, this loop will not even be entered. */
for (t = from; t && t->next; t = t->next)
;
-
+
t->next = e->mail_followup_to; /* t cannot be NULL at this point. */
e->mail_followup_to = from;
}
}
-
+
e->mail_followup_to = mutt_remove_duplicates (e->mail_followup_to);
-
+
}
}
ADDRESS *adr;
const char *fqdn = mutt_fqdn(1);
- /*
+ /*
* Note: We let $from override $realname here. Is this the right
- * thing to do?
+ * thing to do?
*/
if (From)
adr = rfc822_new_address ();
adr->mailbox = safe_strdup (NONULL(Username));
}
-
+
return (adr);
}
static int send_message (HEADER *msg)
-{
+{
char tempfile[_POSIX_PATH_MAX];
FILE *tempfp;
int i;
#ifdef USE_SMTP
short old_write_bcc;
#endif
-
+
/* Write out the message in MIME form. */
mutt_mktemp (tempfile, sizeof (tempfile));
if ((tempfp = safe_fopen (tempfile, "w")) == NULL)
if (old_write_bcc)
set_option (OPTWRITEBCC);
#endif
-
+
fputc ('\n', tempfp); /* tie off the header. */
if ((mutt_write_mime_body (msg->content, tempfp) == -1))
unlink (tempfile);
return (-1);
}
-
+
if (fclose (tempfp) != 0)
{
mutt_perror (tempfile);
(msg->content->encoding == ENC8BIT));
#endif /* USE_SMTP */
- i = mutt_invoke_sendmail (msg->env->from, msg->env->to, msg->env->cc,
+ i = mutt_invoke_sendmail (msg->env->from, msg->env->to, msg->env->cc,
msg->env->bcc, tempfile,
(msg->content->encoding == ENC8BIT));
return (i);
static void decode_descriptions (BODY *b)
{
BODY *t;
-
+
for (t = b; t; t = t->next)
{
if (t->description)
{
FILE *fp;
int c;
-
+
if ((fp = safe_fopen (data, "a+")) == NULL)
return;
fseek (fp,-1,SEEK_END);
int mutt_resend_message (FILE *fp, CONTEXT *ctx, HEADER *cur)
{
HEADER *msg = mutt_new_header ();
-
+
if (mutt_prepare_template (fp, ctx, msg, cur, 1) < 0)
return -1;
char *ctype;
int rv = -1;
-
+
if (!flags && !msg && quadoption (OPT_RECALL) != MUTT_NO &&
mutt_num_postponed (1))
{
if(i == MUTT_YES)
flags |= SENDPOSTPONED;
}
-
-
+
+
if (flags & SENDPOSTPONED)
{
if (WithCrypto & APPLICATION_PGP)
}
/* Parse and use an eventual list-post header */
- if ((flags & SENDLISTREPLY)
- && cur && cur->env && cur->env->list_post)
+ if ((flags & SENDLISTREPLY)
+ && cur && cur->env && cur->env->list_post)
{
/* Use any list-post header as a template */
url_parse_mailto (msg->env, NULL, cur->env->list_post);
/* We don't let them set the sender's address. */
rfc822_free_address (&msg->env->from);
}
-
+
if (! (flags & (SENDKEY | SENDPOSTPONED | SENDRESEND)))
{
/* When SENDDRAFTFILE is set, the caller has already
/* Expand aliases and remove duplicates/crossrefs */
mutt_expand_aliases_env (msg->env);
-
+
if (flags & SENDREPLY)
mutt_fix_reply_recipients (msg->env);
}
/* change settings based upon recipients */
-
+
mutt_message_hook (NULL, msg, MUTT_SENDHOOK);
/*
&& Editor && mutt_strcmp (Editor, "builtin") != 0)
append_signature (tempfp);
}
-
- /*
+
+ /*
* This hook is even called for postponed messages, and can, e.g., be
* used for setting the editor, the sendmail path, or the
* envelope sender.
else
mutt_perror (msg->content->filename);
}
-
+
/* If using format=flowed, perform space stuffing. Avoid stuffing when
* recalling a postponed message where the stuffing was already
* performed. If it has already been performed, the format=flowed
}
}
- /*
+ /*
* Set the message security unless:
* 1) crypto support is not enabled (WithCrypto==0)
* 2) pgp: header field was present during message editing with $edit_headers (msg->security != 0)
if (msg->security || option (OPTCRYPTOPPORTUNISTICENCRYPT))
{
- /*
+ /*
* When replying / forwarding, use the original message's
* crypto system. According to the documentation,
* smime_is_default should be disregarded here.
- *
+ *
* Problem: At least with forwarding, this doesn't really
* make much sense. Should we have an option to completely
* disable individual mechanisms at run-time?
*/
if (cur)
{
- if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP)
+ if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP)
&& (cur->security & APPLICATION_PGP))
msg->security |= APPLICATION_PGP;
else if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME)
/*
* No crypto mechanism selected? Use availability + smime_is_default
- * for the decision.
+ * for the decision.
*/
if (!(msg->security & (APPLICATION_SMIME | APPLICATION_PGP)))
{
- if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME)
+ if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME)
&& option (OPTSMIMEISDEFAULT))
msg->security |= APPLICATION_SMIME;
else if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP))
}
}
-
+
mutt_update_encoding (msg->content);
if (! (flags & (SENDMAILX | SENDBATCH)))
FREE (&err);
if (!(flags & SENDBATCH))
goto main_loop;
- else
+ else
goto cleanup;
}
-
+
if (!msg->env->subject && ! (flags & SENDBATCH) &&
(i = query_quadoption (OPT_SUBJECT, _("No subject, abort sending?"))) != MUTT_NO)
{
if (msg->content->next)
msg->content = mutt_make_multipart (msg->content);
- /*
+ /*
* Ok, we need to do it this way instead of handling all fcc stuff in
* one place in order to avoid going to main_loop with encoded "env"
* in case of error. Ugh.
*/
mutt_encode_descriptions (msg->content, 1);
-
+
/*
* Make sure that clear_content and free_clear_content are
* properly initialized -- we may visit this particular place in
* the code multiple times, including after a failed call to
* mutt_protect().
*/
-
+
clear_content = NULL;
free_clear_content = 0;
-
+
if (WithCrypto)
{
if (msg->security & (ENCRYPT | SIGN))
{
/* save the decrypted attachments */
clear_content = msg->content;
-
+
if ((crypt_get_keys (msg, &pgpkeylist, 0) == -1) ||
mutt_protect (msg, pgpkeylist) == -1)
{
msg->content = mutt_remove_multipart (msg->content);
-
+
FREE (&pgpkeylist);
-
+
decode_descriptions (msg->content);
goto main_loop;
}
mutt_encode_descriptions (msg->content, 0);
}
-
- /*
+
+ /*
* at this point, msg->content is one of the following three things:
* - multipart/signed. In this case, clear_content is a child.
* - multipart/encrypted. In this case, clear_content exists
* - application/pgp. In this case, clear_content exists independently.
* - something else. In this case, it's the same as clear_content.
*/
-
+
/* This is ugly -- lack of "reporting back" from mutt_protect(). */
-
+
if (clear_content && (msg->content != clear_content)
&& (msg->content->parts != clear_content))
free_clear_content = 1;
{
if (!WithCrypto)
;
- else if ((msg->security & ENCRYPT) ||
+ else if ((msg->security & ENCRYPT) ||
((msg->security & SIGN)
&& msg->content->type == TYPEAPPLICATION))
{
else if ((msg->security & SIGN) && msg->content->type == TYPEMULTIPART)
{
mutt_free_body (&msg->content->parts->next); /* destroy sig */
- msg->content = mutt_remove_multipart (msg->content);
+ msg->content = mutt_remove_multipart (msg->content);
}
FREE (&pgpkeylist);
rv = 0;
-
+
cleanup:
if (flags & SENDPOSTPONED)
SmimeSignAs = smime_signas;
}
}
-
+
safe_fclose (&tempfp);
if (! (flags & SENDNOFREEHEADER))
mutt_free_header (&msg);
-
+
return rv;
}
/*
* Copyright (C) 1996-2000,2012 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
void mutt_allow_interrupt (int disposition)
{
struct sigaction sa;
-
+
memset (&sa, 0, sizeof sa);
sa.sa_handler = sighandler;
#ifdef SA_RESTART
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
return 1;
smime_void_passphrase();
-
+
if (mutt_get_password (_("Enter S/MIME passphrase:"), SmimePass, sizeof (SmimePass)) == 0)
{
SmimeExptime = mutt_add_timeout (time (NULL), SmimeTimeout);
char fmt[16];
struct smime_command_context *cctx = (struct smime_command_context *) data;
int optional = (flags & MUTT_FORMAT_OPTIONAL);
-
+
switch (op)
{
case 'C':
snprintf (buf2, sizeof (buf2), "-CAfile %s", buf1);
else
snprintf (buf2, sizeof (buf2), "-CApath %s", buf1);
-
+
snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
snprintf (dest, destlen, fmt, buf2);
}
optional = 0;
break;
}
-
+
case 'c':
{ /* certificate (list) */
if (!optional) {
optional = 0;
break;
}
-
+
case 'i':
{ /* intermediate certificates */
if (!optional) {
optional = 0;
break;
}
-
+
case 's':
{ /* detached signature */
if (!optional)
optional = 0;
break;
}
-
+
case 'k':
{ /* private key */
if (!optional)
optional = 0;
break;
}
-
+
case 'a':
{ /* algorithm for encryption */
if (!optional) {
optional = 0;
break;
}
-
+
case 'f':
{ /* file to process */
if (!optional)
optional = 0;
break;
}
-
+
case 'd':
{ /* algorithm for the signature message digest */
if (!optional) {
{
struct smime_command_context cctx;
char cmd[HUGE_STRING];
-
+
memset (&cctx, 0, sizeof (cctx));
if (!format || !*format)
return (pid_t) -1;
-
+
cctx.fname = fname;
cctx.sig_fname = sig_fname;
cctx.key = key;
cctx.digestalg = digestalg;
cctx.certificates = certificates;
cctx.intermediates = intermediates;
-
+
mutt_smime_command (cmd, sizeof (cmd), &cctx, format);
return mutt_create_filter_fd (cmd, smimein, smimeout, smimeerr,
-/*
+/*
This sets the '*ToUse' variables for an upcoming decryption, where
the required key is different from SmimeDefaultKey.
*/
k = key->hash;
/* the key used last time. */
- if (*SmimeKeyToUse &&
+ if (*SmimeKeyToUse &&
!mutt_strcasecmp (k, SmimeKeyToUse + mutt_strlen (SmimeKeys)+1))
{
smime_free_key (&key);
}
else smime_void_passphrase ();
- snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
+ snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
NONULL(SmimeKeys), k);
-
+
snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
NONULL(SmimeCertificates), k);
if (*SmimeKeyToUse)
{
- if (!mutt_strcasecmp (SmimeDefaultKey,
+ if (!mutt_strcasecmp (SmimeDefaultKey,
SmimeKeyToUse + mutt_strlen (SmimeKeys)+1))
return;
smime_void_passphrase ();
}
- snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
+ snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
NONULL (SmimeKeys), NONULL (SmimeDefaultKey));
-
+
snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
NONULL (SmimeCertificates), NONULL (SmimeDefaultKey));
}
if (option (OPTSDEFAULTDECRYPTKEY) && SmimeDefaultKey && *SmimeDefaultKey)
{
- snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
+ snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
NONULL (SmimeKeys), SmimeDefaultKey);
-
+
snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
NONULL(SmimeCertificates), SmimeDefaultKey);
safe_fclose (&fperr);
mutt_unlink (pk7out);
return NULL;
-
+
}
mutt_perror (certfile);
return NULL;
}
-
+
/* Step 2: Extract the certificates from a PKCS#7 structure.
*/
if ((thepid = smime_invoke (NULL, NULL, NULL,
mutt_perror (certfile);
return NULL;
}
-
+
/* Extract signer's certificate
*/
if ((thepid = smime_invoke (NULL, NULL, NULL,
if ((certfile = smime_extract_certificate(infile)))
{
mutt_endwin (NULL);
-
+
if ((thepid = smime_invoke (&smimein, NULL, NULL,
-1, fileno(fpout), fileno(fperr),
certfile, NULL, NULL, NULL, NULL, NULL, NULL,
safe_fclose (&smimein);
mutt_wait_filter (thepid);
-
+
mutt_unlink (certfile);
FREE (&certfile);
}
if (h->env->from)
{
- h->env->from = mutt_expand_aliases (h->env->from);
- mbox = h->env->from->mailbox;
+ h->env->from = mutt_expand_aliases (h->env->from);
+ mbox = h->env->from->mailbox;
}
else if (h->env->sender)
{
- h->env->sender = mutt_expand_aliases (h->env->sender);
- mbox = h->env->sender->mailbox;
+ h->env->sender = mutt_expand_aliases (h->env->sender);
+ mbox = h->env->sender->mailbox;
}
if (mbox)
mutt_unlink(certfile);
FREE (&certfile);
}
- else
+ else
mutt_any_key_to_continue(_("no certfile"));
}
- else
+ else
mutt_any_key_to_continue(_("no mbox"));
mutt_unlink(tempfname);
static
pid_t smime_invoke_sign (FILE **smimein, FILE **smimeout, FILE **smimeerr,
- int smimeinfd, int smimeoutfd, int smimeerrfd,
+ int smimeinfd, int smimeoutfd, int smimeerrfd,
const char *fname)
{
return smime_invoke (smimein, smimeout, smimeerr, smimeinfd, smimeoutfd,
BODY *t;
int err = 0, empty, off;
pid_t thepid;
-
+
mutt_mktemp (tempfile, sizeof (tempfile));
if ((fpout = safe_fopen (tempfile, "w+")) == NULL)
{
return NULL;
}
mutt_unlink (smimeerrfile);
-
+
mutt_mktemp (smimeinfile, sizeof (smimeinfile));
if ((fptmp = safe_fopen (smimeinfile, "w+")) == NULL)
{
}
safe_fclose (&smimein);
-
+
mutt_wait_filter (thepid);
mutt_unlink (smimeinfile);
-
+
fflush (fpout);
rewind (fpout);
empty = (fgetc (fpout) == EOF);
safe_fclose (&fpout);
-
+
fflush (smimeerr);
rewind (smimeerr);
while (fgets (buf, sizeof (buf) - 1, smimeerr) != NULL)
t->unlink = 1; /*delete after sending the message */
t->parts=0;
t->next=0;
-
+
return (t);
}
mutt_unlink (filetosign);
return NULL;
}
-
+
mutt_write_mime_header (a, sfp);
fputc ('\n', sfp);
mutt_write_mime_body (a, sfp);
safe_fclose (&sfp);
-
- snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
+
+ snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s",
NONULL(SmimeKeys), signas);
snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
NONULL(SmimeCertificates), signas);
-
+
signas_key = smime_get_key_by_hash (signas, 1);
if ((! signas_key) ||
(! mutt_strcmp ("?", signas_key->issuer)))
NONULL(SmimeCertificates), intermediates);
smime_free_key (&signas_key);
-
+
if ((thepid = smime_invoke_sign (&smimein, NULL, &smimeerr,
fputs (SmimePass, smimein);
fputc ('\n', smimein);
safe_fclose (&smimein);
-
+
mutt_wait_filter (thepid);
safe_fclose (&smimeout);
mutt_unlink (filetosign);
-
+
if (err)
mutt_any_key_to_continue (NULL);
static
pid_t smime_invoke_verify (FILE **smimein, FILE **smimeout, FILE **smimeerr,
- int smimeinfd, int smimeoutfd, int smimeerrfd,
+ int smimeinfd, int smimeoutfd, int smimeerrfd,
const char *fname, const char *sig_fname, int opaque)
{
return smime_invoke (smimein, smimeout, smimeerr, smimeinfd, smimeoutfd,
static
pid_t smime_invoke_decrypt (FILE **smimein, FILE **smimeout, FILE **smimeerr,
- int smimeinfd, int smimeoutfd, int smimeerrfd,
+ int smimeinfd, int smimeoutfd, int smimeerrfd,
const char *fname)
{
return smime_invoke (smimein, smimeout, smimeerr, smimeinfd, smimeoutfd,
snprintf (signedfile, sizeof (signedfile), "%s.sig", tempfile);
-
+
/* decode to a tempfile, saving the original destination */
fp = s->fpout;
if ((s->fpout = safe_fopen (signedfile, "w")) == NULL)
/* restore the prefix */
s->prefix = savePrefix;
-
+
sigbdy->type = origType;
-
+
mutt_mktemp (smimeerrfile, sizeof (smimeerrfile));
if (!(smimeerr = safe_fopen (smimeerrfile, "w+")))
{
mutt_unlink (signedfile);
return -1;
}
-
+
crypt_current_time (s, "OpenSSL");
-
- if ((thepid = smime_invoke_verify (NULL, &smimeout, NULL,
+
+ if ((thepid = smime_invoke_verify (NULL, &smimeout, NULL,
-1, -1, fileno (smimeerr),
tempfile, signedfile, 0)) != -1)
{
fflush (smimeout);
safe_fclose (&smimeout);
-
+
if (mutt_wait_filter (thepid))
badsig = -1;
else
char *line = NULL;
int lineno = 0;
size_t linelen;
-
+
fflush (smimeerr);
rewind (smimeerr);
-
+
line = mutt_read_line (line, &linelen, smimeerr, &lineno, 0);
if (linelen && !ascii_strcasecmp (line, "verification successful"))
badsig = 0;
FREE (&line);
}
}
-
+
fflush (smimeerr);
rewind (smimeerr);
mutt_copy_stream (smimeerr, s->fpout);
safe_fclose (&smimeerr);
-
+
state_attach_puts (_("[-- End of OpenSSL output --]\n\n"), s);
-
+
mutt_unlink (signedfile);
mutt_unlink (smimeerrfile);
sigbdy->length = tmplength;
sigbdy->offset = tmpoffset;
-
+
/* restore the original source stream */
safe_fclose (&s->fpin);
s->fpin = fp;
-
+
return badsig;
}
if (b->parts)
return -1;
-
+
memset (&s, 0, sizeof (s));
s.fpin = fpin;
fseeko (s.fpin, b->offset, 0);
rv = -1;
goto bail;
}
-
+
(*cur)->goodsig = b->goodsig;
(*cur)->badsig = b->badsig;
safe_fclose (&tmpfp);
if (*fpout)
rewind (*fpout);
-
+
return rv;
}
case 'a': /* sign (a)s */
- if ((key = smime_ask_for_key (_("Sign as: "), KEYFLAG_CANSIGN, 0)))
+ if ((key = smime_ask_for_key (_("Sign as: "), KEYFLAG_CANSIGN, 0)))
{
mutt_str_replace (&SmimeSignAs, key->hash);
smime_free_key (&key);
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
int smime_send_menu (HEADER *msg);
#endif
-
-
{
r = smtp_auth_oauth (conn);
}
- else
+ else
{
#ifdef USE_SASL
r = smtp_auth_sasl (conn, method);
if (rc == -1)
return SMTP_AUTH_FAIL;
- if (smtp_get_resp (conn) != 0)
+ if (smtp_get_resp (conn) != 0)
return SMTP_AUTH_FAIL;
return SMTP_AUTH_SUCCESS;
* original. Also, there is now a builtin-test, just compile with:
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
* and run snprintf for results.
- *
+ *
* Thomas Roessler <roessler@does-not-exist.org> 01/27/98 for mutt 0.89i
- * The PGP code was using unsigned hexadecimal formats.
+ * The PGP code was using unsigned hexadecimal formats.
* Unfortunately, unsigned formats simply didn't work.
*
* Michael Elkins <me@mutt.org> 03/05/98 for mutt 0.90.8
/*int snprintf (char *str, size_t count, const char *fmt, ...);*/
/*int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);*/
-static int dopr (char *buffer, size_t maxlen, const char *format,
+static int dopr (char *buffer, size_t maxlen, const char *format,
va_list args);
static void fmtstr (char *buffer, size_t *currlen, size_t maxlen,
char *value, int flags, int min, int max);
int flags;
int cflags;
size_t currlen;
-
+
state = DP_S_DEFAULT;
currlen = flags = cflags = min = 0;
max = -1;
if (ch == '\0')
state = DP_S_DONE;
- switch(state)
+ switch(state)
{
case DP_S_DEFAULT:
- if (ch == '%')
+ if (ch == '%')
state = DP_S_FLAGS;
- else
+ else
dopr_outch (buffer, &currlen, maxlen, ch);
ch = *format++;
break;
case DP_S_FLAGS:
- switch (ch)
+ switch (ch)
{
case '-':
flags |= DP_F_MINUS;
}
break;
case DP_S_MIN:
- if (isdigit((unsigned char)ch))
+ if (isdigit((unsigned char)ch))
{
min = 10*min + char_to_int (ch);
ch = *format++;
- }
- else if (ch == '*')
+ }
+ else if (ch == '*')
{
min = va_arg (args, int);
ch = *format++;
state = DP_S_DOT;
- }
- else
+ }
+ else
state = DP_S_DOT;
break;
case DP_S_DOT:
- if (ch == '.')
+ if (ch == '.')
{
state = DP_S_MAX;
ch = *format++;
- }
- else
+ }
+ else
state = DP_S_MOD;
break;
case DP_S_MAX:
- if (isdigit((unsigned char)ch))
+ if (isdigit((unsigned char)ch))
{
if (max < 0)
max = 0;
max = 10*max + char_to_int (ch);
ch = *format++;
- }
- else if (ch == '*')
+ }
+ else if (ch == '*')
{
max = va_arg (args, int);
ch = *format++;
state = DP_S_MOD;
- }
- else
+ }
+ else
state = DP_S_MOD;
break;
case DP_S_MOD:
- switch (ch)
+ switch (ch)
{
case 'h':
cflags = DP_C_SHORT;
state = DP_S_CONV;
break;
case DP_S_CONV:
- switch (ch)
+ switch (ch)
{
case 'd':
case 'i':
- if (cflags == DP_C_SHORT)
+ if (cflags == DP_C_SHORT)
value = va_arg (args, short int);
else if (cflags == DP_C_LONG)
value = va_arg (args, long int);
fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags);
break;
case 'n':
- if (cflags == DP_C_SHORT)
+ if (cflags == DP_C_SHORT)
{
short int *num;
num = va_arg (args, short int *);
*num = currlen;
- }
- else if (cflags == DP_C_LONG)
+ }
+ else if (cflags == DP_C_LONG)
{
long int *num;
num = va_arg (args, long int *);
*num = currlen;
- }
- else if (cflags == DP_C_LONGLONG)
+ }
+ else if (cflags == DP_C_LONGLONG)
{
long long int *num;
num = va_arg (args, long long int *);
*num = currlen;
- }
- else
+ }
+ else
{
int *num;
num = va_arg (args, int *);
break; /* some picky compilers need this */
}
}
- if (currlen < maxlen - 1)
+ if (currlen < maxlen - 1)
buffer[currlen] = '\0';
- else
+ else
buffer[maxlen - 1] = '\0';
return (int)currlen;
{
int padlen, strln; /* amount to pad */
int cnt = 0;
-
+
if (!value)
{
value = "<NULL>";
for (strln = 0; value[strln]; ++strln); /* strlen */
padlen = min - strln;
- if (padlen < 0)
+ if (padlen < 0)
padlen = 0;
- if (flags & DP_F_MINUS)
+ if (flags & DP_F_MINUS)
padlen = -padlen; /* Left Justify */
- while ((padlen > 0) && (max == -1 || cnt < max))
+ while ((padlen > 0) && (max == -1 || cnt < max))
{
dopr_outch (buffer, currlen, maxlen, ' ');
--padlen;
++cnt;
}
- while (*value && (max == -1 || cnt < max))
+ while (*value && (max == -1 || cnt < max))
{
dopr_outch (buffer, currlen, maxlen, *value++);
++cnt;
}
- while ((padlen < 0) && (max == -1 || cnt < max))
+ while ((padlen < 0) && (max == -1 || cnt < max))
{
dopr_outch (buffer, currlen, maxlen, ' ');
++padlen;
int spadlen = 0; /* amount to space pad */
int zpadlen = 0; /* amount to zero pad */
int caps = 0;
-
+
if (max < 0)
max = 0;
if (flags & DP_F_SPACE)
signvalue = ' ';
}
-
+
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
do {
zpadlen = MAX(zpadlen, spadlen);
spadlen = 0;
}
- if (flags & DP_F_MINUS)
+ if (flags & DP_F_MINUS)
spadlen = -spadlen; /* Left Justifty */
#ifdef DEBUG_SNPRINTF
#endif
/* Spaces */
- while (spadlen > 0)
+ while (spadlen > 0)
{
dopr_outch (buffer, currlen, maxlen, ' ');
--spadlen;
}
/* Sign */
- if (signvalue)
+ if (signvalue)
dopr_outch (buffer, currlen, maxlen, signvalue);
/* Zeros */
- if (zpadlen > 0)
+ if (zpadlen > 0)
{
while (zpadlen > 0)
{
}
/* Digits */
- while (place > 0)
+ while (place > 0)
dopr_outch (buffer, currlen, maxlen, convert[--place]);
-
+
/* Left Justified spaces */
while (spadlen < 0) {
dopr_outch (buffer, currlen, maxlen, ' ');
result *= 10;
exp--;
}
-
+
return result;
}
int iplace = 0;
int fplace = 0;
int padlen = 0; /* amount to pad */
- int zpadlen = 0;
+ int zpadlen = 0;
int caps = 0;
long intpart;
long fracpart;
-
- /*
+
+ /*
* AIX manpage says the default is 0, but Solaris says the default
* is 6, and sprintf on AIX defaults to 6
*/
intpart = ufvalue;
- /*
- * Sorry, we only support 9 digits past the decimal because of our
+ /*
+ * Sorry, we only support 9 digits past the decimal because of our
* conversion method
*/
if (max > 9)
fconvert[fplace] = 0;
/* -1 for decimal point, another -1 if we are printing a sign */
- padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
+ padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
zpadlen = max - fplace;
if (zpadlen < 0)
zpadlen = 0;
- if (padlen < 0)
+ if (padlen < 0)
padlen = 0;
- if (flags & DP_F_MINUS)
+ if (flags & DP_F_MINUS)
padlen = -padlen; /* Left Justifty */
- if ((flags & DP_F_ZERO) && (padlen > 0))
+ if ((flags & DP_F_ZERO) && (padlen > 0))
{
- if (signvalue)
+ if (signvalue)
{
dopr_outch (buffer, currlen, maxlen, signvalue);
--padlen;
dopr_outch (buffer, currlen, maxlen, ' ');
--padlen;
}
- if (signvalue)
+ if (signvalue)
dopr_outch (buffer, currlen, maxlen, signvalue);
- while (iplace > 0)
+ while (iplace > 0)
dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
/*
*/
dopr_outch (buffer, currlen, maxlen, '.');
- while (fplace > 0)
+ while (fplace > 0)
dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
while (zpadlen > 0)
--zpadlen;
}
- while (padlen < 0)
+ while (padlen < 0)
{
dopr_outch (buffer, currlen, maxlen, ' ');
++padlen;
#endif
int len;
VA_LOCAL_DECL;
-
+
VA_START (fmt);
VA_SHIFT (str, char *);
VA_SHIFT (count, size_t );
"%3.2f",
NULL
};
- double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996,
+ double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996,
0.9996, 1.996, 4.136, 0};
char *int_fmt[] = {
"%-1.5d",
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
HEADER *h;
THREAD *thread, *top;
sort_t *sortfunc;
-
+
unset_option (OPTNEEDRESORT);
if (!ctx)
mutt_sleep (1);
return;
}
- else
+ else
qsort ((void *) ctx->hdrs, ctx->msgcount, sizeof (HEADER *), sortfunc);
/* adjust the virtual message numbers */
/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#define SORT_DATE 1 /* the date the mail was sent. */
#define SORT_SIZE 2
/*
* Copyright (C) 1996-2000,2007 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
* %S = current aux sorting method ($sort_aux)
* %t = # of tagged messages [option]
* %u = number of unread messages [option]
- * %v = Mutt version
+ * %v = Mutt version
* %V = currently active limit pattern [option] */
static const char *
status_format_str (char *buf, size_t buflen, size_t col, int cols, char op, const char *src,
(Context->magic != MUTT_IMAP &&
Context->deleted)) ? 1 : 0);
}
-
+
if (!StChars || !StChars->len)
buf[0] = 0;
else if (i >= StChars->len)
int strncasecmp (char *s1, char *s2, size_t n)
{
register int c1, c2, l = 0;
-
+
while (*s1 && *s2 && l < n)
{
c1 = tolower ((unsigned char) *s1);
int strcasecmp (char *s1, char *s2)
{
register int c1, c2;
-
+
while (*s1 && *s2)
{
c1 = tolower ((unsigned char) *s1);
return (c1 - c2);
s1++;
s2++;
- }
+ }
return (int) (*s1 - *s2);
}
char *strdup (const char *s) /* __MEM_CHECKED__ */
{
char *d;
-
+
if (s == NULL)
return NULL;
-
+
if ((d = malloc (strlen (s) + 1)) == NULL) /* __MEM_CHECKED__ */
return NULL;
memcpy (d, s, strlen (s) + 1);
return d;
}
-
/*
* Copyright (C) 1996-2000,2013 Michael R. Elkins <me@mutt.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
#if HAVE_CONFIG_H
# include "config.h"
break;
}
}
-
+
/* if there is a parent-to-child subject change anywhere between us and our
* closest displayed ancestor, display the subject */
for (tmp = tree->parent; tmp; tmp = tmp->parent)
tree = tree->prev;
}
}
-
+
/* now fix up for the OPTHIDETOP* options if necessary */
if (hide_top_limited || hide_top_missing)
{
tree = ctx->tree;
FOREVER
{
- if (!tree->visible && tree->deep && tree->subtree_visible < 2
+ if (!tree->visible && tree->deep && tree->subtree_visible < 2
&& ((tree->message && hide_top_limited) || (!tree->message && hide_top_missing)))
tree->deep = 0;
if (!tree->deep && tree->child && tree->subtree_visible)
time_t thisdate;
LIST *curlist, *oldlist, *newlist, *subjects = NULL;
int rc = 0;
-
+
FOREVER
{
while (!cur->message)
/* find the best possible match for a parent message based upon subject.
* if there are multiple matches, the one which was sent the latest, but
- * before the current message, is used.
+ * before the current message, is used.
*/
static THREAD *find_subject (CONTEXT *ctx, THREAD *cur)
{
struct hash_elem *ptr;
THREAD *tmp, *last = NULL;
LIST *subjects = NULL, *oldlist;
- time_t date = 0;
+ time_t date = 0;
subjects = make_subject_list (cur, &date);
THREAD **array, *sort_key, *top, *tmp;
HEADER *oldsort_key;
int i, array_size, sort_top = 0;
-
+
/* we put things into the array backwards to save some cycles,
- * but we want to have to move less stuff around if we're
+ * but we want to have to move less stuff around if we're
* resorting, so we sort backwards and then put them back
* in reverse order so they're forwards
*/
int i, oldsort, using_refs = 0;
THREAD *thread, *new, *tmp, top;
LIST *ref = NULL;
-
+
/* set Sort to the secondary method to support the set sort_aux=reverse-*
* settings. The sorting functions just look at the value of
* SORT_REVERSE
*/
oldsort = Sort;
Sort = SortAux;
-
+
if (!ctx->thread_hash)
init = 1;
ref = cur->env->references;
else
ref = cur->env->references->next;
-
+
using_refs = 2;
}
}
else
ref = ref->next; /* go on with references */
-
+
if (!ref)
break;
/* restore the oldsort order. */
Sort = oldsort;
-
+
/* Put the list into an array. */
linearize_tree (ctx);
if ((dir != 0) ^ ((Sort & SORT_REVERSE) != 0))
{
do
- {
+ {
cur = cur->next;
if (!cur)
return (-1);
else
{
do
- {
+ {
cur = cur->prev;
if (!cur)
return (-1);
else if (flag & MUTT_THREAD_NEXT_UNREAD)
return (min_unread);
}
-
+
FOREVER
{
cur = thread->message;
if (cur != roothdr)
cur->virtual = -1;
}
- else
+ else
{
if (CHECK_LIMIT)
cur->virtual = cur->msgno;
{
while (!threads[i]->message)
threads[i] = threads[i]->child;
- }
+ }
if (Sort & SORT_REVERSE)
rc = threads[0]->message->msgno - (threads[1] ? threads[1]->message->msgno : -1);
else
rc = (threads[1] ? threads[1]->message->msgno : ctx->msgcount) - threads[0]->message->msgno;
-
+
if (flag)
rc += 1;
-
+
return (rc);
}
/*
* Copyright (C) 2000-2002,2004 Thomas Roessler <roessler@does-not-exist.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+ */
/*
* A simple URL parser.
FREE (&tmp);
return rc;
}
-
char *host;
unsigned short port;
char *path;
-}
+}
ciss_url_t;
url_scheme_t url_check_scheme (const char *s);
int mutt_wctoutf8 (char *s, unsigned int c, size_t buflen)
{
- if (c < (1 << 7))
+ if (c < (1 << 7))
{
if (s && buflen >= 1)
*s++ = c;