-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97ef6e6
commit 144168e
Showing
3 changed files
with
25 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
MIT License | ||
|
||
Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com) | ||
Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
|
||
SCRIPT_NAME = 'notification_center' | ||
SCRIPT_AUTHOR = 'Sindre Sorhus <[email protected]>' | ||
SCRIPT_VERSION = '1.5.0' | ||
SCRIPT_VERSION = '1.5.1' | ||
SCRIPT_LICENSE = 'MIT' | ||
SCRIPT_DESC = 'Pass highlights and private messages to the macOS Notification Center' | ||
WEECHAT_ICON = os.path.expanduser('~/.weechat/weechat.png') | ||
|
@@ -36,25 +36,25 @@ | |
weechat.hook_print('', 'irc_privmsg,' + weechat.config_get_plugin('tags'), '', 1, 'notify', '') | ||
|
||
def notify(data, buffer, date, tags, displayed, highlight, prefix, message): | ||
# ignore if it's yourself | ||
# Ignore if it's yourself | ||
own_nick = weechat.buffer_get_string(buffer, 'localvar_nick') | ||
if prefix == own_nick or prefix == ('@%s' % own_nick): | ||
return weechat.WEECHAT_RC_OK | ||
|
||
# ignore messages from the current buffer | ||
# Ignore messages from the current buffer | ||
if weechat.config_get_plugin('ignore_current_buffer_messages') == 'on' and buffer == weechat.current_buffer(): | ||
return weechat.WEECHAT_RC_OK | ||
|
||
# ignore messages older than the configured theshold (such as ZNC logs) if enabled | ||
# Ignore messages older than the configured theshold (such as ZNC logs) if enabled | ||
if weechat.config_get_plugin('ignore_old_messages') == 'on': | ||
message_time = datetime.datetime.utcfromtimestamp(int(date)) | ||
now_time = datetime.datetime.utcnow() | ||
|
||
# ignore if the message is greater than 5 seconds old | ||
# Ignore if the message is greater than 5 seconds old | ||
if (now_time - message_time).seconds > 5: | ||
return weechat.WEECHAT_RC_OK | ||
|
||
# passing `None` or `''` still plays the default sound so we pass a lambda instead | ||
# Passing `None` or `''` still plays the default sound so we pass a lambda instead | ||
sound = weechat.config_get_plugin('sound_name') if weechat.config_get_plugin('sound') == 'on' else lambda:_ | ||
activate_bundle_id = weechat.config_get_plugin('activate_bundle_id') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters