Removed lame scripts.
[scripts.git] / gma.sh
diff --git a/gma.sh b/gma.sh
deleted file mode 100755 (executable)
index d914893..0000000
--- a/gma.sh
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/bin/bash
-
-#########################################################################
-# This program is free software: you can redistribute it and/or modify  #
-# it under the terms of the version 3 of the GNU General Public License #
-# 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, see <http://www.gnu.org/licenses/>.  #
-#                                                                       #
-# Written by and Copyright (C) Francois Fleuret                         #
-# Contact <francois.fleuret@idiap.ch> for comments & bug reports        #
-#########################################################################
-
-set -e
-
-function usage () {
-    echo "gma.sh [--body] [--nospam] [--subject|--from|--to|--fromto|--sender] <pattern> [<year>]"
-}
-
-RESULT_MBOX="/tmp/gma"
-KEEP_SPAM=1
-
-if [[ -z "${MAIL_ARCHIVE_DIR}" ]]; then
-    echo "Undefined \$MAIL_ARCHIVE_DIR" >&2
-    exit 1
-fi
-
-if [[ $(which ionice) ]]; then
-    IONICE="ionice -c3"
-else
-    IONICE=""
-fi
-
-HEADER_ONLY="-H"
-
-while [[ $1 ]]; do
-
-    case $1 in
-
-        "--help"|"-h")
-            usage
-            exit 0
-            ;;
-
-        "--body")
-            HEADER_ONLY=""
-            ;;
-
-        "--intense")
-            IONICE=""
-            ;;
-
-        "--nospam")
-            KEEP_SPAM=0
-            ;;
-
-        "--from")
-            RE_PREFIX="^From:.*"
-            ;;
-
-        "--to")
-            RE_PREFIX="^To:.*"
-            ;;
-
-        "--fromto")
-            RE_PREFIX="^(From|To):.*"
-            ;;
-
-        "--sender")
-            RE_PREFIX="^Sender:.*"
-            ;;
-
-        "--subject")
-            RE_PREFIX="^Subject:.*"
-            ;;
-
-        *)
-            if [[ ${PATTERN} ]]; then
-                # If we already have the pattern to match in the
-                # message, get the new argument as a pattern for the
-                # filename
-                if [[ ${FILE_PATTERN} ]]; then
-                    usage
-                    exit 1
-                else
-                    FILE_PATTERN="${MAIL_ARCHIVE_DIR}/${1}/*/*"
-                    SIZE_FILE_PATTERN="${MAIL_ARCHIVE_DIR}/${1}"
-                fi
-            else
-                PATTERN=$1
-            fi
-            ;;
-    esac
-    shift
-done
-
-if [[ -z "${PATTERN}" ]]; then
-    usage
-    exit 1
-fi
-
-[[ ${FILE_PATTERN} ]] || FILE_PATTERN="${MAIL_ARCHIVE_DIR}/*/*/*"
-[[ ${SIZE_FILE_PATTERN} ]] || SIZE_FILE_PATTERN="${MAIL_ARCHIVE_DIR}"
-
-SIZE=$(\dus ${SIZE_FILE_PATTERN} | cut -f 1 -d" ")
-
-echo "Looking for ${RE_PREFIX}${PATTERN}"
-echo "        in ${FILE_PATTERN}"
-echo "        writing result in ${RESULT_MBOX}"
-
-if [[ ${KEEP_SPAM} == "1" ]]; then
-
-    ${IONICE} cat ${FILE_PATTERN} \
-        | pv -s ${SIZE} -p -t -e - \
-        | mboxgrep ${HEADER_ONLY} -i "${RE_PREFIX}${PATTERN}" > ${RESULT_MBOX}
-
-else
-
-    ${IONICE} cat ${FILE_PATTERN} \
-        | pv -s ${SIZE} -p -t -e - \
-        | mboxgrep ${HEADER_ONLY} -i "${RE_PREFIX}${PATTERN}" \
-        | mboxgrep ${HEADER_ONLY} -v '^Subject:.*SPAM' > ${RESULT_MBOX}
-
-fi
-
-echo "Found "$(grep ^"From " ${RESULT_MBOX} | wc -l)" messages."