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

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

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

@ -34,8 +34,8 @@ fi
} }
@test "send/receive message: using stdin" { @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") & (sleep 10; echo 'test123: ~!@#$' | xmppipe -r user1 -u "$XMPPIPE_TEST_USERNAME" -p "$XMPPIPE_TEST_PASSWORD" xmppipe-test-1) &
xmppipe -o xmppipe-test-1 -s | egrep "^m:groupchat:[^/]+/user1:[^:]+:test123%3A%20~%21@%23%24%0A" xmppipe -s xmppipe-test-1 | egrep "^m:groupchat:[^/]+/user1:[^:]+:test123%3A%20~%21@%23%24%0A"
} }
@test "send/receive message: using script" { @test "send/receive message: using script" {
@ -46,10 +46,10 @@ fi
-u "$XMPPIPE_TEST_USERNAME" \ -u "$XMPPIPE_TEST_USERNAME" \
-p "$XMPPIPE_TEST_PASSWORD" \ -p "$XMPPIPE_TEST_PASSWORD" \
'test123: &(*)_+' & '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" { @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") & (sleep 10; echo 'test123: ~!@#$' | xmppipe -x -r user1 -u "$XMPPIPE_TEST_USERNAME" -p "$XMPPIPE_TEST_PASSWORD" xmppipe-test-1) &
xmppipe -x -o xmppipe-test-1 -s | egrep "^m:groupchat:[^/]+/user1:[^:]+:test123%3A%20~%21@%23%24%0A" 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)) shift $((OPTIND-1))
wait_presence "$TO" "$@" > $TMPDIR/stdin & 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