2018-08-04 10:16:28 +00:00
|
|
|
# go-sendxmpp
|
|
|
|
|
|
|
|
## about
|
|
|
|
|
2020-06-06 10:04:45 +00:00
|
|
|
A little tool to send messages to an XMPP contact or MUC inspired by [sendxmpp](https://sendxmpp.hostname.sk/).
|
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
|
|
|
|
2018-08-10 10:14:21 +00:00
|
|
|
The account data is expected at `~/.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
|
2020-06-06 10:06:09 +00:00
|
|
|
username: <your_jid>
|
2018-08-10 10:14:21 +00:00
|
|
|
jserver: <jabber_server>
|
|
|
|
port: <jabber_port>
|
|
|
|
password: <your_jabber_password>
|
|
|
|
```
|
2018-08-04 10:16:28 +00:00
|
|
|
|
2020-10-01 16:55:41 +00:00
|
|
|
`jserver` and `port` might not be necessary depending on the used server. It is also possible to
|
|
|
|
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.
|
2018-08-10 13:03:04 +00:00
|
|
|
-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.
|
2018-08-10 13:03:04 +00:00
|
|
|
-i, --interactive Interactive mode (for use with e.g. 'tail -f').
|
2018-08-10 10:14:21 +00:00
|
|
|
-j, --jserver=value
|
2018-08-10 13:03:04 +00:00
|
|
|
XMPP server address.
|
2018-08-10 11:12:21 +00:00
|
|
|
-m, --message=value
|
2018-08-10 13:03:04 +00:00
|
|
|
Set file including the message.
|
2020-04-05 19:49:17 +00:00
|
|
|
-n, --no-tls-verify
|
|
|
|
Skip verification of TLS certificates (not recommended).
|
2018-08-10 10:14:21 +00:00
|
|
|
-p, --password=value
|
2018-08-10 13:03:04 +00:00
|
|
|
Password for XMPP account.
|
2018-08-10 10:14:21 +00:00
|
|
|
-r, --resource=value
|
2018-08-10 13:03:04 +00:00
|
|
|
Set resource. When sending to a chatroom this is used as
|
2020-04-05 19:49:17 +00:00
|
|
|
'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
|
2020-06-06 10:06:09 +00:00
|
|
|
Username for XMPP account (JID).
|
2018-08-10 13:03:04 +00:00
|
|
|
-x, --start-tls Use StartTLS.
|
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
|
2018-08-10 13:03:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
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
|
|
|
```
|