Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

2 changed files with 5 additions and 4 deletions

View File

@ -36,3 +36,5 @@ require (
) )
replace dev.sum7.eu/genofire/unified-push-xmpp/messages => ../messages replace dev.sum7.eu/genofire/unified-push-xmpp/messages => ../messages
replace mellium.im/xmpp => ../../../../mellium.im/xmpp

View File

@ -6,7 +6,6 @@ import (
"encoding/xml" "encoding/xml"
"errors" "errors"
"io" "io"
"strings"
"time" "time"
"github.com/bdlm/log" "github.com/bdlm/log"
@ -113,7 +112,7 @@ func (s *XMPPService) message(msgHead stanza.Message, t xmlstream.TokenReadEncod
return nil return nil
} }
from := msgHead.From.String() from := msgHead.From.String()
if settings := strings.Split(conn.Settings, ":"); !(len(settings) > 1 && settings[0] == from) { if from != conn.Settings {
log.WithField("from", from).Info("message not from gateway, that is no notification") log.WithField("from", from).Info("message not from gateway, that is no notification")
return nil return nil
} }
@ -179,7 +178,7 @@ func (s *XMPPService) selectGateway() {
if s.KeepGateway { if s.KeepGateway {
return return
} }
conns := s.store.GetUnequalSettings(s.gateway.String() + ":" + s.session.LocalAddr().Bare().String()) conns := s.store.GetUnequalSettings(s.gateway.String())
if len(conns) <= 0 { if len(conns) <= 0 {
return return
} }
@ -243,7 +242,7 @@ func (s *XMPPService) Register(appID, appToken string) (string, string, error) {
"appID": appID, "appID": appID,
"appToken": appToken, "appToken": appToken,
}) })
conn := s.store.NewConnection(appID, appToken, s.gateway.String()+":"+s.session.LocalAddr().Bare().String()) conn := s.store.NewConnection(appID, appToken, s.gateway.String())
if conn == nil { if conn == nil {
errStr := "error to store public token" errStr := "error to store public token"
err := errors.New(errStr) err := errors.New(errStr)