parent
95407cc1e0
commit
1cca25e08d
|
@ -188,7 +188,6 @@ QtObject:
|
||||||
self.channelGroups[channelGroupId].chats.add(chat)
|
self.channelGroups[channelGroupId].chats.add(chat)
|
||||||
else:
|
else:
|
||||||
self.channelGroups[channelGroupId].chats[index] = chat
|
self.channelGroups[channelGroupId].chats[index] = chat
|
||||||
|
|
||||||
|
|
||||||
proc parseChatResponse*(self: Service, response: RpcResponse[JsonNode]): (seq[ChatDto], seq[MessageDto]) =
|
proc parseChatResponse*(self: Service, response: RpcResponse[JsonNode]): (seq[ChatDto], seq[MessageDto]) =
|
||||||
var chats: seq[ChatDto] = @[]
|
var chats: seq[ChatDto] = @[]
|
||||||
|
@ -204,24 +203,14 @@ QtObject:
|
||||||
chats.add(chat)
|
chats.add(chat)
|
||||||
result = (chats, messages)
|
result = (chats, messages)
|
||||||
|
|
||||||
proc processMessageUpdateAfterSend*(self: Service, response: RpcResponse[JsonNode]): (seq[ChatDto], seq[MessageDto]) =
|
proc processMessageUpdateAfterSend*(self: Service, response: RpcResponse[JsonNode]): (seq[ChatDto], seq[MessageDto]) =
|
||||||
result = self.parseChatResponse(response)
|
result = self.parseChatResponse(response)
|
||||||
var (chats, messages) = result
|
var (chats, messages) = result
|
||||||
if chats.len == 0 or messages.len == 0:
|
if chats.len == 0 or messages.len == 0:
|
||||||
error "no chats or messages in the parsed response"
|
error "no chats or messages in the parsed response"
|
||||||
return
|
return
|
||||||
|
|
||||||
# The reason why we are sending all the messages with responseTo filled in is because
|
for msg in messages:
|
||||||
# the reposnse from status_go doesnt necessarily contain the last reply on the 0th position.
|
|
||||||
var isaReply = false
|
|
||||||
var msg = messages[0]
|
|
||||||
for m in messages:
|
|
||||||
if(m.responseTo.len > 0):
|
|
||||||
isaReply = true
|
|
||||||
msg = m
|
|
||||||
self.events.emit(SIGNAL_SENDING_SUCCESS, MessageSendingSuccess(message: msg, chat: chats[0]))
|
|
||||||
|
|
||||||
if not isaReply:
|
|
||||||
self.events.emit(SIGNAL_SENDING_SUCCESS, MessageSendingSuccess(message: msg, chat: chats[0]))
|
self.events.emit(SIGNAL_SENDING_SUCCESS, MessageSendingSuccess(message: msg, chat: chats[0]))
|
||||||
|
|
||||||
proc processUpdateForTransaction*(self: Service, messageId: string, response: RpcResponse[JsonNode]) =
|
proc processUpdateForTransaction*(self: Service, messageId: string, response: RpcResponse[JsonNode]) =
|
||||||
|
@ -243,7 +232,7 @@ QtObject:
|
||||||
if (showWarning):
|
if (showWarning):
|
||||||
warn "trying to get chat data for an unexisting chat id", chatId
|
warn "trying to get chat data for an unexisting chat id", chatId
|
||||||
return
|
return
|
||||||
|
|
||||||
return self.chats[chatId]
|
return self.chats[chatId]
|
||||||
|
|
||||||
proc getOneToOneChatNameAndImage*(self: Service, chatId: string):
|
proc getOneToOneChatNameAndImage*(self: Service, chatId: string):
|
||||||
|
|
|
@ -464,7 +464,7 @@ Item {
|
||||||
index += 8 // "<a href="
|
index += 8 // "<a href="
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
let addrEndIndex = message.indexOf('"', addrIndex)
|
let addrEndIndex = message.indexOf("\"", addrIndex)
|
||||||
if (addrEndIndex < 0) {
|
if (addrEndIndex < 0) {
|
||||||
index += 8 // "<a href="
|
index += 8 // "<a href="
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue