Make incoming messages to the transport trigger a subscription
This commit is contained in:
parent
2bf4c6666e
commit
6cbfed8245
|
@ -71,17 +71,24 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) {
|
|||
return
|
||||
}
|
||||
|
||||
gatewayJid := gateway.Jid.Bare()
|
||||
|
||||
session, ok := sessions[bare]
|
||||
if !ok {
|
||||
if msg.To == gatewayJid {
|
||||
gateway.SendPresence(component, msg.From, gateway.SPType("subscribe"))
|
||||
gateway.SendPresence(component, msg.From, gateway.SPType("subscribed"))
|
||||
} else {
|
||||
log.Error("Message from stranger")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
toID, ok := toToID(msg.To)
|
||||
if ok {
|
||||
session.ProcessOutgoingMessage(toID, msg.Body, msg.From)
|
||||
return
|
||||
} else if msg.To == gateway.Jid.Bare() {
|
||||
} else if msg.To == gatewayJid {
|
||||
if strings.HasPrefix(msg.Body, "/") {
|
||||
response := session.ProcessTransportCommand(msg.Body, resource)
|
||||
if response != "" {
|
||||
|
|
Loading…
Reference in a new issue