Add initial support for XEP-0363. HTTP uploads can be used when colon
separated values for stdin is enabled:
~~~
u::::<filename>|<size (bytes)>[|<content-type>]
u::::example.png%7C16698
u::::tr.png%7C16698%7Cimage%2Fpng
~~~
The reponse:
~~~
U:upload.example.com:user@example.com/477937350262208314215778:https%3A%2F%2Fexample.com%2Fupload%2F1234%2Fabc%2Fexample.png%7Chttps%3A%2F%2Fexample.com%2Fupload%2F1234%2Fabc%2Fexample.png
~~~
TODO:
* support PUT header elements
* support/test error conditions
Questions:
* save the maximum file size returned by the server and disallow uploads
larger than the value?
* xmppipe is "pinned" to the upload server returned in the IQ reply (the
"to" field is ignored)
* allow other upload servers?
* error if different upload server is specified in "u:<from>:<to>"?
Correct the type for the flag argument from int to long. Note the
compiler will still complain because, although xmpp_conn_set_flags() is
declared to take a signed long, the constants are declared as unsigned
longs:
src/xmppipe.c: In function ‘main’:
src/xmppipe.c:205:13: warning: conversion to ‘long unsigned int’ from
‘long int’ may change the sign of the result [-Wsign-conversion]
flags |= XMPP_CONN_FLAG_TRUST_TLS;
^
src/xmppipe.c:205:16: warning: conversion to ‘long int’ from ‘long
unsigned int’ may change the sign of the result [-Wsign-conversion]
flags |= XMPP_CONN_FLAG_TRUST_TLS;
Support chat marker (XEP-0333) stanzas when the "--chat-marker" switch
is provided on the command line. A chat marker is prefixed by 'M':
~~~
M:groupchat:test@conference.example.com/msantos:me@example.com/162315501161646113068402:
~~~
The idea is to allow scripts to react based on whether a message has
been read, for example, escalating via other channels.
strcmp(3) segfaulted when comparing the from address to NULL.
Checking messages originated from the output account only makes sense
with groupchat. Remove the check for type of "chat".
An empty string in the type, to and from uses a default value. For
example to send a message to the groupchat specified on the command
line:
~~~
m::::this is a test message
~~~
Rough implementation to allow input to be formatted as colon separated
values in the same way as output:
* percent decoding of the input is not supported yet
* only message stanzas supported
Using formatted input lets the script respond to other users aside from
the default channel assigned to stdout:
~~~
m:chat:to@example.com:from@example.com:message-body
~~~
TODO:
* does the default stdout channel always need to be formatted?
~~~
m:chat:to@example.com:from@example.com:message-body
m:groupchat:default@conference.example.com:from@example.com:message-body
~~~
Otherwise it could be ambiguous.
* support presence and iq stanzas
For example, a bot could respond to groupchat invitations.
* percent decoding: require the input to be percent encoded
Support binary and multiline data.
* format naming: choose better names for the format types
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.