Skip to content

Commit 79f3f89

Browse files
author
bspkrs
committed
try to get DCC to allow secure connections
1 parent cc9c4f4 commit 79f3f89

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

BotBase.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def requestDCC(self, bot, sender, dest, cmd, args):
397397
if self.dccActive:
398398
host, port = self.dccSocket.getAddr()
399399
if self.dccSocket.addPending(sender):
400-
self.sendRaw(CmdGenerator.getDCCCHAT(sender.nick, host, port))
400+
self.sendRaw(CmdGenerator.getDCCCHAT(sender.nick, host, port, self.use_ssl))
401401
else:
402402
self.sendNotice(sender.nick, "§BDCC is not active on this bot.")
403403

IRCHandler.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,11 @@ def getWHOIS(cls, nick):
137137
return "WHOIS {nick}".format(nick = nick) + EOL
138138

139139
@classmethod
140-
def getDCCCHAT(cls, dest, addr, port):
141-
ctcpmsg = CmdGenerator.getCTCP("DCC CHAT chat {addr} {port}".format(addr=CmdGenerator.conv_ip_std_long(addr), port=port))
140+
def getDCCCHAT(cls, dest, addr, port, use_ssl):
141+
if use_ssl:
142+
ctcpmsg = CmdGenerator.getCTCP("DCC SCHAT chat {addr} {port}".format(addr=CmdGenerator.conv_ip_std_long(addr), port=port))
143+
else:
144+
ctcpmsg = CmdGenerator.getCTCP("DCC CHAT chat {addr} {port}".format(addr=CmdGenerator.conv_ip_std_long(addr), port=port))
142145
privmsg = CmdGenerator.getPRIVMSG(dest, ctcpmsg)
143146
return privmsg
144147

@@ -147,9 +150,9 @@ def conv_ip_long_std(cls, longip):
147150
try:
148151
ip = long(longip)
149152
except ValueError:
150-
return '0.0.0.0'
153+
return longip
151154
if ip >= 2 ** 32:
152-
return '0.0.0.0'
155+
return longip
153156
address = [str(ip >> shift & 0xFF) for shift in [24, 16, 8, 0]]
154157
return '.'.join(address)
155158

@@ -163,9 +166,9 @@ def conv_ip_std_long(cls, stdip):
163166
try:
164167
ip_part = int(part)
165168
except ValueError:
166-
return 0
169+
return stdip
167170
if ip_part >= 2 ** 8:
168-
return 0
171+
return stdip
169172
longip += ip_part << shift
170173
return longip
171174

0 commit comments

Comments
 (0)