Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1210|回复: 0
打印 上一主题 下一主题

MailSpring源码分析--同步邮件 重试 邮件数据的处理

[复制链接]

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
跳转到指定楼层
楼主
发表于 2020-10-12 15:27:46 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Qter 于 2020-10-13 18:09 编辑

  1. app\internal_packages\notifications\lib\items\account-error-notif.tsx
  2. this._onCheckAgain([erroredAccount]),
  3.   _onCheckAgain(accounts) {
  4.   accounts.forEach(acct => AppEnv.mailsyncBridge.forceRelaunchClient(acct));
  5.   }
  6.   

  7. app\src\flux\mailsync-bridge.ts
  8. async forceRelaunchClient(account: Account) {
  9.   const keys = await KeyManager._getKeyHash();
  10.   this._launchClient(account, keys, { force: true });
  11. }

  12. async _launchClient(account: Account, keys, { force }: { force?: boolean } = {}) {
  13.   const client = new MailsyncProcess(this._getClientConfiguration());
  14.     const fullAccountJSON = (await KeyManager.insertAccountSecrets(account, keys)).toJSON();
  15.    client.account = fullAccountJSON;
  16.     client.identity = IdentityStore.identity();
  17.     client.sync();
  18.     client.on('deltas', this._onIncomingMessages);
  19. }

  20. _onIncomingMessages = msgs => {
  21. for (const msg of msgs) {
  22.       const models = modelJSONs.map(Utils.convertToModel);
  23.       this._onIncomingChangeRecord(
  24.         new DatabaseChangeRecord({
  25.           type, // TODO BG move to "model" naming style, finding all uses might be tricky
  26.           objectClass: modelClass,
  27.           objects: models,
  28.           objectsRawJSON: modelJSONs,
  29.         })
  30.       );
  31. }
  32. }

  33. app\src\mailsync-process.ts
  34. sync() {
  35. this._spawnProcess('sync');
  36.   const msgs = outBuffer.split('\n');
  37.           outBuffer = msgs.pop();
  38.           this.emit('deltas', msgs);
  39. }
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-5-4 03:28 , Processed in 0.079123 second(s), 22 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表