MCPcopy Create free account
hub / github.com/Epic0522/Codex-Remote-Contact / extractAttributedBodyText

Function extractAttributedBodyText

src/server.js:2818–2829  ·  view source on GitHub ↗
(hex)

Source from the content-addressed store, hash-verified

2816}
2817
2818function extractAttributedBodyText(hex) {
2819 if (!hex) return "";
2820 const buffer = Buffer.from(String(hex), "hex");
2821 const marker = Buffer.from("NSString", "utf8");
2822 const markerIndex = buffer.indexOf(marker);
2823 if (markerIndex === -1) return "";
2824 const plusIndex = buffer.indexOf(0x2b, markerIndex + marker.length);
2825 if (plusIndex === -1 || plusIndex + 1 >= buffer.length) return "";
2826 const length = buffer[plusIndex + 1];
2827 if (length <= 0 || plusIndex + 2 + length > buffer.length) return "";
2828 return buffer.subarray(plusIndex + 2, plusIndex + 2 + length).toString("utf8").trim();
2829}
2830
2831async function initializeIMessageCursor() {
2832 const rows = await sqliteJson("select coalesce(max(ROWID), 0) as rowid from message;");

Callers 1

pollIMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected