From 0490e0a087b9d67fc9e19fa6aa5c0768ef33337f Mon Sep 17 00:00:00 2001 From: Chteufleur Date: Wed, 5 Oct 2016 21:26:42 +0200 Subject: [PATCH] Add support of Remote Roster Manager (XEP-0321). --- src/xmpp/remoteRosterManager.go | 21 +++++++++++++++++++++ src/xmpp/roster.go | 26 ++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/xmpp/remoteRosterManager.go create mode 100644 src/xmpp/roster.go diff --git a/src/xmpp/remoteRosterManager.go b/src/xmpp/remoteRosterManager.go new file mode 100644 index 0000000..83ce91b --- /dev/null +++ b/src/xmpp/remoteRosterManager.go @@ -0,0 +1,21 @@ +package xmpp + +import ( + "encoding/xml" +) + +const ( + NSRemoteRosterManager = "urn:xmpp:tmp:roster-management:0" + + RemoteRosterManagerTypeRequest = "request" + RemoteRosterManagerTypeAllowed = "allowed" + RemoteRosterManagerTypeRejected = "rejected" +) + +// XEP-0321: Remote Roster Manager + +type RemoteRosterManagerQuery struct { + XMLName xml.Name `xml:"urn:xmpp:tmp:roster-management:0 query"` + Reason string `xml:"reason,attr,omitempty"` + Type string `xml:"type,attr"` +} diff --git a/src/xmpp/roster.go b/src/xmpp/roster.go new file mode 100644 index 0000000..19272b9 --- /dev/null +++ b/src/xmpp/roster.go @@ -0,0 +1,26 @@ +package xmpp + +import ( + "encoding/xml" +) + +const ( + NSRoster = "jabber:iq:roster" + + RosterSubscriptionBoth = "both" + RosterSubscriptionFrom = "from" + RosterSubscriptionTo = "to" + RosterSubscriptionRemove = "remove" +) + +type RosterQuery struct { + XMLName xml.Name `xml:"jabber:iq:roster query"` + Items []RosterItem `xml:"item"` +} + +type RosterItem struct { + JID string `xml:"jid,attr"` + Name string `xml:"name,attr,omitempty"` + Subscription string `xml:"subscription,attr"` + Groupes []string `xml:"group"` +}