diff options
Diffstat (limited to 'xmpp')
-rw-r--r-- | xmpp/handlers.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go index bb2064a..ff8fb21 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -292,7 +292,7 @@ func HandlePresence(s xmpp.Sender, p stanza.Packet) { var mucExt stanza.MucPresence prs.Get(&mucExt) if mucExt.XMLName.Space != "" { - handleMUCPresence(s, prs) + handleMUCPresence(s, prs, mucExt) } } @@ -403,7 +403,7 @@ func handlePresence(s xmpp.Sender, p stanza.Presence) { } } -func handleMUCPresence(s xmpp.Sender, p stanza.Presence) { +func handleMUCPresence(s xmpp.Sender, p stanza.Presence, mucExt stanza.MucPresence) { log.WithFields(log.Fields{ "type": p.Type, "from": p.From, @@ -458,7 +458,11 @@ func handleMUCPresence(s xmpp.Sender, p stanza.Presence) { return } - session.JoinMUC(chatId, fromResource) + limit, ok := mucExt.History.MaxStanzas.Get() + if !ok { + limit = 20 + } + session.JoinMUC(chatId, fromResource, int32(limit)) } } } |