diff --git a/README.md b/README.md index e8a39b0..be64c5d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/xmppipe.c b/src/xmppipe.c index e80f474..6e5f702 100644 --- a/src/xmppipe.c +++ b/src/xmppipe.c @@ -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 XMPP username (aka JID)\n" " -p, --password XMPP password\n" " -r, --resource resource (aka MUC nick)\n" - " -o, --output MUC room to send stdin\n" " -S, --subject set MUC subject\n" " -a, --address set XMPP server address (port is optional)\n" diff --git a/src/xmppipe.h b/src/xmppipe.h index 629f4af..230500f 100644 --- a/src/xmppipe.h +++ b/src/xmppipe.h @@ -23,7 +23,7 @@ #include -#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) diff --git a/test/10-groupchat.bats b/test/10-groupchat.bats index 177d832..0616d79 100644 --- a/test/10-groupchat.bats +++ b/test/10-groupchat.bats @@ -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" } diff --git a/test/script/send-message.sh b/test/script/send-message.sh index 16a3820..d5dfc33 100755 --- a/test/script/send-message.sh +++ b/test/script/send-message.sh @@ -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