use nonblocking sockets
This commit is contained in:
2
irc.py
2
irc.py
@@ -101,7 +101,7 @@ class Bot(asynchat.async_chat):
|
|||||||
if use_ssl:
|
if use_ssl:
|
||||||
sock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1)
|
sock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1)
|
||||||
# FIXME: ssl module does not appear to work properly with nonblocking sockets
|
# FIXME: ssl module does not appear to work properly with nonblocking sockets
|
||||||
#sock.setblocking(0)
|
sock.setblocking(0)
|
||||||
self.set_socket(sock)
|
self.set_socket(sock)
|
||||||
|
|
||||||
def handle_connect(self):
|
def handle_connect(self):
|
||||||
|
|||||||
@@ -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
|
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 html.entities import name2codepoint
|
||||||
from string import join
|
|
||||||
import web
|
import web
|
||||||
from tools import deprecated
|
from tools import deprecated
|
||||||
|
|
||||||
@@ -97,7 +96,7 @@ def noteuri(phenny, input):
|
|||||||
noteuri.rule = r'.*(http[s]?://[^<> "\x01]+)[,.]?'
|
noteuri.rule = r'.*(http[s]?://[^<> "\x01]+)[,.]?'
|
||||||
noteuri.priority = 'low'
|
noteuri.priority = 'low'
|
||||||
|
|
||||||
titlecommands = r'(?:' + join(f_title.commands, r'|') + r')'
|
titlecommands = r'(?:' + r'|'.join(f_title.commands) + r')'
|
||||||
def snarfuri(phenny, input):
|
def snarfuri(phenny, input):
|
||||||
if re.match(r'(?i)' + phenny.config.prefix + titlecommands, input.group()):
|
if re.match(r'(?i)' + phenny.config.prefix + titlecommands, input.group()):
|
||||||
return
|
return
|
||||||
@@ -183,11 +182,6 @@ def gettitle(uri):
|
|||||||
title = r_entity.sub(e, title)
|
title = r_entity.sub(e, title)
|
||||||
|
|
||||||
if 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('\n', '')
|
||||||
title = title.replace('\r', '')
|
title = title.replace('\r', '')
|
||||||
else: title = None
|
else: title = None
|
||||||
|
|||||||
Reference in New Issue
Block a user