diff options
Diffstat (limited to 'xmpp/gateway/gateway.go')
-rw-r--r-- | xmpp/gateway/gateway.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/xmpp/gateway/gateway.go b/xmpp/gateway/gateway.go index c09a061..e4a1be7 100644 --- a/xmpp/gateway/gateway.go +++ b/xmpp/gateway/gateway.go @@ -243,6 +243,9 @@ var SPImmed = args.NewBool(args.Default(true)) // SPAffiliation is a XEP-0045 MUC affiliation var SPAffiliation = args.NewString() +// SPMUCStatusCodes is a set of XEP-0045 MUC status codes +var SPMUCStatusCodes = args.New() + func newPresence(bareJid string, to string, args ...args.V) stanza.Presence { var presenceFrom string if SPFrom.IsSet(args) { @@ -301,12 +304,21 @@ func newPresence(bareJid string, to string, args ...args.V) stanza.Presence { if SPAffiliation.IsSet(args) { affiliation := SPAffiliation.Get(args) if affiliation != "" { - presence.Extensions = append(presence.Extensions, extensions.PresenceXMucUserExtension{ + userExt := extensions.PresenceXMucUserExtension{ Item: extensions.PresenceXMucUserItem{ Affiliation: affiliation, Role: affilationToRole(affiliation), }, - }) + } + if SPMUCStatusCodes.IsSet(args) { + statusCodes := SPMUCStatusCodes.Get(args).([]uint16) + for _, statusCode := range statusCodes { + userExt.Statuses = append(userExt.Statuses, extensions.PresenceXMucUserStatus{ + Code: statusCode, + }) + } + } + presence.Extensions = append(presence.Extensions, userExt) } } |