diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a1384e..329489d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## Unreleased +## Added +- Added support for joining password protected MUCs. ## [v0.2.0] ### Added diff --git a/README.md b/README.md index 06f4399..17eaf3e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/go-sendxmpp.go b/go-sendxmpp.go index af40ed1..25d59b5 100644 --- a/go-sendxmpp.go +++ b/go-sendxmpp.go @@ -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. diff --git a/man/go-sendxmpp.1 b/man/go-sendxmpp.1 index 5d1b8ba..4c991b8 100644 --- a/man/go-sendxmpp.1 +++ b/man/go-sendxmpp.1 @@ -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) diff --git a/man/go-sendxmpp.1.html b/man/go-sendxmpp.1.html index 72a2a56..b5b0569 100644 --- a/man/go-sendxmpp.1.html +++ b/man/go-sendxmpp.1.html @@ -119,6 +119,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).

diff --git a/man/go-sendxmpp.1.ronn b/man/go-sendxmpp.1.ronn index 706408c..e0cc805 100644 --- a/man/go-sendxmpp.1.ronn +++ b/man/go-sendxmpp.1.ronn @@ -44,6 +44,9 @@ compatibility with the original perl sendxmpp) if no other configuration file lo `-m`, `--message`=[]: Set file including the message. + `--muc-password`=[]: + Password for password protected MUCs. + `-n`, `--no-tls-verify`: Skip verification of TLS certificates (not recommended).