Files
sovereign_browser/src/relay_fetch.h
T

46 lines
1.3 KiB
C

/*
* relay_fetch.h — post-login bootstrap relay fetch for sovereign_browser
*
* After the user logs in, fetches their kind 0 (profile), kind 3 (contacts),
* and kind 10002 (relay list) events from the configured bootstrap relays
* and stores them in the SQLite database.
*/
#ifndef RELAY_FETCH_H
#define RELAY_FETCH_H
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Fetch the user's kind 0, 3, and 10002 events from the bootstrap relays
* and store them in the SQLite database via db_store_event().
*
* pubkey_hex — user's hex pubkey (64 chars, no 0x prefix)
* relay_urls — array of relay URL strings (e.g. "wss://relay.damus.io")
* relay_count — number of relays in the array
*
* Returns the number of events fetched and stored, or -1 on error.
*/
int relay_fetch_bootstrap(const char *pubkey_hex,
const char **relay_urls,
int relay_count);
/*
* Background thread entry point for relay_fetch_bootstrap.
* Pass a pointer to a g_strdup'd pubkey_hex string (the thread frees it).
* Reads bootstrap relays from the global settings singleton.
*
* Usage: g_thread_new("relay-fetch", relay_fetch_thread, g_strdup(pubkey));
*/
gpointer relay_fetch_thread(gpointer data);
#ifdef __cplusplus
}
#endif
#endif /* RELAY_FETCH_H */