--- a/weechat/python/autoload/growl.py Wed Aug 14 12:43:22 2013 -0400
+++ b/weechat/python/autoload/growl.py Wed Aug 14 12:43:34 2013 -0400
@@ -24,12 +24,13 @@
SCRIPT_NAME = 'growl'
SCRIPT_AUTHOR = 'Sorin Ionescu <sorin.ionescu@gmail.com>'
-SCRIPT_VERSION = '1.0.5'
+SCRIPT_VERSION = '2.0.0'
SCRIPT_LICENSE = 'MIT'
SCRIPT_DESC = 'Sends Growl notifications upon events.'
# Changelog
+# 2013-08-14: v2.0.0 Remove GNTP fuckery and use growlnotify because UNIX -- sjl
# 2011-12-30: v1.0.5 Fixed a NoneType error.
# 2011-10-11: v1.0.4 Handle import errors better.
# 2011-10-10: v1.0.3 Handle Growl exceptions.
@@ -65,18 +66,14 @@
# Imports
# -----------------------------------------------------------------------------
try:
- import re
- import os
+ import re, os, subprocess
import weechat
- from gntp.notifier import GrowlNotifier
IMPORT_OK = True
except ImportError as error:
IMPORT_OK = False
if str(error).find('weechat') != -1:
print('This script must be run under WeeChat.')
print('Get WeeChat at http://www.weechat.org.')
- elif str(error).find('notifier') != -1:
- weechat.prnt('', 'growl: GNTP bindings are not installed')
else:
weechat.prnt('', 'growl: {0}'.format(error))
@@ -412,22 +409,14 @@
def growl_notify(notification, title, description, priority=None):
'''Returns whether Growl notifications should be sticky.'''
- growl = STATE['growl']
- is_away = STATE['is_away']
- icon = STATE['icon']
- is_sticky = False
- if weechat.config_get_plugin('sticky') == 'on':
- is_sticky = True
- if weechat.config_get_plugin('sticky_away') == 'on' and is_away:
- is_sticky = True
try:
- growl.notify(
- noteType=notification,
- title=title,
- description=description,
- icon=icon,
- sticky=is_sticky,
- priority=priority)
+ subprocess.call(['growlnotify',
+ '-n', 'WeeChat',
+ '-I', STATE['icon'],
+ '-m', description,
+ '-d', notification,
+ '-p', priority or '0',
+ '-t', title])
except Exception as error:
weechat.prnt('', 'growl: {0}'.format(error))
@@ -465,17 +454,6 @@
hostname = ''
if len(password) == 0:
password = ''
- growl = GrowlNotifier(
- applicationName=name,
- hostname=hostname,
- password=password,
- notifications=notifications,
- applicationIcon=icon)
- try:
- growl.register()
- except Exception as error:
- weechat.prnt('', 'growl: {0}'.format(error))
- STATE['growl'] = growl
STATE['icon'] = icon
# Register hooks.
weechat.hook_signal(