Better handle the 'not composing, just typing a command',
the user cannot trick the system by doing (e.g), "w, ←, /, ENTER"
This commit is contained in:
parent
1d2bb35f3b
commit
d0b1349cf4
1 changed files with 4 additions and 3 deletions
|
@ -1165,14 +1165,15 @@ class ConversationTab(ChatTab, TabWithInfoWin):
|
||||||
if key in self.key_func:
|
if key in self.key_func:
|
||||||
self.key_func[key]()
|
self.key_func[key]()
|
||||||
return False
|
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)
|
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 = self.core.xmpp.make_message(self.get_name())
|
||||||
msg['type'] = 'chat'
|
msg['type'] = 'chat'
|
||||||
msg['chat_state'] = 'active'
|
msg['chat_state'] = 'active'
|
||||||
msg.send()
|
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 = self.core.xmpp.make_message(self.get_name())
|
||||||
msg['type'] = 'chat'
|
msg['type'] = 'chat'
|
||||||
msg['chat_state'] = 'composing'
|
msg['chat_state'] = 'composing'
|
||||||
|
|
Loading…
Reference in a new issue