Send channel as prefix for compat clients

This commit is contained in:
2023-05-27 20:02:16 +02:00
parent 8826cb0312
commit b2df0a5a02
15 changed files with 136 additions and 33 deletions

View File

@@ -155,3 +155,26 @@ func (db *Database) SetAck(ctx TxContext, userid models.UserID, msgid models.Mes
return nil
}
func (db *Database) IsCompatClient(ctx TxContext, clientid models.ClientID) (bool, error) {
tx, err := ctx.GetOrCreateTransaction(db)
if err != nil {
return false, err
}
rows, err := tx.Query(ctx, "SELECT * FROM compat_clients WHERE client_id = :id LIMIT 1", sq.PP{
"id": clientid,
})
if err != nil {
return false, err
}
res := rows.Next()
err = rows.Close()
if err != nil {
return false, err
}
return res, nil
}

View File

@@ -214,6 +214,13 @@ CREATE UNIQUE INDEX "idx_compatacks_messageid" ON compat_acks (message_id
CREATE UNIQUE INDEX "idx_compatacks_userid_messageid" ON compat_acks (user_id, message_id);
CREATE TABLE compat_clients
(
client_id TEXT NOT NULL
) STRICT;
CREATE UNIQUE INDEX "idx_compatclient_clientid" ON compat_clients (client_id);
CREATE TABLE `meta`
(
meta_key TEXT NOT NULL,