Add support for password protected MUCs.

v0.3
Martin Dosch 2 years ago
parent db3d9feb86
commit e1130aa34a

@ -1,6 +1,8 @@
# Changelog
## Unreleased
## Added
- Added support for joining password protected MUCs.
## [v0.2.0]
### Added

@ -75,7 +75,7 @@ If no configuration file is present or if the values should be overridden it is
the account details via command line options:
```plain
Usage: go-sendxmpp [-cdilnt] [-f value] [--help] [--http-upload value] [-j value] [-m value] [-p value] [--raw] [-r value] [--timeout value] [--tls-version value] [-u value] [--version] [parameters ...]
Usage: go-sendxmpp [-cdilnt] [-f value] [--help] [--http-upload value] [-j value] [-m value] [--muc-password value] [-p value] [--raw] [-r value] [--timeout value] [--tls-version value] [-u value] [--version] [parameters ...]
-c, --chatroom Send message to a chatroom.
-d, --debug Show debugging info.
-f, --file=value Set configuration file. (Default:
@ -89,6 +89,8 @@ Usage: go-sendxmpp [-cdilnt] [-f value] [--help] [--http-upload value] [-j value
-l, --listen Listen for messages and print them to stdout.
-m, --message=value
Set file including the message.
--muc-password=value
Password for password protected MUCs.
-n, --no-tls-verify
Skip verification of TLS certificates (not recommended).
-p, --password=value

@ -241,6 +241,7 @@ func main() {
flagTLSMinVersion := getopt.IntLong("tls-version", 0, 12,
"Minimal TLS version. 10 (TSLv1.0), 11 (TLSv1.1), 12 (TLSv1.2) or 13 (TLSv1.3).")
flagVersion := getopt.BoolLong("version", 0, "Show version information.")
flagMUCPassword := getopt.StringLong("muc-password", 0, "", "Password for password protected MUCs.")
// Parse command line flags.
getopt.Parse()
@ -414,10 +415,16 @@ func main() {
// Send raw XML to chatroom
if *flagChatroom && *flagRaw {
var err error
// Join the MUCs.
for _, recipient := range recipients {
_, err := client.JoinMUCNoHistory(recipient, *flagResource)
if *flagMUCPassword != "" {
dummyTime := time.Now()
_, err = client.JoinProtectedMUC(recipient, *flagResource,
*flagMUCPassword, 0, 0, &dummyTime)
} else {
_, err = client.JoinMUCNoHistory(recipient, *flagResource)
}
if err != nil {
// Try to nicely close connection,
// even if there was an error joining.
@ -482,7 +489,13 @@ func main() {
for _, recipient := range recipients {
// Join the MUC.
_, err := client.JoinMUCNoHistory(recipient, *flagResource)
if *flagMUCPassword != "" {
dummyTime := time.Now()
_, err = client.JoinProtectedMUC(recipient, *flagResource,
*flagMUCPassword, 0, 0, &dummyTime)
} else {
_, err = client.JoinMUCNoHistory(recipient, *flagResource)
}
if err != nil {
// Try to nicely close connection,
// even if there was an error joining.

@ -28,6 +28,8 @@ You can either pipe a programs output to \fBgo\-sendxmpp\fR, write in your termi
.P
\fB\-m\fR, \fB\-\-message\fR=[\fIvalue\fR]: Set file including the message\.
.P
\fB\-\-muc\-password\fR=[\fIvalue\fR]: Password for password protected MUCs\.
.P
\fB\-n\fR, \fB\-\-no\-tls\-verify\fR: Skip verification of TLS certificates (not recommended)\.
.P
\fB\-\-tls\-version\fR=[\fIvalue\fR]: Minimal TLS version\. 10 (TSLv1\.0), 11 (TLSv1\.1) (Default: 12)

@ -119,6 +119,9 @@ compatibility with the original perl sendxmpp) if no other configuration file lo
<p><code>-m</code>, <code>--message</code>=[<var>value</var>]:
Set file including the message.</p>
<p><code>--muc-password</code>=[<var>value</var>]:
Password for password protected MUCs.</p>
<p><code>-n</code>, <code>--no-tls-verify</code>:
Skip verification of TLS certificates (not recommended).</p>

@ -44,6 +44,9 @@ compatibility with the original perl sendxmpp) if no other configuration file lo
`-m`, `--message`=[<value>]:
Set file including the message.
`--muc-password`=[<value>]:
Password for password protected MUCs.
`-n`, `--no-tls-verify`:
Skip verification of TLS certificates (not recommended).

Loading…
Cancel
Save