@bobfrankston/rmfmail 1.0.702 → 1.0.704

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6411,7 +6411,13 @@ async function openCompose(mode) {
6411
6411
  const account = accounts.find((a) => a.id === accountId);
6412
6412
  const explicitDomains = (account?.identityDomains || []).map((d) => d.toLowerCase());
6413
6413
  const accountDomain = (account?.email || "").split("@")[1]?.toLowerCase();
6414
- const identityDomains = explicitDomains.length > 0 ? explicitDomains : accountDomain ? [accountDomain] : [];
6414
+ function foldDomains(list) {
6415
+ const unique = Array.from(new Set(list));
6416
+ return unique.filter((d) => !unique.some((p) => p !== d && d.endsWith(`.${p}`)));
6417
+ }
6418
+ const identityDomains = foldDomains(
6419
+ explicitDomains.length > 0 ? explicitDomains : accountDomain ? [accountDomain] : []
6420
+ );
6415
6421
  function detectReplyFrom() {
6416
6422
  if (!msg) return void 0;
6417
6423
  if (msg.deliveredTo) {
@@ -6433,6 +6439,33 @@ async function openCompose(mode) {
6433
6439
  console.log(`[compose] no identity match`);
6434
6440
  return void 0;
6435
6441
  }
6442
+ if (msg) {
6443
+ try {
6444
+ const dump = {
6445
+ mode,
6446
+ accountId,
6447
+ hasMsg: true,
6448
+ from: msg.from || null,
6449
+ toLen: Array.isArray(msg.to) ? msg.to.length : -1,
6450
+ ccLen: Array.isArray(msg.cc) ? msg.cc.length : -1,
6451
+ deliveredTo: msg.deliveredTo || "",
6452
+ identityDomains,
6453
+ subject: msg.subject || ""
6454
+ };
6455
+ const apiClient = window.mailxapi;
6456
+ if (apiClient?.logClientEvent) {
6457
+ apiClient.logClientEvent("reply-init", dump);
6458
+ } else {
6459
+ console.log("[reply-init]", dump);
6460
+ }
6461
+ } catch {
6462
+ }
6463
+ } else {
6464
+ try {
6465
+ window.mailxapi?.logClientEvent?.("reply-init", { mode, accountId, hasMsg: false });
6466
+ } catch {
6467
+ }
6468
+ }
6436
6469
  if (msg && mode === "reply") {
6437
6470
  init.to = msg.from ? [msg.from] : [];
6438
6471
  init.subject = `Re: ${cleanSubject}`;