Commit Graph

25 Commits (548a1590f5d36294a90015da3abb11c92c7cfde2)

Author SHA1 Message Date
Michael Santos 548a1590f5 Fix function declarations without prototypes 1 year ago
Michael Santos a3a29bbba6 cleanup: move common operation to function 2 years ago
Michael Santos 2df5896df2 Set a unique default resource
The default resource is "xmppipe". A subsequent xmppipe using the default
resource connects to the groupchat will be disconnected.

* reduce the amount of configuration needed for scripts
* make the resource unique on the same host by appending the PID
2 years ago
Michael Santos f9bdddd910 0.14.1: --chat: fix use of username without domain
One to one chats with a username without a domain would echo back
messages. Use the domain from the user's JID:

```
xmppipe -u user1@example.com --chat user2
```
2 years ago
Michael Santos abfa336640 xmppipe_uuid_gen: xmpp_uuid_gen NULL check wrapper 5 years ago
Michael Santos 287bb92aee vesion: free allocated stanzas 5 years ago
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.
5 years ago
Michael Santos e00a7fddd2 Consistently format using clang-format 5 years ago
Michael Santos 17e40ad118 reorg: move stream_close with other stream ops 5 years ago
Michael Santos ee0f59516b reorg: stream_close: move to util for now 5 years ago
Michael Santos 8b1374a25a reorg: move next_state to util 5 years ago
Michael Santos 561fc9cbc3 xmppipe_roomname: clean up 5 years ago
Michael Santos ab6d1b3f79 format: clean up input parsing 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 c7eb9a1d71 Check for NULL before calling libstrophe 6 years ago
Michael Santos 899e988a6f roomname: use UID in default roomname
Use the UID of the xmppipe process instead of the PID in the default
name. This allows many processes running under the same user on a host
to share the same output channel and makes it easier to pre-create the
MUC if the xmppipe XMPP user does not have MUC creation privs.
7 years ago
Michael Santos ad56bab3cc xmppipe_roomname: use define for hostname 7 years ago
Michael Santos 5cb6364cd0 Check gethostname(2) for error
Whether gethostname(2) returns an error depends on the implementation.
Some implementations:

* truncate the hostname if length is less than the hostname, with or
  without a trailing NULL

* return -1 if length is less than hostname

* return -1 if length is 0

Set a default name if gethostanme() returns error.
7 years ago
Michael Santos 072e8542ae alloc: log sizes on error 8 years ago
Michael Santos 7d4672a99a enomem: log function name
xmppipe occasionally crashes with an "allocation failure" message. Log
the function name for debugging.
8 years ago
Michael Santos fc09ca4ff1 Be explicit with checks 9 years ago
Michael Santos 633bc390cb Test string is NULL, not first character of string 9 years ago
Michael Santos 4cbd8ec1c3 Add wrappers around libstrophe funs that may fail
Check for errors on libstrophe functions that return non-void. Some of
the funs have undocumented failure conditions (e.g.,
xmpp_stanza_copy()). Others return less than zero or enum values. To
account for future discoveries, use a wrapper instead of a macro.
9 years ago
Michael Santos de7200819d Fix memory leak on NULL 9 years ago
Michael Santos 3d79e9fda8 Forward stdin over XMPP 9 years ago