aboutsummaryrefslogtreecommitdiff
path: root/http2irc.py
diff options
context:
space:
mode:
authorGravatar JustAnotherArchivist2019-12-15 15:38:00 +0000
committerGravatar JustAnotherArchivist2019-12-15 15:38:00 +0000
commita888c9b9cb423cb07ab01d45492b7909ef8e1eff (patch)
tree640820c455c8e1e66b7e8c8e541d6edd6b08182f /http2irc.py
parentHandle prefixed messages from the server (diff)
signature
Wait for connection registration before trying to join channels and send messages
Diffstat (limited to 'http2irc.py')
-rw-r--r--http2irc.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/http2irc.py b/http2irc.py
index d355ae4..cc06daf 100644
--- a/http2irc.py
+++ b/http2irc.py
@@ -215,9 +215,6 @@ class IRCClientProtocol(asyncio.Protocol):
nickb = self.config.irc.nick.encode('utf-8')
self.send(b'NICK ' + nickb)
self.send(b'USER ' + nickb + b' ' + nickb + b' ' + nickb + b' :' + self.config.irc.real.encode('utf-8'))
- self.send(b'JOIN ' + ','.join(self.channels).encode('utf-8')) #TODO: Split if too long
- asyncio.create_task(self.send_messages())
- asyncio.create_task(self.confirm_messages())
def update_channels(self, channels: set):
channelsToPart = self.channels - channels
@@ -310,6 +307,11 @@ class IRCClientProtocol(asyncio.Protocol):
self.send(b'PONG ' + message[5:])
elif message.startswith(b'PONG '):
self.pongReceivedEvent.set()
+ elif message.startswith(b'001 '):
+ # Connection registered
+ self.send(b'JOIN ' + ','.join(self.channels).encode('utf-8')) #TODO: Split if too long
+ asyncio.create_task(self.send_messages())
+ asyncio.create_task(self.confirm_messages())
def connection_lost(self, exc):
logging.info('The server closed the connection')