Warn about undelivered carbons to foreign servers

This commit is contained in:
Bohdan Horbeshko 2023-03-19 18:12:06 -04:00
parent 0a2c4e09d9
commit 75f0532193
2 changed files with 10 additions and 1 deletions

View file

@ -15,7 +15,7 @@ import (
goxmpp "gosrc.io/xmpp"
)
var version string = "1.5.0-dev"
var version string = "1.5.0"
var commit string
var sm *goxmpp.StreamManager

View file

@ -168,6 +168,15 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) {
if msg.Type == "error" {
log.Errorf("MESSAGE ERROR: %#v", p)
if msg.XMLName.Space == "jabber:component:accept" && msg.Error.Code == 401 {
suffix := "@" + msg.From
for bare := range sessions {
if strings.HasSuffix(bare, suffix) {
gateway.SendServiceMessage(bare, "Your server \"" + msg.From + "\" does not allow to send carbons", component)
}
}
}
}
}