Added /raw command to the IRC client input to allow sending raw data to the server

This commit is contained in:
Dionysus 2024-05-25 19:56:17 -04:00
parent 171f46d401
commit 6da5a97bb2
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
2 changed files with 17 additions and 2 deletions

View File

@ -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

View File

@ -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);