From 22fcf4ecb57c204a743d325f309f1ee3a75f576e Mon Sep 17 00:00:00 2001 From: griffin_stewie Date: Tue, 10 Jan 2012 19:08:43 +0900 Subject: [PATCH 1/3] Add priority option --- lib/ruby_gntp.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ruby_gntp.rb b/lib/ruby_gntp.rb index 12a9225..ff2f81d 100755 --- a/lib/ruby_gntp.rb +++ b/lib/ruby_gntp.rb @@ -101,6 +101,7 @@ def notify(params, &callback) text = params[:text] icon = params[:icon] || get_notification_icon(name) sticky = params[:sticky] + priority = params[:priority] callback_context = params[:callback_context] callback_context_type = params[:callback_context_type] @@ -108,7 +109,7 @@ def notify(params, &callback) @binaries = [] - message = notify_header(app_name, name, title, text, sticky, icon) + message = notify_header(app_name, name, title, text, sticky, icon, priority) message << output_origin_headers if callback || callback_context message << "Notification-Callback-Context: #{callback_context || '(none)'}\r\n" @@ -204,7 +205,7 @@ def register_header(app_name, app_icon) # # outputs the notification header # - def notify_header(app_name, name, title, text, sticky, icon) + def notify_header(app_name, name, title, text, sticky, icon, priority) message = "#{get_gntp_header_start('NOTIFY')}\r\n" message << "Application-Name: #{@app_name}\r\n" message << "Notification-Name: #{name}\r\n" @@ -212,6 +213,7 @@ def notify_header(app_name, name, title, text, sticky, icon) message << "Notification-Text: #{text}\r\n" if text message << "Notification-Sticky: #{sticky}\r\n" if sticky message << "#{handle_icon(icon, 'Notification')}\r\n" if icon + message << "Notification-Priority: #{priority}\r\n" if priority message end From 92e13aa8bd32776b76aece4f5d48304432bab755 Mon Sep 17 00:00:00 2001 From: Shane Pinnell Date: Wed, 18 Jan 2012 15:20:48 -0800 Subject: [PATCH 2/3] Updated gem spec file to remove relative path for require. This was causing an error when building in Ruby 1.9 --- ruby_gntp.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby_gntp.gemspec b/ruby_gntp.gemspec index 1657356..1a2a847 100755 --- a/ruby_gntp.gemspec +++ b/ruby_gntp.gemspec @@ -1,4 +1,4 @@ -require 'lib/ruby_gntp' +require './lib/ruby_gntp' Gem::Specification.new do |s| s.name = GNTP::RUBY_GNTP_NAME From 776ff0e8d59ff048c6e3e9b4a13e156d1eaca923 Mon Sep 17 00:00:00 2001 From: Shane Pinnell Date: Wed, 18 Jan 2012 22:13:16 -0800 Subject: [PATCH 3/3] Update README --- README | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README b/README index 26dcc9f..4518be0 100644 --- a/README +++ b/README @@ -2,6 +2,14 @@ Ruby library for GNTP(Growl Notification Transport Protocol) Sorry, document is not avilable now. +Priority level mappings + + 2 Emergency + 1 High + 0 Normal + -1 Moderate + -2 Very Low + Usage example: require 'rubygems' @@ -20,6 +28,7 @@ growl.notify({ :text => "Congraturation! You are successful install ruby_gntp.", :icon => "http://www.hatena.ne.jp/users/sn/snaka72/profile.gif", :sticky=> true, + :priority => 2 }) # -- Instant notification @@ -28,6 +37,7 @@ GNTP.notify({ :title => "Instant notification", :text => "Instant notification available now.", :icon => "http://www.hatena.ne.jp/users/sn/snaka72/profile.gif", + :priority => 2 })