summaryrefslogtreecommitdiff
path: root/ircserver.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2014-01-22 09:31:30 +0100
committerTreeki <treeki@gmail.com>2014-01-22 09:31:30 +0100
commite3e6a3f2c422a6b82b234f575a6b3bad459e5e0b (patch)
tree411f501c1e5ee85228607d1440df341be0b66c4c /ircserver.cpp
parentf458a0b65de5db40ecb57d5831117305fc4dd876 (diff)
downloadbounce4-e3e6a3f2c422a6b82b234f575a6b3bad459e5e0b.tar.gz
bounce4-e3e6a3f2c422a6b82b234f575a6b3bad459e5e0b.zip
add window management, move hacky Python client over to PyQt5
Diffstat (limited to '')
-rw-r--r--ircserver.cpp24
1 files changed, 17 insertions, 7 deletions
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);
}