summaryrefslogtreecommitdiff
path: root/ircserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ircserver.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/ircserver.cpp b/ircserver.cpp
index 94456dc..8ccdbb9 100644
--- a/ircserver.cpp
+++ b/ircserver.cpp
@@ -7,3 +7,31 @@ IRCServer::IRCServer(Bouncer *_bouncer) : Server(_bouncer) {
void IRCServer::connect() {
Server::connect(config.hostname, config.port, config.useTls);
}
+
+
+void IRCServer::connectedEvent() {
+ printf("[IRCServer:%p] connectedEvent\n", this);
+
+ char buf[2048];
+
+ if (strlen(config.password) > 0) {
+ sprintf(buf, "PASS %s", config.password);
+ sendLine(buf);
+ }
+
+ sprintf(buf, "USER %s 0 * :%s\r\nNICK %s",
+ config.username, config.realname, config.nickname);
+ sendLine(buf);
+}
+void IRCServer::disconnectedEvent() {
+ printf("[IRCServer:%p] disconnectedEvent\n", this);
+}
+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]->authState == Client::AS_AUTHED)
+ bouncer->clients[i]->sendPacket(Packet::B2C_STATUS, pkt);
+}