SkypeR 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,102 @@
1
+ require 'rubygems'
2
+ #require 'uuidtools.rb'
3
+ require 'uuidtools'
4
+ require 'rbus.rb'
5
+ require 'thread.rb'
6
+ require 'timeout.rb'
7
+
8
+
9
+ module SkypeR
10
+ module Service
11
+ class Application
12
+ def initialize(name, protocol_num = 5)
13
+ remote_bus = ::RBus.session_bus
14
+ service_name = 'com.Skype.API'
15
+ object_path = "/com/Skype"
16
+ @api_object = remote_bus.get_object(service_name, object_path)
17
+ @api_object.interface!(service_name)
18
+ @application_name = name
19
+ @invoked_commands = Hash.new
20
+ end
21
+
22
+ def invoke(command, timeout = 60)
23
+ begin
24
+ ::Timeout.timeout(timeout) {
25
+ authenticate
26
+ @invoked_commands[command.command_id] = command.statement
27
+ @api_object.Invoke("##{command.command_id} #{command.statement}")
28
+ }
29
+ rescue ::Timeout::Error
30
+ puts "Connection timeout. Please try again."
31
+ end
32
+ end
33
+
34
+
35
+ def parse(message)
36
+ case message
37
+ when CommandMessage
38
+ command_parser = SkypeR::Parser::CommandStatement.new
39
+ command_parser.parse(message.statement)
40
+ when ResponseMessage
41
+ response_parser = SkypeR::Parser::ResponseCommandStatement.new
42
+ response_parser.parse(message.statement)
43
+ else
44
+ raise
45
+ end
46
+ end
47
+
48
+ def validate(command)
49
+ case result = parse(command)
50
+ when Yaparc::Result::OK
51
+ true
52
+ when Yaparc::Result::Fail
53
+ false
54
+ else
55
+ raise
56
+ end
57
+ end
58
+
59
+ private
60
+ def authenticate(protocol_num = 5)
61
+ result = nil
62
+ query = Thread.start do
63
+ name_command = SkypeR::Service::CommandMessage.new("NAME #{@application_name}")
64
+ result = @api_object.Invoke(name_command.statement)
65
+ puts result
66
+ protocol_command = SkypeR::Service::CommandMessage.new("PROTOCOL #{protocol_num}")
67
+ result = @api_object.Invoke(protocol_command.statement)
68
+ puts result
69
+ end
70
+ query.join
71
+ end
72
+ end # of Application
73
+
74
+
75
+ class MessageBase
76
+ attr_accessor :statement, :command_id
77
+ end
78
+
79
+ class CommandMessage < MessageBase
80
+
81
+ def initialize(statement)
82
+ @statement = statement
83
+ @command_id = UUID.timestamp_create.to_i
84
+ end
85
+ end # of Command
86
+
87
+
88
+ class ResponseMessage < MessageBase
89
+ attr_accessor :statement, :response_instance
90
+ def initialize(statement, response_instance)
91
+ @statement = statement
92
+ @response_instance = response_instance
93
+ end
94
+ end # Response
95
+
96
+ # class Result < Response
97
+ # end
98
+
99
+ # class Error < Response
100
+ # end
101
+ end
102
+ end
data/lib/skyper.rb ADDED
@@ -0,0 +1,13 @@
1
+ $:.unshift File.join(File.dirname(__FILE__))
2
+
3
+ require 'rubygems'
4
+ require 'rbus.rb'
5
+
6
+ require 'skyper/service.rb'
7
+ require 'skyper/object.rb'
8
+ require 'skyper/parser.rb'
9
+ require 'skyper/response.rb'
10
+ require 'skyper/command.rb'
11
+
12
+
13
+
@@ -0,0 +1,192 @@
1
+
2
+ require 'lib/skyper.rb'
3
+ require 'test/unit'
4
+
5
+ class SkypeYaparcTest < Test::Unit::TestCase
6
+ include ::Yaparc
7
+
8
+ def setup
9
+ end
10
+
11
+ def test_identifier
12
+ parser = SkypeR::Parser::Identifier.new
13
+ result = parser.parse("abc")
14
+ assert_equal "abc", result.value
15
+ end
16
+
17
+ def test_command_id
18
+ parser = SkypeR::Parser::CommandID.new
19
+ result = parser.parse(" #ABC ")
20
+ assert_equal "#ABC", result.value
21
+ end
22
+
23
+ def test_chat_id
24
+ parser = SkypeR::Parser::ChatID.new
25
+ result = parser.parse(' #me/$target;012345679012345 ')
26
+ assert_equal "#me/$target;012345679012345", result.value
27
+ end
28
+
29
+ def test_user_property
30
+ parser = SkypeR::Parser::UserProperty.new
31
+ result = parser.parse("HANDLE")
32
+ assert_equal "HANDLE", result.value
33
+ result = parser.parse(" IS_CF_ACTIVE ")
34
+ assert_equal "IS_CF_ACTIVE", result.value
35
+ end
36
+
37
+ def test_profile_property
38
+ parser = SkypeR::Parser::ProfileProperty.new
39
+ result = parser.parse(" PSTN_BALANCE ")
40
+ assert_equal "PSTN_BALANCE", result.value
41
+ end
42
+
43
+ def test_pstn
44
+ parser = SkypeR::Parser::PSTN.new
45
+ assert_equal "+18005551234", parser.parse("+18005551234").value
46
+ end
47
+
48
+ def test_target
49
+ parser = SkypeR::Parser::Target.new
50
+ assert_equal "echo124", parser.parse("echo124").value
51
+ end
52
+
53
+
54
+ def test_call_command
55
+ parser = SkypeR::Parser::CallCommand.new
56
+ assert_equal ["foo"], parser.parse("CALL foo").value[:targets]
57
+ assert_equal ["foo", "bar"], parser.parse("CALL foo, bar").value[:targets]
58
+ assert_equal ["foo", "bar", "bla"], parser.parse("CALL foo, bar, bla").value[:targets]
59
+ end
60
+
61
+ def test_set_call_finished_command
62
+ parser = SkypeR::Parser::SetCallFinishedCommand.new
63
+ assert_equal 567, parser.parse("SET CALL 567 STATUS FINISHED").value[:call_id]
64
+ end
65
+
66
+
67
+ def test_set_call_inprogress_command
68
+ parser = SkypeR::Parser::SetCallInprogressCommand.new
69
+ assert_equal 234, parser.parse("SET CALL 234 STATUS INPROGRESS").value[:call_id]
70
+ end
71
+
72
+ def test_set_command
73
+ parser = SkypeR::Parser::SetCommand.new
74
+ assert_equal 987, parser.parse("SET CALL 987 STATUS FINISHED").value[:call_id]
75
+ end
76
+
77
+ def test_get_user
78
+ parser = SkypeR::Parser::GetUserCommand.new
79
+ assert_equal "foo", parser.parse("GET USER foo FULLNAME ").value[:username]
80
+ assert_equal "FULLNAME", parser.parse("GET USER foo FULLNAME ").value[:property]
81
+ parser.parse(" GET USER foo BUDDYSTATUS ") do |result|
82
+ {"#{parser.class}" => {:identifier => result.value[:identifier], :property => result.value[:property]}}
83
+ end
84
+ assert_equal "BUDDYSTATUS", parser.tree["SkypeR::Parser::GetUserCommand"][:property]
85
+ assert_instance_of SkypeR::Parser::GetUserResponse, parser.response
86
+ parser.response.parse("USER foo BUDDYSTATUS 3 ") do |result|
87
+ {"#{parser.response.class}" =>
88
+ {
89
+ :identifier => result.value[:identifier],
90
+ :property => result.value[:property],
91
+ :value => result.value[:value]
92
+ }
93
+ }
94
+ end
95
+ assert_equal "3", parser.response.tree["SkypeR::Parser::GetUserResponse"][:value]
96
+ end
97
+
98
+ def test_get_call
99
+ parser = SkypeR::Parser::GetCallCommand.new
100
+ assert_instance_of Yaparc::Result::Fail, parser.parse("GET CALL TIMEZONE ")
101
+ assert_equal "TIMESTAMP", parser.parse("GET CALL 123 TIMESTAMP ").value[:property]
102
+ assert_equal 123, parser.parse("GET CALL 123 TIMESTAMP ").value[:call_id]
103
+ parser.parse(" GET CALL 123 STATUS ") do |result|
104
+ {"#{parser.class}" => {:property => result.value[:property]}}
105
+ end
106
+ assert_equal "STATUS", parser.tree["SkypeR::Parser::GetCallCommand"][:property]
107
+ assert_instance_of SkypeR::Parser::GetCallResponse, parser.response
108
+ parser.response.parse("CALL foo STATUS FAILED ") do |result|
109
+ {"#{parser.response.class}" =>
110
+ {
111
+ :property => result.value[:property],
112
+ :value => result.value[:value]
113
+ }
114
+ }
115
+ end
116
+ assert_equal "FAILED", parser.response.tree["SkypeR::Parser::GetCallResponse"][:value]
117
+ end
118
+
119
+ def test_get_profile
120
+ parser = SkypeR::Parser::GetProfileCommand.new
121
+ assert_equal "PSTN_BALANCE", parser.parse("GET PROFILE PSTN_BALANCE ").value[:property]
122
+ parser.parse("GET PROFILE PSTN_BALANCE ") do |result|
123
+ {"#{parser.class}" =>
124
+ {:property => result.value[:property]}
125
+ }
126
+ end
127
+ assert_equal "PSTN_BALANCE", parser.tree["SkypeR::Parser::GetProfileCommand"][:property]
128
+ end
129
+
130
+ def test_get_profile2
131
+ parser = SkypeR::Parser::GetProfileCommand.new
132
+ assert_instance_of Yaparc::Result::Fail, parser.parse("GET PROFILE foo TIMEZONE ")
133
+ assert_equal "TIMEZONE", parser.parse("GET PROFILE TIMEZONE ").value[:property]
134
+ parser.parse(" GET PROFILE FULLNAME ") do |result|
135
+ {"#{parser.class}" => {:property => result.value[:property]}}
136
+ end
137
+ assert_equal "FULLNAME", parser.tree["SkypeR::Parser::GetProfileCommand"][:property]
138
+ assert_instance_of SkypeR::Parser::GetProfileResponse, parser.response
139
+ parser.response.parse("PROFILE SEX MALE ") do |result|
140
+ {"#{parser.response.class}" =>
141
+ {
142
+ :property => result.value[:property],
143
+ :value => result.value[:value]
144
+ }
145
+ }
146
+ end
147
+ assert_equal "MALE", parser.response.tree["SkypeR::Parser::GetProfileResponse"][:value]
148
+ end
149
+
150
+
151
+ def test_get_command
152
+ parser = SkypeR::Parser::GetCommand.new
153
+ assert_equal "PSTN_BALANCE", parser.parse("GET PROFILE PSTN_BALANCE ").value[:property]
154
+ end
155
+
156
+
157
+ def test_search_users
158
+ parser = SkypeR::Parser::SearchUsersCommand.new
159
+ assert_equal "foo", parser.parse("SEARCH USERS foo ").value[:target]
160
+ end
161
+
162
+ def test_search_friends
163
+ parser = SkypeR::Parser::SearchFriendsCommand.new
164
+ assert_instance_of SkypeR::Parser::SearchFriendsCommand, parser.parse("SEARCH FRIENDS ").value[:command_instance]
165
+ end
166
+
167
+
168
+ def test_chat_get_chat_chatmessages
169
+ parser = SkypeR::Parser::GetChatChatmessagesCommand.new
170
+ assert_instance_of SkypeR::Parser::GetChatChatmessagesCommand, parser.parse("GET CHAT #me/$target;012345679012345 CHATMESSAGES").value[:command_instance]
171
+ end
172
+
173
+ def test_chat
174
+ parser = SkypeR::Parser::ChatCommand.new
175
+ assert_equal ["foo", "bar", "bla"], parser.parse("CHAT CREATE foo, bar, bla ").value[:targets]
176
+ end
177
+
178
+
179
+
180
+ def test_command
181
+ parser = SkypeR::Parser::Command.new
182
+ assert_equal "PSTN_BALANCE", parser.parse("GET PROFILE PSTN_BALANCE ").value[:property]
183
+ end
184
+
185
+ def test_command_statement
186
+ parser = SkypeR::Parser::CommandStatement.new
187
+ assert_equal "PSTN_BALANCE", parser.parse("GET PROFILE PSTN_BALANCE ").value[:property]
188
+ assert_equal "foo", parser.parse("GET USER foo FULLNAME").value[:username]
189
+ assert_equal "FULLNAME", parser.parse("GET USER foo FULLNAME").value[:property]
190
+ end
191
+ end
192
+
@@ -0,0 +1,45 @@
1
+
2
+ require 'lib/skyper.rb'
3
+ require 'test/unit'
4
+
5
+ class SkypeYaparcResponseTest < Test::Unit::TestCase
6
+ include ::Yaparc
7
+
8
+ def test_search_users
9
+ parser = SkypeR::Parser::SearchUsersResponse.new
10
+ assert_equal Hash[:usernames => ["foo", "bar", "bla"]], parser.parse("USERS foo, bar, bla ").value
11
+ end
12
+
13
+ def test_search_friends
14
+ parser = SkypeR::Parser::SearchFriendsResponse.new
15
+ assert_equal Hash[:usernames => ["foo"]], parser.parse("USERS foo").value
16
+ assert_equal Hash[:usernames => ["foo", "bar", "bla"]], parser.parse("USERS foo, bar, bla ").value
17
+ end
18
+
19
+ def test_search_calls
20
+ parser = SkypeR::Parser::SearchCallsResponse.new
21
+ assert_equal Hash[:identifiers => ["foo"]], parser.parse("CALLS foo").value
22
+ assert_equal Hash[:identifiers => ["foo", "bar", "bla"]], parser.parse("CALLS foo, bar, bla ").value
23
+ end
24
+
25
+ def test_search_activecalls
26
+ parser = SkypeR::Parser::SearchActivecallsResponse.new
27
+ assert_equal Hash[:identifiers => ["foo"]], parser.parse("CALLS foo").value
28
+ assert_equal Hash[:identifiers => ["foo", "bar", "bla"]], parser.parse("CALLS foo, bar, bla ").value
29
+ end
30
+
31
+
32
+ def test_search_missedcalls
33
+ parser = SkypeR::Parser::SearchMissedcallsResponse.new
34
+ assert_equal Hash[:identifiers => ["foo"]], parser.parse("CALLS foo").value
35
+ assert_equal Hash[:identifiers => ["foo", "bar", "bla"]], parser.parse("CALLS foo, bar, bla ").value
36
+ end
37
+
38
+ def test_search_userswaitingmyauthorization
39
+ parser = SkypeR::Parser::SearchUserswaitingmyauthorizationResponse.new
40
+ assert_equal Hash[:identifiers => ["foo"]], parser.parse("USERS foo").value
41
+ assert_equal Hash[:identifiers => ["foo", "bar", "bla"]], parser.parse("USERS foo, bar, bla ").value
42
+ end
43
+
44
+ end
45
+
@@ -0,0 +1,36 @@
1
+ require 'lib/skyper.rb'
2
+ require 'test/unit'
3
+
4
+ class SkypeApplicationTest < Test::Unit::TestCase
5
+ def setup
6
+ @application = SkypeR::Service::Application.new('test')
7
+ end
8
+
9
+ def test_init
10
+ assert_instance_of SkypeR::Service::Application, @application
11
+ end
12
+
13
+ def test_parse
14
+ result = @application.parse(SkypeR::Service::CommandMessage.new("GET PROFILE PSTN_BALANCE "))
15
+
16
+ assert_instance_of SkypeR::Parser::GetProfileCommand, result.value[:command_instance]
17
+ assert_equal "PSTN_BALANCE", result.value[:property]
18
+
19
+ result = @application.parse(SkypeR::Service::CommandMessage.new("GET USER bar FULLNAME"))
20
+ assert_equal "bar", result.value[:username]
21
+ assert_equal "FULLNAME", result.value[:property]
22
+ end
23
+
24
+ def test_validate_true
25
+ assert_equal true, @application.validate(SkypeR::Service::CommandMessage.new("GET PROFILE PSTN_BALANCE "))
26
+ assert_equal true, @application.validate(SkypeR::Service::CommandMessage.new("GET USERSTATUS "))
27
+ end
28
+ end
29
+
30
+
31
+ class SkypeCommandTest < Test::Unit::TestCase
32
+ def test_init
33
+ command = SkypeR::Service::CommandMessage.new('GET PROFILE PSTN_BALANCE')
34
+ assert_equal "GET PROFILE PSTN_BALANCE", command.statement
35
+ end
36
+ end
metadata CHANGED
@@ -1,56 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.3
3
- specification_version: 1
4
2
  name: SkypeR
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.0.5
7
- date: 2008-01-16 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://rubyforge.org/projects/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:
4
+ version: 0.0.6
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Akimichi Tatsukawa
31
- files:
32
- - bin/iskype.rb
33
- - bin/iskype.rb~
34
- - bin/rbus_skype.rb
35
- - bin/rbus_send
36
- - README
37
- test_files: []
38
-
39
- rdoc_options: []
40
-
41
- extra_rdoc_files:
42
- - README
43
- executables: []
44
-
45
- extensions: []
46
-
47
- requirements: []
8
+ autorequire: skyper
9
+ bindir: bin
10
+ cert_chain: []
48
11
 
12
+ date: 2008-01-31 00:00:00 +09:00
13
+ default_executable:
49
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: uuidtools
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - "="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.0
23
+ version:
50
24
  - !ruby/object:Gem::Dependency
51
25
  name: rbus
52
26
  version_requirement:
53
- version_requirements: !ruby/object:Gem::Version::Requirement
27
+ version_requirements: !ruby/object:Gem::Requirement
54
28
  requirements:
55
29
  - - ">="
56
30
  - !ruby/object:Gem::Version
@@ -59,9 +33,65 @@ dependencies:
59
33
  - !ruby/object:Gem::Dependency
60
34
  name: yaparc
61
35
  version_requirement:
62
- version_requirements: !ruby/object:Gem::Version::Requirement
36
+ version_requirements: !ruby/object:Gem::Requirement
63
37
  requirements:
64
38
  - - ">="
65
39
  - !ruby/object:Gem::Version
66
40
  version: 0.1.0
67
41
  version:
42
+ description:
43
+ email: akimichi_tatsukawa@nifty.com
44
+ executables: []
45
+
46
+ extensions: []
47
+
48
+ extra_rdoc_files:
49
+ - README
50
+ - MIT-LICENSE
51
+ files:
52
+ - tests/test_service.rb
53
+ - tests/test_response.rb
54
+ - tests/test_parser.rb
55
+ - lib/skyper
56
+ - lib/skyper/error.csv
57
+ - lib/skyper/error.obj
58
+ - lib/skyper/parser.rb
59
+ - lib/skyper/error.rb
60
+ - lib/skyper/object.rb
61
+ - lib/skyper/response.rb
62
+ - lib/skyper/service.rb
63
+ - lib/skyper/command.rb
64
+ - lib/skyper.rb
65
+ - bin/iskype.rb
66
+ - README
67
+ - MIT-LICENSE
68
+ has_rdoc: true
69
+ homepage: http://rubyforge.org/projects/skyper/
70
+ post_install_message:
71
+ rdoc_options: []
72
+
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ version:
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: "0"
86
+ version:
87
+ requirements: []
88
+
89
+ rubyforge_project:
90
+ rubygems_version: 1.0.1
91
+ signing_key:
92
+ specification_version: 2
93
+ summary: a SkypeAPI library for Ruby
94
+ test_files:
95
+ - tests/test_service.rb
96
+ - tests/test_response.rb
97
+ - tests/test_parser.rb
data/bin/iskype.rb~ DELETED
@@ -1,169 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift File.join(File.dirname(__FILE__))
3
-
4
- require 'rubygems'
5
- require_gem 'yaparc'
6
- require 'readline'
7
- require 'optparse'
8
- require 'logger'
9
- require "lib/skyper.rb"
10
-
11
- module SkypeR
12
- LOGGER = nil
13
- class Arguments < Hash
14
- def initialize(args)
15
- super()
16
- # default values
17
- opts = ::OptionParser.new do |opts|
18
- opts.banner = "Usage: #$0 [options]"
19
- opts.on('-n', '--name [STRING]', 'application name to access Skype') do |string|
20
- self[:name] = string || '$'
21
- end
22
-
23
- opts.on('-l', '--log [STRING]', 'log file path') do |string|
24
- self[:log] = string || '$'
25
- end
26
-
27
- opts.on('-p', '--parse', 'parsing enabled') do
28
- self[:parse] = true
29
- end
30
-
31
- opts.on_tail('-h', '--help', 'display this help') do
32
- puts opts
33
- exit
34
- end
35
- end
36
- opts.parse(args)
37
- end
38
- end
39
-
40
- class REPL
41
- def initialize(name, log = nil, parse = false)
42
- @debug = false
43
- @application = Service::Application.new(name)
44
- @parse = parse
45
- @headers = []
46
- @logger = Logger.new(log ? log : $stderr)
47
- @commands = {
48
- 'd' => ['toggle debug mode.',
49
- proc { @debug = !@debug; puts "debug is #{@debug?'on':'off'}" }],
50
- 'logger' => ['"logger on": bring logger active.',
51
- proc {|args|
52
- @headers << args
53
- }],
54
- 'l' => ['"l m": bring in a C library.',
55
- proc { |args| @libraries << args }],
56
- 'test' => ['test if the repl is ok by running a printf through it.',
57
- proc { xsb_command('printf("repl is ok\n");') }],
58
- 'help' => ['show help on commands.', proc { show_help }]
59
- }
60
- end
61
-
62
-
63
- def skype_command(command_statement)
64
- command_message = Service::CommandMessage.new(command_statement)
65
- end
66
-
67
- def skype_response(response_statement, response_instance)
68
- response = Service::ResponseMessage.new(response_statement, response_instance)
69
- result = @application.parse(response)
70
- end
71
-
72
- def skype_exit
73
- raise
74
- end
75
-
76
-
77
- def show_help
78
- puts <<-EOT
79
- Not in use, yet.
80
- Type C statements and declarations as you would in a normal program.
81
- Type a variable name by itself to see its value.
82
-
83
- Commands start with a . and are as follows:
84
- EOT
85
- cmds = @commands.keys.sort
86
- len = cmds.map{|c|c.length}.max
87
- @commands.keys.sort.each do |cmd|
88
- printf(" %-#{len}s %s\n", cmd, @commands[cmd][0])
89
- end
90
- end
91
-
92
- def input_loop
93
- loop do
94
- line = Readline.readline('Skype> ')
95
- break unless line
96
- line.chomp!
97
- if line.empty?
98
- next
99
- else
100
- @logger.debug("INPUT> #{line}")
101
- case line
102
- when /^exit$/
103
- puts "See you again."
104
- @logger.debug("OUTPUT> See you again.")
105
- return
106
- else
107
- response_statement = nil
108
- command_message = SkypeR::Service::CommandMessage.new(line)
109
- if @parse
110
- case result = @application.parse(command_message)
111
- when Yaparc::OK
112
- response_statement = @application.invoke(command_message, 30)
113
- # response_instance = result.value[:command_instance].response
114
- # skype_response(response_statement, response_instance)
115
- when Yaparc::Fail
116
- response_statement = "##{command_message.command_id} Parse Error"
117
- else
118
- raise
119
- end
120
- else # in case of parse option disabled
121
- response_statement = @application.invoke(command_message, 30)
122
- end
123
- unless response_statement.empty?
124
- response_id, response_statement = split_response(response_statement)
125
- puts "=> #{response_statement}"
126
- @logger.debug("OUTPUT> #{response_statement}")
127
- end
128
- end
129
- end
130
- Readline::HISTORY.push(line)
131
- end
132
- @interpreter.close
133
-
134
- end # of input_loop method
135
-
136
- private
137
- def split_response(response_statement)
138
- if match = Regexp.new(/(#[0-9]+) (.*)$/).match(response_statement)
139
- [match[1], match[2]]
140
- else
141
- p "#{response_statement}"
142
- raise
143
- end
144
- end
145
- end # of Service
146
- end # of SkypeR
147
-
148
-
149
- begin
150
- arguments = SkypeR::Arguments.new(ARGV)
151
- if name = arguments[:name]
152
- repl = SkypeR::REPL.new(name, arguments[:log], arguments[:parse])
153
- else
154
- repl = SkypeR::REPL.new('test', 'log/iskype.log', arguments[:parse])
155
- end
156
- repl.input_loop
157
- # rescue Exception => e
158
- # puts e.message
159
- # puts "Backtrace:"
160
- # e.backtrace.each {|line|
161
- # puts line
162
- # }
163
- end
164
-
165
-
166
-
167
-
168
-
169
-
data/bin/rbus_send DELETED
@@ -1,3 +0,0 @@
1
- rbus-send --dest=com.Skype.API --print-reply --session --type=method_call /com/Skype com.Skype.API.Invoke string:'NAME test'
2
- rbus-send --dest=com.Skype.API --print-reply --session --type=method_call /com/Skype com.Skype.API.Invoke string:'PROTOCOL 3'
3
-