@@ -37,18 +37,18 @@ func newPortal(qh *dbutil.QueryHelper[*Portal]) *Portal {
37
37
}
38
38
39
39
const (
40
- getAllPortalsQuery = "SELECT id, receiver, self_user, other_user, type, mxid, name, name_set, encrypted, in_space FROM portal"
40
+ getAllPortalsQuery = "SELECT id, receiver, self_user, other_user, type, send_mode, force_rcs, mxid, name, name_set, encrypted, in_space FROM portal"
41
41
getAllPortalsForUserQuery = getAllPortalsQuery + " WHERE receiver=$1"
42
42
getPortalByKeyQuery = getAllPortalsQuery + " WHERE id=$1 AND receiver=$2"
43
43
getPortalByOtherUserQuery = getAllPortalsQuery + " WHERE other_user=$1 AND receiver=$2"
44
44
getPortalByMXIDQuery = getAllPortalsQuery + " WHERE mxid=$1"
45
45
insertPortalQuery = `
46
- INSERT INTO portal (id, receiver, self_user, other_user, type, mxid, name, name_set, encrypted, in_space)
47
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
46
+ INSERT INTO portal (id, receiver, self_user, other_user, type, send_mode, force_rcs, mxid, name, name_set, encrypted, in_space)
47
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12 )
48
48
`
49
49
updatePortalQuery = `
50
50
UPDATE portal
51
- SET self_user=$3, other_user=$4, type=$5, mxid =$6, name =$7, name_set =$8, encrypted =$9, in_space =$10
51
+ SET self_user=$3, other_user=$4, type=$5, send_mode =$6, force_rcs =$7, mxid =$8, name =$9, name_set =$10, encrypted=$11, in_space=$12
52
52
WHERE id=$1 AND receiver=$2
53
53
`
54
54
deletePortalQuery = "DELETE FROM portal WHERE id=$1 AND receiver=$2"
@@ -96,6 +96,8 @@ type Portal struct {
96
96
MXID id.RoomID
97
97
98
98
Type gmproto.ConversationType
99
+ SendMode gmproto.ConversationSendMode
100
+ ForceRCS bool
99
101
Name string
100
102
NameSet bool
101
103
Encrypted bool
@@ -104,15 +106,16 @@ type Portal struct {
104
106
105
107
func (portal * Portal ) Scan (row dbutil.Scannable ) (* Portal , error ) {
106
108
var mxid , selfUserID , otherUserID sql.NullString
107
- var convType int
109
+ var convType , sendMode int
108
110
err := row .Scan (
109
- & portal .ID , & portal .Receiver , & selfUserID , & otherUserID , & convType , & mxid ,
111
+ & portal .ID , & portal .Receiver , & selfUserID , & otherUserID , & convType , & sendMode , & portal . ForceRCS , & mxid ,
110
112
& portal .Name , & portal .NameSet , & portal .Encrypted , & portal .InSpace ,
111
113
)
112
114
if err != nil {
113
115
return nil , err
114
116
}
115
117
portal .Type = gmproto .ConversationType (convType )
118
+ portal .SendMode = gmproto .ConversationSendMode (sendMode )
116
119
portal .MXID = id .RoomID (mxid .String )
117
120
portal .OutgoingID = selfUserID .String
118
121
portal .OtherUserID = otherUserID .String
@@ -122,7 +125,7 @@ func (portal *Portal) Scan(row dbutil.Scannable) (*Portal, error) {
122
125
func (portal * Portal ) sqlVariables () []any {
123
126
return []any {
124
127
portal .ID , portal .Receiver , dbutil .StrPtr (portal .OutgoingID ), dbutil .StrPtr (portal .OtherUserID ),
125
- int (portal .Type ), dbutil .StrPtr (portal .MXID ),
128
+ int (portal .Type ), int ( portal . SendMode ), portal . ForceRCS , dbutil .StrPtr (portal .MXID ),
126
129
portal .Name , portal .NameSet , portal .Encrypted , portal .InSpace ,
127
130
}
128
131
}
0 commit comments