Skype

install

gem install Ruby4Skype

require swin.so at Windows.

require rubycocoa at Mac. Not work at OSX 10.6 Snow Leopard.Because Skype.framework not contains 64bit binary. You need copy /Application/Skype/Contnet/Frameworks/Skype.framework to /Library/Frameworks/Skype.framework Some methods not work.

##require dbus or rbus at Linux.

Ruby4Skype support Windows and Mac now.

sample

require 'rubygems'
require 'Skype'

Skype.init 'application_name'
Skype.start_messageloop
Skype::ChatMessage.set_notify do |chatmessage, property, value|
  if property == :status and value == 'RECEIVED'
    chatmessage.get_chat.send_message chatmessage.get_body
  end
end
Skype.attach_wait
sleep

method and object

Ruby4Skype is same Skype API methods and objects.

developer.skype.com/Docs/ApiDoc/FrontPage

method

ex.

CHAT CREATE [<target>, <target>*] -> Skype::Chat.create *targets

developer.skype.com/Docs/ApiDoc/CHAT_CREATE

GET object property

developer.skype.com/Docs/ApiDoc/src#PROPERTIES_OBJECT

Skype::User.get_fullname

Skype Objects

developer.skype.com/Docs/ApiDoc/Objects

USER -> Skype::User

PROFILE -> Skype::Profile

CALL -> Skype::Call

MESSAGE -> Skype::Message (obsolete)

CHAT -> Skype::Chat

CHATMEMBER -> Skype::ChatMember

CHATMESSAGE -> Skype::ChatMessage

VOICEMAIL -> Skype::VoiceMail (none test)

SMS -> Skype::SMS (none test)

APPLICATION -> Skype::Application (none test)

GROUP -> Skype::Group (broken)

FILETRANSFER -> Skype::FileTransfer

notification

When Skype change property, callback is called. Property is symbol of method name get_xxx.

general property

Skype.set_notify{|property, value| }

objects property

Skype::ChatMessage.set_notify{|instance, property, value|}

specify property

Skype::ChatMessage.set_notify(:status){|instance, value|}

specify property and value

Skype::ChatMessage.set_notify(:status, 'RECEIVED'){|instance|}

messageloop

messageloop run with new thread.

Skype.start_messageloop

or messageloop run with current thread.

Skype.messageloop

or message polling

loop do
  Skype.messgepolling
  sleep 0.123
end