Philipp Hörist pushed to branch master at gajim / gajim

Commits:
a4f08b3b by Philipp Hörist at 2018-02-14T21:11:25+01:00
Parse uri with message action correctly

Fixes #8894

- - - - -


1 changed file:

- gajim/gajim.py


Changes:

=====================================
gajim/gajim.py
=====================================
--- a/gajim/gajim.py
+++ b/gajim/gajim.py
@@ -41,6 +41,8 @@ import sys
 import os
 import signal
 import locale
+from urllib.parse import unquote
+
 import gi
 gi.require_version('GLib', '2.0')
 gi.require_version('Gio', '2.0')
@@ -49,6 +51,7 @@ gi.require_version('Gdk', '3.0')
 gi.require_version('GObject', '2.0')
 gi.require_version('Pango', '1.0')
 from gi.repository import GLib, Gio, Gtk
+
 from gajim.common import i18n
 from gajim.common import logging_helpers
 from gajim.common import crypto
@@ -269,12 +272,20 @@ class GajimApplication(Gtk.Application):
                 self.interface.join_gc_minimal(None, jid)
             elif cmd == 'roster':
                 self.activate_action('add-contact', GLib.Variant('s', jid))
-            elif cmd == 'message':
+            elif cmd.startswith('message'):
+                attributes = cmd.split(';')
+                message = None
+                for key in attributes:
+                    if key.startswith('body'):
+                        try:
+                            message = unquote(key.split('=')[1])
+                        except Exception:
+                            app.log('uri_handler').error('Invalid URI: %s', 
cmd)
                 accounts = list(app.connections.keys())
                 if not accounts:
                     continue
                 if len(accounts) == 1:
-                    app.interface.new_chat_from_jid(accounts[0], jid)
+                    app.interface.new_chat_from_jid(accounts[0], jid, message)
                 else:
                     self.activate_action('start-chat')
                     start_chat_window = app.interface.instances['start_chat']



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/a4f08b3bfe2ec2256f199736dd7db000cd9b29f2

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/a4f08b3bfe2ec2256f199736dd7db000cd9b29f2
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to