2
0
mirror of https://github.com/msantos/xmppipe synced 2024-11-19 21:25:35 +00:00
Commit Graph

66 Commits

Author SHA1 Message Date
Michael Santos
4997f4be2c 0.14.0 2020-07-01 08:04:31 -04:00
Michael Santos
45e96e6ea9 s/XMPPIPE_RESTRICT/RESTRICT/gi 2019-12-21 08:44:53 -05:00
Michael Santos
7dda5bafcd sandbox->restrict_process 2019-12-20 10:51:27 -05:00
Michael Santos
abfa336640 xmppipe_uuid_gen: xmpp_uuid_gen NULL check wrapper 2019-07-17 10:23:23 -04:00
Michael Santos
ad1bf58c55 xmppipe_send: move internal functions 2019-07-16 08:55:37 -04:00
Michael Santos
31d6a03bfc XEP-0363: HTTP File Upload
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>"?
2019-07-15 10:15:01 -04:00
Michael Santos
5f2c3003ff v0.13.0
Update usage with --format option.
2019-07-04 10:10:40 -04:00
Michael Santos
2a75c3373a Always display chat markers
Remove the option to explicitly enable/disable chat markers.
2019-07-02 08:13:39 -04:00
Michael Santos
c8774e591c strtonum: fix prototype warning 2019-06-26 10:14:26 -04:00
Michael Santos
396188ea87 xmppipe.h: fix prototype 2019-06-24 10:36:20 -04:00
Michael Santos
287bb92aee vesion: free allocated stanzas 2019-06-18 10:10:16 -04:00
Michael Santos
1bb03b563e xmppipe_send_message: fix memory leak
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.
2019-06-17 10:19:36 -04:00
Michael Santos
8792a8a05c Mark fun as static 2019-05-30 12:10:58 -04:00
Michael Santos
e00a7fddd2 Consistently format using clang-format 2019-05-19 07:15:11 -04:00
Michael Santos
b3991577aa reorg: event_loop: move to separate file 2019-04-29 10:14:27 -04:00
Michael Santos
a8cc5b730a Remove unused function declaration 2019-04-17 08:11:04 -04:00
Michael Santos
4081ab67cb reorg: muc_unlock 2019-04-05 09:47:57 -04:00
Michael Santos
5165f8a1a4 reorg: muc_subject 2019-04-04 10:26:23 -04:00
Michael Santos
9d6b58ba26 reorg: muc: join 2019-02-06 10:43:16 -05:00
Michael Santos
6731de9a13 reorg: ping 2019-02-05 12:23:28 -05:00
Michael Santos
0ba9e92eda reorg: stream management: ack 2019-02-03 09:21:15 -05:00
Michael Santos
ee0f59516b reorg: stream_close: move to util for now 2019-02-02 11:01:22 -05:00
Michael Santos
862ab6d313 reorg: stream management: request 2019-02-01 10:01:03 -05:00
Michael Santos
5cb7647e75 reorg: stream management: check if enabled 2019-01-31 10:35:54 -05:00
Michael Santos
c5f0f7b662 reorg: presence error handler 2019-01-30 09:56:25 -05:00
Michael Santos
0b22ad4302 reorg: presence handler 2019-01-29 09:56:45 -05:00
Michael Santos
8b1374a25a reorg: move next_state to util 2019-01-28 10:25:04 -05:00
Michael Santos
d150e63735 reorg: null handler 2019-01-27 08:38:21 -05:00
Michael Santos
b3468de16f reorg: ping handler 2019-01-26 08:47:55 -05:00
Michael Santos
9a98b8b9bf reorg: version handler 2019-01-25 10:28:00 -05:00
Michael Santos
895ad40ee2 reorg: xmppipe_send* 2019-01-23 10:37:20 -05:00
Michael Santos
a365e18b59 reorg: message: organize by handler 2019-01-21 11:45:29 -05:00
Michael Santos
026890d377 Add experimental support for chat markers
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.
2019-01-02 10:29:32 -05:00
Michael Santos
a2d16c90c1 format: rename options
stdin -> text, colon -> csv
2018-12-13 10:22:20 -05:00
Michael Santos
91173ecc00 xmppipe_fmt -> xmppipe_fmt_encode 2018-08-18 08:31:06 -04:00
Michael Santos
9598e01579 format: use empty element to set default values
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
~~~
2018-08-17 10:22:33 -04:00
Michael Santos
231bee7c74 -f/--format: support percent decoding
Convert percent hexcodes when format mode is enabled:

    m:chat:to@example.com:from@example.com:01234=%30%31%32%33%34
2018-08-16 09:54:54 -04:00
Michael Santos
22afb52f83 --format/-f: formatted input
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
2018-08-13 10:04:46 -04:00
Michael Santos
ba2d49e4bd 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.
2018-07-22 10:00:41 -04:00
Michael Santos
3f7ef5ca7b debug: print state names 2018-05-23 10:05:19 -04:00
Michael Santos
97fa38c86a Support one-to-one chats
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
2018-04-27 11:15:07 -04:00
Michael Santos
3797fc4151 macosx: fix compile errors 2018-04-13 07:32:46 -04:00
Michael Santos
2d67d64ecb Bump version to 0.9.3 2017-12-06 08:03:22 -05:00
Michael Santos
60895c46e4 README: use long options, bump version
Bump version for sandbox compilation changes.
2017-09-05 09:54:06 -04:00
Michael Santos
c184ce68b2 Depend on libstrophe 0.9.2+
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.
2017-07-03 09:45:01 -04:00
Dmitry Podgorny
ef78dc7deb Replace libuuid with xmpp_uuid_gen()
xmpp_uuid_gen() appeared in libstrophe-0.9.0 and solves issues with
libuuid across different systems.
2017-06-28 00:47:56 +03:00
Michael Santos
41a6897bc1 Use native strtonum(3) on BSDs 2017-05-18 09:55:45 -04:00
Michael Santos
20f8b5904c Increment version for pre-connect sandbox 2017-04-19 10:22:16 -04:00
Michael Santos
c17b196053 sandbox: add a pre-connect sandbox
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.
2017-04-10 11:25:01 -04:00
Michael Santos
9a87cd4e1b openbsd: fix compile error 2017-04-09 08:16:11 -04:00