mirror of
https://github.com/logos-messaging/logos-chat.git
synced 2026-05-03 03:03:10 +00:00
Add Context
This commit is contained in:
parent
f5bf1f30f2
commit
28c292d0db
@ -6,10 +6,11 @@
|
|||||||
import # Foreign
|
import # Foreign
|
||||||
chronicles,
|
chronicles,
|
||||||
chronos,
|
chronos,
|
||||||
|
libchat,
|
||||||
sds,
|
sds,
|
||||||
sequtils,
|
sequtils,
|
||||||
std/tables,
|
|
||||||
std/sequtils,
|
std/sequtils,
|
||||||
|
std/tables,
|
||||||
strformat,
|
strformat,
|
||||||
strutils,
|
strutils,
|
||||||
tables,
|
tables,
|
||||||
@ -49,6 +50,7 @@ type KeyEntry* = object
|
|||||||
|
|
||||||
type ChatClient* = ref object
|
type ChatClient* = ref object
|
||||||
ident: Identity
|
ident: Identity
|
||||||
|
libchatCtx: LibChat
|
||||||
ds*: WakuClient
|
ds*: WakuClient
|
||||||
keyStore: Table[string, KeyEntry] # Keyed by HexEncoded Public Key
|
keyStore: Table[string, KeyEntry] # Keyed by HexEncoded Public Key
|
||||||
conversations: Table[string, Conversation] # Keyed by conversation ID
|
conversations: Table[string, Conversation] # Keyed by conversation ID
|
||||||
@ -75,6 +77,8 @@ proc newClient*(ds: WakuClient, ident: Identity): ChatClient {.raises: [IOError,
|
|||||||
|
|
||||||
var q = QueueRef(queue: newAsyncQueue[ChatPayload](10))
|
var q = QueueRef(queue: newAsyncQueue[ChatPayload](10))
|
||||||
var c = ChatClient(ident: ident,
|
var c = ChatClient(ident: ident,
|
||||||
|
var c = ChatClient(
|
||||||
|
libchatCtx: newConversationsContext(),
|
||||||
ds: ds,
|
ds: ds,
|
||||||
keyStore: initTable[string, KeyEntry](),
|
keyStore: initTable[string, KeyEntry](),
|
||||||
conversations: initTable[string, Conversation](),
|
conversations: initTable[string, Conversation](),
|
||||||
@ -88,6 +92,9 @@ proc newClient*(ds: WakuClient, ident: Identity): ChatClient {.raises: [IOError,
|
|||||||
|
|
||||||
notice "Client started", client = c.ident.getName(),
|
notice "Client started", client = c.ident.getName(),
|
||||||
defaultInbox = defaultInbox, inTopic= topic_inbox(c.ident.get_addr())
|
defaultInbox = defaultInbox, inTopic= topic_inbox(c.ident.get_addr())
|
||||||
|
|
||||||
|
# Set LibChatBufferSize
|
||||||
|
c.libchatCtx.setBufferSize(256);
|
||||||
result = c
|
result = c
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error "newCLient", err = e.msg
|
error "newCLient", err = e.msg
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user