File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -592,21 +592,30 @@ subscribe() {
592592 | send_stanza_iq set
593593}
594594
595- # unsubscribe <node> < jid>
595+ # unsubscribe <node> [ jid [subid]]
596596unsubscribe () {
597597 local node=$1
598- local jid=$( qualify_jid $2 )
598+ local jid=$( qualify_jid ${2-$xmpp_user } )
599+ local subid=$3
599600
600601 # check args
601- if (( $# < 2 )) || [[ " $1 " =~ --help ]] || [[ " $1 " =~ -h ]]; then
602- echo " Usage: unsubscribe <node> < jid> "
603- echo " Unsubscribe \" jid\" from the pubsub \" node\" "
602+ if (( $# < 1 )) || [[ " $1 " =~ --help ]] || [[ " $1 " =~ -h ]]; then
603+ echo " Usage: unsubscribe <node> [ jid [subid]] "
604+ echo " Unsubscribe \" jid\" from the pubsub \" node\" with optional \" subid \" "
604605 return 0
605606 fi
606607
607- echo " <unsubscribe node='$node ' jid='$jid '/>" \
608+ if [ -n " $subid " ]; then
609+ eof \
610+ | stanza unsubscribe " node=$node " " jid=$jid " " subid=$subid " \
608611 | stanza_pubsub \
609612 | send_stanza_iq set
613+ else
614+ eof \
615+ | stanza unsubscribe " node=$node " " jid=$jid " \
616+ | stanza_pubsub \
617+ | send_stanza_iq set
618+ fi
610619}
611620
612621# get_nodes
You can’t perform that action at this time.
0 commit comments