WIP
This commit is contained in:
parent
84a017281f
commit
9f65ad172c
@ -43,12 +43,12 @@ func (mq *MessageQuery) New() *Message {
|
|||||||
const (
|
const (
|
||||||
getAllMessagesSelect = `
|
getAllMessagesSelect = `
|
||||||
SELECT chat_gmid, chat_receiver, gmid, mxid, sender, timestamp, sent
|
SELECT chat_gmid, chat_receiver, gmid, mxid, sender, timestamp, sent
|
||||||
FROM messages
|
FROM message
|
||||||
`
|
`
|
||||||
getAllMessagesQuery = getAllMessagesSelect + `
|
getAllMessagesQuery = getAllMessagesSelect + `
|
||||||
WHERE chat_gmid=$1 AND chat_receiver=$2
|
WHERE chat_gmid=$1 AND chat_receiver=$2
|
||||||
`
|
`
|
||||||
getByGMIDQuery = getAllMessagesQuery + "AND jid=$3"
|
getByGMIDQuery = getAllMessagesQuery + "AND gmid=$3"
|
||||||
getByMXIDQuery = getAllMessagesSelect + "WHERE mxid=$1"
|
getByMXIDQuery = getAllMessagesSelect + "WHERE mxid=$1"
|
||||||
getLastMessageInChatQuery = getAllMessagesQuery + `
|
getLastMessageInChatQuery = getAllMessagesQuery + `
|
||||||
AND timestamp<=$3 AND sent=true
|
AND timestamp<=$3 AND sent=true
|
||||||
|
2
go.sum
2
go.sum
@ -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/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.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.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.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
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/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 h1:gkK9HXc1SSPwY7qOAqchzj2xxYqiOYeee8lr28A2g/o=
|
||||||
maunium.net/go/mautrix v0.15.0/go.mod h1:1v8QVDd7q/eJ+eg4sgeOSEafBAFhkt4ab2i97M3IkNQ=
|
maunium.net/go/mautrix v0.15.0/go.mod h1:1v8QVDd7q/eJ+eg4sgeOSEafBAFhkt4ab2i97M3IkNQ=
|
||||||
|
maunium.net/go/mautrix v0.16.0/go.mod h1:XAjE9pTSGcr6vXaiNgQGiip7tddJ8FQV1a29u2QdBG4=
|
||||||
|
6
user.go
6
user.go
@ -324,7 +324,7 @@ func (user *User) SetManagementRoom(roomID id.RoomID) {
|
|||||||
existingUser.ManagementRoom = ""
|
existingUser.ManagementRoom = ""
|
||||||
existingUser.Update()
|
existingUser.Update()
|
||||||
}
|
}
|
||||||
|
//
|
||||||
user.ManagementRoom = roomID
|
user.ManagementRoom = roomID
|
||||||
user.bridge.managementRooms[user.ManagementRoom] = user
|
user.bridge.managementRooms[user.ManagementRoom] = user
|
||||||
user.Update()
|
user.Update()
|
||||||
@ -342,11 +342,12 @@ func (user *User) Connect() bool {
|
|||||||
if timeout == 0 {
|
if timeout == 0 {
|
||||||
timeout = 20
|
timeout = 20
|
||||||
}
|
}
|
||||||
|
|
||||||
conn := groupme.NewPushSubscription(context.Background())
|
conn := groupme.NewPushSubscription(context.Background())
|
||||||
user.Conn = &conn
|
user.Conn = &conn
|
||||||
user.Conn.StartListening(context.Background(), groupmeext.NewFayeClient(user.log))
|
user.Conn.StartListening(context.Background(), groupmeext.NewFayeClient(user.log))
|
||||||
|
|
||||||
user.Conn.AddFullHandler(user)
|
user.Conn.AddFullHandler(user)
|
||||||
user.intPostLogin()
|
|
||||||
|
|
||||||
//TODO: typing notification?
|
//TODO: typing notification?
|
||||||
return user.RestoreSession()
|
return user.RestoreSession()
|
||||||
@ -408,6 +409,7 @@ func (user *User) Login(token string) error {
|
|||||||
if user.Connect() {
|
if user.Connect() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
user.intPostLogin()
|
||||||
return errors.New("failed to connect")
|
return errors.New("failed to connect")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user