aboutsummaryrefslogtreecommitdiffstats
path: root/interfaces/email
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-07-14 15:18:07 -0400
committerW. Trevor King <wking@drexel.edu>2009-07-14 15:18:07 -0400
commite7d150fd7ca22b01defd0c615000b6bfc367aacf (patch)
treeeacb8fbc153b3b15b48cc5d2ddfee9608d431c23 /interfaces/email
parentc38907c85bbb62a2b3bb00dd05eeb588ecc6845d (diff)
downloadbugseverywhere-e7d150fd7ca22b01defd0c615000b6bfc367aacf.tar.gz
Reorganized directory structure, mostly to put all the interfaces in
one place and make things clearer to the uninitiated. Here's my current understanding: . |-- libbe (the guts of BE) |-- becommands (plugins for all "be *" commands) |-- doc (documentation, currently just the man page) |-- interfaces (non-commandline interface implementations) | |-- web | | |-- Bugs-Everywhere-Web (in Turbogears) | |-- gui | | |-- beg (in Tkinter) | | `-- wxbe (in WX) | |-- email | `-- xml (xml <-> whatever conversion) `-- misc (random odds and ends) `-- completion (shell completion scripts) Note that I haven't attempted to use the web or gui interfaces in a while, so I'm not sure how well they're holding vs the core development.
Diffstat (limited to 'interfaces/email')
-rwxr-xr-xinterfaces/email/catmutt59
1 files changed, 59 insertions, 0 deletions
diff --git a/interfaces/email/catmutt b/interfaces/email/catmutt
new file mode 100755
index 0000000..601f14f
--- /dev/null
+++ b/interfaces/email/catmutt
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# catmutt - wrap mutt allowing mboxes read from stdin.
+#
+# Copyright (C) 1998-1999 Moritz Barsnick <barsnick (at) gmx (dot) net>,
+# 2009 William Trevor King <wking (at) drexel (dot) edu>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# version 2 as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# developed from grepm-0.6
+# http://www.barsnick.net/sw/grepm.html
+
+PROGNAME=`basename "$0"`
+export TMPDIR="${TMPDIR-/tmp}" # used by mktemp
+umask 077
+
+if [ $# -gt 0 ] && [ "$1" = "--help" ]; then
+ echo 1>&2 "Usage: ${PROGNAME} [--help] mutt-arguments"
+ echo 1>&2 ""
+ echo 1>&2 "Read a mailbox file from stdin and opens it with mutt."
+ echo 1>&2 "For example: cat somefile.mbox | ${PROGNAME}"
+ exit 0
+fi
+
+# Note: the -t/-p options to mktemp are deprecated for mktemp (GNU
+# coreutils) 7.1 in favor of --tmpdir but the --tmpdir option does not
+# exist yet for my 6.10-3ubuntu2 coreutils
+TMPFILE=`mktemp -t catmutt.XXXXXX` || exit 1
+
+trap "rm -f ${TMPFILE}; exit 1" 1 2 3 13 15
+
+cat > "${TMPFILE}" || exit 1
+
+# Now that we've read in the mailbox file, reopen stdin for mutt/user
+# interaction. When in a pipe we're not technically in a tty, so use
+# a little hack from "greno" at
+# http://www.linuxforums.org/forum/linux-programming-scripting/98607-bash-stdin-problem.html
+tty="/dev/`ps -p$$ --no-heading | awk '{print $2}'`"
+exec < ${tty}
+
+if [ `wc -c "${TMPFILE}" | awk '{print $1}'` -gt 0 ]; then
+ echo 1>&2 "Calling mutt on temporary mailbox file (${TMPFILE})."
+ mutt -R -f "${TMPFILE}" "$@"
+else
+ echo 1>&2 "Empty mailbox input."
+fi
+
+rm -f "${TMPFILE}" && echo 1>&2 "Deleted temporary mailbox file (${TMPFILE})."