Fix a little bug on completion due to the separating line

This commit is contained in:
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 2010-08-14 08:58:31 +00:00
parent 79ce5c2332
commit 20b1f68764
4 changed files with 11 additions and 4 deletions

View file

@ -62,7 +62,13 @@ def debug(string):
a CLI software
"""
fdes = open("debug", 'a')
fdes.write(string)
try:
fdes.write(string)
except:
try:
fdes.write(string.encode('utf-8'))
except:
fdes.write(string.encode('utf-8'))
fdes.close()
def get_base64_from_file(path):

View file

@ -220,6 +220,5 @@ class Connection(threading.Thread):
"""
we received a vcard
"""
return
from common import debug
debug('\n====\n%s\n\n' % iq)

View file

@ -288,6 +288,8 @@ class Gui(object):
char_we_dont_want = [',', '(', ')', '.']
words = list()
for msg in self.current_room().messages[:-9:-1]:
if not msg:
continue
for word in msg.txt.split():
for char in char_we_dont_want: # remove the chars we don't want
word = word.replace(char, '')
@ -1018,6 +1020,8 @@ class Gui(object):
i = 0
link = None
for msg in self.current_room().messages[:-200:-1]:
if not msg:
continue
matches = re.findall('"((ftp|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal):(([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2}){2,}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?([A-Za-z0-9$_+!*();/?:~-]))"', msg.txt)
for m in matches:
if i == nb:
@ -1065,4 +1069,3 @@ class Gui(object):
sleep(0.2) # :(
self.reset_curses()
sys.exit()

View file

@ -223,7 +223,6 @@ class MultiUserChat(object):
def on_presence(self, presence):
"""Receive a MUC presence notification"""
from_ = presence.getFrom().__str__()
if get_stripped_jid(from_) in self.rooms:
self.handler.emit('on-muc-presence-changed',
jid=from_.encode('utf-8'),