Rename to deliveryAck

This commit is contained in:
Jazz Turner-Baggs 2025-09-05 16:19:26 -07:00
parent c151548516
commit a708a4e966
4 changed files with 14 additions and 13 deletions

View File

@ -12,7 +12,8 @@ import # Foreign
std/sequtils, std/sequtils,
strformat, strformat,
strutils, strutils,
tables tables,
types
import #local import #local
conversation_store, conversation_store,
@ -37,8 +38,8 @@ logScope:
type type
MessageCallback*[T] = proc(conversation: Conversation, msg: T): Future[void] {.async.} MessageCallback*[T] = proc(conversation: Conversation, msg: T): Future[void] {.async.}
NewConvoCallback* = proc(conversation: Conversation): Future[void] {.async.} NewConvoCallback* = proc(conversation: Conversation): Future[void] {.async.}
ReadReceiptCallback* = proc(conversation: Conversation, DeliveryAckCallback* = proc(conversation: Conversation,
msgId: string): Future[void] {.async.} msgId: MessageId): Future[void] {.async.}
type KeyEntry* = object type KeyEntry* = object
@ -56,7 +57,7 @@ type Client* = ref object
newMessageCallbacks: seq[MessageCallback[ContentFrame]] newMessageCallbacks: seq[MessageCallback[ContentFrame]]
newConvoCallbacks: seq[NewConvoCallback] newConvoCallbacks: seq[NewConvoCallback]
readReceiptCallbacks: seq[ReadReceiptCallback] deliveryAckCallbacks: seq[DeliveryAckCallback]
################################################# #################################################
# Constructors # Constructors
@ -136,12 +137,12 @@ proc notifyNewConversation(client: Client, convo: Conversation) =
for cb in client.newConvoCallbacks: for cb in client.newConvoCallbacks:
discard cb(convo) discard cb(convo)
proc onReadReceipt*(client: Client, callback: ReadReceiptCallback) = proc onDeliveryAck*(client: Client, callback: DeliveryAckCallback) =
client.readReceiptCallbacks.add(callback) client.deliveryAckCallbacks.add(callback)
proc notifyReadReceipt(client: Client, convo: Conversation, proc notifyDeliveryAck(client: Client, convo: Conversation,
messageId: MessageId) = messageId: MessageId) =
for cb in client.readReceiptCallbacks: for cb in client.deliveryAckCallbacks:
discard cb(convo, messageId) discard cb(convo, messageId)
################################################# #################################################
@ -213,7 +214,7 @@ proc newPrivateConversation*(client: Client,
let deliveryAckCb = proc( let deliveryAckCb = proc(
conversation: Conversation, conversation: Conversation,
msgId: string): Future[void] {.async.} = msgId: string): Future[void] {.async.} =
client.notifyReadReceipt(conversation, msgId) client.notifyDeliveryAck(conversation, msgId)
let convo = initPrivateV1(client.identity(), destPubkey, "default", deliveryAckCb) let convo = initPrivateV1(client.identity(), destPubkey, "default", deliveryAckCb)
client.addConversation(convo) client.addConversation(convo)

View File

@ -17,5 +17,5 @@ type
proc notifyNewMessage(self: Self, convo: Conversation, proc notifyNewMessage(self: Self, convo: Conversation,
content: ContentFrame) content: ContentFrame)
proc notifyReadReceipt(self: Self, convo: Conversation, proc notifyDeliveryAck(self: Self, convo: Conversation,
msgId: MessageId) msgId: MessageId)

View File

@ -75,7 +75,7 @@ proc createPrivateV1FromInvite*[T: ConversationStore](client: T,
let deliveryAckCb = proc( let deliveryAckCb = proc(
conversation: Conversation, conversation: Conversation,
msgId: string): Future[void] {.async.} = msgId: string): Future[void] {.async.} =
client.notifyReadReceipt(conversation, msgId) client.notifyDeliveryAck(conversation, msgId)
let convo = initPrivateV1(client.identity(), destPubkey, "default", deliveryAckCb) let convo = initPrivateV1(client.identity(), destPubkey, "default", deliveryAckCb)
notice "Creating PrivateV1 conversation", client = client.getId(), notice "Creating PrivateV1 conversation", client = client.getId(),

View File

@ -69,7 +69,7 @@ proc main() {.async.} =
"https://waku.org/theme/image/logo-black.svg")) "https://waku.org/theme/image/logo-black.svg"))
) )
saro.onReadReceipt(proc(convo: Conversation, msgId: string) {.async.} = saro.onDeliveryAck(proc(convo: Conversation, msgId: string) {.async.} =
echo " Saro -- Read Receipt for " & msgId echo " Saro -- Read Receipt for " & msgId
) )
@ -86,7 +86,7 @@ proc main() {.async.} =
echo " ------> Raya :: New Conversation: " & convo.id() echo " ------> Raya :: New Conversation: " & convo.id()
await convo.sendMessage(raya.ds, initTextFrame("Hello").toContentFrame()) await convo.sendMessage(raya.ds, initTextFrame("Hello").toContentFrame())
) )
raya.onReadReceipt(proc(convo: Conversation, msgId: string) {.async.} = raya.onDeliveryAck(proc(convo: Conversation, msgId: string) {.async.} =
echo " raya -- Read Receipt for " & msgId echo " raya -- Read Receipt for " & msgId
) )