go-sendxmpp/README.md

107 lines
3.6 KiB
Markdown
Raw Normal View History

2018-08-04 10:16:28 +00:00
# go-sendxmpp
## about
A little tool to send messages to an XMPP contact or MUC inspired by [sendxmpp](https://sendxmpp.hostname.sk/).
You can find other sendxmpp alternatives in the [XSF wiki](https://wiki.xmpp.org/web/User:MDosch/Sendxmpp_incarnations).
2018-08-04 10:16:28 +00:00
2021-01-29 17:09:58 +00:00
## support
You might join the [chat](https://join.jabber.network/#go-sendxmpp@chat.mdosch.de?join) if you have problems,
want to contribute or just want to talk about the project. You might also talk about any of the other
sendxmpp incarnations. :)
2018-08-04 10:16:28 +00:00
## requirements
* [go](https://golang.org/)
## installation
If you have *[GOPATH](https://github.com/golang/go/wiki/SettingGOPATH)*
set just run this commands:
2018-08-10 10:14:21 +00:00
```plain
2020-04-23 07:11:37 +00:00
$ go get salsa.debian.org/mdosch/go-sendxmpp
$ go install salsa.debian.org/mdosch/go-sendxmpp
2018-08-04 10:16:28 +00:00
```
You will find the binary in `$GOPATH/bin` or, if set, `$GOBIN`.
## usage
2018-08-10 11:53:42 +00:00
You can either pipe a programs output to `go-sendxmpp`, write in your terminal (put \^D in a new
line to finish) or send the input from a file (`-m` or `--message`).
2018-08-04 10:16:28 +00:00
2021-03-10 08:56:41 +00:00
The account data is expected at `~/.config/go-sendxmpp/sendxmpprc` if no other configuration file location
is specified with `-f` or `--file`. The configuration file is expected to be in the following format:
2018-08-04 10:16:28 +00:00
2018-08-10 10:14:21 +00:00
```plain
username: <your_jid>
2018-08-10 10:14:21 +00:00
password: <your_jabber_password>
```
2018-08-04 10:16:28 +00:00
2021-03-03 10:39:20 +00:00
If this is not sufficient to connect you might also specify `jserver` and `port`. It is also possible to
2020-10-01 16:55:41 +00:00
use a password manager. In this case the `password` setting should be replaced by the `eval_password`
setting:
```
eval_password: <command_to_unlock_your_password>
```
If no configuration file is present or if the values should be overridden it is possible to define
the account details via command line options:
2018-08-10 10:14:21 +00:00
```plain
2020-04-10 09:21:17 +00:00
Usage: go-sendxmpp [-cdintx] [-f value] [--help] [--http-upload value] [-j value] [-m value] [-p value] [-r value] [-u value] [parameters ...]
2018-12-15 15:15:30 +00:00
-c, --chatroom Send message to a chatroom.
-d, --debug Show debugging info.
-f, --file=value Set configuration file. (Default: ~/.sendxmpprc)
--help Show help.
2020-04-10 09:21:17 +00:00
--http-upload=value
Send a file via http-upload.
-i, --interactive Interactive mode (for use with e.g. 'tail -f').
2018-08-10 10:14:21 +00:00
-j, --jserver=value
XMPP server address.
-m, --message=value
Set file including the message.
-n, --no-tls-verify
Skip verification of TLS certificates (not recommended).
2018-08-10 10:14:21 +00:00
-p, --password=value
Password for XMPP account.
2021-01-31 11:28:58 +00:00
--raw Send raw XML
2018-08-10 10:14:21 +00:00
-r, --resource=value
Set resource. When sending to a chatroom this is used as
'alias'. (Default: go-sendxmpp) [go-sendxmpp]
2021-01-21 10:19:55 +00:00
-t, --tls Use direct TLS.
2018-08-10 10:14:21 +00:00
-u, --username=value
2021-01-29 17:41:25 +00:00
Username for XMPP account.
-x, --start-tls Use StartTLS. (DEPRECATED)
2018-08-04 10:16:28 +00:00
```
### examples
2018-08-10 10:14:21 +00:00
Send a message to two recipients using a configuration file.
2018-08-04 10:16:28 +00:00
```bash
2018-08-10 10:14:21 +00:00
cat message.txt | ./go-sendxmpp -f ./sendxmpp recipient1@example.com recipient2@example.com
2018-08-04 10:16:28 +00:00
```
2018-08-10 10:14:21 +00:00
Send a message to two recipients directly defining account credentials.
2018-08-04 10:16:28 +00:00
```bash
2018-08-10 10:14:21 +00:00
cat message.txt | ./go-sendxmpp -u bob@example.com -j example.com -p swordfish recipient1@example.com recipient2@example.com
2018-08-04 10:16:28 +00:00
```
2018-08-10 10:14:21 +00:00
Send a message to two groupchats (`-c`) using a configuration file.
```bash
cat message.txt | ./go-sendxmpp -cf ./sendxmpp chat1@conference.example.com chat2@conference.example.com
```
Send file changes to two groupchats (`-c`) using a configuration file.
```bash
tail -f example.log | ./go-sendxmpp -cif ./sendxmpp chat1@conference.example.com chat2@conference.example.com
2018-12-15 15:15:30 +00:00
```