import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime"; import { normalizeIrcAllowlist, resolveIrcAllowlistMatch } from "./normalize.js"; import type { IrcAccountConfig, IrcChannelConfig } from "./types.js"; import type { IrcInboundMessage } from "./types.js";
// IRC channel targets are case-insensitive, but config keys are plain strings. // To avoid surprising drops (e.g. "#TUIRC-DEV" vs "#tuirc-dev"), match // group config keys case-insensitively. const direct = groups[params.target]; if (direct) { return { // "allowed" means the target matched an allowlisted key. // Explicit disables are handled later by resolveIrcGroupAccessGate.
allowed: true,
groupConfig: direct,
wildcardConfig: groups["*"],
hasConfiguredGroups,
};
}
const targetLower = normalizeLowercaseStringOrEmpty(params.target); const directKey = Object.keys(groups).find(
(key) => normalizeLowercaseStringOrEmpty(key) === targetLower,
); if (directKey) { const matched = groups[directKey]; if (matched) { return { // "allowed" means the target matched an allowlisted key. // Explicit disables are handled later by resolveIrcGroupAccessGate.
allowed: true,
groupConfig: matched,
wildcardConfig: groups["*"],
hasConfiguredGroups,
};
}
}
const wildcard = groups["*"]; if (wildcard) { return { // "allowed" means the target matched an allowlisted key. // Explicit disables are handled later by resolveIrcGroupAccessGate.
allowed: true,
wildcardConfig: wildcard,
hasConfiguredGroups,
};
} return {
allowed: false,
hasConfiguredGroups,
};
}
// In open mode, unconfigured channels are allowed (mention-gated) but explicit // per-channel/wildcard disables still apply. if (policy === "allowlist") { if (!params.groupMatch.hasConfiguredGroups) { return {
allowed: false,
reason: "groupPolicy=allowlist and no groups configured",
};
} if (!params.groupMatch.allowed) { return { allowed: false, reason: "not allowlisted" };
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.