From 6da5a97bb29d4795f9879764cd35e7f22e2e911c Mon Sep 17 00:00:00 2001 From: acidvegas Date: Sat, 25 May 2024 19:56:17 -0400 Subject: [PATCH] Added /raw command to the IRC client input to allow sending raw data to the server --- README.md | 1 + src/main.ino | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ef4df7d..0535771 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ This is being developed in my free time as a fun project. It is no where near be - [X] Wifi scanning & selection menu - [ ] Saved wifi profiles - [X] IRC Client +- [X] `/raw` command for IRC client to send raw data to the server - [ ] ChatGPT - [ ] SSH Client - [ ] Wardriving diff --git a/src/main.ino b/src/main.ino index a66ac99..902f42b 100644 --- a/src/main.ino +++ b/src/main.ino @@ -236,8 +236,13 @@ void parseAndDisplay(String line) { void handleKeyboardInput(char key) { if (key == '\n' || key == '\r') { // Enter - sendIRC("PRIVMSG " + String(channel) + " :" + inputBuffer); - addLine(nick, inputBuffer, "message"); + if (inputBuffer.startsWith("/raw ")) { + String rawCommand = inputBuffer.substring(5); // Remove "/raw " + sendRawCommand(rawCommand); + } else { + sendIRC("PRIVMSG " + String(channel) + " :" + inputBuffer); + addLine(nick, inputBuffer, "message"); + } inputBuffer = ""; displayInputLine(); } else if (key == '\b') { // Backspace @@ -251,6 +256,15 @@ void handleKeyboardInput(char key) { } } +void sendRawCommand(String command) { + if (client.connected()) { + sendIRC(command); + Serial.println("Sent raw command: " + command); + } else { + Serial.println("Failed to send raw command: Not connected to IRC"); + } +} + char getKeyboardInput() { char incoming = 0; Wire.requestFrom(LILYGO_KB_SLAVE_ADDRESS, 1);