33
44PARAM_LIMIT=10
55PARAM_OFFSET=0
6- PARAM_TYPE=inbox
6+ PARAM_TYPE=all
7+ PARAM_NUMBER=" "
78PARAMS=" "
89
910SCRIPTNAME=termux-sms-list
1011
1112SUPPORTED_TYPES=" all|inbox|sent|draft|outbox"
1213show_usage () {
13- echo " Usage: $SCRIPTNAME [-d] [-l limit] [-n] [-o offset] [-t type]"
14+ echo " Usage: $SCRIPTNAME [-d] [-l limit] [-n] [-o offset] [-t type] [-c] [-f number] "
1415 echo " List SMS messages."
15- echo " -d show dates when messages were created"
1616 echo " -l limit offset in sms list (default: $PARAM_LIMIT )"
17- echo " -n show phone numbers"
1817 echo " -o offset offset in sms list (default: $PARAM_OFFSET )"
1918 echo " -t type the type of messages to list (default: $PARAM_TYPE ):"
2019 echo " $SUPPORTED_TYPES "
20+ echo " -c conversation list (unique item per conversation)"
21+ echo " -f number the number for locate messages"
22+
23+ echo " -n (obsolete) show phone numbers"
24+ echo " -d (obsolete) show dates when messages were created"
2125 exit 0
2226}
2327
24- while getopts :hdl:t:no : option
28+ while getopts :hdl:tf:cno : option
2529do
2630 case " $option " in
2731 h) show_usage;;
3034 n) PARAMS=" $PARAMS --ez show-phone-numbers true" ;;
3135 o) PARAM_OFFSET=$OPTARG ;;
3236 t) PARAM_TYPE=$OPTARG ;;
37+ c) PARAMS=" $PARAMS --ez conversation-list true" ;;
38+ f) PARAM_NUMBER=" --es from $OPTARG " ;;
3339 ? ) echo " $SCRIPTNAME : illegal option -$OPTARG " ; exit 1;
3440 esac
3541done
@@ -46,5 +52,5 @@ case "$PARAM_TYPE" in
4652 * ) echo " $SCRIPTNAME : Unsupported type '$PARAM_TYPE '. Use one of: $SUPPORTED_TYPES " ; exit 1 ;;
4753esac
4854
49- PARAMS=" $PARAMS --ei offset $PARAM_OFFSET --ei limit $PARAM_LIMIT --ei type $PARAM_TYPE "
55+ PARAMS=" $PARAMS --ei offset $PARAM_OFFSET --ei limit $PARAM_LIMIT --ei type $PARAM_TYPE $PARAM_NUMBER "
5056@TERMUX_PREFIX@/libexec/termux-api SmsInbox $PARAMS
0 commit comments