firemail
标题:
MailSpring源码分析--同步邮件 重试 邮件数据的处理
[打印本页]
作者:
Qter
时间:
2020-10-12 15:27
标题:
MailSpring源码分析--同步邮件 重试 邮件数据的处理
本帖最后由 Qter 于 2020-10-13 18:09 编辑
retry.png
(4.69 KB, 下载次数: 618)
下载附件
2020-10-12 15:26 上传
app\internal_packages\notifications\lib\items\account-error-notif.tsx
this._onCheckAgain([erroredAccount]),
_onCheckAgain(accounts) {
accounts.forEach(acct => AppEnv.mailsyncBridge.forceRelaunchClient(acct));
}
app\src\flux\mailsync-bridge.ts
async forceRelaunchClient(account: Account) {
const keys = await KeyManager._getKeyHash();
this._launchClient(account, keys, { force: true });
}
async _launchClient(account: Account, keys, { force }: { force?: boolean } = {}) {
const client = new MailsyncProcess(this._getClientConfiguration());
const fullAccountJSON = (await KeyManager.insertAccountSecrets(account, keys)).toJSON();
client.account = fullAccountJSON;
client.identity = IdentityStore.identity();
client.sync();
client.on('deltas', this._onIncomingMessages);
}
_onIncomingMessages = msgs => {
for (const msg of msgs) {
const models = modelJSONs.map(Utils.convertToModel);
this._onIncomingChangeRecord(
new DatabaseChangeRecord({
type, // TODO BG move to "model" naming style, finding all uses might be tricky
objectClass: modelClass,
objects: models,
objectsRawJSON: modelJSONs,
})
);
}
}
app\src\mailsync-process.ts
sync() {
this._spawnProcess('sync');
const msgs = outBuffer.split('\n');
outBuffer = msgs.pop();
this.emit('deltas', msgs);
}
复制代码
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3