SkypeR 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +128 -0
- data/bin/iskype.rb +132 -0
- data/bin/iskype.rb~ +2 -0
- data/bin/rbus_send +3 -0
- data/bin/rbus_skype.rb +40 -0
- metadata +58 -0
data/README
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
= Synopsis
|
2
|
+
|
3
|
+
SkypeR is the library which enables SkypeAPI connection via RBus.
|
4
|
+
|
5
|
+
= Requirements
|
6
|
+
|
7
|
+
* Skype for Linux
|
8
|
+
* RBus
|
9
|
+
For more infomation, please refer to http://rbus.rubyforge.org/
|
10
|
+
|
11
|
+
= Install & Preparation
|
12
|
+
|
13
|
+
Install Skype for Debian.
|
14
|
+
|
15
|
+
Install the following packages via apt.
|
16
|
+
|
17
|
+
ii dbus 1.0.2-1 simple interprocess messaging system
|
18
|
+
ii dbus-1-doc 1.0.2-1 simple interprocess messaging system (documentation)
|
19
|
+
ii dbus-1-utils 1.0.2-1 simple interprocess messaging system (utilities)
|
20
|
+
ii libdbus-1-3 1.0.2-1 simple interprocess messaging system
|
21
|
+
ii libdbus-1-dev 1.0.2-1 simple interprocess messaging system (development headers)
|
22
|
+
ii libdbus-glib-1-2 0.71-3 simple interprocess messaging system (GLib-based shared li
|
23
|
+
ii libdbus-glib-1-dev 0.71-3 simple interprocess messaging system (GLib interface)
|
24
|
+
ii libdbus-qt-1-1c2 0.62.git.20060814-2 simple interprocess messaging system (Qt-based shared libr
|
25
|
+
ii libdbus-qt-1-dev 0.62.git.20060814-2 simple interprocess messaging system (Qt interface)
|
26
|
+
|
27
|
+
Install RBus via gem.
|
28
|
+
|
29
|
+
# gem install rbus
|
30
|
+
|
31
|
+
Invoke skype with dbus messaging enabled.
|
32
|
+
|
33
|
+
# skype --enable-dbus --use-session-dbus &
|
34
|
+
|
35
|
+
|
36
|
+
= Usage
|
37
|
+
|
38
|
+
== iSky
|
39
|
+
|
40
|
+
Be sure to invoke skype with with dbus messaging enabled.
|
41
|
+
And then, run iskype.rb with application name.
|
42
|
+
|
43
|
+
$ ruby iskype.rb -n application_name
|
44
|
+
Skype> GET USER my_skype_account FULLNAME
|
45
|
+
Skype> GET USER somebodys_account BUDDYSTATUS
|
46
|
+
Skype> GET USERSTATUS
|
47
|
+
#<RBus::Variant:0xb7ac9920 @object_signature="s", @object="USERSTATUS ONLINE">
|
48
|
+
=> #<Thread:0xb7ade26c>
|
49
|
+
Skype> exit
|
50
|
+
See you again.
|
51
|
+
|
52
|
+
|
53
|
+
= Skype API reference
|
54
|
+
|
55
|
+
|
56
|
+
== Comannds
|
57
|
+
|
58
|
+
=== CALL
|
59
|
+
Command: CALL <target>[, <target>]*
|
60
|
+
Response: CALL <call_id> <status>
|
61
|
+
|
62
|
+
<target> := USERNAME
|
63
|
+
| PSTN
|
64
|
+
| SPEED DIAL CODE
|
65
|
+
<status> := STATUS ROUTING
|
66
|
+
| SUBJECT
|
67
|
+
| STATUS RINGING
|
68
|
+
| STATUS INPROGRESS
|
69
|
+
| DURATION <integer>
|
70
|
+
| STATUS FINISHED
|
71
|
+
=== GET CALL
|
72
|
+
Command: GET CALL <id> property
|
73
|
+
Response: CALL <id> property <value>
|
74
|
+
=== SET CALL INPROGRESS
|
75
|
+
=== SET CALL FINISHED
|
76
|
+
=== SET CALL ONHOLD
|
77
|
+
=== SET CALL JOIN CONFERENCE
|
78
|
+
=== SET CALL DTMF
|
79
|
+
=== SET CALL SEEN
|
80
|
+
|
81
|
+
== Voicemail
|
82
|
+
|
83
|
+
=== VOICEMAIL
|
84
|
+
=== OPEN VOICEMAIL
|
85
|
+
=== ALTER VOICEMAIL
|
86
|
+
== Chat
|
87
|
+
=== CHAT CREATE
|
88
|
+
=== CHATMESSAGE
|
89
|
+
=== ALTER CHAT SETTOPIC
|
90
|
+
=== ALTER CHAT ADDMEMBERS
|
91
|
+
=== ALTER CHAT LEAVE
|
92
|
+
=== GET CHAT CHATMESSAGES
|
93
|
+
=== GET CHAT RECENTCHATMESSAGES
|
94
|
+
=== SET CHATMESSAGE SEEN
|
95
|
+
|
96
|
+
== Search
|
97
|
+
|
98
|
+
=== SEARCH
|
99
|
+
<search> := SEARCH <search-args>
|
100
|
+
<search-args> := USERS
|
101
|
+
| FRIENDS
|
102
|
+
| CALLS <target>
|
103
|
+
| ACTIVECALLS
|
104
|
+
| MISSEDCALLS
|
105
|
+
| VOICEMAILS
|
106
|
+
| CHATS
|
107
|
+
| MISSEDCHATS
|
108
|
+
| ACTIVECHATS
|
109
|
+
| RECENTCHATS
|
110
|
+
| BOOKMARKEDCHATS
|
111
|
+
| CHATMESSAGES [<target>]
|
112
|
+
| MISSEDCHATMESSAGES
|
113
|
+
| MESSAGES [<target>]
|
114
|
+
| MISSEDMESSAGES
|
115
|
+
| USERWAITINGMYAUTHORIZATION
|
116
|
+
|
117
|
+
== History
|
118
|
+
|
119
|
+
=== CLEAR HISTORY
|
120
|
+
|
121
|
+
=== CLEAR VOICEMAILHISTORY
|
122
|
+
|
123
|
+
=== CLEAR CALLHISTORY
|
124
|
+
|
125
|
+
== User interface
|
126
|
+
|
127
|
+
== AP2AP
|
128
|
+
|
data/bin/iskype.rb
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift File.join(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
require 'readline'
|
5
|
+
require 'optparse'
|
6
|
+
require "lib/skyper.rb"
|
7
|
+
|
8
|
+
module SkypeR
|
9
|
+
class Arguments < Hash
|
10
|
+
def initialize(args)
|
11
|
+
super()
|
12
|
+
# default values
|
13
|
+
opts = ::OptionParser.new do |opts|
|
14
|
+
opts.banner = "Usage: #$0 [options]"
|
15
|
+
opts.on('-n', '--name [STRING]', 'application name to access Skype') do |string|
|
16
|
+
self[:name] = string || '$'
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on_tail('-h', '--help', 'display this help') do
|
20
|
+
puts opts
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
end
|
24
|
+
opts.parse(args)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class REPL
|
29
|
+
def initialize(name)
|
30
|
+
@debug = false
|
31
|
+
@application = Service::Application.new(name)
|
32
|
+
@commands = {
|
33
|
+
'd' => ['toggle debug mode.',
|
34
|
+
proc { @debug = !@debug; puts "debug is #{@debug?'on':'off'}" }],
|
35
|
+
'h' => ['"h foo.h": bring in a C header.',
|
36
|
+
proc { |args| @headers << args }],
|
37
|
+
'l' => ['"l m": bring in a C library.',
|
38
|
+
proc { |args| @libraries << args }],
|
39
|
+
't' => ['test if the repl is ok by running a printf through it.',
|
40
|
+
proc { xsb_command('printf("repl is ok\n");') }],
|
41
|
+
's' => ['cause a segfault to let crepl attempt to recover.',
|
42
|
+
proc do
|
43
|
+
puts 'attempting segfault'
|
44
|
+
xsb_command '*((char*)0) = 0;'
|
45
|
+
end],
|
46
|
+
'help' => ['show help on commands.', proc { show_help }]
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Generate code from snippet, writing it to out.
|
51
|
+
def generate_code(name, out)
|
52
|
+
out.puts "#include <stdio.h>"
|
53
|
+
@headers.each do |header|
|
54
|
+
out.puts "#include \"#{header}\""
|
55
|
+
end
|
56
|
+
@externs.each do |extern|
|
57
|
+
out.puts "extern #{extern}"
|
58
|
+
end
|
59
|
+
|
60
|
+
out.puts "}"
|
61
|
+
end
|
62
|
+
|
63
|
+
def skype_command(code)
|
64
|
+
command = Service::Command.new(code)
|
65
|
+
@application.invoke_with_timeout(command, 60)
|
66
|
+
end
|
67
|
+
|
68
|
+
def skype_exit
|
69
|
+
raise
|
70
|
+
end
|
71
|
+
|
72
|
+
def show_help
|
73
|
+
puts <<-EOT
|
74
|
+
Type C statements and declarations as you would in a normal program.
|
75
|
+
Type a variable name by itself to see its value.
|
76
|
+
|
77
|
+
Commands start with a . and are as follows:
|
78
|
+
EOT
|
79
|
+
cmds = @commands.keys.sort
|
80
|
+
len = cmds.map{|c|c.length}.max
|
81
|
+
@commands.keys.sort.each do |cmd|
|
82
|
+
printf(" %-#{len}s %s\n", cmd, @commands[cmd][0])
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def input_loop
|
87
|
+
loop do
|
88
|
+
line = Readline.readline('Skype> ')
|
89
|
+
break unless line
|
90
|
+
line.chomp!
|
91
|
+
if line.empty?
|
92
|
+
next
|
93
|
+
else
|
94
|
+
case line
|
95
|
+
when /^exit$/
|
96
|
+
puts "See you again."
|
97
|
+
return
|
98
|
+
else
|
99
|
+
result = skype_command(line)
|
100
|
+
puts "=> #{result}"
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
Readline::HISTORY.push(line)
|
105
|
+
end
|
106
|
+
@interpreter.close
|
107
|
+
end # of Command
|
108
|
+
end # of Service
|
109
|
+
end # of SkypeR
|
110
|
+
|
111
|
+
begin
|
112
|
+
arguments = SkypeR::Arguments.new(ARGV)
|
113
|
+
p "arguments[:name] = #{arguments[:name]}"
|
114
|
+
if name = arguments[:name]
|
115
|
+
repl = SkypeR::REPL.new(name)
|
116
|
+
else
|
117
|
+
repl = SkypeR::REPL.new('test')
|
118
|
+
end
|
119
|
+
repl.input_loop
|
120
|
+
rescue Exception => e
|
121
|
+
puts e.message
|
122
|
+
puts "Backtrace:"
|
123
|
+
e.backtrace.each {|line|
|
124
|
+
puts line
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
data/bin/iskype.rb~
ADDED
data/bin/rbus_send
ADDED
data/bin/rbus_skype.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rbus.rb'
|
5
|
+
|
6
|
+
remote_bus = RBus.session_bus
|
7
|
+
skype_api_object = remote_bus.get_object("com.Skype.API","/com/Skype")
|
8
|
+
skype_api_object.interface!('com.Skype.API')
|
9
|
+
authQueryStr = 'NAME test'
|
10
|
+
authQuery = skype_api_object.Invoke(authQueryStr)
|
11
|
+
authQueryStr = 'PROTOCOL 5'
|
12
|
+
authQuery = skype_api_object.Invoke(authQueryStr)
|
13
|
+
query = Thread.start do
|
14
|
+
# contactListQuery = 'SEARCH FRIENDS'
|
15
|
+
# userList = skype_api_object.Invoke(contactListQuery)
|
16
|
+
# p userList
|
17
|
+
|
18
|
+
# query_str = 'GET USERSTATUS'
|
19
|
+
# query_str = 'GET USER shinkamori FULLNAME'
|
20
|
+
# query_str = 'GET USER shinkamori CITY'
|
21
|
+
# query_str = 'GET USER shinkamori PHONE_HOME'
|
22
|
+
query_str = 'GET USER shinkamori BUDDYSTATUS'
|
23
|
+
# query_str = '#AB GET USER shinkamori BUDDYSTATUS'
|
24
|
+
# query_str = 'GET USER shinkamori ISAUTHORIZED'
|
25
|
+
# query_str = 'GET USER shinkamori ISBLOCKED'
|
26
|
+
# query_str = 'GET USER shinkamori ONLINESTATUS'
|
27
|
+
# query_str = 'GET USER shinkamori LASTONLINETIMESTAMP'
|
28
|
+
# query_str = 'CALL shinkamori'
|
29
|
+
# query_str = 'GET CALL shinkamori property'
|
30
|
+
# query_str = 'OPEN BLOCKEDUSERS'
|
31
|
+
# query_str = 'OPEN AUTHORIZATION shinkamori'
|
32
|
+
result = skype_api_object.Invoke(query_str)
|
33
|
+
p result
|
34
|
+
end
|
35
|
+
query.join
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.3
|
3
|
+
specification_version: 1
|
4
|
+
name: SkypeR
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.0.2
|
7
|
+
date: 2007-08-12 00:00:00 +09:00
|
8
|
+
summary: a SkypeAPI library for Ruby
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: akimichi_tatsukawa@nifty.com
|
12
|
+
homepage: http://akimichi.homeunix.net/~emile/aki/hiki.cgi?SkypeR
|
13
|
+
rubyforge_project:
|
14
|
+
description:
|
15
|
+
autorequire: skyper
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Akimichi Tatsukawa
|
31
|
+
files:
|
32
|
+
- bin/iskype.rb~
|
33
|
+
- bin/rbus_send
|
34
|
+
- bin/rbus_skype.rb
|
35
|
+
- bin/iskype.rb
|
36
|
+
- README
|
37
|
+
test_files: []
|
38
|
+
|
39
|
+
rdoc_options: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README
|
43
|
+
executables: []
|
44
|
+
|
45
|
+
extensions: []
|
46
|
+
|
47
|
+
requirements: []
|
48
|
+
|
49
|
+
dependencies:
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rbus
|
52
|
+
version_requirement:
|
53
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 0.2.0
|
58
|
+
version:
|