PubSub protocol support

Added support for :
- XEP-0050   (Command))
- XEP-0060   (PubSub)
- XEP-0004   (Forms)

Fixed the NewClient function by adding parsing of the domain from the JID if no domain is provided in transport config.
Updated xmpp_jukebox example
This commit is contained in:
CORNIERE Rémi
2020-01-09 07:11:35 +01:00
parent 6e2ba9ca57
commit 00ceeeb5d4
27 changed files with 3397 additions and 46 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"bufio"
"gosrc.io/xmpp/stanza"
"os"
"strings"
"sync"
@@ -48,7 +49,7 @@ func sendxmpp(cmd *cobra.Command, args []string) {
wg.Add(1)
// FIXME: Remove global variables
var mucsToLeave []*xmpp.Jid
var mucsToLeave []*stanza.Jid
cm := xmpp.NewStreamManager(client, func(c xmpp.Sender) {
defer wg.Done()
@@ -57,7 +58,7 @@ func sendxmpp(cmd *cobra.Command, args []string) {
if isMUCRecipient {
for _, muc := range receiver {
jid, err := xmpp.NewJid(muc)
jid, err := stanza.NewJid(muc)
if err != nil {
log.WithField("muc", muc).Errorf("skipping invalid muc jid: %w", err)
continue

View File

@@ -7,7 +7,7 @@ import (
"gosrc.io/xmpp/stanza"
)
func joinMUC(c xmpp.Sender, toJID *xmpp.Jid) error {
func joinMUC(c xmpp.Sender, toJID *stanza.Jid) error {
return c.Send(stanza.Presence{Attrs: stanza.Attrs{To: toJID.Full()},
Extensions: []stanza.PresExtension{
stanza.MucPresence{
@@ -16,7 +16,7 @@ func joinMUC(c xmpp.Sender, toJID *xmpp.Jid) error {
})
}
func leaveMUCs(c xmpp.Sender, mucsToLeave []*xmpp.Jid) {
func leaveMUCs(c xmpp.Sender, mucsToLeave []*stanza.Jid) {
for _, muc := range mucsToLeave {
if err := c.Send(stanza.Presence{Attrs: stanza.Attrs{
To: muc.Full(),