Use argument as output JID

Instead of supplying the output JID as an optional argument:

    xmppipe --output foo@conference.example.com

Use the first argument:

    xmppipe foo@conference.example.com

The -o/--output switches are still accepted.
master
Michael Santos 6 years ago
parent 846f87c6bd
commit ba2d49e4bd

@ -20,7 +20,11 @@ Usage
XMPPIPE_USERNAME=me@example.com
XMPPIPE_PASSWORD="password"
xmppipe -o muc
# default name: stdout-*hostname*-*uid*
xmpipe
xmppipe muc
xmppipe muc@example.com
Requirements
------------
@ -99,11 +103,6 @@ Options
-r, --resource *resource*
: XMPP resource, used as the nickname in the MUC
-o, --output *output*
: XMPP MUC name
Default: stdout-*hostname*-*uid*
-S, --subject *subject*
: XMPP MUC subject
@ -279,7 +278,7 @@ curl -s --get --data subscribe=true \
--data-urlencode 'query=(service ~= "^example")' \
http://example.com:80/index < /dev/null > riemann &
xmppipe --verbose --verbose \
--output "muc" --discard --subject "riemann events" < riemann
--discard --subject "riemann events" muc < riemann
~~~
### Desktop Notifications
@ -326,7 +325,7 @@ FIFO=$TMPDIR/console
mkfifo $FIFO
stty cols 80 rows 24
(cat $FIFO | xmppipe --resource user --output $MUC -x) > /dev/null 2> $TMPDIR/stderr &
(cat $FIFO | xmppipe --resource user -x $MUC) > /dev/null 2> $TMPDIR/stderr &
script -q -f $FIFO
~~~
@ -340,7 +339,7 @@ decode() {
}
stty cols 80 rows 24
xmppipe --resource viewer --output console --base64 | \
xmppipe --resource viewer --base64 console | \
while IFS=: read -r x s f t m; do
[ "$m" = "m" ] && decode "$m"
done

@ -255,6 +255,11 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
if (argc > 0) {
free(state->room);
state->room = xmppipe_strdup(argv[0]);
}
if (jid == NULL)
usage(state);
@ -1331,7 +1336,6 @@ usage(xmppipe_state_t *state)
" -u, --username <jid> XMPP username (aka JID)\n"
" -p, --password <password> XMPP password\n"
" -r, --resource <resource> resource (aka MUC nick)\n"
" -o, --output <muc> MUC room to send stdin\n"
" -S, --subject <subject> set MUC subject\n"
" -a, --address <addr:port> set XMPP server address (port is optional)\n"

@ -23,7 +23,7 @@
#include <strophe.h>
#define XMPPIPE_VERSION "0.10.0"
#define XMPPIPE_VERSION "0.11.0"
#define XMPPIPE_RESOURCE "xmppipe"
#define XMPPIPE_STREQ(a,b) (strcmp((a),(b)) == 0)

@ -34,8 +34,8 @@ fi
}
@test "send/receive message: using stdin" {
(sleep 10; echo 'test123: ~!@#$' | xmppipe -o xmppipe-test-1 -r user1 -u "$XMPPIPE_TEST_USERNAME" -p "$XMPPIPE_TEST_PASSWORD") &
xmppipe -o xmppipe-test-1 -s | egrep "^m:groupchat:[^/]+/user1:[^:]+:test123%3A%20~%21@%23%24%0A"
(sleep 10; echo 'test123: ~!@#$' | xmppipe -r user1 -u "$XMPPIPE_TEST_USERNAME" -p "$XMPPIPE_TEST_PASSWORD" xmppipe-test-1) &
xmppipe -s xmppipe-test-1 | egrep "^m:groupchat:[^/]+/user1:[^:]+:test123%3A%20~%21@%23%24%0A"
}
@test "send/receive message: using script" {
@ -46,10 +46,10 @@ fi
-u "$XMPPIPE_TEST_USERNAME" \
-p "$XMPPIPE_TEST_PASSWORD" \
'test123: &(*)_+' &
xmppipe -r user2 -o xmppipe-test-2 -s | egrep "^m:groupchat:[^/]+/user1:[^:]+:test123%3A%20%26%28%2A%29_%2B%0A"
xmppipe -r user2 -s xmppipe-test-2 | egrep "^m:groupchat:[^/]+/user1:[^:]+:test123%3A%20%26%28%2A%29_%2B%0A"
}
@test "send/receive message: base64 stdin" {
(sleep 10; echo 'test123: ~!@#$' | xmppipe -x -o xmppipe-test-1 -r user1 -u "$XMPPIPE_TEST_USERNAME" -p "$XMPPIPE_TEST_PASSWORD") &
xmppipe -x -o xmppipe-test-1 -s | egrep "^m:groupchat:[^/]+/user1:[^:]+:test123%3A%20~%21@%23%24%0A"
(sleep 10; echo 'test123: ~!@#$' | xmppipe -x -r user1 -u "$XMPPIPE_TEST_USERNAME" -p "$XMPPIPE_TEST_PASSWORD" xmppipe-test-1) &
xmppipe -x -s xmppipe-test-1 | egrep "^m:groupchat:[^/]+/user1:[^:]+:test123%3A%20~%21@%23%24%0A"
}

@ -42,4 +42,4 @@ done
shift $((OPTIND-1))
wait_presence "$TO" "$@" > $TMPDIR/stdin &
xmppipe -o $MUC -r "$FROM" -u "$XMPPIPE_USERNAME" -p "$XMPPIPE_PASSWORD" < $TMPDIR/stdin > $TMPDIR/stdout
xmppipe -r "$FROM" -u "$XMPPIPE_USERNAME" -p "$XMPPIPE_PASSWORD" "$MUC" < $TMPDIR/stdin > $TMPDIR/stdout

Loading…
Cancel
Save