fix 9597 mailserver when login offline

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2019-12-06 15:41:54 +01:00
parent 54cf783d5b
commit 4fa275bb05
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
1 changed files with 19 additions and 15 deletions

View File

@ -287,21 +287,25 @@
- mailserver connected: we mark the mailserver as trusted peer" - mailserver connected: we mark the mailserver as trusted peer"
[{:keys [db] :as cofx} previous-summary] [{:keys [db] :as cofx} previous-summary]
(when (:multiaccount db) (when (:multiaccount db)
(let [{:keys [peers-summary peers-count]} db (if (:mailserver/current-id db)
{:keys [address sym-key-id] :as mailserver} (fetch-current db) (let [{:keys [peers-summary peers-count]} db
mailserver-was-registered? (registered-peer? previous-summary {:keys [address sym-key-id] :as mailserver} (fetch-current db)
address) mailserver-was-registered? (registered-peer? previous-summary
mailserver-is-registered? (registered-peer? peers-summary address)
address) mailserver-is-registered? (registered-peer? peers-summary
mailserver-added? (and mailserver-is-registered? address)
(not mailserver-was-registered?)) mailserver-added? (and mailserver-is-registered?
mailserver-removed? (and mailserver-was-registered? (not mailserver-was-registered?))
(not mailserver-is-registered?))] mailserver-removed? (and mailserver-was-registered?
(cond (not mailserver-is-registered?))]
mailserver-added? (cond
(mark-trusted-peer cofx) mailserver-added?
mailserver-removed? (mark-trusted-peer cofx)
(connect-to-mailserver cofx))))) mailserver-removed?
(connect-to-mailserver cofx)))
;; if there is no current mailserver defined,
;; we set it first
(set-current-mailserver cofx))))
(defn adjust-request-for-transit-time (defn adjust-request-for-transit-time
[from] [from]