summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-02-24 20:27:53 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-02-24 20:27:53 +0100
commitd0b1349cf4b0c7378cb83508737aa7b301dd0ea8 (patch)
tree7eea486a323ae4b02551effd8081ac1771a77596 /src
parent1d2bb35f3bcd35a242f8cbb37f743d70be436e5a (diff)
downloadpoezio-d0b1349cf4b0c7378cb83508737aa7b301dd0ea8.tar.gz
poezio-d0b1349cf4b0c7378cb83508737aa7b301dd0ea8.tar.bz2
poezio-d0b1349cf4b0c7378cb83508737aa7b301dd0ea8.tar.xz
poezio-d0b1349cf4b0c7378cb83508737aa7b301dd0ea8.zip
Better handle the 'not composing, just typing a command',
the user cannot trick the system by doing (e.g), "w, ←, /, ENTER"
Diffstat (limited to 'src')
-rw-r--r--src/tabs.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tabs.py b/src/tabs.py
index bf903310..4bc2ed99 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1165,14 +1165,15 @@ class ConversationTab(ChatTab, TabWithInfoWin):
if key in self.key_func:
self.key_func[key]()
return False
- empty_before = self.input.get_text() == ''
+ empty_before = self.input.get_text() == '' or self.input.get_text().startswith('/')
self.input.do_command(key)
- if not self.input.get_text() and not empty_before:
+ empty_after = self.input.get_text() == '' or self.input.get_text().startswith('/')
+ if not empty_before and empty_after:
msg = self.core.xmpp.make_message(self.get_name())
msg['type'] = 'chat'
msg['chat_state'] = 'active'
msg.send()
- elif self.input.get_text() and empty_before and not self.input.get_text().startswith('/'):
+ elif empty_before and not empty_after:
msg = self.core.xmpp.make_message(self.get_name())
msg['type'] = 'chat'
msg['chat_state'] = 'composing'