Read only published membership for attachment roles and invitations
This commit is contained in:
1 parent
33e403ab44
commit
017db6bb2d
3 files changed
+6
-3
No files matched your search
@@ -1110,7 +1110,8 @@ int chat_attachment_downloaded(struct UTUN_INSTANCE* inst, const char* channel,
|
||||
int rc = sqlite3_exec(db, "BEGIN IMMEDIATE /* attachment downloaded */", NULL, NULL, NULL);
|
||||
if (rc != SQLITE_OK) goto fail;
|
||||
char sql[768]; snprintf(sql, sizeof(sql), "SELECT downloaded,wanted,error,NOT EXISTS(SELECT 1 FROM peers_%s"
|
||||
" WHERE node_id=? AND source=0 AND deleted=0 AND admitted=1 AND length(adm_tags_sig)=64 AND json_extract(adm_tags,'$.storage')='yes')"
|
||||
" WHERE node_id=? AND record_state=0 AND source=0 AND deleted=0 AND admitted=1"
|
||||
" AND length(adm_tags_sig)=64 AND json_extract(adm_tags,'$.storage')='yes')"
|
||||
" AND NOT EXISTS(SELECT 1 FROM attachment_key_requests r WHERE r.channel=a.channel AND r.message_id=a.message_id"
|
||||
" AND r.incoming=0 AND r.state=5) FROM attachment_keys a WHERE channel=? AND message_id=?", channel);
|
||||
stage = "prepare download state"; rc = sqlite3_prepare_v2(db, sql, -1, &st, NULL);
|
||||
|
||||
+2
-1
@@ -665,7 +665,8 @@ static int msg_list_ids(struct UTUN_INSTANCE* inst, const char* channel, uint8_t
|
||||
uint8_t* temporary = u_malloc(capacity);
|
||||
if (!temporary) { DEBUG_ERROR(DEBUG_CATEGORY_CHAT, "ID list: allocation bytes=%zu failed", capacity); return -1; }
|
||||
char sql[160];
|
||||
if (channel) snprintf(sql, sizeof(sql), "SELECT node_id FROM peers_%s WHERE deleted=0 AND admitted=1 ORDER BY node_id<0,node_id", channel);
|
||||
if (channel) snprintf(sql, sizeof(sql), "SELECT node_id FROM peers_%s"
|
||||
" WHERE record_state=0 AND deleted=0 AND admitted=1 ORDER BY node_id<0,node_id", channel);
|
||||
else strcpy(sql, "SELECT channel_id FROM channels ORDER BY created_at,channel_id");
|
||||
sqlite3_stmt* st = NULL; size_t used = 2; uint16_t count = 0; int full = 0;
|
||||
int rc = sqlite3_prepare_v2(cc->db, sql, -1, &st, NULL);
|
||||
|
||||
@@ -81,7 +81,8 @@ static int select_nodes(struct UTUN_INSTANCE* inst, uint64_t channel, struct inv
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "invite_build: inactive context/invalid channel=%llu", (unsigned long long)channel); return -1;
|
||||
}
|
||||
char sql[256];
|
||||
snprintf(sql, sizeof(sql), "SELECT node_id,node_type FROM peers_%llu WHERE source=0 AND deleted=0 AND admitted=1 ORDER BY node_id<0,node_id",
|
||||
snprintf(sql, sizeof(sql), "SELECT node_id,node_type FROM peers_%llu"
|
||||
" WHERE record_state=0 AND source=0 AND deleted=0 AND admitted=1 ORDER BY node_id<0,node_id",
|
||||
(unsigned long long)channel);
|
||||
sqlite3_stmt* st = NULL; result->priority = 4;
|
||||
int rc = sqlite3_prepare_v2(cc->db, sql, -1, &st, NULL);
|
||||
|
||||
Reference in new issue
Block a user