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>"?
Fix a memory leak caused by improper usage of
xmpp_stanza_new()/xmpp_stanza_release() by replacing usage with the
simpler xmpp_message_new()/xmpp_message_set_body() API available in
libstrophe 0.9.0, as advised by @pasis.
Fixes https://github.com/msantos/xmppipe/issues/3.
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.
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.
Add preliminary support to one to one chats. No XEPs were read in the
preparation of this change:
xmppipe -C example@example.com
TODO
* clean up
* state change is hardcoded
* if (GROUPCHAT) branches
* autodetect MUC
* in chat mode, ctrl-D can cause a loop
libstrophe 0.9.2 supports TLS certificate verification. Tested by:
* valid certificate: verified using strace that xmppipe is reading the
system SSL cert store
* invalid certificate:
sudo chmod 700 /usr/lib/ssl
Verified xmppipe rejected the cert as invalid without the local CA
root.
* valid certificate, invalid domain
Verified a subdomain hosted on the XMPP node but not included in the
TLS certificate is rejected.
Add a sandbox enforced before options are parsed and the connection is
established to the XMPP server. This sandbox will allow network
operations.
The post-connect sandbox is unchanged and restricts operations to stdio.
The commit just adds the infrastructure for the pre-connect sandbox.