add mailserver layer to status lib; remove references to libstatus mailservers

This commit is contained in:
Iuri Matias 2021-06-08 11:43:10 -04:00
parent ceb7f85e4e
commit be696ad20f
5 changed files with 27 additions and 6 deletions

View File

@ -6,7 +6,6 @@ import
import # status-desktop libs
../../status/chat/chat as status_chat, ./views/communities,
../../status/libstatus/mailservers as status_mailservers,
../../status/tasks/marathon,
../../status/tasks/marathon/mailserver/worker,
../../status/libstatus/mailservers # TODO: needed for MailserverTopic type, remove?

View File

@ -1,8 +1,7 @@
import NimQml, Tables, json, sequtils, chronicles, times, re, sugar, strutils, os, strformat, algorithm
import ../../status/status
import ../../status/[status, mailservers]
import ../../status/libstatus/chat as libstatus_chat
import ../../status/libstatus/accounts/constants
import ../../status/libstatus/mailservers as status_mailservers
import ../../status/libstatus/chat as core_chat
import ../../status/libstatus/utils as status_utils
import ../../status/accounts as status_accounts
@ -749,7 +748,7 @@ QtObject:
proc fillGaps*(self: ChatsView, messageId: string) {.slot.} =
self.loadingMessages = true
self.loadingMessagesChanged(true)
discard status_mailservers.fillGaps(self.activeChannel.id, @[messageId])
discard self.status.mailservers.fillGaps(self.activeChannel.id, @[messageId])
proc leaveActiveChat*(self: ChatsView) {.slot.} =
self.status.chat.leave(self.activeChannel.id)

View File

@ -1,6 +1,5 @@
import NimQml, json, strutils, sugar, sequtils, tables
import json_serialization
import ../../status/libstatus/mailservers as status_mailservers
import ../../status/signals/types
import ../../status/libstatus/accounts/constants
import ../../status/libstatus/types as status_types

View File

@ -0,0 +1,22 @@
import json, json_serialization
import
sugar, sequtils, strutils, atomics
import libstatus/mailservers as status_mailservers
import ../eventemitter
import signals/types
#TODO: temporary?
import libstatus/types as LibStatusTypes
type
MailserversModel* = ref object
events*: EventEmitter
proc newMailserversModel*(events: EventEmitter): MailserversModel =
result = MailserversModel()
result.events = events
proc fillGaps*(self: MailserversModel, chatId: string, messageIds: seq[string]): string =
result = status_mailservers.fillGaps(chatId, messageIds)

View File

@ -2,7 +2,7 @@ import libstatus/accounts as libstatus_accounts
import libstatus/core as libstatus_core
import libstatus/settings as libstatus_settings
import libstatus/types as libstatus_types
import chat, accounts, wallet, node, network, messages, contacts, profile, stickers, permissions, fleet, settings
import chat, accounts, wallet, node, network, messages, contacts, profile, stickers, permissions, fleet, settings, mailservers
import ../eventemitter
import ./tasks/task_runner_impl
@ -23,6 +23,7 @@ type Status* = ref object
permissions*: PermissionsModel
tasks*: TaskRunner
settings*: SettingsModel
mailservers*: MailserversModel
proc newStatusInstance*(fleetConfig: string): Status =
result = Status()
@ -41,6 +42,7 @@ proc newStatusInstance*(fleetConfig: string): Status =
result.stickers = stickers.newStickersModel(result.events)
result.permissions = permissions.newPermissionsModel(result.events)
result.settings = settings.newSettingsModel(result.events)
result.mailservers = mailservers.newMailserversModel(result.events)
proc initNode*(self: Status) =
self.tasks.init()