53 lines
2.0 KiB
C
53 lines
2.0 KiB
C
#ifndef OPEN_WING_NOSTR_HANDLER_H
|
|
#define OPEN_WING_NOSTR_HANDLER_H
|
|
|
|
#include "config.h"
|
|
#include "cjson/cJSON.h"
|
|
|
|
typedef enum {
|
|
DIDACTYL_SENDER_ADMIN = 1,
|
|
DIDACTYL_SENDER_WOT = 2,
|
|
DIDACTYL_SENDER_STRANGER = 3
|
|
} didactyl_sender_tier_t;
|
|
|
|
typedef void (*dm_callback_t)(const char* sender_pubkey_hex,
|
|
const char* message,
|
|
didactyl_sender_tier_t tier,
|
|
void* user_data);
|
|
|
|
typedef struct {
|
|
int success;
|
|
int kind;
|
|
int relay_count;
|
|
int accepted_by_pool_count;
|
|
char event_id[65];
|
|
char note_uri[256];
|
|
char naddr_uri[1024];
|
|
char d_tag[128];
|
|
char** relays;
|
|
} nostr_publish_result_t;
|
|
|
|
int nostr_handler_init(didactyl_config_t* config);
|
|
int nostr_handler_subscribe_admin_context(void);
|
|
int nostr_handler_subscribe_dms(dm_callback_t callback, void* user_data);
|
|
int nostr_handler_send_dm(const char* recipient_pubkey_hex, const char* message);
|
|
int nostr_handler_send_dm_auto(const char* recipient_pubkey_hex, const char* message);
|
|
int nostr_handler_publish_kind_event(int kind, const char* content, cJSON* tags, nostr_publish_result_t* out_result);
|
|
void nostr_handler_publish_result_free(nostr_publish_result_t* result);
|
|
char* nostr_handler_query_json(cJSON* filter, int timeout_ms);
|
|
int nostr_handler_poll(int timeout_ms);
|
|
int nostr_handler_reconcile_startup_events(void);
|
|
void nostr_handler_refresh_relay_statuses(void);
|
|
const char* nostr_handler_get_system_context(void);
|
|
const char* nostr_handler_get_startup_display_name(void);
|
|
int nostr_handler_connected_relay_count(void);
|
|
char* nostr_handler_get_admin_kind0_context(void);
|
|
char* nostr_handler_get_admin_kind10002_context(void);
|
|
char* nostr_handler_get_admin_kind1_notes_context(void);
|
|
int nostr_handler_is_wot_contact(const char* pubkey_hex);
|
|
char* nostr_handler_relay_status_json(void);
|
|
char* nostr_handler_relay_info_json(const char* relay_url);
|
|
int nostr_handler_send_dm_nip17(const char* recipient_pubkey_hex, const char* message, const char* subject);
|
|
void nostr_handler_cleanup(void);
|
|
|
|
#endif |