2
0
mirror of https://github.com/msantos/xmppipe synced 2024-11-16 00:12:59 +00:00
Commit Graph

110 Commits

Author SHA1 Message Date
Michael Santos
91a43f2433 -V/--version: display version information 2020-07-04 07:19:16 -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
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
a45b734211 options: remove --chat-marker 2019-07-03 07:54:19 -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
5e488e059a xmpp_conn_set_flags() argument is a long
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;
2019-06-29 11:07:59 -04:00
Michael Santos
8776afe0f5 Suppress conversion warnings 2019-06-28 10:04:53 -04:00
Michael Santos
42e0ce4a67 xmppipe: free child stanzas 2019-06-22 08:08:47 -04:00
Michael Santos
e00a7fddd2 Consistently format using clang-format 2019-05-19 07:15:11 -04:00
Michael Santos
4b85976242 --keepalives -> --keepalive 2019-05-07 08:13:47 -04:00
Michael Santos
7793b0ac07 Fix pasto in -k/--keepalive 2019-05-06 10:13:30 -04:00
Michael Santos
b3991577aa reorg: event_loop: move to separate file 2019-04-29 10:14:27 -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
990874ef2e Add support for printing groupchat subject 2019-01-10 11:26:21 -05:00
Michael Santos
4e660c641a --keepalive-failures: check minimum using strtonum() 2019-01-05 10:04:48 -05:00
Michael Santos
b38d4b9e0c handle_message: use xmpp_free() 2019-01-03 10:06:19 -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
501ada87ff chat: set default user to self 2018-12-31 08:05:51 -05:00
Michael Santos
a10b4bd84c chat: fix segfault when checking origin
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".
2018-12-29 08:34:27 -05:00
Michael Santos
0a776e3441 Fix warning
src/xmppipe.c:69:19: warning: duplicate ‘const’ declaration specifier
[-Wduplicate-decl-specifier]
 static const char const *xmppipe_states[] = {
                   ^~~~~
2018-12-14 09:03:52 -05:00
Michael Santos
a2d16c90c1 format: rename options
stdin -> text, colon -> csv
2018-12-13 10:22:20 -05:00
Michael Santos
df6a7ee596 format: use separate function 2018-12-09 08:33:42 -05:00
Michael Santos
ab6d1b3f79 format: clean up input parsing 2018-12-08 09:43:32 -05:00
Michael Santos
4d1423eb5e <Remove unused verbose log
Statement will never be called since verbose mode is set afterwards.
2018-12-03 10:05:50 -05:00
Michael Santos
06f50d4b11 Fix "-x/--base64" option 2018-09-19 10:08:28 -04: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
5127b271ba -f/--format: fix arguments 2018-08-14 08:40:20 -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
25dbece040 chat: fix segfault when domain is not provided
Running xmppipe in chat mode without a full jid:

    xmppipe --chat --output foo

Caused a segfault when a NULL domain was passed to
xmpp_stanza_set_attribute(). The libstrophe functions do not check for
NULL and so crash calling strlen(NULL).

Set the jid's domain from the user's username. If the user's jid is
user@example.com:

    # expanded to foo@example.com
    xmppipe --chat --output foo
2018-07-16 10:11:47 -04:00