Skip to content
This repository was archived by the owner on Feb 21, 2018. It is now read-only.

Commit dfdbfe1

Browse files
committed
protocol/inspircd: monkey-patch Cod().join()
1 parent 2ce8536 commit dfdbfe1

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

modules/protocol/inspircd.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@
3131
DESC="Handles login and protocol commands for inspircd"
3232

3333
def initModule(cod):
34-
cod.log("Lol not updated", "!!!")
35-
sys.exit(-1)
36-
3734
cod.loginFunc = login
35+
cod.join = join
3836
cod.burstClient = burstClient
3937

4038
cod.s2scommands["UID"] = [handleUID]
@@ -56,9 +54,6 @@ def initModule(cod):
5654
cod.s2scommands["AWAY"] = [nullCommand]
5755

5856
def destroyModule(cod):
59-
del cod.loginFunc
60-
cod.loginFunc = None
61-
6257
del cod.s2scommands["UID"]
6358
del cod.s2scommands["QUIT"]
6459
del cod.s2scommands["FJOIN"]
@@ -82,6 +77,18 @@ def destroyModule(cod):
8277
def rehash():
8378
pass
8479

80+
# Monkey-patch join because inspircd is weird
81+
def join(self, channel, client=None):
82+
if client is None:
83+
client = self.client
84+
85+
if channel not in self.channels:
86+
self.channels[channel] = Channel(channel, int(time.time()))
87+
88+
channel = self.channels[channel]
89+
90+
self.sendLine(":%s JOIN %s %s" % (client.uid, channel.name, channel.ts))
91+
8592
def burstClient(cod, nick, user, host, real, uid=None):
8693
if uid is None:
8794
uid = cod.getUID()

0 commit comments

Comments
 (0)