From f99f4f6acc6734ecbd0da80015285e6b3d39fdd8 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Sun, 17 Sep 2023 23:21:57 -0400 Subject: Send memberlist on MUC join, suppress PM statuses for MUC JIDs --- xmpp/extensions/extensions.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'xmpp/extensions') diff --git a/xmpp/extensions/extensions.go b/xmpp/extensions/extensions.go index 8e2f743..0b7269f 100644 --- a/xmpp/extensions/extensions.go +++ b/xmpp/extensions/extensions.go @@ -213,6 +213,19 @@ type QueryRegisterRemove struct { XMLName xml.Name `xml:"remove"` } +// PresenceXMucUserExtension is from XEP-0045 +type PresenceXMucUserExtension struct { + XMLName xml.Name `xml:"http://jabber.org/protocol/muc#user x"` + Item PresenceXMucUserItem +} + +// PresenceXMucUserItem is from XEP-0045 +type PresenceXMucUserItem struct { + XMLName xml.Name `xml:"item"` + Affiliation string `xml:"affiliation,attr"` + Role string `xml:"role,attr"` +} + // Namespace is a namespace! func (c PresenceNickExtension) Namespace() string { return c.XMLName.Space @@ -278,6 +291,11 @@ func (c QueryRegister) GetSet() *stanza.ResultSet { return c.ResultSet } +// Namespace is a namespace! +func (c PresenceXMucUserExtension) Namespace() string { + return c.XMLName.Space +} + // Name is a packet name func (ClientMessage) Name() string { return "message" @@ -362,4 +380,10 @@ func init() { "jabber:iq:register", "query", }, QueryRegister{}) + + // presence muc user + stanza.TypeRegistry.MapExtension(stanza.PKTPresence, xml.Name{ + "http://jabber.org/protocol/muc#user", + "x", + }, PresenceXMucUserExtension{}) } -- cgit v1.2.3