+----------------------------------------------------+
bg cs da de el en eo es et fi fr gl he hr id it ja
0 14 24 32 11 1 8 23 13 1 33 22 4 0 7 9 18
-
+
ko lv nb nl nn no pl pt pt_BR ru sk sl sv tr uk zh
+----------------------------------------------------+
a2ps | [] [] [] | 6
(fallout from conversion from article to book).
* UPDATING: Use +/-/! instead of N/D/M in UPDATING.
-
+
2006-05-19 18:30:10 Rocco Rutte <pdmef@gmx.net> (brendan)
* Makefile.am, README, UPDATING: The UPDATING document is supposed
destabilised things. Time for some brave (or lazy
non-Changelog-reading) testers to report... next up, IDLE
support.
-
+
2005-12-10 07:06:44 Brendan Cully <brendan@kublai.com> (brendan)
* imap/browse.c, imap/command.c, imap/imap.c, imap/imap_private.h,
--disable-nls
This switch disables mutt's native language support.
---with-included-gettext
+--with-included-gettext
Mutt will be built using the GNU gettext library included in
the intl/ sub-directory. You may need to use this switch if
your machine has something which looks like gettext to the
routines, so this provides a way to support them.
--enable-flock
- use flock() to lock files.
+ use flock() to lock files.
--disable-fcntl
by default, Mutt uses fcntl() to lock files. Over NFS this can
result in poor performance on read/write. Note that using this
option could be dangerous if dotlocking is also disabled.
-
+
--enable-nfs-fix
some implementations of NFS do not always write the
atime/mtime of small files. This means that Mutt's ``mailboxes''
GNU General Public License
==========================
-_Version 2, June 1991_
-_Copyright © 1989, 1991 Free Software Foundation, Inc.,_
+_Version 2, June 1991_
+_Copyright © 1989, 1991 Free Software Foundation, Inc.,_
_51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA_
Everyone is permitted to copy and distribute verbatim copies
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
-
+
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.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
+
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
verified if the output from $pgp_verify_command matches this
regular expression. It's suggested that you set this variable to
the typical text message output by PGP (or GPG, or whatever)
- produces when it encounters a good signature.
+ produces when it encounters a good signature.
- There's a new function, check-traditional-pgp, which is bound to
esc-P by default. It'll check whether a text parts of a message
-IMAP/SSL in mutt
+IMAP/SSL in mutt
================
Compilation
calculating the MD5-sum from the output and saving it in a file.
** Note: The contents of the file pointed by $RANDFILE environment
-** variable (or ~/.rnd if unset) will be overwritten every time Mutt
+** variable (or ~/.rnd if unset) will be overwritten every time Mutt
** is run so don't put anything you can't afford to lose in that file.
The files Mutt will try to use to initialize SSL library with are files
connection will be terminated immediately. If you accept the
certificate, the connection will be established. Accepted certificates
can also be saved so that further connections to the server are
-automatically accepted.
+automatically accepted.
If OpenSSL was built with support for ServerNameIndication (SNI) and TLS
is used in the negotiation, mutt will send its idea of the server-name
You can also combine the options until you get a successful connect. Once
you know which options do not work, you can set the variables for non-working
-protocols to know. The variables for the protocols are ssl_use_tlsv1,
+protocols to know. The variables for the protocols are ssl_use_tlsv1,
ssl_use_sslv2, and ssl_use_sslv3.
To verify TLS SNI support by a server, you can use:
-tls1 -servername <imap server>
---
+--
Tommi Komulainen
Tommi.Komulainen@iki.fi
- make patterns generic (I have patches for this -tlr), and
introduce generic menu limiting, menu pattern searching, and the
- like.
+ like.
Note: This still requires some thought, since we'd have to store
per-entry data in the menu structure. As an alternative, we could
- $imap_cachedir replaced with $message_cachedir
+ Header/body caching for POP ($message_cachedir)
- + Header caching for MH folders
+ + Header caching for MH folders
! $record now defaults to ~/sent
! $imap_idle now defaults to "yes" instead of "no"
+ Tab-completion for $my_* variable names and values
+ Expansion of mutt variables (except shell escape)
- + Self-defined variables with $my_* prefix
- + Pattern group support
+ + Self-defined variables with $my_* prefix
+ + Pattern group support
+ $imap_cachedir
+ 'old' flag on IMAP folders
+ SASL-IR support for IMAP
1.6.0.1:
+ rebase to mutt upstream 1.6.0
-+ update to the new sidebar implementation. Note that all .muttrc options
++ update to the new sidebar implementation. Note that all .muttrc options
are prefixed by "sidebar_" now.
+ rebase is based on neomutt project (see https://github.com/neomutt) where are
maintained all non-upstream mutt changes, so it's easy to merge another
features like "trash", "ifdef", ... to mutt-kz.
-+ the stable mutt-kz releases and tags are maintained in stable/v<version> branches,
- the master branch is going to be *rebased*. This development model help us to be
++ the stable mutt-kz releases and tags are maintained in stable/v<version> branches,
+ the master branch is going to be *rebased*. This development model help us to be
up to date with mutt upstream.
/*
* 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
-
+
#ifdef USE_NNTP
if (a1->type == MUTT_ACCT_TYPE_NNTP && NntpUser)
user = NntpUser;
/*
* 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!"));
return;
}
-
+
/* tell whoever called me to redraw the screen when I return */
set_option (OPTNEEDREDRAW);
-
+
menu = mutt_new_menu (MENU_ALIAS);
menu->make_entry = alias_entry;
menu->tag = alias_tag;
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_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 MUTT_ABORT:
+ case MUTT_ABORT:
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;
}
-
+
mutt_debug (5, "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.
*/
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 = tolower (*a) - 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 = tolower (*a) - 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"
char tempfile[_POSIX_PATH_MAX];
FILE *fpin = NULL, *fpout = NULL;
struct stat st;
-
+
if(a->unlink)
return 0;
rfc1524_entry *entry = rfc1524_new_entry();
snprintf(type, sizeof(type), "%s/%s", TYPE(a), a->subtype);
rfc1524_mailcap_lookup(a, type, entry, 0);
- rfc1524_expand_filename(entry->nametemplate, a->filename,
+ rfc1524_expand_filename(entry->nametemplate, a->filename,
tempfile, sizeof(tempfile));
-
+
rfc1524_free_entry(&entry);
if(stat(a->filename, &st) == -1)
}
else
mutt_perror(fpin ? tempfile : a->filename);
-
+
if(fpin) safe_fclose (&fpin);
if(fpout) safe_fclose (&fpout);
-
+
return a->unlink ? 0 : -1;
}
rfc1524_entry *entry = rfc1524_new_entry ();
short unlink_newfile = 0;
int rc = 0;
-
+
snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
if (rfc1524_mailcap_lookup (a, type, entry, MUTT_COMPOSE))
{
if (entry->composetypecommand)
strfcpy (command, entry->composetypecommand, sizeof (command));
- else
+ else
strfcpy (command, entry->composecommand, sizeof (command));
if (rfc1524_expand_filename (entry->nametemplate,
a->filename, newfile, sizeof (newfile)))
}
else
strfcpy(newfile, a->filename, sizeof(newfile));
-
+
if (rfc1524_expand_command (a, newfile, type,
command, sizeof (command)))
{
mutt_endwin (NULL);
if ((r = mutt_system (command)) == -1)
mutt_error (_("Error running \"%s\"!"), 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_mktemp (tempfile, sizeof (tempfile));
mutt_copy_stream (fp, tfp);
safe_fclose (&fp);
safe_fclose (&tfp);
- mutt_unlink (a->filename);
- if (mutt_rename_file (tempfile, a->filename) != 0)
+ mutt_unlink (a->filename);
+ if (mutt_rename_file (tempfile, a->filename) != 0)
{
mutt_perror (_("Failure to rename file."));
goto bailout;
}
rc = 1;
-
+
bailout:
-
+
if(unlink_newfile)
unlink(newfile);
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.
rfc1524_entry *entry = rfc1524_new_entry ();
short unlink_newfile = 0;
int rc = 0;
-
+
snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
if (rfc1524_mailcap_lookup (a, type, entry, MUTT_EDIT))
{
}
rc = 1;
-
+
bailout:
-
+
if(unlink_newfile)
unlink(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) {
mutt_debug (1, "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;
}
strfcpy (command, entry->command, sizeof (command));
-
+
if (fp)
{
fname = safe_strdup (a->filename);
}
else if (fp == NULL) /* send case */
strfcpy (tempfile, a->filename, sizeof (tempfile));
-
+
if (fp)
{
/* recv case: we need to save the attachment to a file */
command, sizeof (command));
use_pager = entry->copiousoutput;
}
-
+
if (use_pager)
{
if (fp && !use_mailcap && a->filename)
else
mutt_mktemp (pagerfile, sizeof (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 && 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 (safe_fsync_close (&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
*/
pid_t thepid;
FILE *ifp, *fpout;
short unlink_newfile = 0;
-
+
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))
{
char command[_POSIX_PATH_MAX+STRING];
rfc1524_entry *entry;
int piped = false;
mutt_debug (2, "Using mailcap...\n");
-
+
entry = rfc1524_new_entry ();
rfc1524_mailcap_lookup (a, type, entry, MUTT_PRINT);
if (rfc1524_expand_filename (entry->nametemplate, a->filename,
/* decode and print */
int rc = 0;
-
+
ifp = NULL;
fpout = NULL;
-
+
mutt_mktemp (newfile, sizeof (newfile));
if (mutt_decode_save_attachment (fp, a, newfile, MUTT_PRINTING, 0) == 0)
{
-
+
mutt_debug (2, "successfully decoded %s type attachment to %s\n",
type, newfile);
-
+
if ((ifp = fopen (newfile, "r")) == NULL)
{
mutt_perror ("fopen");
}
mutt_debug (2, "successfully opened %s read-only\n", newfile);
-
+
mutt_endwin (NULL);
if ((thepid = mutt_create_filter (NONULL(PrintCmd), &fpout, NULL, NULL)) < 0)
{
}
mutt_debug (2, "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;
}
else
{
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;
-
+
if ((! S_ISREG (s.st_mode)) && (! S_ISDIR (s.st_mode)) &&
(! S_ISLNK (s.st_mode)))
continue;
-
+
tmp = Incoming;
while (tmp && mutt_strcmp (buffer, tmp->path))
tmp = tmp->next;
}
add_folder (menu, state, de->d_name, NULL, &s, tmp, NULL);
}
- closedir (dp);
+ closedir (dp);
}
browser_sort (state);
return 0;
folder.ff = &((struct folder_file *) menu->data)[num];
folder.num = num;
-
+
#ifdef USE_NNTP
if (option (OPTNEWS))
- mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL(GroupFormat), newsgroup_format_str,
+ mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL(GroupFormat), newsgroup_format_str,
(unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR);
else
#endif
- 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;
-
+
#ifdef USE_NNTP
if (option (OPTNEWS))
{
mutt_error (_("Can't attach a directory!"));
return 0;
}
-
+
ot = ff->tagged;
ff->tagged = (m >= 0 ? m : !ff->tagged);
-
+
return ff->tagged - ot;
}
char GotoSwapper[_POSIX_PATH_MAX] = "";
buffy = buffy && folder;
-
+
memset (&state, 0, sizeof (struct browser_state));
#ifdef USE_NNTP
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 &&
}
break;
#endif
-
+
case OP_CHANGE_DIRECTORY:
#ifdef USE_NNTP
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))
}
MAYBE_REDRAW (menu->redraw);
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) ?
/* L10N: The highlighted letters must match the "Sort" options */
_("Reverse sort by (d)ate, (a)lpha, si(z)e, d(e)scription, (c)ount, ne(w) count, 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)
#endif /* USE_IMAP */
}
}
-
+
bail:
-
+
if (GotoSwapper[0])
GotoSwapper[0] = '\0';
}
/*
* 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
* 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.
void mutt_buffer_free (BUFFER **p)
{
- if (!p || !*p)
+ if (!p || !*p)
return;
FREE(&(*p)->data);
{
va_list ap, ap_retry;
int len, blen, doff;
-
+
va_start (ap, fmt);
va_copy (ap_retry, ap);
/* 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)
{
* 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,2010,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2016 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)
{
ut.actime = st->st_atime;
ut.modtime = time (NULL);
- utime (buf, &ut);
+ utime (buf, &ut);
}
else
utime (buf, NULL);
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;
}
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
* MIME name is given.
*/
-static const struct
+static const struct
{
const char *key;
const char *pref;
{
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, int match)
{
/* 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)
{
int i;
{
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 ((*o = mutt_getvaluebyname (buf->data, Fields)) == -1)
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_BODY) ||
(object == MT_COLOR_HEADER) ||
(object == MT_COLOR_ATTACH_HEADERS) ||
mutt_extract_token (buf, s, 0);
}
-
+
if (MoreArgs (s) && (object != MT_COLOR_STATUS))
{
strfcpy (err->data, _("too many arguments"), err->dsize);
return (-1);
}
-
+
/* dry run? */
-
+
if(dry_run)
{
*s->dptr = '\0'; /* fake that we're done parsing */
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, match);
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;
/*
* 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;
safe_fclose (&fpfilterout); /* XXX - check result? */
-
+
if (WithCrypto)
{
/* update crypto information for this message */
cur->security &= ~(GOODSIGN|BADSIGN);
cur->security |= crypt_query (cur->content);
-
+
/* Remove color cache for this message, in case there
are color patterns for both ~g and ~V */
cur->pair = 0;
{
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 (option (OPTNEEDREDRAW))
}
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 */
mutt_perror (_("Can't create filter process"));
return 1;
}
-
+
pipe_msg (h, fpout, decode, print);
safe_fclose (&fpout);
rc = mutt_wait_filter (thepid);
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;
}
/* returns 0 if the copy/save was successful, or -1 on error/abort */
-int mutt_save_message (HEADER *h, int delete,
+int mutt_save_message (HEADER *h, int delete,
int decode, int decrypt, int *redraw)
{
int i, need_buffy_cleanup;
*redraw = 0;
-
+
snprintf (prompt, sizeof (prompt),
decode ? (delete ? _("Decode-save%s to mailbox") :
_("Decode-copy%s to mailbox")) :
_("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;
-
+
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;
-
+
/* 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);
if (fp && (is_multipart (b) || mutt_is_message_type (b->type, b->subtype)))
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(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(idx[i]->content);
else if(r == MUTT_ABORT)
{
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)
rfc822_write_address (buf, sizeof (buf), *addr, 1);
mutt_window_move (MuttIndexWindow, line, HDR_XOFFSET);
mutt_paddstr (W, buf);
-
+
return 0;
}
idx[x] = idx[x+1];
idx[*idxlen - 1] = NULL;
menu->max = --(*idxlen);
-
+
return (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 = menu->data;
CONTENT *info;
BODY *b;
-
+
for (i = 0, s = 0; i < menu->max; 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;
#ifdef USE_NNTP
case OP_COMPOSE_EDIT_NEWSGROUPS:
case OP_COMPOSE_ATTACH_KEY:
if (!(WithCrypto & APPLICATION_PGP))
- break;
+ break;
if (idxlen == idxmax)
{
safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5));
menu->data = idx;
}
-
+
idx[idxlen] = safe_calloc (1, sizeof (ATTACHPTR));
if ((idx[idxlen]->content = crypt_pgp_make_key_attachment(NULL)) != NULL)
{
menu->redraw = REDRAW_FULL;
unset_option(OPTNEEDREDRAW);
}
-
+
mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
FREE (&idx[idxlen]);
}
}
-
+
FREE (&files);
if (!error) mutt_clear_error ();
this = Context; /* remember current folder and sort methods*/
oldSort = Sort; oldSortAux = SortAux;
-
+
Context = ctx;
set_option(OPTATTACHMSG);
mutt_message (_("Tag the messages you want to attach!"));
}
menu->redraw |= REDRAW_FULL;
- if (close == OP_QUIT)
+ if (close == OP_QUIT)
mx_close_mailbox (Context, NULL);
else
mx_fastclose_mailbox (Context);
break;
#define CURRENT idx[menu->current]->content
-
+
case OP_COMPOSE_TOGGLE_RECODE:
- {
+ {
CHECK_COUNT;
if (!mutt_is_text_part (CURRENT))
{
}
mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
-
+
case OP_COMPOSE_TOGGLE_DISPOSITION:
/* toggle the content-disposition between inline/attachment */
idx[menu->current]->content->disposition = (idx[menu->current]->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(idx, idxlen) != 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 (idx[menu->current]->content->filename, fname))
break;
-
+
mutt_str_replace (&idx[menu->current]->content->filename, fname);
menu->redraw = REDRAW_CURRENT;
if(idx[menu->current]->content->stamp >= st.st_mtime)
mutt_stamp_attachment(idx[menu->current]->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, &menu->redraw);
mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
}
/* Draw formatted compose status line */
- if (menu->redraw & REDRAW_STATUS)
+ if (menu->redraw & REDRAW_STATUS)
{
compose_status_line (buf, sizeof (buf), 0, MuttStatusWindow->cols, menu, NONULL(ComposeFormat));
mutt_window_move (MuttStatusWindow, 0, 0);
X509v3 extensions:
X509v3 Basic Constraints: critical
CA:TRUE
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:08:20:6C:66:EB:81:0A:6C:5C:D5:B5:A6:3C:41:DD:1C:96:91:27:77
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
08:20:6C:66:EB:81:0A:6C:5C:D5:B5:A6:3C:41:DD:1C:96:91:27:77
Signature Algorithm: sha1WithRSAEncryption
5a:87:58:8f:2d:ab:76:21:6b:54:0c:d9:f1:41:f6:4e:cd:2b:
8d:38:26:b0:6f:43:6e:09:7d
Exponent: 3 (0x3)
X509v3 extensions:
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
- X509v3 CRL Distribution Points:
+ X509v3 CRL Distribution Points:
DirName:/C=US/O=Digital Signature Trust Co./OU=DST (ANX Network) CA/CN=CRL1
- X509v3 Private Key Usage Period:
+ X509v3 Private Key Usage Period:
Not Before: Dec 9 15:46:48 1998 GMT, Not After: Dec 9 15:46:48 2018 GMT
- X509v3 Key Usage:
+ X509v3 Key Usage:
Certificate Sign, CRL Sign
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:8C:16:55:70:CC:16:0A:53:64:C2:A5:84:AA:B3:64:17:43:3F:82:36
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
8C:16:55:70:CC:16:0A:53:64:C2:A5:84:AA:B3:64:17:43:3F:82:36
- X509v3 Basic Constraints:
+ X509v3 Basic Constraints:
CA:TRUE
- 1.2.840.113533.7.65.0:
+ 1.2.840.113533.7.65.0:
0
..V4.0....
Signature Algorithm: sha1WithRSAEncryption
CA:TRUE, pathlen:5
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
- X509v3 Certificate Policies:
+ X509v3 Certificate Policies:
Policy: 1.2.840.113807.10.1.5.1
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
57:47:35:7B:36:27:11:A8:08:FC:2F:46:25:EB:24:69
Signature Algorithm: sha1WithRSAEncryption
c7:61:45:a8:8a:71:b9:be:34:e9:21:7b:21:cd:56:13:98:d5:
5d:88:64:d0:c8:f8:5d:54:51
Exponent: 65537 (0x10001)
X509v3 extensions:
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
Signature Algorithm: md5WithRSAEncryption
63:76:17:7c:96:f0:53:a5:5d:01:1c:53:ce:29:c2:7e:75:ac:
ee:4a:fd:6d:de:fe:26:a5:3b
Exponent: 65537 (0x10001)
X509v3 extensions:
- Netscape Cert Type:
+ Netscape Cert Type:
SSL Client, S/MIME
Signature Algorithm: md5WithRSAEncryption
6c:3d:99:c3:05:e2:1d:ca:e5:2d:aa:68:85:8b:40:31:20:66:
94:40:64:78:83:a1:cc:39:89
Exponent: 65537 (0x10001)
X509v3 extensions:
- X509v3 Basic Constraints:
+ X509v3 Basic Constraints:
CA:TRUE, pathlen:5
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
2C:87:59:1F:8B:13:80:B2:F9:86:9D:3E:12:7E:58:96
Signature Algorithm: md5WithRSAEncryption
0f:fe:73:b5:07:88:6f:a0:0b:89:ea:ca:50:1f:94:de:94:2b:
13:74:76:36:b5:7a:b4:2d:71
Exponent: 3 (0x3)
X509v3 extensions:
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
- X509v3 CRL Distribution Points:
+ X509v3 CRL Distribution Points:
DirName:/C=US/O=Digital Signature Trust Co./OU=DSTCA E1/CN=CRL1
- X509v3 Private Key Usage Period:
+ X509v3 Private Key Usage Period:
Not Before: Dec 10 18:10:23 1998 GMT, Not After: Dec 10 18:10:23 2018 GMT
- X509v3 Key Usage:
+ X509v3 Key Usage:
Certificate Sign, CRL Sign
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:6A:79:7E:91:69:46:18:13:0A:02:77:A5:59:5B:60:98:25:0E:A2:F8
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
6A:79:7E:91:69:46:18:13:0A:02:77:A5:59:5B:60:98:25:0E:A2:F8
- X509v3 Basic Constraints:
+ X509v3 Basic Constraints:
CA:TRUE
- 1.2.840.113533.7.65.0:
+ 1.2.840.113533.7.65.0:
0
..V4.0....
Signature Algorithm: sha1WithRSAEncryption
0c:9d:e7:91:5b:80:cd:94:9d
Exponent: 3 (0x3)
X509v3 extensions:
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
- X509v3 CRL Distribution Points:
+ X509v3 CRL Distribution Points:
DirName:/C=US/O=Digital Signature Trust Co./OU=DSTCA E2/CN=CRL1
- X509v3 Private Key Usage Period:
+ X509v3 Private Key Usage Period:
Not Before: Dec 9 19:17:26 1998 GMT, Not After: Dec 9 19:17:26 2018 GMT
- X509v3 Key Usage:
+ X509v3 Key Usage:
Certificate Sign, CRL Sign
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:1E:82:4D:28:65:80:3C:C9:41:6E:AC:35:2E:5A:CB:DE:EE:F8:39:5B
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
1E:82:4D:28:65:80:3C:C9:41:6E:AC:35:2E:5A:CB:DE:EE:F8:39:5B
- X509v3 Basic Constraints:
+ X509v3 Basic Constraints:
CA:TRUE
- 1.2.840.113533.7.65.0:
+ 1.2.840.113533.7.65.0:
0
..V4.0....
Signature Algorithm: sha1WithRSAEncryption
c6:ec:3f:be:35:9c:3d:22:ef
Exponent: 3 (0x3)
X509v3 extensions:
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
- X509v3 CRL Distribution Points:
+ X509v3 CRL Distribution Points:
DirName:/C=US/O=Digital Signature Trust Co./OU=DST-Entrust GTI CA/CN=CRL1
- X509v3 Private Key Usage Period:
+ X509v3 Private Key Usage Period:
Not Before: Dec 9 00:02:24 1998 GMT, Not After: Dec 9 00:02:24 2018 GMT
- X509v3 Key Usage:
+ X509v3 Key Usage:
Certificate Sign, CRL Sign
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:93:9A:44:CA:D0:78:53:80:29:49:04:DF:C7:AF:33:3F:99:75:5F:AE
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
93:9A:44:CA:D0:78:53:80:29:49:04:DF:C7:AF:33:3F:99:75:5F:AE
- X509v3 Basic Constraints:
+ X509v3 Basic Constraints:
CA:TRUE
- 1.2.840.113533.7.65.0:
+ 1.2.840.113533.7.65.0:
0
..V4.0....
Signature Algorithm: sha1WithRSAEncryption
07:e1
Exponent: 65537 (0x10001)
X509v3 extensions:
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70
- 1.2.840.113533.7.65.0:
+ 1.2.840.113533.7.65.0:
0...V5.0:4.0....
Signature Algorithm: sha1WithRSAEncryption
59:47:ac:21:84:8a:17:c9:9c:89:53:1e:ba:80:85:1a:c6:3c:
8c:e6:02:a4:e6:4f:5e:f7:8b
Exponent: 3 (0x3)
X509v3 extensions:
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
- X509v3 CRL Distribution Points:
+ X509v3 CRL Distribution Points:
DirName:/C=US/O=Entrust.net/OU=www.entrust.net/Client_CA_Info/CPS incorp. by ref. limits liab./OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Client Certification Authority/CN=CRL1
URI:http://www.entrust.net/CRL/Client1.crl
- X509v3 Private Key Usage Period:
+ X509v3 Private Key Usage Period:
Not Before: Oct 12 19:24:30 1999 GMT, Not After: Oct 12 19:24:30 2019 GMT
- X509v3 Key Usage:
+ X509v3 Key Usage:
Certificate Sign, CRL Sign
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:C4:FB:9C:29:7B:97:CD:4C:96:FC:EE:5B:B3:CA:99:74:8B:95:EA:4C
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
C4:FB:9C:29:7B:97:CD:4C:96:FC:EE:5B:B3:CA:99:74:8B:95:EA:4C
- X509v3 Basic Constraints:
+ X509v3 Basic Constraints:
CA:TRUE
- 1.2.840.113533.7.65.0:
+ 1.2.840.113533.7.65.0:
0
..V4.0....
Signature Algorithm: md5WithRSAEncryption
b1:16:19:61:b9:54:b6:e6:43
Exponent: 3 (0x3)
X509v3 extensions:
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
- X509v3 CRL Distribution Points:
+ X509v3 CRL Distribution Points:
DirName:/C=US/O=Entrust.net/OU=www.entrust.net/CPS incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Secure Server Certification Authority/CN=CRL1
URI:http://www.entrust.net/CRL/net1.crl
- X509v3 Private Key Usage Period:
+ X509v3 Private Key Usage Period:
Not Before: May 25 16:09:40 1999 GMT, Not After: May 25 16:09:40 2019 GMT
- X509v3 Key Usage:
+ X509v3 Key Usage:
Certificate Sign, CRL Sign
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:F0:17:62:13:55:3D:B3:FF:0A:00:6B:FB:50:84:97:F3:ED:62:D0:1A
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
F0:17:62:13:55:3D:B3:FF:0A:00:6B:FB:50:84:97:F3:ED:62:D0:1A
- X509v3 Basic Constraints:
+ X509v3 Basic Constraints:
CA:TRUE
- 1.2.840.113533.7.65.0:
+ 1.2.840.113533.7.65.0:
0
..V4.0....
Signature Algorithm: sha1WithRSAEncryption
d2:d8:ba:9a:ff:be:10:60:5b
Exponent: 65537 (0x10001)
X509v3 extensions:
- X509v3 CRL Distribution Points:
+ X509v3 CRL Distribution Points:
DirName:/C=US/O=Equifax/OU=Equifax Premium Certificate Authority/CN=CRL1
- X509v3 Private Key Usage Period:
+ X509v3 Private Key Usage Period:
Not After: Aug 24 22:54:23 2018 GMT
- X509v3 Key Usage:
+ X509v3 Key Usage:
Certificate Sign, CRL Sign
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:15:EE:B2:28:59:AB:6E:E5:F8:CF:8B:81:F4:24:E1:AE:3F:75:1B:98
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
15:EE:B2:28:59:AB:6E:E5:F8:CF:8B:81:F4:24:E1:AE:3F:75:1B:98
- X509v3 Basic Constraints:
+ X509v3 Basic Constraints:
CA:TRUE
- 1.2.840.113533.7.65.0:
+ 1.2.840.113533.7.65.0:
0...V3.0c....
Signature Algorithm: sha1WithRSAEncryption
bd:0b:9c:27:a9:03:db:28:dc:98:a9:4b:d0:d1:8e:a7:a8:1a:
3a:88:e7:bf:14:fd:e0:c7:b9
Exponent: 65537 (0x10001)
X509v3 extensions:
- X509v3 CRL Distribution Points:
+ X509v3 CRL Distribution Points:
DirName:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority/CN=CRL1
- X509v3 Private Key Usage Period:
+ X509v3 Private Key Usage Period:
Not After: Aug 22 16:41:51 2018 GMT
- X509v3 Key Usage:
+ X509v3 Key Usage:
Certificate Sign, CRL Sign
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4
- X509v3 Basic Constraints:
+ X509v3 Basic Constraints:
CA:TRUE
- 1.2.840.113533.7.65.0:
+ 1.2.840.113533.7.65.0:
0...V3.0c....
Signature Algorithm: sha1WithRSAEncryption
58:ce:29:ea:fc:f7:de:b5:ce:02:b9:17:b5:85:d1:b9:e3:e0:
CA:TRUE, pathlen:5
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
- X509v3 Certificate Policies:
+ X509v3 Certificate Policies:
Policy: 1.2.840.113763.1.2.1.3
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
76:0A:49:21:38:4C:9F:DE:F8:C4:49:C7:71:71:91:9D
Signature Algorithm: sha1WithRSAEncryption
41:3a:d4:18:5b:da:b8:de:21:1c:e1:8e:09:e5:f1:68:34:ff:
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
43:24:8D:70:15:08:62:55:9C:4F:0C:40:17:5D:86:5E:0F:A2:4C:FB
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B
X509v3 Basic Constraints: critical
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
FC:E0:66:F6:5A:35:99:EB:40:1E:D2:B8:1E:43:BC:98:8E:1F:8A:C3
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B
X509v3 Basic Constraints: critical
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
7C:E7:B2:B1:2C:DE:B1:A7:6B:E9:76:0C:E1:A3:FD:4E:6C:C7:B9:F6
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B
X509v3 Basic Constraints: critical
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
CC:36:CC:17:B4:45:91:2F:ED:CF:3B:30:48:77:FB:B5:14:99:BE:E3
- X509v3 Authority Key Identifier:
+ X509v3 Authority Key Identifier:
keyid:60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B
X509v3 Basic Constraints: critical
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
+ X509v3 Subject Key Identifier:
60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B
X509v3 Basic Constraints: critical
CA:TRUE
39:d7:e5:5f:fa:e4:7e:cc:a3
Exponent: 65537 (0x10001)
X509v3 extensions:
- Netscape Revocation Url:
+ Netscape Revocation Url:
https://www.trustcenter.de/cgi-bin/check-rev.cgi?
- Netscape CA Revocation Url:
+ Netscape CA Revocation Url:
https://www.trustcenter.de/cgi-bin/check-rev.cgi?
- Netscape Renewal Url:
+ Netscape Renewal Url:
https://www.trustcenter.de/cgi-bin/Renew.cgi?
- Netscape CA Policy Url:
+ Netscape CA Policy Url:
http://www.trustcenter.de/guidelines/index.html
- Netscape Comment:
+ Netscape Comment:
TC TrustCenter Class 0 CA
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
Signature Algorithm: md5WithRSAEncryption
4d:07:7f:5f:09:30:19:92:aa:05:47:7a:94:75:54:2a:ae:cf:
44:c8:a3:61:ca:1b:a0:36:1f
Exponent: 65537 (0x10001)
X509v3 extensions:
- Netscape Revocation Url:
+ Netscape Revocation Url:
https://www.trustcenter.de/cgi-bin/check-rev.cgi?
- Netscape CA Revocation Url:
+ Netscape CA Revocation Url:
https://www.trustcenter.de/cgi-bin/check-rev.cgi?
- Netscape Renewal Url:
+ Netscape Renewal Url:
https://www.trustcenter.de/cgi-bin/Renew.cgi?
- Netscape CA Policy Url:
+ Netscape CA Policy Url:
http://www.trustcenter.de/guidelines/index.html
- Netscape Comment:
+ Netscape Comment:
TC TrustCenter Class 1 CA
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
Signature Algorithm: md5WithRSAEncryption
05:42:52:26:a4:0c:27:01:44:ac:5c:25:28:c2:44:42:54:08:
9c:fb:fc:57:9b:57:5c:4f:0d
Exponent: 65537 (0x10001)
X509v3 extensions:
- Netscape Revocation Url:
+ Netscape Revocation Url:
https://www.trustcenter.de/cgi-bin/check-rev.cgi?
- Netscape CA Revocation Url:
+ Netscape CA Revocation Url:
https://www.trustcenter.de/cgi-bin/check-rev.cgi?
- Netscape Renewal Url:
+ Netscape Renewal Url:
https://www.trustcenter.de/cgi-bin/Renew.cgi?
- Netscape CA Policy Url:
+ Netscape CA Policy Url:
http://www.trustcenter.de/guidelines/index.html
- Netscape Comment:
+ Netscape Comment:
TC TrustCenter Class 2 CA
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
Signature Algorithm: md5WithRSAEncryption
89:1b:f4:ef:e9:38:e2:6c:0c:f6:cd:6f:49:ce:29:cc:fb:a6:
ea:64:cf:d2:8e:7a:50:77:77
Exponent: 65537 (0x10001)
X509v3 extensions:
- Netscape Revocation Url:
+ Netscape Revocation Url:
https://www.trustcenter.de/cgi-bin/check-rev.cgi?
- Netscape CA Revocation Url:
+ Netscape CA Revocation Url:
https://www.trustcenter.de/cgi-bin/check-rev.cgi?
- Netscape Renewal Url:
+ Netscape Renewal Url:
https://www.trustcenter.de/cgi-bin/Renew.cgi?
- Netscape CA Policy Url:
+ Netscape CA Policy Url:
http://www.trustcenter.de/guidelines/index.html
- Netscape Comment:
+ Netscape Comment:
TC TrustCenter Class 3 CA
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
Signature Algorithm: md5WithRSAEncryption
84:86:50:62:79:a0:27:e1:25:ba:09:b1:34:0f:13:09:ed:2d:
35:1d:29:4c:51:f3:f2:6c:55
Exponent: 65537 (0x10001)
X509v3 extensions:
- Netscape Revocation Url:
+ Netscape Revocation Url:
https://www.trustcenter.de/cgi-bin/check-rev.cgi?
- Netscape CA Revocation Url:
+ Netscape CA Revocation Url:
https://www.trustcenter.de/cgi-bin/check-rev.cgi?
- Netscape Renewal Url:
+ Netscape Renewal Url:
https://www.trustcenter.de/cgi-bin/Renew.cgi?
- Netscape CA Policy Url:
+ Netscape CA Policy Url:
http://www.trustcenter.de/guidelines/index.html
- Netscape Comment:
+ Netscape Comment:
TC TrustCenter Class 4 CA
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
Signature Algorithm: md5WithRSAEncryption
94:68:14:1b:25:9e:29:99:b1:b2:23:d2:44:b3:95:9f:d1:9e:
44:e4:e9
Exponent: 65537 (0x10001)
X509v3 extensions:
- X509v3 Basic Constraints:
+ X509v3 Basic Constraints:
CA:TRUE
- X509v3 Certificate Policies:
+ X509v3 Certificate Policies:
Policy: 2.16.840.1.113733.1.7.1.1
CPS: http://trust.web.de/Hilfe/Policy/
- Netscape Comment:
+ Netscape Comment:
TrustCenter von WEB.DE - Root-Zertifikat
Die Nutzung dieses Zertifikates wird von den Allgemeinen Geschäftsbedingungen (AGB) / Zertifizierungsrichtlinien des WEB.DE TrustCenters geregelt.
Die AGBs und Zertifizierungsrichtlinien sind unter http://trust.web.de/Hilfe/ einsehbar.
- Netscape CA Policy Url:
+ Netscape CA Policy Url:
/Hilfe/AGB/
- Netscape Renewal Url:
+ Netscape Renewal Url:
/rn/?s=
- Netscape Revocation Url:
+ Netscape Revocation Url:
/rv/?s=
- Netscape Base Url:
+ Netscape Base Url:
https://trust.web.de
- Netscape Cert Type:
+ Netscape Cert Type:
SSL CA, S/MIME CA, Object Signing CA
- Netscape CA Revocation Url:
+ Netscape CA Revocation Url:
https://trust.web.de/rvCA/?s=
Signature Algorithm: md5WithRSAEncryption
2d:3d:17:6d:14:09:03:ea:4c:ad:45:13:e2:d9:b5:9c:29:cf:
# -*-muttrc-*-
#
# Command formats for gpg.
-#
-# This version uses gpg-2comp from
+#
+# This version uses gpg-2comp from
# http://70t.de/download/gpg-2comp.tar.gz
#
# $Id$
## Introduction
-The shell script and the configuration file in this directory can be used to benchmark the NeoMutt hcache backends.
+The shell script and the configuration file in this directory can be used to benchmark the NeoMutt hcache backends.
## Preparation
#!/bin/sh
#
# Copyright 2017 Pietro Cerutti <gahr@gahr.ch>
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
-#
+#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
LIBICONV="$1"
test -d $LIBICONV/libcharset/tools || {
- echo "Sorry, I can't find libiconv's source!" >&2 ;
+ echo "Sorry, I can't find libiconv's source!" >&2 ;
exit 1 ;
}
echo 'export PATH="$PATH:~/.mutt/keybaseMutt/scripts"' >> "$HOME/.kshrc"
elif [ "$shellInput" = 'z' ]; then
echo 'export PATH="$PATH:~/.mutt/keybaseMutt/scripts"' >> "$HOME/.zshrc"
-else
+else
echo "If you use something another shell, you'll need to add the path manually."
fi
sich nicht im privaten Schlüsselbund. Soll ich diesen Schlüssel trotzdem\n\
als 'absolut vertrauenswürdigen Einführer' behandeln? (j/N) "
es: "\nLa clave del usuario \"%s\"\n\
-está designada como referencia \"fundamentalmente fiable\", pero
+está designada como referencia \"fundamentalmente fiable\", pero
la clave no aparece en el anillo de claves secretas.\n\
¿Se utiliza como referencia fundamentalmente fiable (s/N)? "
fr: "\nLa clef de l'utilisateur '%s' \n\
--- slang.old/src/slkeymap.c Fri Apr 24 09:16:47 1998
+++ slang/src/slkeymap.c Sat Jul 4 07:41:42 1998
@@ -343,6 +343,8 @@
-
+
SLang_Key_Type *SLang_do_key(SLKeyMap_List_Type *kml, int (*getkey)(void))
{
+ unsigned char SLang_Undo_Buffer [SL_MAX_INPUT_BUFFER_LEN];
unsigned char input_ch;
@@ -356,6 +358,7 @@
return NULL;
-
+
input_ch = (unsigned char) SLang_Last_Key_Char;
+ SLang_Undo_Buffer [SLang_Undo_Len++] = input_ch;
-
+
key = (SLang_Key_Type *) &((kml->keymap)[input_ch]);
-
+
@@ -372,7 +375,11 @@
-
+
key = kml->keymap + input_ch;
if (key->type == 0)
+ {
return NULL;
+ }
}
-
+
/* It appears to be a prefix character in a key sequence. */
@@ -385,6 +392,7 @@
{
SLang_Last_Key_Char = (*getkey)();
+ SLang_Undo_Buffer [SLang_Undo_Len++] = (unsigned char) SLang_Last_Key_Char;
SLang_Key_TimeOut_Flag = 0;
-
+
len++;
@@ -458,6 +466,8 @@
kmax = next;
}
-
+
+ if (getkey == (int (*)(void)) SLang_getkey)
+ SLang_ungetkey_string (SLang_Undo_Buffer, SLang_Undo_Len);
return NULL;
}
-
+
diff -ur slang.old/src/slkeypad.c slang/src/slkeypad.c
--- slang.old/src/slkeypad.c Fri Apr 24 09:16:47 1998
+++ slang/src/slkeypad.c Sat Jul 4 07:30:31 1998
+ /* SLang_flush_input (); */
return SL_KEY_ERR;
}
-
+
set pgp_verify_key_command="pgpk -c +batchmode +language=mutt --OutputInformationFD=1 %r"
# read in the public key ring
-set pgp_list_pubring_command="pgpring -5 %r"
+set pgp_list_pubring_command="pgpring -5 %r"
# read in the secret key ring
set pgp_list_secring_command="pgpring -5 -s %r"
# generic generic keymap for all of the above
# editor line editor
# pager text viewer
-#
+#
bind generic "\e<" first-entry # emacs-like bindings for moving to top/bottom
bind generic \e> last-entry
# using it won't make you send messages with my name in the header.
#
# Things to change: You probably want to change the "priv.rc" source
-# command in the end of this file. Also, it's likely you want to have
+# command in the end of this file. Also, it's likely you want to have
# a look at the the $editor and $tmpdir variables.
#
# auto_view application/ms-tnef text/x-vcard
# auto_view application/x-chess application/x-lotus-notes
-# auto_view text/html application/x-gzip application/x-gunzip
+# auto_view text/html application/x-gzip application/x-gunzip
# auto_view application/rtf application/x-rath
# auto_view application/msword
# emulate the old POP-feature bindings
-macro index G "!fetchmail\n"
+macro index G "!fetchmail\n"
macro pager G "!fetchmail\n"
# razor-report: Report spam.
set delete=yes # Don't ask me whether or not I meant to delete messages
# set display_filter="tr '\240\204\223\226' ' \"\"-'" # fix some funny characters
set edit_hdrs # I want to edit the headers.
-set editor="/usr/bin/jed %s -f 'mail_mode();'"
+set editor="/usr/bin/jed %s -f 'mail_mode();'"
# Invoke jed with mail_mode. This may
# or may not work for you.
set noenvelope_from # set messages' envelope-from header.
set reply_to=ask-yes # Ask me whether I want to honor users' reply-to headers.
set reverse_alias # Use aliases to display real names on the index.
set save_name # Save copies by name. Together with $record and $save_name,
- # this means that when a folder exists, copies of outgoing
+ # this means that when a folder exists, copies of outgoing
# messages are written to ~/Mail/<name>, otherwise they go to
# ~/Mail/archive/now
set signature=~/.signature # Silly signature
open OUT, '>demoCA/index.txt' or die;
close OUT;
-# make the CA
-run 'openssl req -new -x509 -keyout demoCA/private/cakey.pem -out demoCA/cacert.pem -days 7300 -nodes',
+# make the CA
+run 'openssl req -new -x509 -keyout demoCA/private/cakey.pem -out demoCA/cacert.pem -days 7300 -nodes',
"\n\nx\n\nx\nx\n\n";
# trust it
run "openssl smime -sign -signer certificates/$keyid -inkey user.key -in /etc/passwd -certfile certificates/37adefc3.0 > signed";
unlink 'user.key' or die;
-# verify it
+# verify it
run 'openssl smime -verify -out /dev/null -in signed -CAfile ca-bundle.crt';
unlink 'signed' or die;
sub run ($;$) {
my $cmd = shift or die;
my $input = shift;
-
+
print "\n\nRunning [$cmd]\n";
my $exp = Expect->spawn ($cmd);
/*
* 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;
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)))
{
mutt_debug (1, "_mutt_copy_message failed to detect EOF!\n");
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 */
* 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 'd';
else if (flags & KEYFLAG_CRITICAL)
return 'c';
- else
+ else
return ' ';
}
crypt_key_t *key)
{
int rv = 0;
-
+
if (crypt_id_is_valid (key))
rv |= CRYPT_KV_VALID;
if (crypt_id_is_strong (key))
rv |= CRYPT_KV_STRONGID;
-
+
if (addr->mailbox && u_addr->mailbox
&& mutt_strcasecmp (addr->mailbox, u_addr->mailbox) == 0)
rv |= CRYPT_KV_ADDR;
-
+
if (addr->personal && u_addr->personal
&& mutt_strcasecmp (addr->personal, u_addr->personal) == 0)
rv |= CRYPT_KV_STRING;
-
+
return rv;
}
gpgme_data_t data;
err = gpgme_data_new (&data);
- if (err)
+ if (err)
{
mutt_error (_("error creating gpgme data object: %s\n"),
gpgme_strerror (err));
FILE *fptmp;
int err = 0;
gpgme_data_t data;
-
+
mutt_mktemp (tempfile, sizeof (tempfile));
fptmp = safe_fopen (tempfile, "w+");
if (!fptmp)
{
if (c == '\r')
hadcr = 1;
- else
+ else
{
if (c == '\n' && !hadcr)
{
buf[0] = '\r';
gpgme_data_write (data, buf, 1);
}
-
+
hadcr = 0;
}
/* FIXME: This is quite suboptimal */
err = gpgme_data_new_from_file (&data, tempfile, 1);
}
unlink (tempfile);
- if (err)
+ if (err)
{
mutt_error (_("error allocating data object: %s\n"), gpgme_strerror (err));
return NULL;
{
int err = 0;
gpgme_data_t data;
-
+
err = gpgme_data_new_from_filepart (&data, NULL, fp, offset, length);
- if (err)
+ if (err)
{
mutt_error (_("error allocating data object: %s\n"), gpgme_strerror (err));
return NULL;
buf[i] = 0;
if (*buf)
{
- if (i>1 && buf[i-1] == '!')
+ if (i>1 && buf[i-1] == '!')
{
/* The user selected to override the validity of that
key. */
buf[i-1] = 0;
-
+
err = gpgme_get_key (context, buf, &key, 0);
if (! err)
key->uids->validity = GPGME_VALIDITY_FULL;
/* NULL terminate. */
safe_realloc (&rset, sizeof (*rset) * (rset_n + 1));
rset[rset_n++] = NULL;
-
+
if (context)
gpgme_release (context);
char *outfile;
ctx = create_gpgme_context (use_smime);
- if (!use_smime)
+ if (!use_smime)
gpgme_set_armor (ctx, 1);
ciphertext = create_gpgme_data ();
state_puts (p, s);
}
-/*
+/*
* Implementation of `sign_message'.
*/
{
t->subtype = safe_strdup ("pkcs7-signature");
mutt_set_parameter ("name", "smime.p7s", &t->parameter);
- t->encoding = ENCBASE64;
+ t->encoding = ENCBASE64;
t->use_disp = 1;
t->disposition = DISPATTACH;
t->d_filename = safe_strdup ("smime.p7s");
BODY *t;
gpgme_key_t *rset = NULL;
gpgme_data_t plaintext;
-
+
rset = create_recipient_set (keylist, GPGME_PROTOCOL_OpenPGP);
if (!rset)
return NULL;
-
+
if (sign)
convert_to_7bit (a);
plaintext = body_to_data_object (a, 0);
free_recipient_set (&rset);
return NULL;
}
-
+
outfile = encrypt_gpgme_object (plaintext, rset, 0, sign);
gpgme_data_release (plaintext);
free_recipient_set (&rset);
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");
outfile = encrypt_gpgme_object (plaintext, rset, 1, 0);
gpgme_data_release (plaintext);
free_recipient_set (&rset);
- if (!outfile)
+ if (!outfile)
return NULL;
t = mutt_new_body ();
t->unlink = 1; /*delete after sending the message */
t->parts=0;
t->next=0;
-
+
return t;
}
-/*
+/*
* Implementation of `verify_one'.
*/
gpgme_verify_result_t result;
gpgme_signature_t sig;
unsigned int i;
-
+
result = gpgme_op_verify_result (ctx);
for (sig = result->signatures, i = 0; sig && (i < idx);
sig = sig->next, i++)
;
-
+
state_puts (_("Warning: The signature expired at: "), s);
print_time (sig ? sig->exp_timestamp : 0, s);
state_puts ("\n", s);
/* Show information about one signature. This function is called with
the context CTX of a successful verification operation and the
enumerator IDX which should start at 0 and increment for each
- call/signature.
+ call/signature.
Return values are: 0 for normal procession, 1 for a bad signature,
2 for a signature with a warning or -1 for no more signature. */
gpgme_key_unref (signature_key);
signature_key = NULL;
}
-
+
fpr = sig->fpr;
sum = sig->summary;
gpgme_data_set_encoding (signature, GPGME_DATA_ENCODING_BASE64);
err = gpgme_data_new_from_file (&message, tempfile, 1);
- if (err)
+ if (err)
{
gpgme_data_release (signature);
mutt_error (_("error allocating data object: %s\n"), gpgme_strerror (err));
if (err)
{
char buf[200];
-
- snprintf (buf, sizeof(buf)-1,
+
+ snprintf (buf, sizeof(buf)-1,
_("Error: verification failed: %s\n"),
gpgme_strerror (err));
state_puts (buf, s);
}
gpgme_release (ctx);
-
+
state_attach_puts (_("[-- End signature information --]\n\n"), s);
mutt_debug (1, "verify_one: returning %d.\n", badsig);
-
+
return badsig? 1: anywarn? 2 : 0;
}
if ((s->flags & MUTT_DISPLAY))
{
char buf[200];
-
- snprintf (buf, sizeof(buf)-1,
+
+ snprintf (buf, sizeof(buf)-1,
_("[-- Error: decryption failed: %s --]\n\n"),
gpgme_strerror (err));
state_attach_puts (buf, s);
{
int res, idx;
int anybad = 0;
-
+
if (maybe_signed)
a->is_signed_data = 1;
if(r_is_signed)
}
if (!anybad && idx && r_is_signed && *r_is_signed)
*r_is_signed = anywarn? 2:1; /* Good signature. */
-
+
if ((s->flags & MUTT_DISPLAY))
state_attach_puts (_("[-- End signature "
"information --]\n\n"), s);
*/
fstat (fileno (fpout), &info);
tattach->length = info.st_size - tattach->offset;
-
+
tattach->warnsig = anywarn;
/* See if we need to recurse on this MIME part. */
size_t saved_length;
FILE *decoded_fp = NULL;
int rv = 0;
-
+
first_part->goodsig = 0;
first_part->warnsig = 0;
}
else
return -1;
-
+
memset (&s, 0, sizeof (s));
s.fpin = fpin;
if (b->parts)
return -1;
-
+
/* Decode the body - we need to pass binary CMS to the
backend. The backend allows for Base64 encoded data but it does
not allow for QP which I have seen in some messages. So better
saved_b_length = b->length;
memset (&s, 0, sizeof (s));
s.fpin = fpin;
- fseeko (s.fpin, b->offset, 0);
+ fseeko (s.fpin, b->offset, 0);
mutt_mktemp (tempfile, sizeof (tempfile));
if (!(tmpfp = safe_fopen (tempfile, "w+")))
{
saved_b_length = bb->length;
memset (&s, 0, sizeof (s));
s.fpin = *fpout;
- fseeko (s.fpin, bb->offset, 0);
+ fseeko (s.fpin, bb->offset, 0);
mutt_mktemp (tempfile, sizeof (tempfile));
if (!(tmpfp = safe_fopen (tempfile, "w+")))
{
bb->length = ftello (s.fpout);
bb->offset = 0;
rewind (tmpfp);
- safe_fclose (fpout);
+ safe_fclose (fpout);
memset (&s, 0, sizeof (s));
s.fpin = tmpfp;
mutt_debug (1, "Error creating GPGME context\n");
return rc;
}
-
+
if (dryrun)
{
snprintf (tmpdir, sizeof(tmpdir), "%s/mutt-gpgme-XXXXXX", Tempdir);
#define PUBLIC_KEY_BLOCK(_y) _LINE_COMPARE("PUBLIC KEY BLOCK-----", _y)
#define BEGIN_PGP_SIGNATURE(_y) _LINE_COMPARE("-----BEGIN PGP SIGNATURE-----", _y)
-/*
+/*
* Implementation of `pgp_check_traditional'.
*/
char tempfile[_POSIX_PATH_MAX];
char buf[HUGE_STRING];
FILE *tfp;
-
+
short sgn = 0;
short enc = 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))
return 0;
/* fix the content type */
-
+
mutt_set_parameter ("format", "fixed", &b->parameter);
mutt_set_parameter ("x-action", enc ? "pgp-encrypted" : "pgp-signed",
&b->parameter);
-
+
return 1;
}
}
-/*
+/*
* Implementation of `application_handler'.
*/
-/*
+/*
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 & Cie in this, and also
note that we can successfully handle anything produced by any
existing versions of mutt.) */
* charset-hooks. Therefore we set flags to MUTT_ICONV_HOOK_FROM.
*/
fc = fgetconv_open (fp, charset, Charset, MUTT_ICONV_HOOK_FROM);
-
+
for (complete = 1, armor_header = 1;
fgetconvs (buf, sizeof (buf), fc) != NULL;
complete = strchr (buf, '\n') != NULL)
if (BEGIN_PGP_SIGNATURE(buf))
break;
-
+
if (armor_header)
{
- if (buf[0] == '\n')
+ if (buf[0] == '\n')
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);
safe_fclose (&fp);
}
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))
{
clearsign = 0;
-
+
if (MESSAGE(buf + 15))
needpass = 1;
else if (SIGNED_MESSAGE(buf + 15))
{
needpass = 0;
pgp_keyblock = 1;
- }
+ }
else
{
/* XXX - we may wish to recode here */
state_puts (buf, s);
continue;
}
-
+
have_any_sigs = (have_any_sigs
|| (clearsign && (s->flags & MUTT_VERIFY)));
-
+
/* Copy PGP material to an data container */
armored_data = file_to_data_object (s->fpin, m->offset, m->length);
/* Invoke PGP if needed */
if (err)
{
char errbuf[200];
-
- snprintf (errbuf, sizeof(errbuf)-1,
+
+ snprintf (errbuf, sizeof(errbuf)-1,
_("Error: decryption/verification failed: %s\n"),
gpgme_strerror (err));
state_puts (errbuf, s);
}
if (!anybad && idx)
maybe_goodsig = 1;
-
+
state_attach_puts (_("[-- End signature "
"information --]\n\n"), s);
}
gpgme_data_release (plaintext);
gpgme_release (ctx);
}
-
+
/*
* Now, copy cleartext to the screen. NOTE - we expect that PGP
- * outputs utf-8 cleartext. This may not always be true, but it
+ * outputs utf-8 cleartext. This may not always be true, but it
* seems to be a reasonable guess.
*/
-
+
if(s->flags & MUTT_DISPLAY)
{
if (needpass)
state_attach_puts (_("[-- BEGIN PGP SIGNED MESSAGE --]\n\n"),
s);
}
-
+
if (clearsign)
{
copy_clearsigned (armored_data, s, body_charset);
}
fgetconv_close (&fc);
}
-
+
if (s->flags & MUTT_DISPLAY)
{
state_putc ('\n', s);
else
state_attach_puts (_("[-- END PGP SIGNED MESSAGE --]\n"), s);
}
-
+
gpgme_data_release (armored_data);
if (pgpout)
{
}
m->goodsig = (maybe_goodsig && have_any_sigs);
-
+
if (needpass == -1)
{
state_attach_puts (_("[-- Error: could not find beginning"
return err;
}
-/*
+/*
* Implementation of `encrypted_handler'.
*/
BODY *tattach;
int is_signed;
int rc = 0;
-
+
mutt_debug (2, "Entering pgp_encrypted handler\n");
mutt_mktemp (tempfile, sizeof (tempfile));
_("[-- The following data is PGP/MIME signed and encrypted --]\n\n"):
_("[-- The following data is PGP/MIME encrypted --]\n\n"),
s);
-
+
{
FILE *savefp = s->fpin;
s->fpin = fpout;
s->fpin = savefp;
}
- /*
+ /*
* 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 rc = 0;
mutt_debug (2, "Entering smime_encrypted handler\n");
-
+
a->warnsig = 0;
mutt_mktemp (tempfile, sizeof (tempfile));
if (!(fpout = safe_fopen (tempfile, "w+")))
_("[-- The following data is S/MIME signed --]\n\n"):
_("[-- The following data is S/MIME encrypted --]\n\n"),
s);
-
+
{
FILE *savefp = s->fpin;
s->fpin = fpout;
s->fpin = savefp;
}
- /*
+ /*
* if a multipart/signed is the _only_ sub-part of a
* multipart/encrypted, cache signature verification
* status.
mutt_free_body (&tattach);
}
-
+
safe_fclose (&fpout);
mutt_unlink(tempfile);
mutt_debug (2, "Leaving smime_encrypted handler\n");
-
+
return rc;
}
/*
* Format an entry on the CRYPT key selection menu.
- *
+ *
* %n number
* %k key id %K key id of the principal key
* %u user id
kflags = (key->flags /*| (pkey->flags & KEYFLAG_RESTRICTIONS)
| uid->flags*/);
-
+
switch (tolower (op))
{
case '[':
mutt_FormatString (dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0);
return (src);
}
-
+
/* Used by the display function to format a line. */
static void crypt_entry (char *s, size_t l, MUTTMENU * menu, int num)
{
crypt_key_t **key_table = (crypt_key_t **) menu->data;
crypt_entry_t entry;
-
+
entry.key = key_table[num];
entry.num = num + 1;
- mutt_FormatString (s, l, 0, MuttIndexWindow->cols, NONULL (PgpEntryFormat), crypt_entry_fmt,
+ mutt_FormatString (s, l, 0, MuttIndexWindow->cols, NONULL (PgpEntryFormat), crypt_entry_fmt,
(unsigned long) &entry, MUTT_FORMAT_ARROWCURSOR);
}
print_dn_parts (FILE *fp, struct dn_array_s *dn)
{
static const char * const stdpart[] = {
- "CN", "OU", "O", "STREET", "L", "ST", "C", NULL
+ "CN", "OU", "O", "STREET", "L", "ST", "C", NULL
};
int any=0, any2=0, i;
-
+
for (i=0; stdpart[i]; i++)
{
if (any)
{ /* pair */
s++;
if (*s == ',' || *s == '=' || *s == '+'
- || *s == '<' || *s == '>' || *s == '#' || *s == ';'
+ || *s == '<' || *s == '>' || *s == '#' || *s == ';'
|| *s == '\\' || *s == '\"' || *s == ' ')
n++;
else if (isxdigit (*s) && isxdigit (*(s+1)))
return NULL; /* invalid encoding */
else if (*s == ',' || *s == '=' || *s == '+'
|| *s == '<' || *s == '>' || *s == '#' || *s == ';' )
- break;
+ break;
else
n++;
}
for (s=string; n; s++, n--)
{
if (*s == '\\')
- {
+ {
s++;
if (isxdigit (*s))
{
struct dn_array_s *dn = parse_dn (userid);
if (!dn)
fputs (_("[Can't display this user ID (invalid DN)]"), fp);
- else
+ else
{
- print_dn_parts (fp, dn);
+ print_dn_parts (fp, dn);
for (i=0; dn[i].key; i++)
{
FREE (&dn[i].key);
/* L10N: DOTFILL */
fprintf (fp, _("Valid From : %s\n"), shortbuf);
}
-
+
if (key->subkeys && (key->subkeys->expires > 0))
{
tt = key->subkeys->expires;
-
+
tm = localtime (&tt);
#ifdef HAVE_LANGINFO_D_T_FMT
strftime (shortbuf, sizeof shortbuf, nl_langinfo (D_T_FMT), tm);
idx++, subkey = subkey->next)
{
s = subkey->keyid;
-
+
putc ('\n', fp);
if ( strlen (s) == 16)
s += 8; /* display only the short keyID */
/* Show detailed information about the selected key */
-static void
+static void
verify_key (crypt_key_t *key)
{
FILE *fp;
goto leave;
}
gpgme_op_keylist_end (listctx);
-
+
print_key_info (k, fp);
if (!--maxdepth)
{
mutt_do_pager (cmd, tempfile, 0, NULL);
}
-/*
+/*
* Implementation of `findkeys'.
*/
pattern = list_to_pattern (hints);
if (!pattern)
return NULL;
-
+
err = gpgme_new (&ctx);
- if (err)
+ if (err)
{
mutt_error (_("gpgme_new failed: %s"), gpgme_strerror (err));
FREE (&pattern);
db = NULL;
kend = &db;
-
+
if ((app & APPLICATION_PGP))
{
/* It's all a mess. That old GPGME expects different things
for (n=0; patarr[n]; n++)
FREE (&patarr[n]);
FREE (&patarr);
- if (err)
+ if (err)
{
mutt_error (_("gpgme_op_keylist_start failed: %s"),
gpgme_strerror (err));
while (!(err = gpgme_op_keylist_next (ctx, &key)) )
{
unsigned int flags = 0;
-
+
if (key_check_cap (key, KEY_CAP_CAN_ENCRYPT))
flags |= KEYFLAG_CANENCRYPT;
if (key_check_cap (key, KEY_CAP_CAN_SIGN))
/* and now look for x509 certificates */
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
err = gpgme_op_keylist_start (ctx, pattern, 0);
- if (err)
+ if (err)
{
mutt_error (_("gpgme_op_keylist_start failed: %s"),
gpgme_strerror (err));
flags |= KEYFLAG_CANENCRYPT;
if (key_check_cap (key, KEY_CAP_CAN_SIGN))
flags |= KEYFLAG_CANSIGN;
-
+
for (idx = 0, uid = key->uids; uid; idx++, uid = uid->next)
{
k = safe_calloc (1, sizeof *k);
if (strlen (t) > 3)
hints = mutt_add_list (hints, t);
}
-
+
FREE (&scratch);
return hints;
}
will be set to true on return if the user did override the
key's validity. */
static crypt_key_t *crypt_select_key (crypt_key_t *keys,
- ADDRESS * p, const char *s,
+ ADDRESS * p, const char *s,
unsigned int app, int *forced_valid)
{
int keymax;
unusable = 1;
continue;
}
-
+
if (i == keymax)
{
keymax += 20;
safe_realloc (&key_table, sizeof (crypt_key_t*)*keymax);
}
-
+
key_table[i++] = k;
}
/* L10N:
e.g. 'S/MIME keys matching "Michael Elkins".' */
snprintf (buf, sizeof (buf), _("%s \"%s\"."), ts, s);
- menu->title = buf;
+ menu->title = buf;
}
mutt_clear_error ();
verify_key (key_table[menu->current]);
menu->redraw = REDRAW_FULL;
break;
-
+
case OP_VIEW_ID:
mutt_message ("%s", key_table[menu->current]->uid);
break;
-
+
case OP_GENERIC_SELECT_ENTRY:
/* FIXME make error reporting more verbose - this should be
easy because gpgme provides more information */
break;
}
}
-
+
if (option (OPTPGPCHECKTRUST) &&
(!crypt_id_is_valid (key_table[menu->current])
|| !crypt_id_is_strong (key_table[menu->current])))
{
const char *warn_s;
char buff[LONG_STRING];
-
+
if (key_table[menu->current]->flags & KEYFLAG_CANTUSE)
warn_s = N_("ID is expired/disabled/revoked.");
- else
+ else
{
warn_s = "??";
switch (key_table[menu->current]->validity)
{
- case GPGME_VALIDITY_UNKNOWN:
- case GPGME_VALIDITY_UNDEFINED:
+ case GPGME_VALIDITY_UNKNOWN:
+ case GPGME_VALIDITY_UNDEFINED:
warn_s = N_("ID has undefined validity.");
break;
- case GPGME_VALIDITY_NEVER:
+ case GPGME_VALIDITY_NEVER:
warn_s = N_("ID is not valid.");
break;
- case GPGME_VALIDITY_MARGINAL:
+ case GPGME_VALIDITY_MARGINAL:
warn_s = N_("ID is only marginally valid.");
break;
- case GPGME_VALIDITY_FULL:
- case GPGME_VALIDITY_ULTIMATE:
+ case GPGME_VALIDITY_FULL:
+ case GPGME_VALIDITY_ULTIMATE:
break;
}
}
snprintf (buff, sizeof (buff),
_("%s Do you really want to use the key?"),
_(warn_s));
-
+
if (mutt_yesorno (buff, 0) != MUTT_YES)
{
mutt_clear_error ();
break;
}
*forced_valid = 1;
- }
+ }
k = crypt_copy_key (key_table[menu->current]);
done = 1;
break;
-
+
case OP_EXIT:
k = NULL;
done = 1;
break;
}
}
-
+
mutt_menuDestroy (&menu);
FREE (&key_table);
set_option (OPTNEEDREDRAW);
-
+
return k;
}
crypt_key_t *a_valid_addrmatch_key = NULL;
crypt_key_t *matches = NULL;
crypt_key_t **matches_endp = &matches;
-
+
*forced_valid = 0;
if (a && a->mailbox)
keys = get_candidates (hints, app, (abilities & KEYFLAG_CANSIGN) );
mutt_free_list (&hints);
-
+
if (!keys)
return NULL;
-
+
mutt_debug (5, "crypt_getkeybyaddr: looking for %s <%s>.",
a->personal, a->mailbox);
{
mutt_debug (5, " looking at key: %s `%.15s'\n",
crypt_keyid (k), k->uid);
-
+
if (abilities && !(k->flags & abilities))
{
mutt_debug (5, " insufficient abilities: Has %x, want %x\n",
for (p = r; p; p = p->next)
{
int validity = crypt_id_matches_addr (a, p, k);
-
+
if (validity & CRYPT_KV_MATCH) /* something matches */
{
match = 1;
}
}
rfc822_free_address (&r);
-
+
if (match)
{
crypt_key_t *tmp;
weak = 1;
}
}
-
+
crypt_free_key (&keys);
-
+
if (matches)
{
if (oppenc_mode)
}
else if (the_strong_valid_key && !multi && !weak && !addr_match
&& !(invalid && option (OPTPGPSHOWUNUSABLE)))
- {
- /*
+ {
+ /*
* There was precisely one strong match on a valid ID, there
* were no valid keys with weak matches, and we aren't
* interested in seeing invalid keys.
- *
+ *
* Proceed without asking the user.
*/
k = crypt_copy_key (the_strong_valid_key);
}
- else
+ else
{
- /*
+ /*
* Else: Ask the user.
*/
k = crypt_select_key (matches, a, NULL, app, forced_valid);
crypt_free_key (&matches);
}
- else
+ else
k = NULL;
-
+
return k;
}
matches_endp = &tmp->next;
}
}
-
+
FREE (&pfcopy);
crypt_free_key (&keys);
-
+
if (matches)
{
k = crypt_select_key (matches, NULL, p, app, forced_valid);
crypt_free_key (&matches);
return k;
}
-
+
return NULL;
}
default. ABILITIES describe the required key abilities (sign,
encrypt) and APP the type of the requested key; ether S/MIME or
PGP. Return a copy of the key or NULL if not found. */
-static crypt_key_t *crypt_ask_for_key (char *tag,
- char *whatfor,
+static crypt_key_t *crypt_ask_for_key (char *tag,
+ char *whatfor,
short abilities,
unsigned int app,
int *forced_valid)
resp[0] = 0;
if (whatfor)
{
-
+
for (l = id_defaults; l; l = l->next)
if (!mutt_strcasecmp (whatfor, l->what))
{
resp[0] = 0;
if (mutt_get_field (tag, resp, sizeof (resp), MUTT_CLEAR) != 0)
return NULL;
-
+
if (whatfor)
{
if (l)
l->dflt = safe_strdup (resp);
}
}
-
+
if ((key = crypt_getkeybystr (resp, abilities, app, forced_valid)))
return key;
-
+
BEEP ();
}
/* not reached */
}
/* check for e-mail address */
- if ((t = strchr (crypt_hook_val, '@')) &&
+ if ((t = strchr (crypt_hook_val, '@')) &&
(addr = rfc822_parse_adrlist (NULL, crypt_hook_val)))
{
if (fqdn)
}
else if (! oppenc_mode)
{
-#if 0
- k_info = crypt_getkeybystr (crypt_hook_val, KEYFLAG_CANENCRYPT,
+#if 0
+ k_info = crypt_getkeybystr (crypt_hook_val, KEYFLAG_CANENCRYPT,
*r_application, &forced_valid);
#else
- k_info = crypt_getkeybystr (crypt_hook_val, KEYFLAG_CANENCRYPT,
+ k_info = crypt_getkeybystr (crypt_hook_val, KEYFLAG_CANENCRYPT,
app, &forced_valid);
#endif
}
if ((k_info == NULL) && (! oppenc_mode))
{
snprintf (buf, sizeof (buf), _("Enter keyID for %s: "), q->mailbox);
-
+
k_info = crypt_ask_for_key (buf, q->mailbox,
KEYFLAG_CANENCRYPT,
#if 0
if (!(k_info->flags & KEYFLAG_ISX509))
*r_application &= ~APPLICATION_SMIME;
#endif
-
+
bypass_selection:
keylist_size += mutt_strlen (keyID) + 4 + 1;
safe_realloc (&keylist, keylist_size);
snprintf (input_signas, sizeof (input_signas), "0x%s",
crypt_fpr_or_lkeyid (p));
mutt_str_replace (is_smime? &SmimeDefaultKey : &PgpSignAs, input_signas);
- crypt_free_key (&p);
+ crypt_free_key (&p);
msg->security |= SIGN;
}
-/*
+/*
* 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.
-/*
+/*
* 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.
*/
-/*
+/*
This is a crytpo module wrapping the classic pgp code.
*/
-/*
+/*
* 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.
*/
-/*
+/*
This is a crytpo module wrapping the gpgme based pgp code.
*/
-/*
+/*
* 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.
*/
-/*
+/*
This is a crytpo module wrapping the classic smime code.
*/
NULL, /* pgp_invoke_getkeys */
NULL, /* pgp_invoke_import */
NULL, /* pgp_extract_keys_from_attachment_list */
-
+
crypt_mod_smime_getkeys,
crypt_mod_smime_verify_sender,
crypt_mod_smime_build_smime_entity,
-/*
+/*
* 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.
*/
-/*
+/*
This is a crytpo module wrapping the gpgme based smime code.
*/
NULL, /* pgp_invoke_getkeys */
NULL, /* pgp_invoke_import */
NULL, /* pgp_extract_keys_from_attachment_list */
-
+
NULL, /* smime_getkeys */
crypt_mod_smime_verify_sender,
crypt_mod_smime_build_smime_entity,
* 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.
* 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 CRYPTO_SUPPORT(identifier) (WithCrypto & APPLICATION_ ## identifier)
-/*
+/*
Type definitions for crypto module functions.
*/
typedef void (*crypt_func_void_passphrase_t) (void);
typedef void (*crypt_func_pgp_invoke_import_t) (const char *fname);
typedef int (*crypt_func_verify_one_t) (BODY *sigbdy, STATE *s,
const char *tempf);
-typedef void (*crypt_func_pgp_extract_keys_from_attachment_list_t)
+typedef void (*crypt_func_pgp_extract_keys_from_attachment_list_t)
(FILE *fp, int tag, BODY *top);
typedef int (*crypt_func_send_menu_t) (HEADER *msg, int *redraw);
/*
- A structure to describe a crypto module.
+ A structure to describe a crypto module.
*/
typedef struct crypt_module_specs
{
-/*
- High Level crypto module interface.
+/*
+ High Level crypto module interface.
*/
void crypto_module_register (crypt_module_specs_t specs);
* 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);
}
- /* destroy temporary signature envelope when doing retainable
+ /* destroy temporary signature envelope when doing retainable
* signatures.
*/
}
-
-
+
+
int mutt_is_multipart_signed (BODY *b)
{
char *p;
if ((WithCrypto & APPLICATION_PGP)
&& !(ascii_strcasecmp (p, "application/pgp-signature")))
return PGPSIGN;
-
+
if ((WithCrypto & APPLICATION_SMIME)
&& !(ascii_strcasecmp (p, "application/x-pkcs7-signature")))
return SMIMESIGN;
return 0;
}
-
-
+
+
int mutt_is_multipart_encrypted (BODY *b)
{
if ((WithCrypto & APPLICATION_PGP))
{
char *p;
-
+
if (!b || b->type != TYPEMULTIPART ||
!b->subtype || ascii_strcasecmp (b->subtype, "encrypted") ||
!(p = mutt_get_parameter ("protocol", b->parameter)) ||
ascii_strcasecmp (p, "application/pgp-encrypted"))
return 0;
-
+
return PGPENCRYPT;
}
{
int t = 0;
char *p;
-
+
if (m->type == TYPEAPPLICATION)
{
if (!ascii_strcasecmp (m->subtype, "pgp") || !ascii_strcasecmp (m->subtype, "x-pgp-message"))
&& (!ascii_strcasecmp (p, "sign") || !ascii_strcasecmp (p, "signclear")))
t |= PGPSIGN;
- if ((p = mutt_get_parameter ("format", m->parameter)) &&
+ if ((p = mutt_get_parameter ("format", m->parameter)) &&
!ascii_strcasecmp (p, "keys-only"))
t |= PGPKEY;
else if (m->type == TYPETEXT && ascii_strcasecmp ("plain", m->subtype) == 0)
{
if (((p = mutt_get_parameter ("x-mutt-action", m->parameter))
- || (p = mutt_get_parameter ("x-action", m->parameter))
+ || (p = mutt_get_parameter ("x-action", m->parameter))
|| (p = mutt_get_parameter ("action", m->parameter)))
&& !ascii_strncasecmp ("pgp-sign", p, 8))
t |= PGPSIGN;
return (SMIMESIGN|SMIMEOPAQUE);
else return 0;
}
- /* Netscape 4.7 uses
+ /* Netscape 4.7 uses
* Content-Description: S/MIME Encrypted Message
* instead of Content-Type parameter
*/
if (!t) t = m->d_filename;
if (!t) t = m->filename;
- if (!t)
+ if (!t)
{
if (complain)
mutt_message (_("S/MIME messages with no hints on content are unsupported."));
#if 0
return SMIMEENCRYPT;
#else
- /* Not sure if this is the correct thing to do, but
+ /* Not sure if this is the correct thing to do, but
it's required for compatibility with Outlook */
return (SMIMESIGN|SMIMEOPAQUE);
#endif
if (!WithCrypto)
return 0;
-
+
if (!m)
return 0;
if (t && m->goodsig)
t |= GOODSIGN;
}
-
+
if (m->type == TYPEMULTIPART)
{
t |= mutt_is_multipart_encrypted(m);
t |= mutt_is_multipart_signed (m);
t |= mutt_is_malformed_multipart_pgp_encrypted (m);
- if (t && m->goodsig)
+ if (t && m->goodsig)
t |= GOODSIGN;
}
{
BODY *p;
int u, v, w;
-
+
u = m->parts ? 0xffffffff : 0; /* Bits set in all parts */
w = 0; /* Bits set in any part */
-
+
for (p = m->parts; p; p = p->next)
{
v = crypt_query (p);
u &= v; w |= v;
}
t |= u | (w & ~GOODSIGN);
-
+
if ((w & GOODSIGN) && !(u & GOODSIGN))
t |= PARTSIGN;
}
mutt_perror (tempfile);
return -1;
}
-
+
fseeko (s->fpin, a->hdr_offset, 0);
bytes = a->length + a->offset - a->hdr_offset;
hadcr = 0;
{
if ((c = fgetc (s->fpin)) == EOF)
break;
-
+
bytes--;
-
+
if (c == '\r')
hadcr = 1;
- else
+ else
{
if (c == '\n' && !hadcr)
fputc ('\r', fp);
-
+
hadcr = 0;
}
-
+
fputc (c, fp);
-
+
}
safe_fclose (&fp);
}
else if ((WithCrypto & APPLICATION_PGP) && option (OPTPGPSTRICTENC))
convert_to_7bit (a->parts);
- }
+ }
else if (a->type == TYPEMESSAGE &&
ascii_strcasecmp(a->subtype, "delivery-status"))
{
else if (a->encoding == ENCBINARY)
a->encoding = ENCBASE64;
else if (a->content && a->encoding != ENCBASE64 &&
- (a->content->from || (a->content->space &&
+ (a->content->from || (a->content->space &&
option (OPTPGPSTRICTENC))))
a->encoding = ENCQUOTEDPRINTABLE;
a = a->next;
if ((WithCrypto & APPLICATION_PGP)
&& (Context->hdrs[Context->v2r[i]]->security & APPLICATION_PGP))
{
- mutt_copy_message (fpout, Context, Context->hdrs[Context->v2r[i]],
+ mutt_copy_message (fpout, Context, Context->hdrs[Context->v2r[i]],
MUTT_CM_DECODE|MUTT_CM_CHARCONV, 0);
fflush(fpout);
-
+
mutt_endwin (_("Trying to extract PGP keys...\n"));
crypt_pgp_invoke_import (tempfname);
}
fflush(fpout);
if (h->env->from) tmp = mutt_expand_aliases (h->env->from);
- else if (h->env->sender) tmp = mutt_expand_aliases (h->env->sender);
+ else if (h->env->sender) tmp = mutt_expand_aliases (h->env->sender);
mbox = tmp ? tmp->mailbox : NULL;
if (mbox) /* else ? */
{
}
}
}
-
+
safe_fclose (&fpout);
if (isendwin())
mutt_any_key_to_continue (NULL);
}
rfc822_free_address (&adrlist);
-
+
return (0);
}
char tempfile[_POSIX_PATH_MAX];
int signed_type;
int inconsistent = 0;
-
+
BODY *b = a;
BODY **signatures = NULL;
int sigcnt = 0;
if (s->flags & MUTT_DISPLAY)
{
-
+
crypt_fetch_signatures (&signatures, a->next, &sigcnt);
-
+
if (sigcnt)
{
mutt_mktemp (tempfile, sizeof (tempfile));
for (i = 0; i < sigcnt; i++)
{
if ((WithCrypto & APPLICATION_PGP)
- && signatures[i]->type == TYPEAPPLICATION
+ && signatures[i]->type == TYPEAPPLICATION
&& !ascii_strcasecmp (signatures[i]->subtype, "pgp-signature"))
{
if (crypt_pgp_verify_one (signatures[i], s, tempfile) != 0)
goodsig = 0;
-
+
continue;
}
if ((WithCrypto & APPLICATION_SMIME)
- && signatures[i]->type == TYPEAPPLICATION
+ && signatures[i]->type == TYPEAPPLICATION
&& (!ascii_strcasecmp(signatures[i]->subtype, "x-pkcs7-signature")
|| !ascii_strcasecmp(signatures[i]->subtype, "pkcs7-signature")))
{
if (crypt_smime_verify_one (signatures[i], s, tempfile) != 0)
goodsig = 0;
-
+
continue;
}
TYPE(signatures[i]), signatures[i]->subtype);
}
}
-
+
mutt_unlink (tempfile);
b->goodsig = goodsig;
b->badsig = !goodsig;
-
+
/* Now display the signed body */
state_attach_puts (_("[-- The following data is signed --]\n\n"), s);
else
state_attach_puts (_("[-- Warning: Can't find any signatures. --]\n\n"), s);
}
-
+
rc = mutt_body_handler (a, s);
-
+
if (s->flags & MUTT_DISPLAY && sigcnt)
state_attach_puts (_("\n[-- End of signed data --]\n"), s);
-
+
return rc;
}
* 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 "crypt-mod.h"
/*
-
+
Generic
*/
}
-/*
+/*
PGP
{
if (CRYPT_MOD_CALL_CHECK (PGP, application_handler))
return (CRYPT_MOD_CALL (PGP, application_handler)) (m, s);
-
+
return -1;
}
{
if (CRYPT_MOD_CALL_CHECK (PGP, encrypted_handler))
return (CRYPT_MOD_CALL (PGP, encrypted_handler)) (a, s);
-
+
return -1;
}
-/*
+/*
- S/MIME
+ S/MIME
*/
{
if (CRYPT_MOD_CALL_CHECK (SMIME, application_handler))
return (CRYPT_MOD_CALL (SMIME, application_handler)) (m, s);
-
+
return -1;
}
/*
* 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
{
mutt_window_clearline (MuttMessageWindow, 0);
while (ret == 1);
mutt_window_clearline (MuttMessageWindow, 0);
mutt_free_enter_state (&es);
-
+
return (ret);
}
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 (
}
}
-#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);
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)
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 */
else
break;
}
-
+
/* Selected directory is okay, let's save it.*/
mutt_browser_select_dir (buf);
/*
* 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;
## message flow?)
##
attachments +I text/plain
-
+
## These two lines make Mutt qualify MIME containers. (So, for example,
## a message/rfc822 forward will count as an attachment.) The first
## line is unnecessary if you already have "attach-allow */.*", of
##
## PGP
##
-
+
:0
* !^Content-Type: message/
* !^Content-Type: multipart/
if (!/^Content-Type: message/ && !/^Content-Type: multipart/ \
&& !/^Content-Type: application\/pgp/)
-{
+{
if (/^$BPGPM/:b && /^$EPGPM/:b)
xfilter "reformail -A 'Content-Type: application/pgp; format=text; \
x-action=encrypt'"
-k <key ring> Dump the contents of the key ring specified
as an argument to -k.
-
- -2, -5 Use the default key ring for PGP 2 or 5,
+
+ -2, -5 Use the default key ring for PGP 2 or 5,
respectively.
-
+
-s Dump the secret key ring.
-S Dump signatures.
$pgp_decode_command Decode application/pgp messages. This
command operates with and without pass phrases.
-
+
$pgp_verify_command Verify a PGP/MIME signature.
$pgp_decrypt_command Decrypt a PGP/MIME encrypted MIME body.
$pgp_encrypt_sign_command Encrypt and sign a MIME body. This
command always gets a pass phrase.
-
+
$pgp_encrypt_only_command Encrypt a MIME body, but don't sign it.
-
+
$pgp_import_command Import PGP keys from a file.
-
+
$pgp_export_command Export PGP keys to a file. The output must
be ASCII armored.
-
+
$pgp_verify_key_command Check a public key. This is used from the
key selection menu.
--- gettext.m4.bak Thu Jul 2 18:46:08 1998
+++ gettext.m4 Mon Oct 5 23:32:54 1998
@@ -46,12 +46,13 @@
-
+
if test "$gt_cv_func_gettext_libc" != "yes"; then
AC_CHECK_LIB(intl, bindtextdomain,
- [AC_CACHE_CHECK([for gettext in libintl],
+ if test "$gt_cv_func_gettext_libintl" = "yes" ; then
+ LIBS="-lintl $LIBS"
fi
-
+
if test "$gt_cv_func_gettext_libc" = "yes" \
.\"
.\" Copyright (C) 1996-8 Michael R. Elkins <me@cs.hmc.edu>
.\" Copyright (C) 1998-9 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_dotlock \- Lock mail spool files.
.SH SYNOPSIS
.PP
-.B mutt_dotlock
+.B mutt_dotlock
[\-t|\-f|\-u|\-d] [\-p] [\-r \fIretries\fP] \fIfile\fP
.SH DESCRIPTION
.PP
process if it's at all possible to lock \fIfile\fP.
.IP "-f"
Force the lock. If another process holds a lock on
-\fIfile\fP longer than a certain amount of time,
+\fIfile\fP longer than a certain amount of time,
.B mutt_dotlock
will break that lock by removing the lockfile.
.IP "-u"
Unlock.
-.B mutt_dotlock
+.B mutt_dotlock
will remove \fIfile\fP.lock.
.IP "-d"
Delete.
will lock \fIfile\fP, remove it if it has length 0, and afterwards
remove \fIfile\fP.lock.
.IP "-p"
-Use privileges. If given this option,
+Use privileges. If given this option,
.B mutt_dotlock
will operate with group mail privileges when creating and
deleting lock files.
.IP "-r \fIretries\fP"
-This command line option tells
-.B mutt_dotlock
+This command line option tells
+.B mutt_dotlock
to try locking
\fIretries\fP times before giving up or (if invoked with
-the
+the
.B -f
command line option) break a lock. The default value is 5.
.B mutt_dotlock
-waits one second between successive locking attempts.
+waits one second between successive locking attempts.
.SH FILES
.PP
.IP "\fIfile\fP.lock"
-The lock file
+The lock file
.B mutt_dotlock
generates.
.SH SEE ALSO
.TP
.B "0 \- DL_EX_OK"
The program was successful.
-.TP
+.TP
.B "1 \- DL_EX_ERROR"
An unspecified error such as bad command line parameters,
lack of system memory and the like has occurred.
-.TP
+.TP
.B "3 \- DL_EX_EXIST"
-The
+The
user wants to lock a file which has been locked by
-another process already. If
+another process already. If
.B mutt_dotlock
is invoked with the
-.B -f
-command line option,
+.B -f
+command line option,
.B mutt_dotlock
won't generate this error, but break other processes'
locks.
-.TP
+.TP
.B "4 \- DL_EX_NEED_RPIVS"
-This return value only occurs if
-.B mutt_dotlock
+This return value only occurs if
+.B mutt_dotlock
has been invoked
-with the
+with the
.B -t
command line option. It means that
.B mutt_dotlock
has been invoked with the
.B -t
command line option. It means that
-.B mutt_dotlock
+.B mutt_dotlock
is unable to lock \fIfile\fP even with group mail
privileges.
.SH NOTES
.PP
.B mutt_dotlock
tries to implement an NFS-safe dotlocking method which was
-borrowed from
+borrowed from
.B lockfile
-(1).
+(1).
.PP
If the user can't open \fIfile\fP for reading with his
-normal privileges,
-.B mutt_dotlock
+normal privileges,
+.B mutt_dotlock
will return the
.B DL_EX_ERROR
exit value to avoid certain attacks against other users'
/*
* 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;
-
+
return DT_NONE;
}
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 ("\"", 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))
syn match muttrcKeyName contained "\c<\%(BackSpace\|BackTab\|Delete\|Down\|End\|Enter\|Esc\|Home\|Insert\|Left\|PageDown\|PageUp\|Return\|Right\|Space\|Tab\|Up\)>"
syn match muttrcKeyName contained "<F[0-9]\+>"
-syn keyword muttrcVarBool skipwhite contained
+syn keyword muttrcVarBool skipwhite contained
\ allow_8bit allow_ansi arrow_cursor ascii_chars askbcc askcc attach_split
\ auto_tag autoedit beep beep_new bounce_delivered braille_friendly
\ check_mbox_size check_new collapse_unread confirmappend confirmcreate
\ use_idn use_ipv6 user_agent wait_key weed wrap_search write_bcc
\ nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained
+syn keyword muttrcVarBool skipwhite contained
\ noallow_8bit noallow_ansi noarrow_cursor noascii_chars noaskbcc noaskcc noattach_split
\ noauto_tag noautoedit nobeep nobeep_new nobounce_delivered nobraille_friendly
\ nocheck_mbox_size nocheck_new nocollapse_unread noconfirmappend noconfirmcreate
" The following info was pulled from mix_entry_fmt in remailer.c
syn match muttrcMixFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[ncsa%]/
syn match muttrcMixFormatConditionals contained /%?[ncsa]?/
-" The following info was pulled from crypt_entry_fmt in crypt-gpgme.c
-" and pgp_entry_fmt in pgpkey.c (note that crypt_entry_fmt supports
+" The following info was pulled from crypt_entry_fmt in crypt-gpgme.c
+" and pgp_entry_fmt in pgpkey.c (note that crypt_entry_fmt supports
" 'p', but pgp_entry_fmt does not).
syn match muttrcPGPFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[nkualfctp%]/
syn match muttrcPGPFormatConditionals contained /%?[nkualfct]?/
-" The following info was pulled from _mutt_fmt_pgp_command in
+" The following info was pulled from _mutt_fmt_pgp_command in
" pgpinvoke.c
syn match muttrcPGPCmdFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[pfsar%]/
syn match muttrcPGPCmdFormatConditionals contained /%?[pfsar]?/ nextgroup=muttrcFormatConditionals2
syn match muttrcStatusFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[bdfFhlLmMnopPrsStuvV%]/
syn match muttrcStatusFormatEscapes contained /%[>|*]./
syn match muttrcStatusFormatConditionals contained /%?[bdFlLmMnoptuV]?/ nextgroup=muttrcFormatConditionals2
-" This matches the documentation, but directly contradicts the code
-" (according to the code, this should be identical to the
+" This matches the documentation, but directly contradicts the code
+" (according to the code, this should be identical to the
" muttrcPGPCmdFormatEscapes
syn match muttrcPGPGetKeysFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[r%]/
-" The following info was pulled from _mutt_fmt_smime_command in
+" The following info was pulled from _mutt_fmt_smime_command in
" smime.c
syn match muttrcSmimeFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[Cciskaf%]/
syn match muttrcSmimeFormatConditionals contained /%?[Cciskaf]?/ nextgroup=muttrcFormatConditionals2
.\"
.\"
.\" Copyright (C) 1996-2016 Michael R. Elkins <me@cs.hmc.edu>
-.\"
+.\"
.\" 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.
[\-GnRyzZ]
[\-e \fIcmd\fP] [\-F \fIfile\fP] [\-g \fIserver\fP] [\-m \fItype\fP] [\-f \fIfile\fP]
.PP
-.B mutt
-[\-Enx]
-[\-e \fIcmd\fP]
+.B mutt
+[\-Enx]
+[\-e \fIcmd\fP]
[\-F \fIfile\fP]
[\-H \fIfile\fP]
[\-i \fIfile\fP]
[\-a \fIfile\fP [...] \-\-]
\fIaddr|mailto_url\fP [...]
.PP
-.B mutt
-[\-nx]
-[\-e \fIcmd\fP]
+.B mutt
+[\-nx]
+[\-e \fIcmd\fP]
[\-F \fIfile\fP]
[\-s \fIsubj\fP]
[\-b \fIaddr\fP]
.B mutt
[\-n] [\-e \fIcmd\fP] [\-F \fIfile\fP] \-Q \fIquery\fP
.PP
-.B mutt
+.B mutt
\-v[v]
.PP
-.B mutt
+.B mutt
\-D [\-S]
.SH DESCRIPTION
.PP
-personal_ws-1.1 en 515
+personal_ws-1.1 en 515
unconvertable
fIask
fPcollapsed
.\"
.\" Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
.\" 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.
.IP
This commands permits you to specify that mutt should automatically
convert the given MIME types to text/plain when displaying messages.
-For this to work, there must be a
+For this to work, there must be a
.BR mailcap (5)
-entry for the given MIME type with the
+entry for the given MIME type with the
.B copiousoutput
-flag set. A subtype of \(lq\fB*\fP\(rq
+flag set. A subtype of \(lq\fB*\fP\(rq
matches any subtype, as does an empty subtype.
.PP
.nf
.IP
This command permits you to define a list of "data" MIME content
types for which mutt will try to determine the actual file type from
-the file name, and not use a
+the file name, and not use a
.BR mailcap (5)
entry given for the original MIME type. For instance, you may add
the \fBapplication/octet-stream\fP MIME type to this list.
separating them with commas (no whitespace is allowed).
.IP
Valid maps are:
-.BR generic ", " alias ", " attach ", "
+.BR generic ", " alias ", " attach ", "
.BR browser ", " editor ", "
-.BR index ", " compose ", "
+.BR index ", " compose ", "
.BR pager ", " pgp ", " postpone ", "
.BR mix .
.IP
.TP
\fBiconv-hook\fP \fIcharset\fP \fIlocal-charset\fP
This command defines a system-specific name for a character set.
-This is useful when your system's
+This is useful when your system's
.BR iconv (3)
-implementation does not understand MIME character set names (such as
+implementation does not understand MIME character set names (such as
.BR iso-8859-1 ),
but instead insists on being fed with implementation-specific
character set names (such as
.IP
For terminals which don't support color, you can still assign
attributes to objects. Valid attributes include:
-.BR none ", " bold ", " underline ", "
+.BR none ", " bold ", " underline ", "
.BR reverse ", and " standout .
.TP
[\fBun\fP]\fBignore\fP \fIpattern\fP [ \fIpattern\fP ... ]
.BR m ,
.BR w ", or"
.BR d ,
-specifying a unit of years, months, weeks, or days.
+specifying a unit of years, months, weeks, or days.
.B +
increases the maximum date matched by the given interval of time,
-.B -
+.B -
decreases the minimum date matched by the given interval of time, and
.B *
increases the maximum date and decreases the minimum date matched by
.B >
matches dates which are older than the specified amount of time, an
offset which begins with the character
-.B <
+.B <
matches dates which are more recent than the specified amount of time,
and an offset which begins with the character
.B =
Content-Length: 1273
Lines: 34
-You folks have convinced me that the old patchlist was almost the
+You folks have convinced me that the old patchlist was almost the
right way to go for mutt identifying what patches have been applied.
-Thus, I've implemented this scheme (and will commit it to the CVS
-in a moment): There's a new file called PATCHES in the source tree,
+Thus, I've implemented this scheme (and will commit it to the CVS
+in a moment): There's a new file called PATCHES in the source tree,
which will be empty in the official distribution.
-This file's format is one patch ID per line. Patch IDs should be
-the same as the file names used for distributing patches. The
-format for these file names should be this:
+This file's format is one patch ID per line. Patch IDs should be
+the same as the file names used for distributing patches. The
+format for these file names should be this:
patch-<version>.<initials>.<patch-description>.<patchlevel>
-That is, Vsevolod's NNTP patch for mutt-1.3.42 could be named like
+That is, Vsevolod's NNTP patch for mutt-1.3.42 could be named like
this:
patch-1.3.42.vvv.nntp.1
- From PATCHES, patchlist.c will be automatically generated. In
-order to properly construct PATCHES, please include the following
+ From PATCHES, patchlist.c will be automatically generated. In
+order to properly construct PATCHES, please include the following
chunk with your patch, replacing <your-id-here> by your patch ID.
------------------------------snip------------------------------
+<your-id-here>
------------------------------snip------------------------------
-The patch IDs will be displayed when mutt is run with the 'v'
+The patch IDs will be displayed when mutt is run with the 'v'
command line switch.
---
+--
Thomas Roessler http://log.does-not-exist.org/
/*
* 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
char *p;
/* first, drop privileges */
-
+
if (dotlock_init_privs () == -1)
return DL_EX_ERROR;
/* determine the system's host name */
-
+
uname (&utsname);
if ((p = strchr (utsname.nodename, '.')))
*p = '\0';
/* 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 [NeoMutt %s%s (%s)]\n", PACKAGE_VERSION, GitVer, MUTT_VERSION);
/*
* 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 - Everything'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,
#ifdef DL_STANDALONE
(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);
if ((ch = km_dokey (MENU_EDITOR)) == -1)
{
- rv = -1;
+ rv = -1;
goto bye;
}
set_option (OPTNEEDREDRAW);
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);
set_option (OPTNEEDREDRAW);
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);
FREE (&tempbuf);
return rv;
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.
*/
/*
* 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;
}
* 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 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;
mutt_debug (3, "is_from(): got return path: %s\n", path);
}
-
+
s = p + 1;
SKIPWS (s);
if (!*s)
/* year */
if (sscanf (s, "%d", &yr) != 1) return 0;
tm.tm_year = yr > 1900 ? yr - 1900 : (yr < 70 ? yr + 100 : yr);
-
+
mutt_debug (3, "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-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 */
mutt_debug (2, "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)
{
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"));
mutt_debug (1, "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;
* 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 0 on success, -1 otherwise.
*/
int
-mutt_hcache_store_raw(header_cache_t *h, const char* key, size_t keylen,
+mutt_hcache_store_raw(header_cache_t *h, const char* key, size_t keylen,
void* data, size_t dlen);
/**
* Copyright (C) 1996-2000,2002,2007 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2016 Richard Russon <rich@flatcap.org>
* Copyright (C) 2016 Ian Zimmerman <itz@primate.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"
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':
colorlen = add_index_color (dest, destlen, flags, MT_COLOR_INDEX_SIZE);
mutt_pretty_size (buf2, sizeof (buf2), (long) hdr->content->length);
/* preprocess $date_format to handle %Z */
{
const char *cp;
- struct tm *tm;
+ struct tm *tm;
time_t T;
int i = 0, invert = 0;
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));
mutt_format_s (dest + colorlen, destlen - colorlen, prefix, NONULL (hdr->env->x_label));
add_index_color (dest + colorlen, destlen - colorlen, flags, MT_COLOR_INDEX);
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, 1, 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;
-};
+};
/* global vars used for the string-history routines */
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;
/*
* 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;
}
* We should maybe add a new imap_format string for IMAP browsing, without all
the stat variables but with tags like how many messages are in the folders,
how many subfolders, that weird \Marked tag, etc.
-
+
[ -- speed -- ]
* Partial index loading, using server-side threading and sorting
* 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;
-
+
mutt_debug (2, "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)
{
mutt_debug (1, "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)
{
mutt_debug (1, "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]);
mutt_debug (2, "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 (ibuf, obuf, strlen (obuf), sizeof (ibuf) - 2);
safe_strcat (ibuf, sizeof (ibuf), "\r\n");
mutt_socket_write (idata->conn, ibuf);
/*
* 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];
-
+
do
{
maj_stat = gss_display_status (&min_stat,
break;
strncpy(buf_maj, (char*) status_string.value, sizeof(buf_maj));
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);
-
+
mutt_debug (2, "((%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;
mutt_debug (2, "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 */
do
rc = imap_cmd_step(idata);
while (rc == IMAP_CMD_CONTINUE);
-
+
if (rc == IMAP_CMD_BAD)
{
res = IMAP_AUTH_UNAVAIL;
/*
* 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"))
/* do not use SASL login for regular IMAP login (#3556) */
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");
mutt_debug (1, "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);
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;
* 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",
mutt_debug (3, "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)
{
int count = idata->newMailCount;
mutt_debug (1, "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))
mutt_debug (3, "Handling FETCH\n");
msgno = atoi (s);
-
+
if (msgno <= idata->ctx->msgcount)
/* see cmd_parse_expunge */
for (cur = 0; cur < idata->ctx->msgcount; cur++)
{
h = idata->ctx->hdrs[cur];
-
+
if (h && h->active && h->index+1 == msgno)
{
mutt_debug (2, "Message UID %d updated\n", HEADER_DATA(h)->uid);
break;
}
-
+
h = NULL;
}
-
+
if (!h)
{
mutt_debug (3, "FETCH response ignored for this message\n");
return;
}
-
+
/* skip FETCH */
s = imap_next_word (s);
s = imap_next_word (s);
/* 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)
{
mutt_debug (1, "Error parsing mailbox %s, skipping\n", inc->path);
continue;
}
/* mutt_debug (2, "Buffy entry: [%s] mbox: [%s]\n", inc->path, NONULL(mx.mbox)); */
-
+
if (imap_account_match (&idata->conn->account, &mx.account))
{
if (mx.mbox)
{
mutt_debug (3, "Found %s in buffy list (OV: %d ON: %d U: %d)\n",
mailbox, olduv, oldun, status->unseen);
-
+
if (option(OPTMAILCHECKRECENT))
{
if (olduv && olduv == status->uidvalidity)
/*
* Copyright (C) 1996-1998 Michael R. Elkins <me@mutt.org>
* 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.
- */
+ */
#ifndef _IMAP_H
#define _IMAP_H 1
/*
* 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"
/*
* 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"
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;
if ((addr = mutt_parse_adrlist (NULL, buf->data)) == NULL)
goto bail;
if (mutt_addrlist_to_intl (addr, &estr))
- {
+ {
snprintf (err->data, err->dsize, _("%sgroup: warning: bad IDN '%s'.\n"),
data == 1 ? "un" : "", estr);
rfc822_free_address (&addr);
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;
set_option (OPTFORCEREDRAWINDEX);
}
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, _("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++;
{
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);
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;
line_rc = mutt_parse_rc_line (currentline, &token, err);
if (line_rc == -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 (int hide_sensitive)
{
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);
snprintf (AttachmentMarker, sizeof (AttachmentMarker),
"\033]9;%" PRIu64 "\a", mutt_rand64());
-
+
/* on one of the systems I use, getcwd() does not return the same prefix
as is listed in the passwd file */
if ((p = getenv ("HOME")))
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 */
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
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
# it with the rest of us. Send it using the `glibcbug' script to
# bugs@gnu.org.
-# Packages using this file:
+# Packages using this file:
bokmal no_NO.ISO-8859-1
bokmål no_NO.ISO-8859-1
/*
* 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 ("<return>", MENU_PAGER, OP_NEXT_LINE);
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);
if(!(key = km_find_func(menu, OP_HELP)))
key = km_find_func(MENU_GENERIC, OP_HELP);
-
+
if(!(km_expand_key(buf, sizeof(buf), key)))
{
mutt_error (_("Key is not bound."));
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.
*
*/
-
+
mutt_debug (1, "safe_rename: link (%s, %s) failed: %s (%d)\n",
src, target, strerror (errno), errno);
)
{
mutt_debug (1, "safe_rename: trying rename...\n");
- if (rename (src, target) == -1)
+ if (rename (src, target) == -1)
{
mutt_debug (1, "safe_rename: rename (%s, %s) failed: %s (%d)\n",
src, target, strerror (errno), errno);
return -1;
}
mutt_debug (1, "safe_rename: rename succeeded.\n");
-
+
return 0;
}
/*
* Stat both links and check if they are equal.
*/
-
+
if (lstat (src, &ssb) == -1)
{
mutt_debug (1, "safe_rename: can't stat %s: %s (%d)\n",
src, strerror (errno), errno);
return -1;
}
-
+
if (lstat (target, &tsb) == -1)
{
mutt_debug (1, "safe_rename: can't stat %s: %s (%d)\n",
return -1;
}
- /*
+ /*
* pretend that the link failed because the target file
* did already exist.
*/
* value here? XXX
*/
- if (unlink (src) == -1)
+ if (unlink (src) == -1)
{
mutt_debug (1, "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';
mutt_debug (1, "mutt_mkwrapdir: mkdtemp() failed\n");
return -1;
}
-
+
if (snprintf (newfile, nflen, "%s/%s", newdir, NONULL(basename)) >= nflen)
{
rmdir(newdir);
mutt_debug (1, "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
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
if test "$gpgme_version_major" -gt "$req_major"; then
ok=yes
- else
+ else
if test "$gpgme_version_major" -eq "$req_major"; then
if test "$gpgme_version_minor" -gt "$req_minor"; then
ok=yes
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
if test "$gpgme_version_major" -gt "$req_major"; then
ok=yes
- else
+ else
if test "$gpgme_version_major" -eq "$req_major"; then
if test "$gpgme_version_minor" -gt "$req_minor"; then
ok=yes
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
if test "$gpgme_version_major" -gt "$req_major"; then
ok=yes
- else
+ else
if test "$gpgme_version_major" -eq "$req_major"; then
if test "$gpgme_version_minor" -gt "$req_minor"; then
ok=yes
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
if test "$gpgme_version_major" -gt "$req_major"; then
ok=yes
- else
+ else
if test "$gpgme_version_major" -eq "$req_major"; then
if test "$gpgme_version_minor" -gt "$req_minor"; then
ok=yes
/*
* 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\
int double_dash = argc, nargc = 1;
/* 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;
for (; alias_queries; alias_queries = alias_queries->next)
{
if ((a = mutt_lookup_alias (alias_queries->data)))
- {
+ {
/* output in machine-readable form */
mutt_addrlist_to_intl (a, NULL);
mutt_write_address_list (a, stdout, 0, 0);
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];
- if (menu->dialog)
+ if (menu->dialog)
{
menu->redraw &= ~REDRAW_MOTION;
return;
}
-
+
mutt_window_move (menu->indexwin, menu->oldcurrent + menu->offset - menu->top, 0);
ATTRSET(menu->color (menu->oldcurrent));
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;
set_option (OPTNEEDREDRAW);
}
}
- 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;
}
unset_option (OPTMENUCALLER);
return OP_NULL;
}
-
-
+
+
mutt_curs_set (0);
if (menu_redraw (menu) == OP_REDRAW)
return OP_REDRAW;
-
+
menu->oldcurrent = menu->current;
/* move the cursor out of the way */
-
-
+
+
if (option (OPTARROWCURSOR))
mutt_window_move (menu->indexwin, menu->current - menu->top + menu->offset, 2);
else if (option (OPTBRAILLEFRIENDLY))
menu->indexwin->cols - 1);
mutt_refresh ();
-
+
/* try to catch dialog keys before ops */
if (menu->dialog && menu_dialog_dokey (menu, &i) == 0)
return i;
-
+
i = km_dokey (menu->menu);
if (i == OP_TAG_PREFIX || i == OP_TAG_PREFIX_COND)
{
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)
ctx->mtime = st.st_mtime;
}
-/*
+/*
* Actually parse a maildir message. This may also be used to fill
* out a fake header structure generated by lazy maildir parsing.
*/
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;
char fn[_POSIX_PATH_MAX];
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.
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++;
}
* end of list block if required.
*/
int context_changed = ctx->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
* message.
*/
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 occult ? MUTT_REOPENED : (have_new ? MUTT_NEW_MAIL : 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
strfcpy (buf, ctx->path, sizeof (buf));
if (stat (buf, &st) == -1)
return -1;
-
+
/* create .mh_sequences when there isn't one. */
snprintf (buf, sizeof (buf), "%s/.mh_sequences", ctx->path);
if ((i = stat (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
#ifdef USE_NNTP
MUTT_NEWSGROUPS,
#endif
-
+
/* Options for Mailcap lookup */
MUTT_EDIT,
MUTT_COMPOSE,
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 */
time_t stamp; /* time stamp of last
* encoding update.
*/
-
+
unsigned int type : 4; /* content-type primary type */
unsigned int encoding : 3; /* content-transfer-encoding */
unsigned int disposition : 2; /* content-disposition */
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.
*/
* option.
*/
unsigned int xlabel_changed : 1; /* editable - used for syncing */
-
+
/* 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;
void *data; /* driver-specific data */
void (*free_cb)(struct header *); /* driver-specific data free function */
#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);
int (*tag) (struct menu_t *, int i, int m);
- /* 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
mutt_debug (2, "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,
mutt_debug (2, "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)
if (rc < len - sent)
mutt_debug (3, "mutt_socket_write: short write (%d of %d bytes)\n",
rc, len - sent);
-
+
sent += rc;
}
buf[i] = '\0';
mutt_debug (dbg, "%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;
}
}
mutt_debug (1, "Unknown address family!\n");
return -1;
}
-
+
if (ConnectTimeout > 0)
alarm (ConnectTimeout);
FD_ZERO (&rfds);
FD_SET (conn->fd, &rfds);
-
+
return select (conn->fd + 1, &rfds, NULL, NULL, &tv);
}
int fd;
char *host_idna = NULL;
-
+
#ifdef HAVE_GETADDRINFO
/* --- IPv4/6 --- */
hints.ai_socktype = SOCK_STREAM;
snprintf (port, sizeof (port), "%d", conn->account.port);
-
+
# ifdef HAVE_LIBIDN
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);
# ifdef HAVE_LIBIDN
}
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 = 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;
}
int i;
struct utimbuf ut;
- 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++;
#ifdef USE_SIDEBAR
}
}
- /*
+ /*
* 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;
-
+
/* update memory to reflect the new state of the mailbox */
ctx->vcount = 0;
ctx->vsize = 0;
ctx->hdrs[j]->changed = 0;
else if (ctx->hdrs[j]->changed)
ctx->changed++;
-
+
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
* 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-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"
color = (lineInfo[m].syntax)[i].color;
break;
}
- /* don't break here, as cnt might be
+ /* don't break here, as cnt might be
* in the next chunk as well */
}
}
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)
{
tmp->prefix = 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;
lineInfo[n].type = MT_COLOR_NORMAL;
/* body patterns */
- if (lineInfo[n].type == MT_COLOR_NORMAL ||
+ if (lineInfo[n].type == MT_COLOR_NORMAL ||
lineInfo[n].type == MT_COLOR_QUOTED)
{
size_t nl;
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;
static int check_attachment_marker (char *p)
{
char *q = AttachmentMarker;
-
+
for (;*p == *q && *q && *p && *q != '\a' && *p != '\a'; p++, q++)
;
return (int) (*p - *q);
{
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++;
for (; len > 0; buf += k, len -= k)
{
k = mbrtowc (NULL, (char *) buf, len, &mbstate);
- if (k == (size_t)(-2))
- break;
+ if (k == (size_t)(-2))
+ break;
else if (k == (size_t)(-1) || k == 0)
{
if (k == (size_t)(-1))
* certain versions of glibc. Trim them if necessary. */
if (b_read == *blen - 2)
b_read -= trim_incomplete_mbyte(*buf, b_read);
-
+
/* copy "buf" to "fmt", but without bold and underline controls */
p = *buf;
q = *fmt;
/* 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
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] = "";
while (lines < pager_window->rows && lineInfo[curline].offset <= sb.st_size - 1)
{
- if (display_line (fp, &last_pos, &lineInfo, curline, &lastLine,
+ if (display_line (fp, &last_pos, &lineInfo, curline, &lastLine,
&maxLine,
(flags & MUTT_DISPLAYFLAGS) | hideQuoted | SearchFlag | (flags & MUTT_PAGER_NOWRAP),
&QuoteList, &q_level, &force_redraw, &SearchRE,
/* print out the index status bar */
menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
-
+
mutt_window_move (index_status_window, 0, 0);
SETCOLOR (MT_COLOR_STATUS);
mutt_draw_statusline (index_status_window->cols, buffer, sizeof (buffer));
}
else
OldHdr = NULL;
-
+
ch = km_dokey (MENU_PAGER);
if (ch != -1)
{
/* searching forward */
for (i = wrapped ? 0 : topline + searchctx + 1; i < lastLine; i++)
{
- if ((!hideQuoted || lineInfo[i].type != MT_COLOR_QUOTED) &&
+ if ((!hideQuoted || lineInfo[i].type != MT_COLOR_QUOTED) &&
!lineInfo[i].continuation && lineInfo[i].search_cnt > 0)
break;
}
/* searching backward */
for (i = wrapped ? lastLine : topline + searchctx - 1; i >= 0; i--)
{
- if ((!hideQuoted || (has_types &&
- lineInfo[i].type != MT_COLOR_QUOTED)) &&
+ if ((!hideQuoted || (has_types &&
+ lineInfo[i].type != MT_COLOR_QUOTED)) &&
!lineInfo[i].continuation && 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 */
SearchCompiled = 1;
/* update the search pointers */
i = 0;
- while (display_line (fp, &last_pos, &lineInfo, i, &lastLine,
+ while (display_line (fp, &last_pos, &lineInfo, i, &lastLine,
&maxLine, MUTT_SEARCH | (flags & MUTT_PAGER_NSKIP) | (flags & MUTT_PAGER_NOWRAP),
&QuoteList, &q_level,
&force_redraw, &SearchRE, pager_window) == 0)
/* searching forward */
for (i = topline; i < lastLine; i++)
{
- if ((!hideQuoted || lineInfo[i].type != MT_COLOR_QUOTED) &&
+ if ((!hideQuoted || lineInfo[i].type != MT_COLOR_QUOTED) &&
!lineInfo[i].continuation && lineInfo[i].search_cnt > 0)
break;
}
/* searching backward */
for (i = topline; i >= 0; i--)
{
- if ((!hideQuoted || lineInfo[i].type != MT_COLOR_QUOTED) &&
+ if ((!hideQuoted || lineInfo[i].type != MT_COLOR_QUOTED) &&
!lineInfo[i].continuation && lineInfo[i].search_cnt > 0)
break;
}
if (dretval < 0)
{
mutt_error (_("No more unquoted text after quoted text."));
- break;
+ break;
}
topline = new_topline;
}
{
i = curline;
/* make sure the types are defined to the end of file */
- while (display_line (fp, &last_pos, &lineInfo, i, &lastLine,
+ while (display_line (fp, &last_pos, &lineInfo, i, &lastLine,
&maxLine, has_types | (flags & MUTT_PAGER_NOWRAP),
&QuoteList, &q_level, &force_redraw,
&SearchRE, 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;
}
break;
-
+
case OP_CREATE_ALIAS:
CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
if (IsMsgAttach (extra))
mutt_menuDestroy (&index);
index = NULL;
}
-
- if (option (OPTWRAP) != old_smart_wrap ||
+
+ if (option (OPTWRAP) != old_smart_wrap ||
option (OPTMARKERS) != old_markers)
{
if (flags & MUTT_PAGER_RETWINCH)
/* try to keep the old position */
topline = 0;
lastLine = 0;
- while (j > 0 && display_line (fp, &last_pos, &lineInfo, topline,
+ while (j > 0 && display_line (fp, &last_pos, &lineInfo, topline,
&lastLine, &maxLine,
(has_types ? MUTT_TYPES : 0) | (flags & MUTT_PAGER_NOWRAP),
&QuoteList, &q_level, &force_redraw,
case OP_MAIL:
CHECK_MODE(IsHeader (extra) && !IsAttach (extra));
- CHECK_ATTACH;
+ CHECK_ATTACH;
ci_send_message (0, NULL, NULL, extra->ctx, NULL);
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->idx,
extra->idxlen, extra->bdy,
SENDREPLY);
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->idx,
extra->idxlen, extra->bdy, SENDREPLY|SENDLISTREPLY);
break;
}
}
-
+
cleanup_quote (&QuoteList);
-
+
for (i = 0; i < maxLine ; i++)
{
FREE (&(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;
mutt_debug (2, "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)
{
int matched = 0;
LIST *last = NULL;
-
+
if (lastp)
last = *lastp;
-
+
switch (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))
{
}
#endif
break;
-
+
case 'i':
if (!ascii_strcasecmp (line+1, "n-reply-to"))
{
{
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;
-
+
#ifdef USE_NNTP
case 'n':
if (!ascii_strcasecmp (line + 1, "ewsgroups"))
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)
{
{
/* restore the original line */
line[strlen (line)] = ':';
-
+
if (weed && option (OPTWEED) && mutt_matches_ignore (line))
goto done;
}
done:
-
+
*lastp = last;
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))
}
pat->min = pat->max = CTX_MSGNO(Context);
}
-
+
/* Since we don't enforce order, we must swap bounds if they're backward */
order_range(pat);
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;
memcpy (&min, tm, sizeof (min));
min.tm_hour = min.tm_sec = min.tm_min = 0;
}
-
+
/* preset max date for relative offsets,
if nothing follows we search for messages on a specific day */
max.tm_year = min.tm_year;
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
mutt_debug (2, "pgp_copy_checksig: \"%s\" doesn't match regexp.\n",
line);
-
+
if (strncmp (line, "[GNUPG:] ", 9) == 0)
continue;
fputs (line, fpout);
}
-/*
+/*
* 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 */
FREE(&gpgcharset);
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;
FREE(&gpgcharset);
return -1;
}
-
+
if ((thepid = pgp_invoke_decode (&pgpin, NULL, &pgperr, -1,
fileno (pgpout), -1, tmpfname,
needpass)) == -1)
*PgpPass = 0;
fprintf (pgpin, "%s\n", PgpPass);
}
-
+
safe_fclose (&pgpin);
if (s->flags & MUTT_DISPLAY)
crypt_current_time (s, "PGP");
rc = pgp_copy_checksig (pgperr, s->fpout);
}
-
+
safe_fclose (&pgperr);
rv = mutt_wait_filter (thepid);
-
+
if (s->flags & MUTT_DISPLAY)
{
if (rc == 0) have_any_sigs = 1;
* 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 && !(s->flags & MUTT_DISPLAY))
{
mutt_error (_("Could not decrypt PGP message"));
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;
-
+
mutt_debug (1, "pgp_verify_one: mutt_wait_filter returned %d.\n", rv);
}
mutt_unlink (pgperrfile);
mutt_debug (1, "pgp_verify_one: returning %d.\n", badsig);
-
+
return badsig;
}
}
set_option (OPTDONTHANDLEPGPKEYS);
-
+
if (!h)
{
for (i = 0; i < Context->vcount; i++)
safe_fclose (&fpout);
goto bailout;
}
- mutt_copy_message (fpout, Context, Context->hdrs[Context->v2r[i]],
+ mutt_copy_message (fpout, Context, Context->hdrs[Context->v2r[i]],
MUTT_CM_DECODE|MUTT_CM_CHARCONV, 0);
}
}
- }
+ }
else
{
mutt_parse_mime_message (Context, h);
}
mutt_copy_message (fpout, Context, h, MUTT_CM_DECODE|MUTT_CM_CHARCONV, 0);
}
-
+
safe_fclose (&fpout);
mutt_endwin (NULL);
pgp_invoke_import (tempfname);
mutt_any_key_to_continue (NULL);
bailout:
-
+
mutt_unlink (tempfname);
unset_option (OPTDONTHANDLEPGPKEYS);
-
+
}
static void pgp_extract_keys_from_attachment (FILE *fp, BODY *top)
}
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)
{
/*
rc = mutt_body_handler (tattach, s);
s->fpin = fpin;
- /*
+ /*
* 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);
-
+
#if 0
- /* The following is intended to give a clue to some completely brain-dead
+ /* The following is intended to give a clue to some completely brain-dead
* "mail environments" which are typically used by large corporations.
*/
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),
/* L10N: PGP options (inline) (opportunistic encryption is off) */
_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, %s format, (c)lear, or (o)ppenc mode? "), mime_inline);
prompt = promptbuf;
if (msg->security & (ENCRYPT | SIGN))
{
- snprintf (promptbuf, sizeof (promptbuf),
+ snprintf (promptbuf, sizeof (promptbuf),
/* L10N: PGP options (inline) */
_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, %s format, or (c)lear? "), mime_inline);
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;
cctx.signas = signas;
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,
- need_passphrase, fname, NULL, PgpSignAs, NULL,
+ need_passphrase, fname, NULL, PgpSignAs, NULL,
PgpDecodeCommand);
}
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,
{
if (sign)
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
- 1, fname, NULL, PgpSignAs, uids,
+ 1, fname, NULL, PgpSignAs, uids,
PgpEncryptSignCommand);
else
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
{
if (flags & ENCRYPT)
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
- flags & SIGN ? 1 : 0, fname, NULL, PgpSignAs, uids,
+ flags & SIGN ? 1 : 0, fname, NULL, PgpSignAs, uids,
flags & SIGN ? PgpEncryptSignCommand : PgpEncryptOnlyCommand);
else
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;
cctx.signas = PgpSignAs;
-
+
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)
{
char uids[HUGE_STRING];
char tmpuids[HUGE_STRING];
char quoted[HUGE_STRING];
-
+
*uids = '\0';
-
+
for (; hints; hints = hints->next)
{
mutt_quote_filename (quoted, sizeof (quoted), (char *) hints->data);
/*
* 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.
* 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);
mutt_debug (1, "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))
mutt_debug (1, "pgp_dearmor: Can't find end of ASCII armor.\n");
return;
}
-
+
if ((end = ftello (in) - strlen (line)) < start)
{
mutt_debug (1, "pgp_dearmor: end < start???\n");
return;
}
-
+
if (fseeko (in, start, SEEK_SET) == -1)
{
mutt_debug (1, "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);
{
mutt_debug (1, "pgp_find_hash: No packet.\n");
}
-
+
bye:
-
+
safe_fclose (&in);
safe_fclose (&out);
pgp_release_packet ();
/*
* 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,
/*
* 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"
#if USE_HCACHE
else
{
- mutt_hcache_store (hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data),
+ mutt_hcache_store (hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data),
ctx->hdrs[i], 0);
}
#endif
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" :
/*
* 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>
* Copyright (C) 2013 Karel Zak <kzak@redhat.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.
- */
+ */
#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;
}
{
menu->data = QueryTable = 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);
FREE (&QueryTable);
-
+
/* tell whoever called me to redraw the screen when I return */
set_option (OPTNEEDREDRAW);
}
/*
* 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"
{
ATTACHPTR *new;
int i;
-
+
for (; m; m = m->next)
{
if (*idxlen == *idxmax)
new->level = level;
/* We don't support multipart messages in the compose menu yet */
- if (!compose && !m->collapsed &&
+ if (!compose && !m->collapsed &&
((m->type == TYPEMULTIPART
&& (!(WithCrypto & APPLICATION_PGP)
|| !mutt_is_multipart_encrypted (m))
* %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)
{
BODY *cur = ((ATTACHPTR **) menu->data)[n]->content;
int ot = cur->tagged;
-
+
cur->tagged = (m >= 0 ? m : !cur->tagged);
return cur->tagged - ot;
}
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 (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 (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;
*idxlen = 0;
idx = *idxp = mutt_gen_attach_list (cur, -1, idx, idxlen, idxmax, 0, 0);
-
+
menu->max = *idxlen;
menu->data = *idxp;
menu->current = menu->max - 1;
menu_check_recenter (menu);
menu->redraw |= REDRAW_INDEX;
-
+
}
int old_optweed = option (OPTWEED);
set_option (OPTWEED);
#endif
-
+
do
{
switch (op)
{
b->tagged = 0;
b->collapsed = 0;
- if (b->parts)
+ if (b->parts)
mutt_attach_init (b->parts);
}
}
short idxmax = 0;
int flags = 0;
int op = OP_NULL;
-
+
/* make sure we have parsed this message */
mutt_parse_mime_message (Context, hdr);
mutt_message_hook (Context, hdr, MUTT_MESSAGEHOOK);
-
+
if ((msg = mx_open_message (Context, hdr->msgno)) == NULL)
return;
{
secured = ! crypt_smime_decrypt_mime (msg->fp, &fp,
hdr->content, &cur);
-
+
/* S/MIME nesting */
if ((mutt_is_application_smime (cur) & SMIMEOPAQUE))
{
BODY *_cur = cur;
FILE *_fp = fp;
-
+
fp = NULL; cur = NULL;
secured = !crypt_smime_decrypt_mime (_fp, &fp, _cur, &cur);
-
+
mutt_free_body (&_cur);
safe_fclose (&_fp);
}
return;
}
}
-
+
if (!WithCrypto || !need_secured)
{
fp = msg->fp;
attach_collapse (idx[menu->current]->content, 0, 1, 1);
mutt_update_attach_index (cur, &idx, &idxlen, &idxmax, menu);
break;
-
+
case OP_FORGET_PASSPHRASE:
crypt_forget_passphrase ();
break;
case OP_EXTRACT_KEYS:
if ((WithCrypto & APPLICATION_PGP))
{
- crypt_pgp_extract_keys_from_attachment_list (fp, menu->tagprefix,
+ crypt_pgp_extract_keys_from_attachment_list (fp, menu->tagprefix,
menu->tagprefix ? cur : idx[menu->current]->content);
menu->redraw = REDRAW_FULL;
}
break;
-
+
case OP_CHECK_TRADITIONAL:
if ((WithCrypto & APPLICATION_PGP)
&& crypt_pgp_check_traditional (fp, menu->tagprefix ? cur
break;
case OP_PRINT:
- mutt_print_attachment_list (fp, menu->tagprefix,
+ mutt_print_attachment_list (fp, menu->tagprefix,
menu->tagprefix ? cur : idx[menu->current]->content);
break;
case OP_PIPE:
- mutt_pipe_attachment_list (fp, menu->tagprefix,
+ mutt_pipe_attachment_list (fp, menu->tagprefix,
menu->tagprefix ? cur : idx[menu->current]->content, 0);
break;
case OP_SAVE:
- mutt_save_attachment_list (fp, menu->tagprefix,
+ mutt_save_attachment_list (fp, menu->tagprefix,
menu->tagprefix ? cur : idx[menu->current]->content, hdr, menu);
if (!menu->tagprefix && option (OPTRESOLVE) && menu->current < menu->max - 1)
menu->current++;
-
+
menu->redraw = REDRAW_MOTION_RESYNCH | REDRAW_FULL;
break;
menu->tagprefix ? NULL : idx[menu->current]->content);
menu->redraw = REDRAW_FULL;
break;
-
+
case OP_BOUNCE_MESSAGE:
CHECK_ATTACH;
mutt_attach_bounce (fp, hdr, idx, idxlen,
menu->tagprefix ? NULL : idx[menu->current]->content, 0);
menu->redraw = REDRAW_FULL;
break;
-
+
#ifdef USE_NNTP
case OP_FORWARD_TO_GROUP:
CHECK_ATTACH;
case OP_LIST_REPLY:
CHECK_ATTACH;
-
- flags = SENDREPLY |
+
+ flags = SENDREPLY |
(op == OP_GROUP_REPLY ? SENDGROUPREPLY : 0) |
(op == OP_LIST_REPLY ? SENDLISTREPLY : 0);
- mutt_attach_reply (fp, hdr, idx, idxlen,
+ mutt_attach_reply (fp, hdr, idx, idxlen,
menu->tagprefix ? NULL : idx[menu->current]->content, flags);
menu->redraw = REDRAW_FULL;
break;
/*
* 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
/* can we decode all tagged attachments? */
-static short check_can_decode (ATTACHPTR ** idx, short idxlen,
+static short check_can_decode (ATTACHPTR ** idx, short idxlen,
BODY * cur)
{
short i;
{
short count = 0;
short i;
-
+
for (i = 0; i < idxlen; i++)
if (idx[i]->content->tagged)
count++;
-
+
return count;
}
* attachment.
*/
-static short count_tagged_children (ATTACHPTR ** idx,
+static short count_tagged_children (ATTACHPTR ** idx,
short idxlen, short i)
{
short level = idx[i]->level;
**
**/
-void mutt_attach_bounce (FILE * fp, HEADER * hdr,
+void mutt_attach_bounce (FILE * fp, HEADER * hdr,
ATTACHPTR ** idx, short idxlen, BODY * cur)
{
short i;
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
/**
**
- ** resend-message, from the attachment menu
+ ** resend-message, from the attachment menu
**
**
**/
-void mutt_attach_resend (FILE * fp, HEADER * hdr, ATTACHPTR ** idx,
+void mutt_attach_resend (FILE * fp, HEADER * hdr, ATTACHPTR ** idx,
short idxlen, BODY * cur)
{
short i;
/**
**
- ** forward-message, from the attachment menu
+ ** forward-message, from the attachment menu
**
**/
-
+
/* try to find a common parent message for the tagged attachments. */
static HEADER *find_common_parent (ATTACHPTR ** idx, short idxlen,
for (i = 0; i < idxlen; i++)
if (idx[i]->content->tagged)
break;
-
+
while (--i >= 0)
{
if (mutt_is_message_type (idx[i]->content->type, 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;
HEADER *parent = NULL;
-
+
if (cur)
{
for (i = 0; i < idxlen; i++)
{
- if (mutt_is_message_type (idx[i]->content->type, idx[i]->content->subtype)
+ if (mutt_is_message_type (idx[i]->content->type, idx[i]->content->subtype)
&& is_parent (i, idx, idxlen, cur))
parent = idx[i]->content->hdr;
if (idx[i]->content == cur)
}
else if (nattach)
parent = find_common_parent (idx, idxlen, 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 (FILE *fp,
- BODY **last,
- ATTACHPTR **idx,
+ BODY **last,
+ ATTACHPTR **idx,
short idxlen,
short force)
{
short i;
-
+
for (i = 0; i < idxlen; i++)
{
- if (idx[i]->content->tagged &&
+ if (idx[i]->content->tagged &&
(force || !mutt_can_decode (idx[i]->content)))
{
if (mutt_copy_body (fp, last, 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.
parent = find_parent (idx, idxlen, cur, nattach);
-
+
if (parent == NULL)
parent = hdr;
else
strfcpy (prefix, ">", sizeof (prefix));
}
-
+
include_header (option (OPTFORWQUOTE), fp, parent,
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 (idx, idxlen, 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 (fp, last, idx, idxlen, mime_fwd_all) == NULL)
goto bail;
}
-
+
mutt_forward_trailer (tmpfp);
-
+
safe_fclose (&tmpfp);
tmpfp = NULL;
/* now that we have the template, send it. */
ci_send_message (flags, tmphdr, tmpbody, NULL, parent);
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,
ATTACHPTR ** idx, short idxlen, BODY * cur, int flags)
{
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 (tmpfp, cur->hdr);
_mutt_copy_message (tmpfp, fp, cur->hdr, cur->hdr->content, cmflags, chflags);
mutt_forward_trailer (tmpfp);
{
if (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 (tmpfp, idx[i]->content->hdr);
_mutt_copy_message (tmpfp, fp, idx[i]->content->hdr,
idx[i]->content->hdr->content, cmflags, chflags);
else
mutt_free_header (&tmphdr);
- ci_send_message (flags, tmphdr, *tmpbody ? tmpbody : NULL,
+ ci_send_message (flags, tmphdr, *tmpbody ? tmpbody : NULL,
NULL, curhdr);
}
-void mutt_attach_forward (FILE * fp, HEADER * hdr,
+void mutt_attach_forward (FILE * fp, HEADER * hdr,
ATTACHPTR ** idx, short idxlen, BODY * cur, int flags)
{
short nattach;
-
+
if (check_all_msg (idx, idxlen, cur, 0) == 0)
attach_forward_msgs (fp, hdr, idx, idxlen, cur, flags);
/**
- **
+ **
** 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, ATTACHPTR **idx, short idxlen,
HEADER *parent, int flags)
ENVELOPE *curenv = NULL;
HEADER *curhdr = NULL;
short i;
-
+
if (!parent)
{
for (i = 0; i < idxlen; i++)
else
{
LIST **p = NULL, **q = NULL;
-
+
for (i = 0; i < idxlen; i++)
{
if (idx[i]->content->tagged)
mutt_add_to_reference_headers (env, 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,
- ATTACHPTR ** idx, short idxlen, BODY * cur,
+
+void mutt_attach_reply (FILE * fp, HEADER * hdr,
+ ATTACHPTR ** idx, short idxlen, BODY * cur,
int flags)
{
short mime_reply_any = 0;
-
+
short nattach = 0;
HEADER *parent = NULL;
HEADER *tmphdr = NULL;
STATE st;
char tmpbody[_POSIX_PATH_MAX];
FILE *tmpfp;
-
+
char prefix[SHORT_STRING];
int rc;
-
+
#ifdef USE_NNTP
if (flags & SENDNEWS)
set_option (OPTNEWSSEND);
tmphdr = mutt_new_header ();
tmphdr->env = mutt_new_envelope ();
- if (attach_reply_envelope_defaults (tmphdr->env, idx, idxlen,
+ if (attach_reply_envelope_defaults (tmphdr->env, idx, idxlen,
parent ? parent : (cur ? cur->hdr : NULL), flags) == -1)
{
mutt_free_header (&tmphdr);
return;
}
-
+
mutt_mktemp (tmpbody, sizeof (tmpbody));
if ((tmpfp = safe_fopen (tmpbody, "w")) == NULL)
{
else
{
mutt_make_attribution (Context, parent, tmpfp);
-
+
memset (&st, 0, sizeof (STATE));
st.fpin = fp;
st.fpout = tmpfp;
if (!option (OPTTEXTFLOWED))
- _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix),
+ _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix),
Context, parent, 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, tmpfp);
- if (mime_reply_any && !cur &&
+ if (mime_reply_any && !cur &&
copy_problematic_attachments (fp, &tmphdr->content, idx, idxlen, 0) == NULL)
{
mutt_free_header (&tmphdr);
}
safe_fclose (&tmpfp);
-
+
if (ci_send_message (flags, tmphdr, tmpbody, NULL,
parent ? parent : (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, int *redraw)
{
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;
}
*redraw = REDRAW_FULL;
-
+
chain = safe_calloc (sizeof (MIXCHAIN), 1);
for (p = *chainp; p; p = p->next)
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->data = type2_list;
menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MIX, RemailerHelp);
menu->pagelen = MIX_VOFFSET - 1;
-
- 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_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);
int i;
snprintf (cmd, sizeof (cmd), "cat %s | %s -m ", tempfile, Mixmaster);
-
+
for (i = 0; chain; chain = chain->next, i = 1)
{
strfcpy (tmp, cmd, sizeof (tmp));
if (!option (OPTNOCURSES))
mutt_endwin (NULL);
-
+
if ((i = mutt_system (cmd)))
{
fprintf (stderr, _("Error sending message, child exited %d.\n"), i);
unlink (tempfile);
return i;
}
-
+
#endif
/*
* 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 rfc1524_expand_filename (char *nametemplate,
- char *oldfile,
+ char *oldfile,
char *newfile,
size_t nflen)
{
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;
}
}
-
+
if (charset)
mutt_convert_string (&d0, charset, Charset, MUTT_ICONV_HOOK_FROM);
mutt_filter_unprintable (&d0);
{
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;
}
* 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"
/*
* 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))
{
void mutt_forward_intro (FILE *fp, HEADER *cur)
{
char buffer[STRING];
-
+
fputs ("----- Forwarded message from ", fp);
buffer[0] = 0;
rfc822_write_address (buffer, sizeof (buffer), cur->env->from, 1);
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));
}
-
+
/* 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;
-
+
#ifdef USE_NNTP
if (option (OPTNEWSSEND) && option (OPTXCOMMENTTO) && curenv->from)
env->x_comment_to = safe_strdup (mutt_get_name (curenv->from));
#endif
}
-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)
{
mutt_free_header (&msg);
char *finalpath = NULL;
int rv = -1;
-
+
#ifdef USE_NNTP
if (flags & SENDNEWS)
set_option (OPTNEWSSEND);
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)))
}
/*
- * make sure the message is written to the right part of a maildir
+ * make sure the message is written to the right part of a maildir
* postponed folder.
*/
msg->read = 0; msg->old = 0;
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;
mutt_expand_path (fcc, sizeof (fcc));
-
+
/* Don't save a copy when we are in batch-mode, and the FCC
* folder is on an IMAP server: This would involve possibly lots
- * of user interaction, which is not available in batch mode.
- *
+ * of user interaction, which is not available in batch mode.
+ *
* Note: A patch to fix the problems with the use of IMAP servers
- * from non-curses mode is available from Brendan Cully. However,
+ * from non-curses mode is available from Brendan Cully. However,
* I'd like to think a bit more about this before including it.
*/
{
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);
}
msg->content = mutt_remove_multipart (msg->content);
if (WithCrypto && (msg->security & ENCRYPT))
FREE (&pgpkeylist);
-
+
if (WithCrypto && free_clear_content)
mutt_free_body (&clear_content);
rv = 0;
-
+
cleanup:
if (flags & SENDPOSTPONED)
SmimeDefaultKey = smime_default_key;
}
}
-
+
safe_fclose (&tempfp);
if (! (flags & SENDNOFREEHEADER))
mutt_free_header (&msg);
/*
* 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 = 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);
FREE (&keylist);
return NULL;
}
-
+
keyID = key->hash;
keylist_size += mutt_strlen (keyID) + 2;
safe_realloc (&keylist, keylist_size);
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;
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);
mutt_unlink (certfile);
-
+
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), SmimeDefaultKey);
snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
NONULL(SmimeCertificates), SmimeDefaultKey);
-
+
default_key = smime_get_key_by_hash (SmimeDefaultKey, 1);
if ((! default_key) ||
(! mutt_strcmp ("?", default_key->issuer)))
NONULL(SmimeCertificates), intermediates);
smime_free_key (&default_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;
}
mutt_perror (outfile);
return NULL;
}
-
+
mutt_mktemp (errfile, sizeof (errfile));
if ((smimeerr = safe_fopen (errfile, "w+")) == NULL)
{
}
mutt_unlink (errfile);
-
+
mutt_mktemp (tmpfname, sizeof (tmpfname));
if ((tmpfp = safe_fopen (tmpfname, "w+")) == NULL)
{
return NULL;
}
-
+
if (type & ENCRYPT)
{
if (!smime_valid_passphrase ())
}
safe_fclose (&smimein);
-
+
mutt_wait_filter (thepid);
mutt_unlink (tmpfname);
-
+
if (s->flags & MUTT_DISPLAY)
{
fflush (smimeerr);
rewind (smimeerr);
-
+
if ((c = fgetc (smimeerr)) != EOF)
{
ungetc (c, smimeerr);
-
+
crypt_current_time (s, "OpenSSL");
mutt_copy_stream (smimeerr, s->fpout);
state_attach_puts (_("[-- End of OpenSSL output --]\n\n"), s);
}
-
+
if (type & ENCRYPT)
state_attach_puts (_("[-- The following data is S/MIME"
" encrypted --]\n"), s);
{
fflush (smimeout);
rewind (smimeout);
-
+
if (outFile) fpout = outFile;
else
{
fputs (buf, fpout);
}
fflush (fpout);
- rewind (fpout);
+ rewind (fpout);
if ((p = mutt_read_mime_header (fpout, 0)) != NULL)
{
fstat (fileno (fpout), &info);
p->length = info.st_size - p->offset;
-
+
mutt_parse_part (fpout, p);
if (s->fpout)
{
mutt_body_handler (p, s);
s->fpin = tmpfp_buffer;
}
-
+
}
safe_fclose (&smimeout);
smimeout = NULL;
char *line = NULL;
int lineno = 0;
size_t linelen;
-
+
rewind (smimeerr);
-
+
line = mutt_read_line (line, &linelen, smimeerr, &lineno, 0);
if (linelen && !ascii_strcasecmp (line, "verification successful"))
m->goodsig = 1;
FREE (&line);
}
- else
+ else
{
m->goodsig = p->goodsig;
m->badsig = p->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 (&SmimeDefaultKey, key->hash);
smime_free_key (&key);
-
+
msg->security |= SIGN;
/* probably need a different passphrase */
* 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_debug (2, "smtp_authenticate: Trying method %s\n", method);
r = smtp_auth_sasl (conn, method);
-
+
if (r == SMTP_AUTH_FAIL && delim)
{
mutt_error (_("%s authentication failed, trying next method"), method);
/*
* 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)
snprintf (buf, buflen, "%s", StChars->chars[i]);
break;
}
-
+
case 's':
snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
snprintf (buf, buflen, fmt,
/*
* 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
*/
THREAD *thread, *new, *tmp, top;
memset (&top, 0, sizeof (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);
}
child->env->in_reply_to = mutt_new_list ();
child->env->in_reply_to->data = safe_strdup (parent->env->message_id);
-
+
mutt_set_flag (ctx, child, MUTT_TAG, 0);
-
+
child->env->irt_changed = child->changed = 1;
return 1;
}
/*
* 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.
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;