plumber

Plumber – a modern approach to plumbing
git clone git://r-36.net/plumber
Log | Files | Refs | README | LICENSE

rpopener (590B)


      1 #!/bin/sh
      2 
      3 rpcmd="rpview"
      4 if [ $# -gt 0 ];
      5 then
      6 	if [ "$1" = "-o" ];
      7 	then
      8 		rpcmd="rpopen"
      9 		shift 1
     10 	fi
     11 fi
     12 
     13 if [ $# -lt 1 ];
     14 then
     15 	printf "usage: [-o] %s URI\n" "$(basename "$0")" >&2
     16 	exit 1
     17 fi
     18 
     19 uri="$1"
     20 account="$(printf "%s\n" "$1" | cut -d'/' -f 2)"
     21 if [ -z "${account}" ];
     22 then
     23 	account="default"
     24 fi
     25 
     26 mailbox="$(printf "%s\n" "$1" | cut -d'/' -f 3)"
     27 ids="$(printf "%s\n" "$1" | cut -d '/' -f 4 | sed 's,%20, ,g')"
     28 
     29 if [ "${rpcmd}" = "rpopen" ];
     30 then
     31 	rpopen -c "${account}" -m "${mailbox}" "${ids}"
     32 else
     33 	$XTERM -e sh -c "${rpcmd} -c \"${account}\" -m \"${mailbox}\" \"${ids}\""
     34 fi
     35