~emersion/public-inbox

gamja: Add support for incoming binary packets v1 PROPOSED

~k4be
This will enhance compatibility with some existing IRCds/IRC networks.

k4be (1):
  Add support for incoming binary packets

 lib/client.js | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

-- 
2.32.0
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/24536/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gamja 1/1] Add support for incoming binary packets Export this patch

~k4be
From: k4be <k4be@pirc.pl>

---
 lib/client.js | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/client.js b/lib/client.js
index 1622479..d205a06 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -160,7 +160,20 @@ export default class Client extends EventTarget {
	}

	handleMessage(event) {
		let msg = irc.parseMessage(event.data);
		if (typeof event.data === 'string' || event.data instanceof String) {
			let msg = irc.parseMessage(event.data);
			this.processMessage(msg);
		} else {
			let reader = new FileReader();
			reader.addEventListener("loadend", function() {
				let msg = irc.parseMessage(reader.result);
				this.processMessage(msg);
			}.bind(this));
			reader.readAsText(event.data);
		}
	}
	
	processMessage(msg) {
		console.debug("Received:", msg);

		// If the prefix is missing, assume it's coming from the server on the
-- 
2.32.0