This commit is contained in:
Brandon Watson 2023-09-04 18:43:32 -05:00
parent 84a017281f
commit 9f65ad172c
3 changed files with 8 additions and 4 deletions

View File

@ -43,12 +43,12 @@ func (mq *MessageQuery) New() *Message {
const (
getAllMessagesSelect = `
SELECT chat_gmid, chat_receiver, gmid, mxid, sender, timestamp, sent
FROM messages
FROM message
`
getAllMessagesQuery = getAllMessagesSelect + `
WHERE chat_gmid=$1 AND chat_receiver=$2
`
getByGMIDQuery = getAllMessagesQuery + "AND jid=$3"
getByGMIDQuery = getAllMessagesQuery + "AND gmid=$3"
getByMXIDQuery = getAllMessagesSelect + "WHERE mxid=$1"
getLastMessageInChatQuery = getAllMessagesQuery + `
AND timestamp<=$3 AND sent=true

2
go.sum
View File

@ -128,6 +128,7 @@ github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIK
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
@ -215,3 +216,4 @@ maunium.net/go/maulogger/v2 v2.4.1 h1:N7zSdd0mZkB2m2JtFUsiGTQQAdP0YeFWT7YMc80yAL
maunium.net/go/maulogger/v2 v2.4.1/go.mod h1:omPuYwYBILeVQobz8uO3XC8DIRuEb5rXYlQSuqrbCho=
maunium.net/go/mautrix v0.15.0 h1:gkK9HXc1SSPwY7qOAqchzj2xxYqiOYeee8lr28A2g/o=
maunium.net/go/mautrix v0.15.0/go.mod h1:1v8QVDd7q/eJ+eg4sgeOSEafBAFhkt4ab2i97M3IkNQ=
maunium.net/go/mautrix v0.16.0/go.mod h1:XAjE9pTSGcr6vXaiNgQGiip7tddJ8FQV1a29u2QdBG4=

View File

@ -324,7 +324,7 @@ func (user *User) SetManagementRoom(roomID id.RoomID) {
existingUser.ManagementRoom = ""
existingUser.Update()
}
//
user.ManagementRoom = roomID
user.bridge.managementRooms[user.ManagementRoom] = user
user.Update()
@ -342,11 +342,12 @@ func (user *User) Connect() bool {
if timeout == 0 {
timeout = 20
}
conn := groupme.NewPushSubscription(context.Background())
user.Conn = &conn
user.Conn.StartListening(context.Background(), groupmeext.NewFayeClient(user.log))
user.Conn.AddFullHandler(user)
user.intPostLogin()
//TODO: typing notification?
return user.RestoreSession()
@ -408,6 +409,7 @@ func (user *User) Login(token string) error {
if user.Connect() {
return nil
}
user.intPostLogin()
return errors.New("failed to connect")
}