Compare commits

..

6 Commits
main ... main

Author SHA1 Message Date
genofire 612d577b21 fix validation of notifcation by sender/from address
continuous-integration/drone the build was successful Details
Reviewed-on: genofire/unified-push-xmpp#19
2021-09-21 11:34:56 +02:00
karmanyaahm 8eb9ba32b5 Add a not condition to an if statement
continuous-integration/drone the build was successful Details
2021-09-21 05:24:30 +02:00
genofire 4b06d6886a Merge pull request 'also use xmpp JID as part of settings persistence' (#17) from karmanyaahm/unified-push-xmpp:smth into main
continuous-integration/drone the build was successful Details
Reviewed-on: genofire/unified-push-xmpp#17
2021-09-17 18:09:46 +02:00
Karmanyaah Malhotra 656c3237dd add other part of conn.Settings check 2021-09-17 10:03:53 -05:00
Karmanyaah Malhotra 5e0ec90bf4 also use xmpp JID as part of settings persistence
continuous-integration/drone the build failed Details
2021-09-16 20:21:43 -05:00
genofire 6d154bfdb1 distributor: fix - dropreplace in go.mod
continuous-integration/drone the build was successful Details
2021-09-16 16:51:54 +02:00
2 changed files with 4 additions and 5 deletions

View File

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

View File

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