Skip to content

Commit

Permalink
added Skype status action
Browse files Browse the repository at this point in the history
  • Loading branch information
21croissants committed Oct 2, 2010
1 parent 96d21e8 commit d31a5d7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
30 changes: 30 additions & 0 deletions actions/skype_status.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class SkypeStatus < CapreseAction
include Appscript

config_schema({:away => String, :available => String})

def start
set_status("dnd")
set_status_message(config[:away])
end

def stop
set_status("online")
set_status_message(config[:available])
end

def skype
@skype ||= app("Skype")
end

private

def set_status(status)
skype.send_(:command => "set userstatus #{status}", :script_name => "caprese")
end

def set_status_message(message)
skype.send_(:command => "set profile mood_text #{message}", :script_name => "caprese")
end

end
5 changes: 5 additions & 0 deletions config.rb.sample
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ IchatStatus(
:available => "Available"
)

SkypeStatus(
:away => "Pomodoro! Ends at #{stop_time.to_short_time}",
:available => "Available"
)

Campfire(
:start_message => %(< #{MY_NAME} started "#{description}": #{start_time.to_short_time} - #{stop_time.to_short_time} >),
:stop_message => "< #{MY_NAME} ended >",
Expand Down
23 changes: 23 additions & 0 deletions spec/actions/skype_status_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe SkypeStatus do

before :each do
@action = SkypeStatus.new(
:away => "Pomodoro! Ends",
:available => "Available"
)
end

# spces are commented as Skype needs to be running
describe "status update" do
it "can set status to Do Not Disturb when pomodoro starts" do
# @action.start
end

it "can set status to online when pomodoro ends" do
# @action.stop
end
end

end

0 comments on commit d31a5d7

Please sign in to comment.