Commit 8458b3a7 authored by Dan Pascu's avatar Dan Pascu

Added testing code to enable/disable OTR on the fly during chat sessions

parent 3df82202
...@@ -815,6 +815,21 @@ class ChatWidget(base_class, ui_class): ...@@ -815,6 +815,21 @@ class ChatWidget(base_class, ui_class):
def _SH_ChatInputTextEntered(self, text): def _SH_ChatInputTextEntered(self, text):
self.composing_timer.stop() self.composing_timer.stop()
doc = QTextDocument()
doc.setHtml(text)
plain_text = doc.toPlainText()
if plain_text == '/otr+':
try:
self.session.chat_stream.encryption.start()
except AttributeError:
pass
return
elif plain_text == '/otr-':
try:
self.session.chat_stream.encryption.stop()
except AttributeError:
pass
return
try: try:
self.send_message(text, content_type='text/html') self.send_message(text, content_type='text/html')
except Exception, e: except Exception, e:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment