Skip to content

Commit 345cc3d

Browse files
committed
Rename to deliveryAck
1 parent 4310e0f commit 345cc3d

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

src/chat_sdk/client.nim

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import # Foreign
1212
std/sequtils,
1313
strformat,
1414
strutils,
15-
tables
15+
tables,
16+
types
1617

1718
import #local
1819
conversation_store,
@@ -37,8 +38,8 @@ logScope:
3738
type
3839
MessageCallback*[T] = proc(conversation: Conversation, msg: T): Future[void] {.async.}
3940
NewConvoCallback* = proc(conversation: Conversation): Future[void] {.async.}
40-
ReadReceiptCallback* = proc(conversation: Conversation,
41-
msgId: string): Future[void] {.async.}
41+
DeliveryAckCallback* = proc(conversation: Conversation,
42+
msgId: MessageId): Future[void] {.async.}
4243

4344

4445
type KeyEntry* = object
@@ -56,7 +57,7 @@ type Client* = ref object
5657

5758
newMessageCallbacks: seq[MessageCallback[ContentFrame]]
5859
newConvoCallbacks: seq[NewConvoCallback]
59-
readReceiptCallbacks: seq[ReadReceiptCallback]
60+
deliveryAckCallbacks: seq[DeliveryAckCallback]
6061

6162
#################################################
6263
# Constructors
@@ -136,12 +137,12 @@ proc notifyNewConversation(client: Client, convo: Conversation) =
136137
for cb in client.newConvoCallbacks:
137138
discard cb(convo)
138139

139-
proc onReadReceipt*(client: Client, callback: ReadReceiptCallback) =
140-
client.readReceiptCallbacks.add(callback)
140+
proc onDeliveryAck*(client: Client, callback: DeliveryAckCallback) =
141+
client.deliveryAckCallbacks.add(callback)
141142

142-
proc notifyReadReceipt(client: Client, convo: Conversation,
143+
proc notifyDeliveryAck(client: Client, convo: Conversation,
143144
messageId: MessageId) =
144-
for cb in client.readReceiptCallbacks:
145+
for cb in client.deliveryAckCallbacks:
145146
discard cb(convo, messageId)
146147

147148
#################################################
@@ -213,7 +214,7 @@ proc newPrivateConversation*(client: Client,
213214
let deliveryAckCb = proc(
214215
conversation: Conversation,
215216
msgId: string): Future[void] {.async.} =
216-
client.notifyReadReceipt(conversation, msgId)
217+
client.notifyDeliveryAck(conversation, msgId)
217218

218219
let convo = initPrivateV1(client.identity(), destPubkey, "default", deliveryAckCb)
219220
client.addConversation(convo)

src/chat_sdk/conversation_store.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ type
1717

1818
proc notifyNewMessage(self: Self, convo: Conversation,
1919
content: ContentFrame)
20-
proc notifyReadReceipt(self: Self, convo: Conversation,
20+
proc notifyDeliveryAck(self: Self, convo: Conversation,
2121
msgId: MessageId)

src/chat_sdk/inbox.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ proc createPrivateV1FromInvite*[T: ConversationStore](client: T,
7575
let deliveryAckCb = proc(
7676
conversation: Conversation,
7777
msgId: string): Future[void] {.async.} =
78-
client.notifyReadReceipt(conversation, msgId)
78+
client.notifyDeliveryAck(conversation, msgId)
7979

8080
let convo = initPrivateV1(client.identity(), destPubkey, "default", deliveryAckCb)
8181
notice "Creating PrivateV1 conversation", client = client.getId(),

src/nim_chat_poc.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ proc main() {.async.} =
6969
"https://waku.org/theme/image/logo-black.svg"))
7070
)
7171

72-
saro.onReadReceipt(proc(convo: Conversation, msgId: string) {.async.} =
72+
saro.onDeliveryAck(proc(convo: Conversation, msgId: string) {.async.} =
7373
echo " Saro -- Read Receipt for " & msgId
7474
)
7575

@@ -86,7 +86,7 @@ proc main() {.async.} =
8686
echo " ------> Raya :: New Conversation: " & convo.id()
8787
await convo.sendMessage(raya.ds, initTextFrame("Hello").toContentFrame())
8888
)
89-
raya.onReadReceipt(proc(convo: Conversation, msgId: string) {.async.} =
89+
raya.onDeliveryAck(proc(convo: Conversation, msgId: string) {.async.} =
9090
echo " raya -- Read Receipt for " & msgId
9191
)
9292

0 commit comments

Comments
 (0)