diff --git a/nostr_core/core_relays.c b/nostr_core/core_relays.c index 392fee8a..e30ca32e 100644 --- a/nostr_core/core_relays.c +++ b/nostr_core/core_relays.c @@ -322,6 +322,23 @@ cJSON** synchronous_query_relays_with_progress( nostr_ws_close(relay->client); relay->client = NULL; } + } else if (msg_type && (strcmp(msg_type, "NOTICE") == 0 || + strcmp(msg_type, "CLOSED") == 0)) { + /* Capture NOTICE and CLOSED messages from the relay. + * These often contain auth-required or restriction + * notices. Pass the message content to the callback. */ + const char* notice_msg = ""; + if (cJSON_IsArray(parsed) && cJSON_GetArraySize(parsed) >= 2) { + cJSON* msg_json = cJSON_GetArrayItem(parsed, 1); + if (msg_json && cJSON_IsString(msg_json)) { + notice_msg = cJSON_GetStringValue(msg_json); + } + } + if (callback) { + callback(relay->url, msg_type, notice_msg, + relay->events_received, relay_count, + completed_relays, user_data); + } } if (msg_type) free(msg_type);