diff --git a/src/signals/messages.nim b/src/signals/messages.nim index 749eec623c..c410842a38 100644 --- a/src/signals/messages.nim +++ b/src/signals/messages.nim @@ -90,7 +90,7 @@ proc toMessage*(jsonMsg: JsonNode): Message = contentType: ContentType(jsonMsg{"contentType"}.getInt), ensName: jsonMsg{"ensName"}.getStr, fromAuthor: jsonMsg{"from"}.getStr, - id: jsonMsg{"identicon"}.getStr, + id: jsonMsg{"id"}.getStr, identicon: jsonMsg{"identicon"}.getStr, lineCount: jsonMsg{"lineCount"}.getInt, localChatId: jsonMsg{"localChatId"}.getStr, diff --git a/src/status/chat/chat.nim b/src/status/chat/chat.nim index 05a41a67cd..0161a3d260 100644 --- a/src/status/chat/chat.nim +++ b/src/status/chat/chat.nim @@ -1,4 +1,5 @@ import message +import strformat type ChatType* {.pure.}= enum Unknown = 0, @@ -30,6 +31,9 @@ type Chat* = ref object members*: seq[ChatMember] # membershipUpdateEvents # ? +proc `$`*(self: Chat): string = + result = fmt"Chat(id:{self.id}, name:{self.name}, active:{self.isActive}, type:{self.chatType})" + proc findIndexById*(self: seq[Chat], id: string): int = result = -1 var idx = -1 diff --git a/src/status/chat/message.nim b/src/status/chat/message.nim index 77dd2abf33..70af5bf435 100644 --- a/src/status/chat/message.nim +++ b/src/status/chat/message.nim @@ -1,3 +1,5 @@ +import strformat + type ContentType* {.pure.} = enum ChatIdentifier = -1, Unknown = 0, @@ -32,4 +34,7 @@ type Message* = object timestamp*: string whisperTimestamp*: string isCurrentUser*: bool - stickerHash*: string \ No newline at end of file + stickerHash*: string + +proc `$`*(self: Message): string = + result = fmt"Message(id:{self.id}, chatId:{self.chatId}, clock:{self.clock}, from:{self.fromAuthor}, type:{self.contentType})"