Fix various error on DCC connection and post treated messages

This commit is contained in:
Némunaire 2012-11-06 04:14:55 +01:00
parent aa697a36d0
commit 02bebb663c
3 changed files with 14 additions and 6 deletions

3
bot.py
View File

@ -28,6 +28,7 @@ import event
import hooks
from networkbot import NetworkBot
from IRCServer import IRCServer
from DCC import DCC
import response
ID_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
@ -94,7 +95,7 @@ class Bot:
def _ctcp_dcc(self, srv, msg):
"""Response to DCC CTCP message"""
ip = self.srv.toIP(int(msg.cmds[3]))
ip = srv.toIP(int(msg.cmds[3]))
conn = DCC(srv, msg.sender)
if conn.accept_user(ip, int(msg.cmds[4])):
srv.dcc_clients[conn.sender] = conn

View File

@ -109,7 +109,10 @@ def replace_variables(cnt, msg=None):
def treat_variables(res):
for i in range(0, len(res.messages)):
res.messages[i] = replace_variables(res.messages[i], res)
if isinstance(res.messages[i], list):
res.messages[i] = replace_variables(", ".join(res.messages[i]), res)
else:
res.messages[i] = replace_variables(res.messages[i], res)
return True
def treat_alias(msg, hooks_cache):

View File

@ -41,10 +41,14 @@ class Response:
@property
def content(self):
if self.title is not None:
return self.title + ", ".join(self.messages)
else:
return ", ".join(self.messages)
#FIXME: error when messages in self.messages are list!
try:
if self.title is not None:
return self.title + ", ".join(self.messages)
else:
return ", ".join(self.messages)
except:
return ""
def set_sender(self, sender):
if sender is None or sender.find("!") < 0: