MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / setCurrentHotmailAccount

Function setCurrentHotmailAccount

background.js:1397–1417  ·  view source on GitHub ↗
(accountId, options = {})

Source from the content-addressed store, hash-verified

1395}
1396
1397async function setCurrentHotmailAccount(accountId, options = {}) {
1398 const { markUsed = false, syncEmail = true } = options;
1399 const state = await getState();
1400 const accounts = normalizeHotmailAccounts(state.hotmailAccounts);
1401 const account = findHotmailAccount(accounts, accountId);
1402 if (!account) {
1403 throw new Error('未找到对应的 Hotmail 账号。');
1404 }
1405
1406 if (markUsed) {
1407 account.lastUsedAt = Date.now();
1408 await syncHotmailAccounts(accounts.map((item) => (item.id === account.id ? account : item)));
1409 }
1410
1411 await setState({ currentHotmailAccountId: account.id });
1412 broadcastDataUpdate({ currentHotmailAccountId: account.id });
1413 if (syncEmail) {
1414 await setEmailState(account.email || null);
1415 }
1416 return account;
1417}
1418
1419async function ensureHotmailAccountForFlow(options = {}) {
1420 const { allowAllocate = true, markUsed = false, preferredAccountId = null } = options;

Callers 2

handleMessageFunction · 0.85

Calls 7

getStateFunction · 0.85
normalizeHotmailAccountsFunction · 0.85
findHotmailAccountFunction · 0.85
syncHotmailAccountsFunction · 0.85
setStateFunction · 0.85
broadcastDataUpdateFunction · 0.85
setEmailStateFunction · 0.85

Tested by

no test coverage detected