diff --git a/src/status/chat/chat.nim b/src/status/chat/chat.nim index ebc85961d4..684e81b5ae 100644 --- a/src/status/chat/chat.nim +++ b/src/status/chat/chat.nim @@ -5,7 +5,9 @@ type ChatType* {.pure.}= enum Unknown = 0, OneToOne = 1, Public = 2, - PrivateGroupChat = 3 + PrivateGroupChat = 3, + Profile = 4, + Timeline = 5 proc isOneToOne*(self: ChatType): bool = self == ChatType.OneToOne diff --git a/src/status/signals/messages.nim b/src/status/signals/messages.nim index 624b3f810e..1f536c3a32 100644 --- a/src/status/signals/messages.nim +++ b/src/status/signals/messages.nim @@ -109,13 +109,17 @@ proc newChat*(id: string, chatType: ChatType): Chat = result.name = id proc toChat*(jsonChat: JsonNode): Chat = + + let chatTypeInt = jsonChat{"chatType"}.getInt + let chatType: ChatType = if chatTypeInt >= ord(low(ChatType)) or chatTypeInt <= ord(high(ChatType)): ChatType(chatTypeInt) else: ChatType.Unknown + result = Chat( id: jsonChat{"id"}.getStr, name: jsonChat{"name"}.getStr, identicon: "", color: jsonChat{"color"}.getStr, isActive: jsonChat{"active"}.getBool, - chatType: ChatType(jsonChat{"chatType"}.getInt), + chatType: chatType, timestamp: jsonChat{"timestamp"}.getBiggestInt, lastClockValue: jsonChat{"lastClockValue"}.getBiggestInt, deletedAtClockValue: jsonChat{"deletedAtClockValue"}.getBiggestInt,