Skypekit

Ruby FFI interface to libskypekit C library

View the Project on GitHub railsware/skypekit

logo

Skypekit

Ruby FFI interface to libskypekit C library

Dependencies

Installation

Install libskypekit.

Add this line to your application's Gemfile:

gem 'skypekit'

And then execute:

$ bundle

Or install it yourself as:

$ gem install skypekit

Usage

ping_pong example:

require "skypekit"

$skype = Skypekit::Skype.new(:keyfile => 'myskypekit.pem')

$skype.start
$skype.login('myskypename', 'mypassword')

def terminate
  puts "Terminating"
  $skype.stop
  exit
end

trap('INT') do
  terminate
end

loop do
  event = $skype.get_event

  unless event
    sleep 5
    next
  end

  case event.type
  when :account_status

    if event.data.logged_in?
      puts "Congrats! We are Logged in!"
    end

    if event.data.logged_out?
      puts "Authentication failed: #{event.data.reason}"
      terminate
    end

  when :chat_message
    message = event.data

    puts "@" * 80
    p message
    puts "@" * 80

    if message.body == "ping"
      $skype.send_chat_message(message.convo_id, "pong")
    end

  end
end

Run ping_pong example:

SK_KEY=bla.pem SK_USER=user SK_PASS=secret be ruby examples/ping_pong.rb

Author

Contributors

License

References