Commit ff4fc92a authored by pg mr's avatar pg mr
Browse files

Added open link in notification

parent 72f489b4
Pipeline #7692 failed with stages
in 0 seconds
......@@ -21,6 +21,7 @@
from gajim.common import helpers
from import interface
from gajim.common.exceptions import GajimGeneralException
from gajim.common.regex import LINK_REGEX
from gajim import dialogs
from gajim.gui.dialogs import ShortcutsWindow
......@@ -257,6 +258,18 @@ def on_remove_event(_action, param):
win.redraw_tab(win.get_control(jid, account))
def on_open_link_from_msg_event(_action, param):
dict_ = param.unpack()
account, jid, type_ = dict_['account'], dict_['jid'], dict_['type_']
to_search =,jid)[-1].message # something better might be needed
if search_result is not None:
if search_result.startswith("www."): #for "legacy_prefixes"
search_result = "http://%s"%search_result
if search_result.startswith("ftp."): #for "legacy_prefixes"
search_result = "ftp://%s"%search_result
# Other Actions
def toggle_ipython(_action, _param):
......@@ -470,6 +470,7 @@ def _get_account_actions(account):
('-delete-motd', a.on_delete_motd, 'online', 's'),
('-open-event', a.on_open_event, 'always', 'a{sv}'),
('-remove-event', a.on_remove_event, 'always', 'a{sv}'),
('-open-link-from-msg-event', a.on_open_link_from_msg_event, 'always', 'a{sv}'),
('-import-contacts', a.on_import_contacts, 'online', 's'),
......@@ -39,6 +39,8 @@
from gajim.common.const import StyleAttr
from gajim.common.i18n import _
from import EventHelper
from gajim.common.regex import LINK_REGEX
from .util import get_builder
from .util import get_icon_name
......@@ -207,6 +209,10 @@ def popup(self, event_type, jid, account, type_='', icon_name=None,
action = 'app.{}-remove-event'.format(account)
_('Mark as Read'), action, variant_dict)
if text is not None:
if is not None:
action = 'app.{}-open-link-from-msg-event'.format(account)
notification.add_button_with_target(_('Open link'), action, variant_dict)
# Only one notification per JID
if event_type == _('Contact Changed Status'):
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