From e3e6a3f2c422a6b82b234f575a6b3bad459e5e0b Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 22 Jan 2014 09:31:30 +0100 Subject: add window management, move hacky Python client over to PyQt5 --- ircserver.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'ircserver.cpp') diff --git a/ircserver.cpp b/ircserver.cpp index 830c82b..f2189b2 100644 --- a/ircserver.cpp +++ b/ircserver.cpp @@ -1,16 +1,29 @@ #include "core.h" -IRCServer::IRCServer(Bouncer *_bouncer) : Server(_bouncer) { - bouncer = _bouncer; +IRCServer::IRCServer(Bouncer *_bouncer) : + Server(_bouncer), + bouncer(_bouncer), + status(this) +{ +} + +IRCServer::~IRCServer() { + bouncer->deregisterWindow(&status); +} + +void IRCServer::attachedToCore() { + bouncer->registerWindow(&status); } void IRCServer::connect() { + status.pushMessage("Connecting..."); Server::connect(config.hostname, config.port, config.useTls); } void IRCServer::connectedEvent() { printf("[IRCServer:%p] connectedEvent\n", this); + status.pushMessage("Connected, identifying to IRC..."); char buf[2048]; @@ -25,13 +38,10 @@ void IRCServer::connectedEvent() { } void IRCServer::disconnectedEvent() { printf("[IRCServer:%p] disconnectedEvent\n", this); + status.pushMessage("Disconnected."); } void IRCServer::lineReceivedEvent(char *line, int size) { printf("[%d] { %s }\n", size, line); - Buffer pkt; - pkt.writeStr(line, size); - for (int i = 0; i < bouncer->clientCount; i++) - if (bouncer->clients[i]->isAuthed()) - bouncer->clients[i]->sendPacket(Packet::B2C_STATUS, pkt); + status.pushMessage(line); } -- cgit v1.2.3