diff --git a/irc.py b/irc.py index d7e911f..6fb3740 100755 --- a/irc.py +++ b/irc.py @@ -101,7 +101,7 @@ class Bot(asynchat.async_chat): if use_ssl: sock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1) # FIXME: ssl module does not appear to work properly with nonblocking sockets - #sock.setblocking(0) + sock.setblocking(0) self.set_socket(sock) def handle_connect(self): diff --git a/modules/head.py b/modules/head.py index b7f5346..5570999 100755 --- a/modules/head.py +++ b/modules/head.py @@ -9,7 +9,6 @@ http://inamidst.com/phenny/ import re, urllib.request, urllib.parse, urllib.error, urllib.request, urllib.error, urllib.parse, http.client, urllib.parse, time, http.cookiejar from html.entities import name2codepoint -from string import join import web from tools import deprecated @@ -97,7 +96,7 @@ def noteuri(phenny, input): noteuri.rule = r'.*(http[s]?://[^<> "\x01]+)[,.]?' noteuri.priority = 'low' -titlecommands = r'(?:' + join(f_title.commands, r'|') + r')' +titlecommands = r'(?:' + r'|'.join(f_title.commands) + r')' def snarfuri(phenny, input): if re.match(r'(?i)' + phenny.config.prefix + titlecommands, input.group()): return @@ -183,11 +182,6 @@ def gettitle(uri): title = r_entity.sub(e, title) if title: - try: title.decode('utf-8') - except: - try: title = title.decode('iso-8859-1') - except: title = title.decode('cp1252') - else: pass title = title.replace('\n', '') title = title.replace('\r', '') else: title = None