Skip to content

Commit 45e93d6

Browse files
authored
Merge pull request #128 from rsanjuan87/sms_conversation
Added support to get conversation list mode and messages from a numbe…
2 parents de0d968 + 9357388 commit 45e93d6

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

scripts/termux-sms-list

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,29 @@ set -u
33

44
PARAM_LIMIT=10
55
PARAM_OFFSET=0
6-
PARAM_TYPE=inbox
6+
PARAM_TYPE=all
7+
PARAM_NUMBER=""
78
PARAMS=""
89

910
SCRIPTNAME=termux-sms-list
1011

1112
SUPPORTED_TYPES="all|inbox|sent|draft|outbox"
1213
show_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
2529
do
2630
case "$option" in
2731
h) show_usage;;
@@ -30,6 +34,8 @@ do
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
3541
done
@@ -46,5 +52,5 @@ case "$PARAM_TYPE" in
4652
*) echo "$SCRIPTNAME: Unsupported type '$PARAM_TYPE'. Use one of: $SUPPORTED_TYPES"; exit 1 ;;
4753
esac
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

Comments
 (0)