mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 14:12:47 +00:00
User directory for nearby Pinecone peers (P2P demo) (#2311)
* User directory for nearby Pinecone peers * Fix mux routing * Use config to determine which server notices user to exclude
This commit is contained in:
parent
0692be44d9
commit
7972915806
18 changed files with 226 additions and 37 deletions
|
@ -54,6 +54,7 @@ const selectProfilesBySearchSQL = "" +
|
|||
|
||||
type profilesStatements struct {
|
||||
db *sql.DB
|
||||
serverNoticesLocalpart string
|
||||
insertProfileStmt *sql.Stmt
|
||||
selectProfileByLocalpartStmt *sql.Stmt
|
||||
setAvatarURLStmt *sql.Stmt
|
||||
|
@ -61,9 +62,10 @@ type profilesStatements struct {
|
|||
selectProfilesBySearchStmt *sql.Stmt
|
||||
}
|
||||
|
||||
func NewSQLiteProfilesTable(db *sql.DB) (tables.ProfileTable, error) {
|
||||
func NewSQLiteProfilesTable(db *sql.DB, serverNoticesLocalpart string) (tables.ProfileTable, error) {
|
||||
s := &profilesStatements{
|
||||
db: db,
|
||||
db: db,
|
||||
serverNoticesLocalpart: serverNoticesLocalpart,
|
||||
}
|
||||
_, err := db.Exec(profilesSchema)
|
||||
if err != nil {
|
||||
|
@ -131,7 +133,9 @@ func (s *profilesStatements) SelectProfilesBySearch(
|
|||
if err := rows.Scan(&profile.Localpart, &profile.DisplayName, &profile.AvatarURL); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
profiles = append(profiles, profile)
|
||||
if profile.Localpart != s.serverNoticesLocalpart {
|
||||
profiles = append(profiles, profile)
|
||||
}
|
||||
}
|
||||
return profiles, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue