Sha256: 92c6b779537ec8c2497a61889b6c2219a84af21443cce5513fcde71589e55bba
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
module Firetower module Plugins class NotifyPlugin < Firetower::Session::Listener def startup(session) if session.kind == :server notify("Firetower", "Firetower is vigilantly scanning the treetops") end end def join(session, room) notify("Firetower", "Joined room \"#{room.name}\"") end def leave(session, room) notify("Firetower", "Left room \"#{room.name}\"") end def receive(session, event) case event['type'] when "TextMessage" user = event.room.account.users[event['user_id']] notify(user['name'], event['body']) else # NOOP end end def error(session, error) notify("Campfire Error", error.message) end private def notify(*args) system('notify-send', '--icon', File.expand_path( 'campfire-logo-for-fluid.png', File.dirname(__FILE__)), '-c', 'Firetower', *args) or raise "Desktop notification failed" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
firetower-0.0.4 | lib/firetower/plugins/core/notify_plugin.rb |
firetower-0.0.3 | lib/firetower/plugins/core/notify_plugin.rb |
firetower-0.0.2 | lib/firetower/plugins/core/notify_plugin.rb |