summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2016-04-15 09:45:38 (GMT)
committer Jaromil <jaromil@dyne.org>2016-04-15 09:45:38 (GMT)
commit82e4069c80174893eed77c7355b263cb790d75ae (patch)
treea16fa139939561225b86cd5d55f20109136c4809
parentb8a9447fd7a805d1affc386d7420ec953d6834a1 (diff)
dropped alot for mutt-kz, which is now detected and activated
-rwxr-xr-xbuild/build-gnu.sh13
-rwxr-xr-xsrc/jaro38
-rw-r--r--src/mutt/formats3
-rwxr-xr-xsrc/zlibs/email19
-rwxr-xr-xsrc/zlibs/filters6
-rwxr-xr-xsrc/zlibs/helpers65
-rwxr-xr-xsrc/zlibs/maildirs2
-rwxr-xr-xsrc/zlibs/stats13
8 files changed, 113 insertions, 46 deletions
diff --git a/build/build-gnu.sh b/build/build-gnu.sh
index 855b53b..b63ede2 100755
--- a/build/build-gnu.sh
+++ b/build/build-gnu.sh
@@ -33,7 +33,7 @@ debian_req() {
case $distro in
debian)
deps=(fetchmail msmtp mutt pinentry-curses)
- deps+=(wipe notmuch sqlite3 alot abook elinks)
+ deps+=(wipe notmuch sqlite3 abook elinks)
deps+=(gcc make libglib2.0-dev)
print "Building on Debian"
@@ -54,7 +54,6 @@ debian_req() {
which wipe || sudo yum install wipe
which abook || sudo yum install abook
which notmuch || sudo yum install notmuch
- which alot || sudo yum install alot
print "Checking build dependencies"
which gcc || sudo yum install gcc
@@ -80,6 +79,16 @@ debian_req() {
print "All dependencies installed"
}
+[[ "$target" = "mutt-kz" ]] && {
+ pushd src/mutt-kz
+ print "Compiling Mutt patched for notmuch ... "
+ print
+ ./configure --enable-notmuch --enable-sidebar --enable-hcache --enable-gpgme --enable-imap --enable-pop &&
+ make
+ popd
+ print OK
+}
+
{ test "$target" = "fetchaddr" } || {
test "$target" = "all" } && {
pushd src
diff --git a/src/jaro b/src/jaro
index 1db944e..5265c8e 100755
--- a/src/jaro
+++ b/src/jaro
@@ -22,7 +22,7 @@
# this source code; if not, write to:
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-VERSION=4.2
+VERSION=4.3-dev
DATE=Apr/2016
JAROMAILEXEC=$0
@@ -896,37 +896,31 @@ EOF
# ;;
*) # unknown command, pass it to autostart
func "no command, autostart"
-
+ func "subcommand: $subcommand"
+ if [[ "$subcommand" = "__default" ]]; then
+ open_folder
+ exitcode=$?
# argument passed: determine if an email
- if isemail "$subcommand"; then
+ elif isemail "$subcommand"; then
notice "Composing message to: ${@}"
# its an email, TODO see if we have it in our addressbook
_mutt ${=@}
exitcode=0
# or a directory of file
- elif [[ -r "$subcommand" ]]; then
+ elif maildircheck "$subcommand"; then
# is it a maildir? then open
- maildircheck ${subcommand}
- [[ $? = 0 ]] && {
- _mutt -f ${subcommand}
- exitcode=0
- }
- # is it a regular file? then attach it
- [[ -f "$subcommand" ]] && {
+ open_folder "$subcommand"
+ exitcode=$?
+ elif maildircheck "$MAILDIRS/$subcommand"; then
+ open_folder "$MAILDIRS/$subcommand"
+ exitcode=$?
+ elif [[ -f "$subcommand" ]]; then
+ # is it a regular file? then ;attach it
_mutt -a ${=@}
exitcode=0
- }
- # or the name of a folder in Jaro Mail
- elif [[ -r "$MAILDIRS/$subcommand" ]]; then
- maildircheck "$MAILDIRS/$subcommand" && {
- notice "Opening folder ${subcommand=}"
- _mutt -f "$MAILDIRS/${subcommand}"
- exitcode=0
- }
else
-
- # just open mutt on first unread folder
- _mutt -Z
+ # just open; mutt on first unread folder
+ open_folder
exitcode=$?
fi
diff --git a/src/mutt/formats b/src/mutt/formats
index 94878c1..34b0be1 100644
--- a/src/mutt/formats
+++ b/src/mutt/formats
@@ -12,7 +12,8 @@ set folder_format="%N %3C %d %2l (%5s) %f"
set message_format="From: <%a>, Sub: %s"
-set index_format="%?M?_%M_ ?%Z %2C %.13d (%-$FCOL.${FCOL}F) %-$SCOL.${SCOL}s %?M?_%M_&(%c/%l?"
+# set index_format="%?M?_%M_ ?%Z %2C %.13d (%-$FCOL.${FCOL}F) %-$SCOL.${SCOL}s %?M?_%M_&(%c/%l?"
+set index_format="%2C %Z %?GI?%GI& ? %[%d/%b] %-16.16F (%4c) %?M?(%3M)& ? %s %>"
set pager_format="%Z %C/%m %d (%F) %s (%c/%l) %|-"
diff --git a/src/zlibs/email b/src/zlibs/email
index ad0bcd2..d8a9375 100755
--- a/src/zlibs/email
+++ b/src/zlibs/email
@@ -574,6 +574,23 @@ set imap_pass = "${password}"
# set imap_peek = yes
EOF
unset password
+
+ # when peeking and using mutt-kz use the sidebar
+ is_mutt_kz && {
+ cat <<EOF > "$MAILDIRS/.mutt/notmuch"
+set sidebar_width = 25
+set sidebar_visible = yes
+
+color sidebar_new white default
+color progress default magenta
+
+bind index p sidebar-prev
+bind index n sidebar-next
+bind index <space> sidebar-open
+bind index S sidebar-toggle
+EOF
+ }
+
# when peeking don't mark unread messages as Old
# and sort date received with no threading (latest up)
# also set the spoolfile name to INBOX (imap's default)
@@ -590,7 +607,7 @@ EOF
sched +3 "
rm -f $MAILDIRS/.mutt/muttpass
touch $MAILDIRS/.mutt/muttpass
-${=rm} -f $tmp" # zero the tmp passfile after a second
+${=rm} -f $_pass_tmp" # zero the tmp passfile after a second
_mutt -f ${iproto}://${ilogin}@${imap}:${imap_port}/${folder}
diff --git a/src/zlibs/filters b/src/zlibs/filters
index 4ea70f7..f8b375e 100755
--- a/src/zlibs/filters
+++ b/src/zlibs/filters
@@ -537,6 +537,9 @@ source '$MAILDIRS/.mutt/muttpass'
# mailboxes in order of priority
source '$MAILDIRS/.mutt/mboxes'
+
+# extra settings for mutt-kz (notmuch enabled)
+source '$MAILDIRS/.mutt/notmuch'
EOF
@@ -599,6 +602,9 @@ EOF
# this one is empty and sources files in temp when necessary
rm -f "$MAILDIRS/.mutt/muttpass"
touch "$MAILDIRS/.mutt/muttpass"
+ rm -f "$MAILDIRS/.mutt/notmuch"
+ touch "$MAILDIRS/.mutt/notmuch"
+
# just the header, will be completed later
rm -f $MAILDIRS/.mutt/mboxes
diff --git a/src/zlibs/helpers b/src/zlibs/helpers
index 9f4079a..82a810a 100755
--- a/src/zlibs/helpers
+++ b/src/zlibs/helpers
@@ -220,25 +220,64 @@ edit_file() {
return $?
}
+is_mutt_kz() {
+ rm -f "$MAILDIRS/.mutt/notmuch"
+ touch "$MAILDIRS/.mutt/notmuch"
+ kz=`mutt -v | awk '/Configure options.*enable-notmuch/ { print $0 }'`
+ if [[ "$kz" = "" ]]; then
+ return 1
+ else
+ act "Notmuch powered mutt-kz detected, enabling extra features"
+ return 0
+ fi
+}
+
#####################
## Open a mail folder
open_folder() {
- notice "Opening folder ${PARAM[1]}"
-
- if maildircheck "${MAILDIRS}/${PARAM[1]}"; then
- _mutt -f "$MAILDIRS/${PARAM[1]}"
- exitcode=$?
-
- elif maildircheck "${PARAM[1]}"; then
- _mutt -f "${PARAM[1]}"
- exitcode=$?
+ notice "Opening folder: $*"
+ # parse if mutt-kz
+
+ is_mutt_kz && {
+ # enable mutt-kz extra functions for notmuch integration
+
+ cat <<EOF > "$MAILDIRS/.mutt/notmuch"
+set sidebar_width = 25
+set sidebar_visible = yes
+
+color sidebar_new white default
+color progress default magenta
+
+bind index p sidebar-prev
+bind index n sidebar-next
+bind index <space> sidebar-open
+bind index S sidebar-toggle
+
+bind index / vfolder-from-query
+bind pager / vfolder-from-query
+
+set index_format="%2C %Z %?GI?%GI& ? %[%d/%b] %-16.16F (%4c) %?M?(%3M)& ? %s %>"
+# for tags at end of index add %?g?%g?
+set virtual_spoolfile = yes
+virtual-mailboxes \
+"INBOX" "notmuch://?query=tag:inbox" \
+" Today" "notmuch://?query= date:1d.. and tag:inbox" \
+" Last week" "notmuch://?query= date:1w.. and tag:inbox" \
+" Last month" "notmuch://?query=date:1M.. and tag:inbox" \
+\
+"ATTACHMENTS" "notmuch://?query=attachment:* and tag:inbox" \
+" Today" "notmuch://?query=attachment:* and date:1d.. and tag:inbox" \
+" Last week" "notmuch://?query=attachment:* and date:1w.. and tag:inbox" \
+" Last month" "notmuch://?query=attachment:* and date:1M.. and tag:inbox"
+EOF
+ }
+ if [[ "$1" = "" ]]; then
+ _mutt -Z
else
- error "No maildir found: ${PARAM[1]}"
- exitcode=1
-
+ _mutt -f "$1"
fi
- return $exitcode
+ return $?
}
##############
diff --git a/src/zlibs/maildirs b/src/zlibs/maildirs
index ffc305e..9f48d13 100755
--- a/src/zlibs/maildirs
+++ b/src/zlibs/maildirs
@@ -29,7 +29,7 @@ typeset -h formail_cache
# no in all other cases
maildircheck() {
{ test -r "$1" } || {
- error "Maildir not existing: $1"
+ func "Maildir not existing: $1"
return 1 }
{ test -w "$1" } || {
error "Directory not writable: $1"
diff --git a/src/zlibs/stats b/src/zlibs/stats
index d8e8109..6b4accb 100755
--- a/src/zlibs/stats
+++ b/src/zlibs/stats
@@ -67,10 +67,10 @@ stats() {
folder*)
_folder=""
-
+
for i in `cat`; do
_folder=${i[(ws:/:)-3]}
-
+
# find maildir prefixes
# pfx="${_folder[(ws:.:)1]}"
# is it a new prefix?
@@ -81,7 +81,8 @@ stats() {
;;
*)
- error "Stats type not specified"
+ error "Stats type not specified, available:"
+ error "domain, email, name, folder"
return 1
;;
esac
@@ -104,7 +105,7 @@ stats() {
print " $v\t$sbar $k"
done
notice "Total: ${#count}"
-
+
return 0
}
@@ -206,7 +207,7 @@ EOF
cat <<EOF >> $table
</tbody>
-</table>
+</table>
EOF
cp $WORKDIR/.stats/visualize/header.html \
$WORKDIR/.stats/index.html
@@ -230,7 +231,7 @@ EOF
{ test $? != 0 } && {
error "Error creating temporary timecloud database."
return 1 }
-
+
for m in ${maildirs}; do
for f in `${=find} $MAILDIRS/${m} -type f`; do
timestamp=`fetchdate ${f} "%Y-%m-%d"`