Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gajim
gajim-plugins
Commits
84fc9279
Commit
84fc9279
authored
Jan 06, 2022
by
Philipp Hörist
Browse files
[triggers] Fix extending the notification event
parent
16559dae
Pipeline
#8959
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
triggers/triggers.py
View file @
84fc9279
...
...
@@ -15,9 +15,14 @@
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
#
from
typing
import
Optional
from
typing
import
Union
from
dataclasses
import
dataclass
from
dataclasses
import
asdict
from
functools
import
partial
from
typing
import
Optional
from
nbxmpp.protocol
import
JID
from
gajim.common
import
app
from
gajim.common
import
ged
...
...
@@ -33,8 +38,8 @@ from triggers.gtk.config import ConfigDialog
@
dataclass
class
ExtendedEvent
:
origin
:
ApplicationEvent
class
ExtendedEvent
(
Notification
)
:
origin
:
Optional
[
ApplicationEvent
]
=
None
show_notification
:
bool
=
True
command
:
Optional
[
str
]
=
None
sound_file
:
Optional
[
str
]
=
None
...
...
@@ -72,14 +77,14 @@ class Triggers(GajimPlugin):
def
_on_notification
(
self
,
event
:
Notification
):
extended_event
=
ExtendedEvent
(
event
)
extended_event
=
ExtendedEvent
(
**
asdict
(
asdict
),
origin
=
event
)
self
.
_check_all
(
extended_event
,
self
.
_check_rule_apply_notification
,
self
.
_apply_rule
)
return
self
.
_excecute
(
extended_event
)
def
_on_message_received
(
self
,
event
):
event
=
ExtendedEvent
(
event
)
event
=
ExtendedEvent
(
**
asdict
(
asdict
),
origin
=
event
)
self
.
_check_all
(
event
,
self
.
_check_rule_apply_msg_received
,
self
.
_apply_rule
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment