/usr/share/konversation/scripts/mail is in konversation-data 1.7.4-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #!/bin/bash
#
# Licensed under GPL v2 or later at your option
# Copyright 2005 by John Tapsell <john.tapsell@kdemail.net>
SERVER=$1;
TARGET=$2;
FOLDER=$3;
if [ "$FOLDER" = "" ] ; then
FOLDER="inbox"
fi
getmails()
{
qdbus org.kde.kmail > /dev/null || {
qdbus org.kde.konversation /irc info "Sorry kmail is not running"
exit
}
for f in $(qdbus org.kde.kmail /KMail folderList) ; do
qdbus org.kde.kmail /KMail getFolder $f > /dev/null
MAILFOLDER=$(qdbus org.kde.kmail /Folder "displayPath" | grep -i $FOLDER)
if [ "$MAILFOLDER" != "" ] ; then
FOUNDFOLDER=1
MAILCOUNT=$(qdbus org.kde.kmail /Folder unreadMessages )
MAILTOTALCOUNT=$(qdbus org.kde.kmail /Folder messages )
MAILTOTALCOUNT=$(($MAILCOUNT + $MAILTOTALCOUNT))
if [[ -z "$MAILCOUNT" ]] ; then MAILCOUNT = "0" ; fi
if [ "$MAILCOUNT" != 0 ] ; then
FOUNDEMAIL=1
echo "Email folder %B$MAILFOLDER%B has %B$MAILCOUNT%B unread messages, out of %B$MAILTOTALCOUNT%B"
fi
fi
done
if [[ -z "$FOUNDEMAIL" ]] ; then
if [[ -z "$FOUNDFOLDER" ]] ; then
qdbus org.kde.konversation /irc info "No email folders were found that had a name containing '$FOLDER'"
exit
else
echo "No new emails in any folders matching '$FOLDER'"
fi
fi
}
if [[ -z "$2" ]] ; then
echo "Scripts are not meant to be called from the command line."
echo "This script should be installed to $KDEDIR/share/apps/konversation/scripts"
echo "Then executed with /exec mail from the konversation"
echo
echo The output is:
getmails
exit
fi
#LINECOUNT=$(getmails | wc -l)
#if [[ "$LINECOUNT" -gt 5 ]] ; then
# dcop $PORT default info "There are more than 5 matches. Cancelling to avoid flooding the server"
# exit
#fi
getmails | head -n 3 | while read line; do qdbus org.kde.konversation /irc say $SERVER "$TARGET" "$line"; done
|