From bb7997a751eb3dfd2aacd6a5c2e6173b50d8ab85 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Wed, 25 Feb 2026 15:26:20 -0600 Subject: [PATCH] fix sendmessage --- source/cell.h | 7 +++---- source/scheduler.c | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/cell.h b/source/cell.h index bb3e24dc..55260316 100644 --- a/source/cell.h +++ b/source/cell.h @@ -1152,17 +1152,16 @@ JSValue CELL_USE_NAME(JSContext *js) { \ JSValue CELL_USE_NAME(JSContext *js) { do { c ; } while(0); } /* ============================================================ - WOTA Message Sending — C modules can send messages to actors - without needing a JSContext. + WOTA Message Sending — C modules can send messages to actors. ============================================================ */ /* Check whether an actor with the given ID exists. */ int JS_ActorExists(const char *actor_id); -/* Send a WOTA-encoded message to an actor by ID. +/* Send a WOTA-encoded message to the actor that owns ctx. Takes ownership of wb's data on success (caller must not free). On failure returns an error string; caller must free wb. */ -const char *JS_SendMessage(const char *actor_id, WotaBuffer *wb); +const char *JS_SendMessage(JSContext *ctx, WotaBuffer *wb); #undef js_unlikely #undef inline diff --git a/source/scheduler.c b/source/scheduler.c index 49ddea5b..085db44e 100644 --- a/source/scheduler.c +++ b/source/scheduler.c @@ -1060,7 +1060,7 @@ int JS_ActorExists(const char *actor_id) return actor_exists(actor_id); } -const char *JS_SendMessage(const char *actor_id, WotaBuffer *wb) +const char *JS_SendMessage(JSContext *ctx, WotaBuffer *wb) { if (!wb || !wb->data || wb->size == 0) return "Empty WOTA buffer"; @@ -1072,7 +1072,7 @@ const char *JS_SendMessage(const char *actor_id, WotaBuffer *wb) blob_write_bytes(msg, wb->data, byte_len); blob_make_stone(msg); - const char *err = send_message(actor_id, msg); + const char *err = send_message(ctx->id, msg); if (!err) { /* Success — send_message took ownership of the blob. Free the WotaBuffer internals since we consumed them. */