[ -d "${CACHE}" ] || mkdir -p "${CACHE}"
CMD=$1
shift
- ARGS=`echo $@ | sed 's/\\$/\\\\$/g'`
+ # we need to a little sanitizing of msg ids so the shell
+ # doesn't mangle them
+ ARGS=`echo $@ | sed 's/[\\$\\*\\!]/\\\&/g'`
$SSH_BIN $USER@$SSH_HOST $NOTMUCH_REMOTE_BIN ${CMD} ${ARGS}
}
notmuch_search ()
{
- #COUNTER=1
notmuch_run search $@ |
while read line; do
- sleep 0.02
- #[ $((COUNTER % 3)) == "0" ] && sleep 0.03
- echo "${line}"
- #COUNTER=$((COUNTER + 1))
+ sleep 0.02
+ echo "${line}"
done
}
notmuch_show ()
{
if [ ${1} = "--format=raw" ]; then
- hashed=`hash_name ${2}`
- check_for_file_name ${hashed} ||
- notmuch_run show --format=raw ${2} > "${CACHE}/${hashed}"
- cat "${CACHE}/${hashed}"
+ hashed=`hash_name ${2}`
+ check_for_file_name ${hashed} ||
+ notmuch_run show --format=raw ${2} > "${CACHE}/${hashed}"
+ cat "${CACHE}/${hashed}"
else
- notmuch_run show $@
+ notmuch_run show $@
fi
}