mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-21 19:18:53 +00:00
Chat and message toString format
This commit is contained in:
parent
0ca50b4e06
commit
f46eed86d7
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
stickerHash*: string
|
||||
|
||||
proc `$`*(self: Message): string =
|
||||
result = fmt"Message(id:{self.id}, chatId:{self.chatId}, clock:{self.clock}, from:{self.fromAuthor}, type:{self.contentType})"
|
||||
|
Loading…
x
Reference in New Issue
Block a user