summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui.py8
-rw-r--r--src/window.py16
2 files changed, 13 insertions, 11 deletions
diff --git a/src/gui.py b/src/gui.py
index 2bab3852..dd7ae1cc 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -292,8 +292,10 @@ class Gui(object):
"""
room.users.remove(user)
by = presence.find('{http://jabber.org/protocol/muc#user}x/{http://jabber.org/protocol/muc#user}item/{http://jabber.org/protocol/muc#user}actor')
+ from common import debug
+ debug('KICK: by:%s %s, %s\n' % (presence, by, by.attrib['jid'] if by else by))
reason = presence.find('{http://jabber.org/protocol/muc#user}x/{http://jabber.org/protocol/muc#user}item/{http://jabber.org/protocol/muc#user}reason')
- by = by.attrib['jid'] if by else ''
+ by = by.attrib['jid'] if by is not None else None
reason = reason.text# if reason else ''
if from_nick == room.own_nick: # we are kicked
room.disconnect()
@@ -306,7 +308,7 @@ class Gui(object):
muc.join_groupchat(self.xmpp, room.name, room.own_nick)
else:
if by:
- kick_msg = _('%(spec)s "[%(nick)s]" has been kicked by ["%(by)s]"') % {'spec':theme.CHAR_KICK.replace('"', '\\"'), 'nick':from_nick.replace('"', '\\"'), 'by':by.replace('"', '\\"')}
+ kick_msg = _('%(spec)s "[%(nick)s]" has been kicked by "[%(by)s]"') % {'spec':theme.CHAR_KICK.replace('"', '\\"'), 'nick':from_nick.replace('"', '\\"'), 'by':by.replace('"', '\\"')}
else:
kick_msg = _('%(spec)s "[%(nick)s]" has been kicked') % {'spec':theme.CHAR_KICK, 'nick':from_nick.replace('"', '\\"')}
if reason:
@@ -531,7 +533,7 @@ class Gui(object):
word = word.replace(char, '')
if len(word) > 5:
words.append(word)
- self.window.input.auto_completion(words)
+ self.window.input.auto_completion(words, False)
def go_to_important_room(self):
"""
diff --git a/src/window.py b/src/window.py
index 5d239c96..8eff8c15 100644
--- a/src/window.py
+++ b/src/window.py
@@ -586,7 +586,7 @@ class Input(Win):
if reset:
self.rewrite_text()
- def auto_completion(self, user_list):
+ def auto_completion(self, user_list, add_after=True):
"""
Complete the nickname
"""
@@ -594,9 +594,9 @@ class Input(Win):
return # we don't complete if cursor is not at the end of line
completion_type = config.get('completion', 'normal')
if completion_type == 'shell' and self.text != '':
- self.shell_completion(user_list)
+ self.shell_completion(user_list, add_after)
else:
- self.normal_completion(user_list)
+ self.normal_completion(user_list, add_after)
def reset_completion(self):
"""
@@ -605,12 +605,12 @@ class Input(Win):
self.hit_list = []
self.last_completion = None
- def normal_completion(self, user_list):
+ def normal_completion(self, user_list, add_after):
"""
Normal completion
"""
- if " " not in self.text.strip() or\
- self.last_completion and self.text == self.last_completion+config.get('after_completion', ',')+" ":
+ if add_after and (" " not in self.text.strip() or\
+ self.last_completion and self.text == self.last_completion+config.get('after_completion', ',')+" "):
after = config.get('after_completion', ',')+" "
#if " " in self.text.strip() and (not self.last_completion or ' ' in self.last_completion):
else:
@@ -640,11 +640,11 @@ class Input(Win):
self.text += nick +after
self.key_end(False)
- def shell_completion(self, user_list):
+ def shell_completion(self, user_list, add_after):
"""
Shell-like completion
"""
- if " " in self.text.strip():
+ if " " in self.text.strip() or not add_after:
after = " " # don't put the "," if it's not the begining of the sentence
else:
after = config.get('after_completion', ',')+" "