#############
# ezmlm-get #
#############

prompt "ezmlm-get (thread):   "

qqclean
SENDER="${BNC}@$HOST"
LOCAL="$LIST-index"
DEFAULT='index'
echo "X-num: thread1" > "$TMP"
LOCAL="$LIST-thread.1"
DEFAULT='thread.1'
${EZBIN}/ezmlm-get -s "$DIR" < "$TMP" >/dev/null 2>&1 && \
	fatal "-s failed to reject -thread from non-sub"
msgexists && \
	fatal "-s failed to reject -thread from non-sub"

qqclean
${EZBIN}/ezmlm-get "$DIR" < "$TMP" >/dev/null 2>&1
if [ "$?" != "99" ]; then
	fatal "failed to exit 99 after -thread"
fi
msgexists || \
	fatal "failed to produce -thread message"
checkenv thread1 "$LIST-return-@$HOST" "$SENDER"

qqclean
echo "X-num: thread2" > "$TMP"
SENDER="${DIG}@$HOST"
${EZBIN}/ezmlm-get -s "$DIR" < "$TMP" >/dev/null 2>&1
if [ "$?" != "99" ]; then
	fatal "-s failed to exit 99 after -thread"
fi
msgexists || \
	fatal "-s failed to produce -thread message"
checkenv thread2 "$LIST-return-@$HOST" "$SENDER"

echo "OK"
