[triggers] Adapt to Gajim changes
This commit is contained in:
@@ -28,24 +28,6 @@ from gajim.plugins.helpers import get_builder
|
|||||||
|
|
||||||
EVENTS = {
|
EVENTS = {
|
||||||
'message_received': [],
|
'message_received': [],
|
||||||
'contact_connected': [
|
|
||||||
'use_systray_cb',
|
|
||||||
'disable_systray_cb',
|
|
||||||
'use_roster_cb',
|
|
||||||
'disable_roster_cb'
|
|
||||||
],
|
|
||||||
'contact_disconnected': [
|
|
||||||
'use_systray_cb',
|
|
||||||
'disable_systray_cb',
|
|
||||||
'use_roster_cb',
|
|
||||||
'disable_roster_cb'
|
|
||||||
],
|
|
||||||
'contact_status_change': [
|
|
||||||
'use_systray_cb',
|
|
||||||
'disable_systray_cb',
|
|
||||||
'use_roster_cb',
|
|
||||||
'disable_roster_cb'
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RECIPIENT_TYPES = [
|
RECIPIENT_TYPES = [
|
||||||
@@ -63,7 +45,7 @@ class ConfigDialog(Gtk.ApplicationWindow):
|
|||||||
self.set_show_menubar(False)
|
self.set_show_menubar(False)
|
||||||
self.set_title(_('Triggers Configuration'))
|
self.set_title(_('Triggers Configuration'))
|
||||||
self.set_transient_for(transient)
|
self.set_transient_for(transient)
|
||||||
self.set_default_size(600, 700)
|
self.set_default_size(600, 800)
|
||||||
self.set_type_hint(Gdk.WindowTypeHint.DIALOG)
|
self.set_type_hint(Gdk.WindowTypeHint.DIALOG)
|
||||||
self.set_modal(True)
|
self.set_modal(True)
|
||||||
self.set_destroy_with_parent(True)
|
self.set_destroy_with_parent(True)
|
||||||
@@ -95,9 +77,7 @@ class ConfigDialog(Gtk.ApplicationWindow):
|
|||||||
'recipient_type_combobox', 'recipient_list_entry',
|
'recipient_type_combobox', 'recipient_list_entry',
|
||||||
'delete_button', 'online_cb', 'away_cb', 'xa_cb', 'dnd_cb',
|
'delete_button', 'online_cb', 'away_cb', 'xa_cb', 'dnd_cb',
|
||||||
'use_sound_cb', 'disable_sound_cb', 'use_popup_cb',
|
'use_sound_cb', 'disable_sound_cb', 'use_popup_cb',
|
||||||
'disable_popup_cb', 'use_auto_open_cb',
|
'disable_popup_cb',
|
||||||
'disable_auto_open_cb', 'use_systray_cb',
|
|
||||||
'disable_systray_cb', 'use_roster_cb', 'disable_roster_cb',
|
|
||||||
'tab_opened_cb', 'not_tab_opened_cb', 'has_focus_cb',
|
'tab_opened_cb', 'not_tab_opened_cb', 'has_focus_cb',
|
||||||
'not_has_focus_cb', 'filechooser', 'sound_file_box',
|
'not_has_focus_cb', 'filechooser', 'sound_file_box',
|
||||||
'up_button', 'down_button', 'run_command_cb',
|
'up_button', 'down_button', 'run_command_cb',
|
||||||
@@ -233,7 +213,7 @@ class ConfigDialog(Gtk.ApplicationWindow):
|
|||||||
self._ui.filechooser.set_filename(value)
|
self._ui.filechooser.set_filename(value)
|
||||||
|
|
||||||
# sound, popup, auto_open, systray, roster
|
# sound, popup, auto_open, systray, roster
|
||||||
for option in ('sound', 'popup', 'auto_open', 'systray', 'roster'):
|
for option in ('sound', 'popup'):
|
||||||
value = self._config[self._active_num][option]
|
value = self._config[self._active_num][option]
|
||||||
if value == 'yes':
|
if value == 'yes':
|
||||||
self._ui.__dict__['use_' + option + '_cb'].set_active(True)
|
self._ui.__dict__['use_' + option + '_cb'].set_active(True)
|
||||||
@@ -322,11 +302,8 @@ class ConfigDialog(Gtk.ApplicationWindow):
|
|||||||
'sound': '',
|
'sound': '',
|
||||||
'sound_file': '',
|
'sound_file': '',
|
||||||
'popup': '',
|
'popup': '',
|
||||||
'auto_open': '',
|
|
||||||
'run_command': False,
|
'run_command': False,
|
||||||
'command': '',
|
'command': '',
|
||||||
'systray': '',
|
|
||||||
'roster': '',
|
|
||||||
'one_shot': False,
|
'one_shot': False,
|
||||||
}
|
}
|
||||||
iter_ = model.append((num, ''))
|
iter_ = model.append((num, ''))
|
||||||
@@ -397,9 +374,6 @@ class ConfigDialog(Gtk.ApplicationWindow):
|
|||||||
return
|
return
|
||||||
event = list(EVENTS.keys())[active]
|
event = list(EVENTS.keys())[active]
|
||||||
self._config[self._active_num]['event'] = event
|
self._config[self._active_num]['event'] = event
|
||||||
for widget in ('use_systray_cb', 'disable_systray_cb', 'use_roster_cb',
|
|
||||||
'disable_roster_cb'):
|
|
||||||
self._ui.__dict__[widget].set_sensitive(True)
|
|
||||||
for widget in EVENTS[event]:
|
for widget in EVENTS[event]:
|
||||||
self._ui.__dict__[widget].set_sensitive(False)
|
self._ui.__dict__[widget].set_sensitive(False)
|
||||||
self._ui.__dict__[widget].set_state(False)
|
self._ui.__dict__[widget].set_state(False)
|
||||||
@@ -555,14 +529,6 @@ class ConfigDialog(Gtk.ApplicationWindow):
|
|||||||
def _on_disable_popup_cb_toggled(self, widget):
|
def _on_disable_popup_cb_toggled(self, widget):
|
||||||
self._on_disable_it_toggled(widget, self._ui.use_popup_cb, 'popup')
|
self._on_disable_it_toggled(widget, self._ui.use_popup_cb, 'popup')
|
||||||
|
|
||||||
def _on_use_auto_open_cb_toggled(self, widget):
|
|
||||||
self._on_use_it_toggled(widget, self._ui.disable_auto_open_cb,
|
|
||||||
'auto_open')
|
|
||||||
|
|
||||||
def _on_disable_auto_open_cb_toggled(self, widget):
|
|
||||||
self._on_disable_it_toggled(widget, self._ui.use_auto_open_cb,
|
|
||||||
'auto_open')
|
|
||||||
|
|
||||||
def _on_run_command_cb_toggled(self, widget):
|
def _on_run_command_cb_toggled(self, widget):
|
||||||
self._config[self._active_num]['run_command'] = widget.get_active()
|
self._config[self._active_num]['run_command'] = widget.get_active()
|
||||||
if widget.get_active():
|
if widget.get_active():
|
||||||
@@ -573,18 +539,6 @@ class ConfigDialog(Gtk.ApplicationWindow):
|
|||||||
def _on_command_entry_changed(self, widget):
|
def _on_command_entry_changed(self, widget):
|
||||||
self._config[self._active_num]['command'] = widget.get_text()
|
self._config[self._active_num]['command'] = widget.get_text()
|
||||||
|
|
||||||
def _on_use_systray_cb_toggled(self, widget):
|
|
||||||
self._on_use_it_toggled(widget, self._ui.disable_systray_cb, 'systray')
|
|
||||||
|
|
||||||
def _on_disable_systray_cb_toggled(self, widget):
|
|
||||||
self._on_disable_it_toggled(widget, self._ui.use_systray_cb, 'systray')
|
|
||||||
|
|
||||||
def _on_use_roster_cb_toggled(self, widget):
|
|
||||||
self._on_use_it_toggled(widget, self._ui.disable_roster_cb, 'roster')
|
|
||||||
|
|
||||||
def _on_disable_roster_cb_toggled(self, widget):
|
|
||||||
self._on_disable_it_toggled(widget, self._ui.use_roster_cb, 'roster')
|
|
||||||
|
|
||||||
def _on_one_shot_cb_toggled(self, widget):
|
def _on_one_shot_cb_toggled(self, widget):
|
||||||
self._config[self._active_num]['one_shot'] = widget.get_active()
|
self._config[self._active_num]['one_shot'] = widget.get_active()
|
||||||
self._ui.command_entry.set_sensitive(widget.get_active())
|
self._ui.command_entry.set_sensitive(widget.get_active())
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -35,176 +35,39 @@ class Triggers(GajimPlugin):
|
|||||||
|
|
||||||
self.events_handlers = {
|
self.events_handlers = {
|
||||||
'notification': (ged.PREGUI, self._on_notification),
|
'notification': (ged.PREGUI, self._on_notification),
|
||||||
'decrypted-message-received': (ged.PREGUI2,
|
'message-received': (ged.PREGUI2, self._on_message_received),
|
||||||
self._on_message_received),
|
'gc-message-received': (ged.PREGUI2, self._on_message_received),
|
||||||
'gc-message-received': (ged.PREGUI2, self._on_gc_message_received),
|
|
||||||
'presence-received': (ged.PREGUI, self._on_presence_received),
|
'presence-received': (ged.PREGUI, self._on_presence_received),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _check_rule_recipients(self, obj, rule):
|
def _on_notification(self, event):
|
||||||
rule_recipients = [t.strip() for t in rule['recipients'].split(',')]
|
self._check_all(event,
|
||||||
if rule['recipient_type'] == 'groupchat':
|
self._check_rule_apply_notification,
|
||||||
if obj.jid in rule_recipients:
|
self._apply_rule)
|
||||||
return True
|
|
||||||
return False
|
|
||||||
if (rule['recipient_type'] == 'contact' and obj.jid not in
|
|
||||||
rule_recipients):
|
|
||||||
return False
|
|
||||||
contact = app.contacts.get_first_contact_from_jid(
|
|
||||||
obj.conn.name, obj.jid)
|
|
||||||
if not contact: # PM?
|
|
||||||
return False
|
|
||||||
contact_groups = contact.groups
|
|
||||||
group_found = False
|
|
||||||
for group in contact_groups:
|
|
||||||
if group in rule_recipients:
|
|
||||||
group_found = True
|
|
||||||
break
|
|
||||||
if rule['recipient_type'] == 'group' and not group_found:
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
def _on_message_received(self, event):
|
||||||
|
self._check_all(event,
|
||||||
|
self._check_rule_apply_msg_received,
|
||||||
|
self._apply_rule)
|
||||||
|
|
||||||
def _check_rule_status(self, obj, rule):
|
def _on_presence_received(self, event):
|
||||||
rule_statuses = rule['status'].split()
|
if event.old_show < 2 and event.new_show > 1:
|
||||||
our_status = app.connections[obj.conn.name].status
|
check_func = self._check_rule_apply_connected
|
||||||
if rule['status'] != 'all' and our_status not in rule_statuses:
|
elif event.old_show > 1 and event.new_show < 2:
|
||||||
return False
|
check_func = self._check_rule_apply_disconnected
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _check_rule_tab_opened(self, obj, rule):
|
|
||||||
if rule['tab_opened'] == 'both':
|
|
||||||
return True
|
|
||||||
tab_opened = False
|
|
||||||
if app.interface.msg_win_mgr.get_control(obj.jid, obj.conn.name):
|
|
||||||
tab_opened = True
|
|
||||||
if tab_opened and rule['tab_opened'] == 'no':
|
|
||||||
return False
|
|
||||||
elif not tab_opened and rule['tab_opened'] == 'yes':
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _check_rule_has_focus(self, obj, rule):
|
|
||||||
if rule['has_focus'] == 'both':
|
|
||||||
return True
|
|
||||||
if rule['tab_opened'] == 'no':
|
|
||||||
# Does not apply in this case
|
|
||||||
return True
|
|
||||||
ctrl = app.interface.msg_win_mgr.get_control(obj.jid, obj.conn.name)
|
|
||||||
if not ctrl:
|
|
||||||
# Does not apply in this case
|
|
||||||
return True
|
|
||||||
has_focus = ctrl.parent_win.window.has_focus()
|
|
||||||
if has_focus and rule['has_focus'] == 'no':
|
|
||||||
return False
|
|
||||||
elif not has_focus and rule['has_focus'] == 'yes':
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _check_rule_all(self, event, obj, rule):
|
|
||||||
# Check notification type
|
|
||||||
if rule['event'] != event:
|
|
||||||
return False
|
|
||||||
|
|
||||||
# notification type is ok. Now check recipient
|
|
||||||
if not self._check_rule_recipients(obj, rule):
|
|
||||||
return False
|
|
||||||
|
|
||||||
# recipient is ok. Now check our status
|
|
||||||
if not self._check_rule_status(obj, rule):
|
|
||||||
return False
|
|
||||||
|
|
||||||
# our_status is ok. Now check opened chat window
|
|
||||||
if not self._check_rule_tab_opened(obj, rule):
|
|
||||||
return False
|
|
||||||
|
|
||||||
# tab_opened is ok. Now check opened chat window
|
|
||||||
if not self._check_rule_has_focus(obj, rule):
|
|
||||||
return False
|
|
||||||
|
|
||||||
# All is ok
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _check_rule_apply_notification(self, obj, rule):
|
|
||||||
# Check notification type
|
|
||||||
notif_type = ''
|
|
||||||
if obj.notif_type in ('msg', 'gc-msg'):
|
|
||||||
notif_type = 'message_received'
|
|
||||||
elif obj.notif_type == 'pres':
|
|
||||||
if obj.base_event.old_show < 2 and obj.base_event.new_show > 1:
|
|
||||||
notif_type = 'contact_connected'
|
|
||||||
elif obj.base_event.old_show > 1 and obj.base_event.new_show < 2:
|
|
||||||
notif_type = 'contact_disconnected'
|
|
||||||
else:
|
|
||||||
notif_type = 'contact_status_change'
|
|
||||||
|
|
||||||
return self._check_rule_all(notif_type, obj, rule)
|
|
||||||
|
|
||||||
def _check_rule_apply_msg_received(self, obj, rule):
|
|
||||||
return self._check_rule_all('message_received', obj, rule)
|
|
||||||
|
|
||||||
def _check_rule_apply_connected(self, obj, rule):
|
|
||||||
return self._check_rule_all('contact_connected', obj, rule)
|
|
||||||
|
|
||||||
def _check_rule_apply_disconnected(self, obj, rule):
|
|
||||||
return self._check_rule_all('contact_disconnected', obj, rule)
|
|
||||||
|
|
||||||
def _check_rule_apply_status_changed(self, obj, rule):
|
|
||||||
return self._check_rule_all('contact_status_change', obj, rule)
|
|
||||||
|
|
||||||
def _apply_rule_notification(self, obj, rule):
|
|
||||||
if rule['sound'] == 'no':
|
|
||||||
obj.do_sound = False
|
|
||||||
elif rule['sound'] == 'yes':
|
|
||||||
obj.do_sound = True
|
|
||||||
obj.sound_event = ''
|
|
||||||
obj.sound_file = rule['sound_file']
|
|
||||||
|
|
||||||
if rule['popup'] == 'no' or obj.control_focused:
|
|
||||||
obj.do_popup = False
|
|
||||||
elif rule['popup'] == 'yes':
|
|
||||||
obj.do_popup = True
|
|
||||||
|
|
||||||
if rule['run_command']:
|
|
||||||
obj.do_command = True
|
|
||||||
obj.command = rule['command']
|
|
||||||
else:
|
else:
|
||||||
obj.do_command = False
|
check_func = self._check_rule_apply_status_changed
|
||||||
|
self._check_all(event, check_func, self._apply_rule)
|
||||||
|
|
||||||
if rule['systray'] == 'no':
|
def _check_all(self, event, check_func, apply_func):
|
||||||
obj.show_in_notification_area = False
|
|
||||||
elif rule['systray'] == 'yes':
|
|
||||||
obj.show_in_notification_area = True
|
|
||||||
|
|
||||||
if rule['roster'] == 'no':
|
|
||||||
obj.show_in_roster = False
|
|
||||||
elif rule['roster'] == 'yes':
|
|
||||||
obj.show_in_roster = True
|
|
||||||
|
|
||||||
def _apply_rule_message_received(self, obj, rule):
|
|
||||||
if rule['auto_open'] == 'no':
|
|
||||||
obj.popup = False
|
|
||||||
elif rule['auto_open'] == 'yes':
|
|
||||||
obj.popup = True
|
|
||||||
|
|
||||||
def _apply_rule_presence_received(self, obj, rule):
|
|
||||||
if rule['auto_open'] == 'no':
|
|
||||||
obj.popup = False
|
|
||||||
elif rule['auto_open'] == 'yes':
|
|
||||||
obj.popup = True
|
|
||||||
|
|
||||||
def _check_all(self, obj, check_func, apply_func):
|
|
||||||
# check rules in order
|
# check rules in order
|
||||||
rules_num = [int(i) for i in self.config.keys()]
|
rules_num = [int(item) for item in self.config.keys()]
|
||||||
rules_num.sort()
|
rules_num.sort()
|
||||||
to_remove = []
|
to_remove = []
|
||||||
for num in rules_num:
|
for num in rules_num:
|
||||||
rule = self.config[str(num)]
|
rule = self.config[str(num)]
|
||||||
if check_func(obj, rule):
|
if check_func(event, rule):
|
||||||
apply_func(obj, rule)
|
apply_func(event, rule)
|
||||||
if 'one_shot' in rule and rule['one_shot']:
|
if 'one_shot' in rule and rule['one_shot']:
|
||||||
to_remove.append(num)
|
to_remove.append(num)
|
||||||
# Should we stop after first valid rule ?
|
# Should we stop after first valid rule ?
|
||||||
@@ -223,23 +86,133 @@ class Triggers(GajimPlugin):
|
|||||||
else:
|
else:
|
||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
def _on_notification(self, obj):
|
def _check_rule_apply_msg_received(self, event, rule):
|
||||||
self._check_all(obj, self._check_rule_apply_notification,
|
return self._check_rule_all('message_received', event, rule)
|
||||||
self._apply_rule_notification)
|
|
||||||
|
|
||||||
def _on_message_received(self, obj):
|
def _check_rule_apply_connected(self, event, rule):
|
||||||
self._check_all(obj, self._check_rule_apply_msg_received,
|
return self._check_rule_all('contact_connected', event, rule)
|
||||||
self._apply_rule_message_received)
|
|
||||||
|
|
||||||
def _on_gc_message_received(self, obj):
|
def _check_rule_apply_disconnected(self, event, rule):
|
||||||
self._check_all(obj, self._check_rule_apply_msg_received,
|
return self._check_rule_all('contact_disconnected', event, rule)
|
||||||
self._apply_rule_message_received)
|
|
||||||
|
|
||||||
def _on_presence_received(self, obj):
|
def _check_rule_apply_status_changed(self, event, rule):
|
||||||
if obj.old_show < 2 and obj.new_show > 1:
|
return self._check_rule_all('contact_status_change', event, rule)
|
||||||
check_func = self._check_rule_apply_connected
|
|
||||||
elif obj.old_show > 1 and obj.new_show < 2:
|
def _check_rule_apply_notification(self, event, rule):
|
||||||
check_func = self._check_rule_apply_disconnected
|
# Check notification type
|
||||||
else:
|
notif_type = ''
|
||||||
check_func = self._check_rule_apply_status_changed
|
if event.notif_type == 'incoming-message':
|
||||||
self._check_all(obj, check_func, self._apply_rule_presence_received)
|
notif_type = 'message_received'
|
||||||
|
if event.notif_type == 'pres':
|
||||||
|
# TODO:
|
||||||
|
if (event.base_event.old_show < 2 and
|
||||||
|
event.base_event.new_show > 1):
|
||||||
|
notif_type = 'contact_connected'
|
||||||
|
elif (event.base_event.old_show > 1 and
|
||||||
|
event.base_event.new_show < 2):
|
||||||
|
notif_type = 'contact_disconnected'
|
||||||
|
else:
|
||||||
|
notif_type = 'contact_status_change'
|
||||||
|
|
||||||
|
return self._check_rule_all(notif_type, event, rule)
|
||||||
|
|
||||||
|
def _check_rule_all(self, notif_type, event, rule):
|
||||||
|
# Check notification type
|
||||||
|
if rule['event'] != notif_type:
|
||||||
|
return False
|
||||||
|
|
||||||
|
# notification type is ok. Now check recipient
|
||||||
|
if not self._check_rule_recipients(event, rule):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# recipient is ok. Now check our status
|
||||||
|
if not self._check_rule_status(event, rule):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# our_status is ok. Now check opened chat window
|
||||||
|
if not self._check_rule_tab_opened(event, rule):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# tab_opened is ok. Now check opened chat window
|
||||||
|
if not self._check_rule_has_focus(event, rule):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# All is ok
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _check_rule_recipients(self, event, rule):
|
||||||
|
rule_recipients = [t.strip() for t in rule['recipients'].split(',')]
|
||||||
|
if rule['recipient_type'] == 'groupchat':
|
||||||
|
if event.jid in rule_recipients:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
if (rule['recipient_type'] == 'contact' and event.jid not in
|
||||||
|
rule_recipients):
|
||||||
|
return False
|
||||||
|
client = app.get_client(event.account)
|
||||||
|
contact = client.get_module('Contacts').get_contact(event.jid)
|
||||||
|
|
||||||
|
group_found = False
|
||||||
|
for group in contact.groups:
|
||||||
|
if group in rule_recipients:
|
||||||
|
group_found = True
|
||||||
|
break
|
||||||
|
if rule['recipient_type'] == 'group' and not group_found:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _check_rule_status(self, event, rule):
|
||||||
|
rule_statuses = rule['status'].split()
|
||||||
|
our_status = app.connections[event.account].status
|
||||||
|
if rule['status'] != 'all' and our_status not in rule_statuses:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _check_rule_tab_opened(self, event, rule):
|
||||||
|
if rule['tab_opened'] == 'both':
|
||||||
|
return True
|
||||||
|
tab_opened = False
|
||||||
|
if app.window.get_control(event.account, event.jid):
|
||||||
|
tab_opened = True
|
||||||
|
if tab_opened and rule['tab_opened'] == 'no':
|
||||||
|
return False
|
||||||
|
elif not tab_opened and rule['tab_opened'] == 'yes':
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _check_rule_has_focus(self, event, rule):
|
||||||
|
if rule['has_focus'] == 'both':
|
||||||
|
return True
|
||||||
|
if rule['tab_opened'] == 'no':
|
||||||
|
# Does not apply in this case
|
||||||
|
return True
|
||||||
|
ctrl = app.window.get_control(event.account, event.jid)
|
||||||
|
if not ctrl:
|
||||||
|
# Does not apply in this case
|
||||||
|
return True
|
||||||
|
has_focus = ctrl.has_focus()
|
||||||
|
if has_focus and rule['has_focus'] == 'no':
|
||||||
|
return False
|
||||||
|
elif not has_focus and rule['has_focus'] == 'yes':
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _apply_rule(self, event, rule):
|
||||||
|
if rule['sound'] == 'no':
|
||||||
|
event.sound = None
|
||||||
|
event.sound_file = None
|
||||||
|
elif rule['sound'] == 'yes':
|
||||||
|
event.sound = None
|
||||||
|
event.sound_file = rule['sound_file']
|
||||||
|
|
||||||
|
if rule['run_command']:
|
||||||
|
event.command = rule['command']
|
||||||
|
|
||||||
|
if rule['popup'] == 'no':
|
||||||
|
event.show_notification = False
|
||||||
|
elif rule['popup'] == 'yes':
|
||||||
|
event.show_notification = True
|
||||||
|
|||||||
Reference in New Issue
Block a user