Commit Graph

168 Commits (d6dcc88bc6a191700e90fee4ee3d0d811214e1eb)
 

Author SHA1 Message Date
Michael Santos d6dcc88bc6 tests: allow time for xmppipe login 5 years ago
Michael Santos a365e18b59 reorg: message: organize by handler 5 years ago
Michael Santos 561fc9cbc3 xmppipe_roomname: clean up 6 years ago
Michael Santos 990874ef2e Add support for printing groupchat subject 6 years ago
Michael Santos f5291fe321 makefile: fix static builds 6 years ago
Michael Santos 4e660c641a --keepalive-failures: check minimum using strtonum() 6 years ago
Michael Santos b38d4b9e0c handle_message: use xmpp_free() 6 years ago
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.
6 years ago
Michael Santos 501ada87ff chat: set default user to self 6 years ago
Michael Santos 1e59f50dc6 Enable PIE 6 years ago
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".
6 years ago
Michael Santos dbbf6e5f5e seccomp: update for Ubuntu 18.04
Add new syscalls (getrandom).

The resolver now uses openat(2) and sendmsg(2).
6 years ago
Michael Santos 0a776e3441 Fix warning
src/xmppipe.c:69:19: warning: duplicate ‘const’ declaration specifier
[-Wduplicate-decl-specifier]
 static const char const *xmppipe_states[] = {
                   ^~~~~
6 years ago
Michael Santos a2d16c90c1 format: rename options
stdin -> text, colon -> csv
6 years ago
Michael Santos df6a7ee596 format: use separate function 6 years ago
Michael Santos ab6d1b3f79 format: clean up input parsing 6 years ago
Michael Santos 4d1423eb5e <Remove unused verbose log
Statement will never be called since verbose mode is set afterwards.
6 years ago
Michael Santos 06f50d4b11 Fix "-x/--base64" option 6 years ago
Michael Santos ff3249c391 Revert "capsicum: allow terminal events"
This reverts commit 7090ef09fb.

fstat/ioctl are checking whether the program is attached to tty for
setting buffering. Since xmppipe explicitly enables line buffering, the
capsicum sandbox can ignore these tests.
6 years ago
Michael Santos 7090ef09fb capsicum: allow terminal events 6 years ago
Michael Santos 91173ecc00 xmppipe_fmt -> xmppipe_fmt_encode 6 years ago
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
~~~
6 years ago
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
6 years ago
Michael Santos 5127b271ba -f/--format: fix arguments 6 years ago
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
6 years ago
Michael Santos 4fac27e382 README: update message types 6 years ago
Michael Santos dff8b8f72e sandbox/seccomp: return value from prctl(2) 6 years ago
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.
6 years ago
Michael Santos 846f87c6bd scripts: rename variables 6 years ago
Michael Santos c7eb9a1d71 Check for NULL before calling libstrophe 6 years ago
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
6 years ago
Michael Santos 29280e2edc Document --chat option
Document usage of one to one chat:

    xmppipe --chat --output me@example.com

Only provide the long option until a few quirks have been worked out:

* if only a username is provided, it will be expanded to a conference
  name

    # expands to me@conference.example.com
    xmppipe --chat --output me

* should "normal" and "headline" message types also be supported?

* tests
6 years ago
Michael Santos 871569e3b5 README: cleanup 6 years ago
Michael Santos ba02827064 README: example of sending notifications 6 years ago
Michael Santos 3f7ef5ca7b debug: print state names 6 years ago
Michael Santos de9fa9ab30 Fixes for ejabberd 18.04
* always add id in iq stanzas.

* presence: response from muc may contain more than one 'x' element,
  match stanza by namespace

* debug: print out current state
6 years ago
Michael Santos 169c6dd69e README: example of notifications 6 years ago
Michael Santos 47102efc69 Set line buffered mode 6 years ago
Michael Santos 0984bc763b examples: script clean up 6 years ago
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
6 years ago
Michael Santos 4a8d1f910f xmppipe_conn_fd: get highest open fd 6 years ago
Michael Santos 3797fc4151 macosx: fix compile errors 6 years ago
Michael Santos 38cd570d28 seccomp: allow restart_syscall in stdin sandbox 6 years ago
Michael Santos cc828f582f seccomp: allow restart_syscall 6 years ago
Michael Santos 9ae3dcc1a1 seccomp: raspbian: allow futex(2), sysinfo(2) 6 years ago
Michael Santos da9d2f8e88 makefile: pass custom LDFLAGS to static build 7 years ago
Michael Santos 2d67d64ecb Bump version to 0.9.3 7 years ago
Michael Santos 77c76d6626 makefile: enable full relro 7 years ago
Michael Santos f0e7ef7c4c Use -fstack-protector-strong 7 years ago
Michael Santos 2933964bca capscicum: return result of setlrimit() 7 years ago