Ruby4Skype 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +95 -7
- data/Rakefile +3 -3
- data/lib/{skypeapi.rb → skype.rb} +102 -89
- data/lib/{skypeapi → skype}/application.rb +5 -5
- data/lib/{skypeapi → skype}/call.rb +9 -9
- data/lib/{skypeapi → skype}/chat.rb +176 -176
- data/lib/{skypeapi → skype}/chatmember.rb +31 -31
- data/lib/{skypeapi → skype}/chatmessage.rb +9 -9
- data/lib/{skypeapi → skype}/error.rb +1 -1
- data/lib/{skypeapi → skype}/event.rb +2 -2
- data/lib/{skypeapi → skype}/filetransfer.rb +2 -2
- data/lib/{skypeapi → skype}/group.rb +8 -8
- data/lib/{skypeapi → skype}/menuitem.rb +4 -4
- data/lib/{skypeapi → skype}/message.rb +1 -1
- data/lib/{skypeapi → skype}/object.rb +16 -15
- data/lib/{skypeapi → skype}/os/etc.rb +35 -9
- data/lib/skype/os/linux.rb +115 -0
- data/lib/skype/os/linux.rb~ +117 -0
- data/lib/skype/os/mac.rb +217 -0
- data/lib/{skypeapi → skype}/os/notifier.rb +1 -1
- data/lib/skype/os/timer.rb +108 -0
- data/lib/{skypeapi → skype}/os/window_event_queue.rb +16 -16
- data/lib/{skypeapi → skype}/os/window_messagehandler.rb +12 -12
- data/lib/{skypeapi → skype}/os/windows.rb +10 -10
- data/lib/{skypeapi → skype}/profile.rb +3 -3
- data/lib/{skypeapi → skype}/sharefunctions.rb +6 -6
- data/lib/{skypeapi → skype}/sms.rb +3 -3
- data/lib/{skypeapi → skype}/user.rb +1 -1
- data/lib/{skypeapi → skype}/version.rb +2 -2
- data/lib/{skypeapi → skype}/voicemail.rb +4 -4
- data/spec/{skypeapi → skype}/application_spec.rb +13 -15
- data/spec/{skypeapi → skype}/chat_spec.rb +75 -77
- data/spec/{skypeapi → skype}/chatmember_spec.rb +13 -13
- data/spec/{skypeapi → skype}/chatmessage_spec.rb +12 -13
- data/spec/skype/event_spec.rb +33 -0
- data/spec/{skypeapi → skype}/filetransfer_spec.rb +10 -11
- data/spec/skype/group_spec.rb +15 -0
- data/spec/{skypeapi → skype}/menuitem_spec.rb +11 -9
- data/spec/skype/os/linux_spec.rb +59 -0
- data/spec/skype/os/linux_spec.rb~ +58 -0
- data/spec/{skypeapi → skype}/os/windows_spec.rb +8 -8
- data/spec/skype/profile_spec.rb +24 -0
- data/spec/skype/user_spec.rb +25 -0
- data/spec/skype_spec.rb +530 -0
- metadata +44 -40
- data/lib/skypeapi/os/linux.rb +0 -110
- data/lib/skypeapi/os/mac.rb +0 -98
- data/spec/skypeapi/event_spec.rb +0 -31
- data/spec/skypeapi/group_spec.rb +0 -16
- data/spec/skypeapi/profile_spec.rb +0 -22
- data/spec/skypeapi/user_spec.rb +0 -25
- data/spec/skypeapi_spec.rb +0 -528
@@ -1,10 +1,10 @@
|
|
1
|
-
module
|
1
|
+
module Skype
|
2
2
|
class Event < AbstractObject
|
3
3
|
OBJECT_NAME = "EVENT"
|
4
4
|
|
5
5
|
class << self
|
6
6
|
def create id, caption, hint, block=Proc.new
|
7
|
-
res =
|
7
|
+
res = Skype.invoke "CREATE EVENT #{id} CAPTION #{caption} HINT #{hint}"
|
8
8
|
res == "EVENT #{id} CREATED"
|
9
9
|
instance = new id
|
10
10
|
instance.setNotify block if block
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Skype
|
2
2
|
class FileTransfer < AbstractObject
|
3
3
|
OBJECT_NAME = "FILETRANSFER"
|
4
4
|
|
@@ -15,7 +15,7 @@ module SkypeAPI
|
|
15
15
|
alias getFailureReason get_failure_reason
|
16
16
|
|
17
17
|
def get_partner() parse :partner, invoke_get("PARTNER_HANDLE") end
|
18
|
-
def_parser(:partner, 'PARTNER_HANDLE'){|str|
|
18
|
+
def_parser(:partner, 'PARTNER_HANDLE'){|str| Skype::User.new str}
|
19
19
|
alias getPartner get_partner
|
20
20
|
|
21
21
|
def get_partner_dispname() invoke_get("PARTNER_DISPNAME") end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
module
|
1
|
+
module Skype
|
2
2
|
class Group < AbstractObject
|
3
3
|
OBJECT_NAME = "GROUP"
|
4
4
|
|
5
5
|
#FASdfklasjidfojsdlkjljfaslkdjf!!!!!!!!!!!!!!!!!!!!
|
6
6
|
def self.create displayName
|
7
|
-
|
7
|
+
Skype.invoke("CREATE GROUP #{displayName}")
|
8
8
|
group = nil
|
9
9
|
tmp = nil
|
10
|
-
if
|
11
|
-
tmp =
|
10
|
+
if Skype::Group.notify[:displayname] and Skype::Group.notify[:displayname][displayName]
|
11
|
+
tmp = Skype::Group.notify[:displayname][displayName]
|
12
12
|
end
|
13
|
-
|
13
|
+
Skype::Group.setNotify :DisplayName, displayName do |g|
|
14
14
|
group = g
|
15
15
|
end
|
16
16
|
until group
|
17
|
-
|
17
|
+
Skype.polling
|
18
18
|
sleep 0.0123
|
19
19
|
end
|
20
20
|
if tmp
|
21
|
-
|
21
|
+
Skype::Group.setNotify :DisplayName, displayName, tmp
|
22
22
|
tmp.call group
|
23
23
|
else
|
24
|
-
|
24
|
+
Skype::Group.notify[:displayname][displayName] = nil
|
25
25
|
end
|
26
26
|
group
|
27
27
|
#ThreadSafe ����ς��낤�Ȃ��B�B�B
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Skype
|
2
2
|
class MenuItem < AbstractObject
|
3
3
|
OBJECT_NAME = 'MENU_ITEM'
|
4
4
|
|
@@ -6,7 +6,7 @@ module SkypeAPI
|
|
6
6
|
def create h, block=Proc.new
|
7
7
|
raise ArgumentError unless h[:id] and h[:context] and h[:caption]
|
8
8
|
#id, context, caption, hint=nil, icon=nil, enabled=nil, enableMultipleContacts=nil, &block
|
9
|
-
res =
|
9
|
+
res = Skype.invoke "CREATE MENU_ITEM #{h[:id]} CONTEXT #{h[:context]} CAPTION #{h[:caption]}#{h[:hint].nil? ? '' : " HINT #{h[:hint]}"}#{h[:icon].nil? ? '' : " ICON #{h[:icon]}"}#{h[:enable].nil? ? '' : " ENABLED #{h[:enabled]}"}#{h[:enableMultipleContacts].nil? ? '' : " ENABLE_MULTIPLE_CONTACTS #{h[:enableMultipleContacts]}"}"
|
10
10
|
res == "MENU_ITEM #{h[:id]} CREATED"
|
11
11
|
instance = new h[:id]
|
12
12
|
instance.setNotify block if block
|
@@ -20,7 +20,7 @@ module SkypeAPI
|
|
20
20
|
def notified msg
|
21
21
|
if msg =~ /^([^ ]+) CLICKED( ([^ ]+))? CONTEXT ([^ ]+)( CONTEXT_ID (.+))?$/m
|
22
22
|
id = $1; context = $4; userID = $3; contextID = $6
|
23
|
-
user = userID ?
|
23
|
+
user = userID ? Skype.user(userID) : nil
|
24
24
|
instance = new $1
|
25
25
|
@notify[nil].call instance, context, user, contextID if @notify[nil]
|
26
26
|
@notify[id].call instance, context, user, contextID if @notify[id]
|
@@ -44,7 +44,7 @@ module SkypeAPI
|
|
44
44
|
alias setNotify set_notify
|
45
45
|
|
46
46
|
def delete
|
47
|
-
res =
|
47
|
+
res = Skype.invoke "DELETE MENU_ITEM #{@id}"
|
48
48
|
res == "DELETE MENU_ITEM #{@id}"
|
49
49
|
end
|
50
50
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'forwardable'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Skype
|
5
5
|
class AbstractObject #:nodoc: all
|
6
6
|
module Notify
|
7
7
|
def setNotify property=nil,value=nil, block=Proc.new
|
@@ -37,8 +37,8 @@ module SkypeAPI
|
|
37
37
|
|
38
38
|
module Get
|
39
39
|
# def getter method_name, skypeProperty=method_name.to_s.upcase, &callBack
|
40
|
-
# define_method = self ==
|
41
|
-
# alias_method = self ==
|
40
|
+
# define_method = self == Skype ? self.class.method(:define_method) : method(:define_method)
|
41
|
+
# alias_method = self == Skype ? self.class.method(:alias_method) : method(:alias_method)
|
42
42
|
#
|
43
43
|
# define_method.call 'get' + method_name.to_s do
|
44
44
|
# str = invoke_get skypeProperty
|
@@ -52,9 +52,9 @@ module SkypeAPI
|
|
52
52
|
# end
|
53
53
|
|
54
54
|
def notice methodName, skypeProperty, &callBack
|
55
|
-
if
|
56
|
-
|
57
|
-
|
55
|
+
if Skype.kind_of? self
|
56
|
+
Skype.property2symbol[skypeProperty] = methodName.to_sym
|
57
|
+
Skype.property2callback[skypeProperty] = callBack if callBack
|
58
58
|
else
|
59
59
|
property2symbol[skypeProperty] = methodName.to_sym
|
60
60
|
property2callback[skypeProperty] = callBack if callBack
|
@@ -70,8 +70,8 @@ module SkypeAPI
|
|
70
70
|
|
71
71
|
module Parser
|
72
72
|
def parse sym, res
|
73
|
-
if self ==
|
74
|
-
|
73
|
+
if self == Skype
|
74
|
+
Skype.property2callback[Skype.property2symbol.index(sym)].call(res)
|
75
75
|
else
|
76
76
|
self.class.property2callback[self.class.property2symbol.index(sym)].call(res)
|
77
77
|
end
|
@@ -87,7 +87,7 @@ module SkypeAPI
|
|
87
87
|
def invoke_echo cmd
|
88
88
|
begin
|
89
89
|
invoke(cmd) == cmd
|
90
|
-
rescue
|
90
|
+
rescue Skype::Error::API => e
|
91
91
|
e.backtrace.shift
|
92
92
|
e.backtrace.shift
|
93
93
|
raise e
|
@@ -102,7 +102,7 @@ module SkypeAPI
|
|
102
102
|
end
|
103
103
|
begin
|
104
104
|
invoke(cmd) =~ /^#{regExp} (.*)$/m
|
105
|
-
rescue
|
105
|
+
rescue Skype::Error::API => e
|
106
106
|
e.backtrace.shift
|
107
107
|
e.backtrace.shift
|
108
108
|
raise e
|
@@ -118,8 +118,9 @@ module SkypeAPI
|
|
118
118
|
"\\" + char
|
119
119
|
end
|
120
120
|
begin
|
121
|
-
invoke(cmd)
|
122
|
-
|
121
|
+
tmp = invoke(cmd)
|
122
|
+
tmp =~ /^#{reg} (.*)$/m
|
123
|
+
rescue Skype::Error::API => e
|
123
124
|
e.backtrace.shift
|
124
125
|
e.backtrace.shift
|
125
126
|
raise e
|
@@ -132,7 +133,7 @@ module SkypeAPI
|
|
132
133
|
reg = "#{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{@id ? @id.to_s + ' ' : ''}#{prop}"
|
133
134
|
begin
|
134
135
|
str = invoke_one cmd, reg
|
135
|
-
rescue
|
136
|
+
rescue Skype::Error::API => e
|
136
137
|
e.backtrace.shift
|
137
138
|
e.backtrace.shift
|
138
139
|
raise e
|
@@ -155,7 +156,7 @@ module SkypeAPI
|
|
155
156
|
#res = "ALTER #{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{prop}"
|
156
157
|
begin
|
157
158
|
invoke(cmd)# == res
|
158
|
-
rescue
|
159
|
+
rescue Skype::Error::API => e
|
159
160
|
e.backtrace.shift
|
160
161
|
e.backtrace.shift
|
161
162
|
raise e
|
@@ -179,7 +180,7 @@ module SkypeAPI
|
|
179
180
|
@@instance = Hash.new do |hash,key|
|
180
181
|
hash[key] = Hash.new
|
181
182
|
end
|
182
|
-
@@skypeApi =
|
183
|
+
@@skypeApi = Skype
|
183
184
|
|
184
185
|
def self.inherited sub
|
185
186
|
if self == AbstractObject
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require '
|
1
|
+
require 'skype/error'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Skype
|
4
4
|
module OS
|
5
5
|
class Abstruct
|
6
6
|
|
7
|
-
def initialize
|
7
|
+
def initialize app_name
|
8
8
|
@send_count = 0
|
9
9
|
@hook = Hash.new do |h,k|
|
10
10
|
h[k] = Array.new
|
@@ -47,7 +47,7 @@ module SkypeAPI
|
|
47
47
|
def invoke cmd
|
48
48
|
begin
|
49
49
|
check_response(invoke_block(cmd), cmd)
|
50
|
-
rescue
|
50
|
+
rescue Skype::Error::API => e
|
51
51
|
e.backtrace.shift
|
52
52
|
e.backtrace.shift
|
53
53
|
raise e
|
@@ -61,21 +61,47 @@ module SkypeAPI
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def check_response res, cmd
|
64
|
-
|
65
|
-
|
64
|
+
case res
|
65
|
+
when /^ERROR /m
|
66
|
+
raise Skype::Error::API.new("#{cmd} => #{res}")
|
67
|
+
when /^((APPLICATION)|(CALL)|(CHAT)|(CHATMESSAGE)|(FILETRANSTER)|(GROUP)|(MENU_ITEM)|(MESSAGE)|(PROFILE)|(SMS)|(USER)|(VOICEMAIL)) [^ ]+? (ERROR .+)$/m
|
68
|
+
res = $14
|
69
|
+
raise Skype::Error::API.new("#{cmd} => #{res}")
|
70
|
+
when ''
|
71
|
+
raise Skype::Error::API.new("#{cmd} => no implement or ,,,")
|
72
|
+
when /^(((APPLICATION)|(CALL)|(CHAT)|(CHATMESSAGE)|(FILETRANSTER)|(GROUP)|(MENU_ITEM)|(MESSAGE)|(PROFILE)|(SMS)|(USER)|(VOICEMAIL)) [^ ]+? [^ ]+? )\(null\)$/m
|
73
|
+
res = $1
|
74
|
+
return res
|
66
75
|
else
|
67
76
|
return res
|
68
77
|
end
|
69
78
|
end
|
70
79
|
private :check_response
|
71
80
|
|
72
|
-
def attach
|
81
|
+
def attach
|
73
82
|
end
|
74
83
|
|
75
|
-
def attach_wait
|
84
|
+
def attach_wait
|
76
85
|
end
|
77
|
-
|
86
|
+
|
87
|
+
def set_notify_selector block=Proc.new
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
def start_messageloop
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
def messageloop
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
def message_polling
|
100
|
+
|
101
|
+
end
|
102
|
+
|
78
103
|
def close
|
104
|
+
|
79
105
|
end
|
80
106
|
end
|
81
107
|
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'skype/os/etc.rb'
|
2
|
+
require 'dbus'
|
3
|
+
require "thread"
|
4
|
+
|
5
|
+
module Skype
|
6
|
+
module OS
|
7
|
+
class Linux < Abstruct
|
8
|
+
class Notify < DBus::Object
|
9
|
+
dbus_interface "com.Skype.API.Client" do
|
10
|
+
dbus_method :Notify, "in data:s" do |res|
|
11
|
+
@os.push_queue res
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize app_name, service_name="org.ruby.service"
|
17
|
+
super()
|
18
|
+
|
19
|
+
@app_name = app_name
|
20
|
+
@queue = Queue.new
|
21
|
+
|
22
|
+
@bus = DBus.session_bus
|
23
|
+
notify = Notify.new("/com/Skype/Client")
|
24
|
+
notify.instance_variable_set(:@os, self)
|
25
|
+
ex_service = @bus.request_service(service_name)
|
26
|
+
ex_service.export(notify)
|
27
|
+
service = @bus.service 'com.Skype.API'
|
28
|
+
@invoker = service.object '/com/Skype'
|
29
|
+
@invoker.default_iface = 'com.Skype.API'
|
30
|
+
@invoker.introspect
|
31
|
+
end
|
32
|
+
|
33
|
+
attr_reader :queue
|
34
|
+
private :queue
|
35
|
+
|
36
|
+
def set_notify_selector block=Proc.new
|
37
|
+
@notify_selector = block
|
38
|
+
end
|
39
|
+
attr_reader :notify_selector
|
40
|
+
private :notify_selector
|
41
|
+
|
42
|
+
def attach
|
43
|
+
invoke "NAME #{@app_name}"
|
44
|
+
invoke "PROTOCOL 9999"
|
45
|
+
if @first_attached
|
46
|
+
#@queue.push proc{do_hook :attached}
|
47
|
+
else
|
48
|
+
#@queue.push proc{do_hook :reattached}
|
49
|
+
end
|
50
|
+
Thread.new do
|
51
|
+
l = DBus::Main.new
|
52
|
+
l << @bus
|
53
|
+
l.run
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
alias attach_wait attach
|
58
|
+
|
59
|
+
def invoke_prototype(cmd)
|
60
|
+
#@queue.push proc{do_hook :sent, cmd}
|
61
|
+
res = @invoker.Invoke(cmd)[0]
|
62
|
+
#@queue.push proc{do_hook :received, res}
|
63
|
+
return res
|
64
|
+
end
|
65
|
+
|
66
|
+
alias invoke_block invoke_prototype
|
67
|
+
|
68
|
+
def invoke_callback *args
|
69
|
+
raise Skype::Error::NotImprement
|
70
|
+
end
|
71
|
+
|
72
|
+
def start_messageloop
|
73
|
+
Thread.new{messageloop}
|
74
|
+
end
|
75
|
+
|
76
|
+
def messageloop
|
77
|
+
while callback = queue.shift
|
78
|
+
break unless message_process callback
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def messagepolling
|
83
|
+
return message_process(queue.shift) unless queue.empty?
|
84
|
+
return true
|
85
|
+
end
|
86
|
+
|
87
|
+
def message_process callback
|
88
|
+
#sleep 0.001 while paused?
|
89
|
+
return false if callback == :exit
|
90
|
+
callback.call
|
91
|
+
return true
|
92
|
+
end
|
93
|
+
private :message_process
|
94
|
+
|
95
|
+
def push_queue res
|
96
|
+
p res
|
97
|
+
#queue.push(proc{do_hook(:received, res)})
|
98
|
+
|
99
|
+
if res == 'CONNSTATUS LOGGEDOUT'
|
100
|
+
@attached = false
|
101
|
+
#queue.push(proc{do_hook(:detached)})
|
102
|
+
#Skype.attach
|
103
|
+
end
|
104
|
+
|
105
|
+
queue.push(proc{notify_selector.call res}) if notify_selector
|
106
|
+
end
|
107
|
+
|
108
|
+
def close
|
109
|
+
queue.push :exit
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'skypeapi/os/etc.rb'
|
2
|
+
require 'dbus'
|
3
|
+
require "thread"
|
4
|
+
|
5
|
+
module SkypeAPI
|
6
|
+
module OS
|
7
|
+
class Linux < Abstruct
|
8
|
+
class Notify < DBus::Object
|
9
|
+
dbus_interface "com.Skype.API.Client" do
|
10
|
+
dbus_method :Notify, "in data:s" do |res|
|
11
|
+
@os.push_queue res
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
@@suffix = 0
|
17
|
+
def initialize service_name="org.ruby.service"
|
18
|
+
super()
|
19
|
+
|
20
|
+
@queue = Queue.new
|
21
|
+
|
22
|
+
service_name += @@suffix.to_s
|
23
|
+
@@suffix+=1
|
24
|
+
@bus = DBus.session_bus
|
25
|
+
notify = Notify.new("/com/Skype/Client")
|
26
|
+
notify.instance_variable_set(:@os, self)
|
27
|
+
ex_service = @bus.request_service(service_name)
|
28
|
+
ex_service.export(notify)
|
29
|
+
service = @bus.service 'com.Skype.API'
|
30
|
+
@invoker = service.object '/com/Skype'
|
31
|
+
@invoker.default_iface = 'com.Skype.API'
|
32
|
+
@invoker.introspect
|
33
|
+
end
|
34
|
+
|
35
|
+
attr_reader :queue
|
36
|
+
private :queue
|
37
|
+
|
38
|
+
def set_notify_selector block=Proc.new
|
39
|
+
@notify_selector = block
|
40
|
+
end
|
41
|
+
attr_reader :notify_selector
|
42
|
+
private :notify_selector
|
43
|
+
|
44
|
+
def attach app_name
|
45
|
+
invoke "NAME #{app_name}"
|
46
|
+
invoke "PROTOCOL 9999"
|
47
|
+
if @first_attached
|
48
|
+
#@queue.push proc{do_hook :attached}
|
49
|
+
else
|
50
|
+
#@queue.push proc{do_hook :reattached}
|
51
|
+
end
|
52
|
+
Thread.new do
|
53
|
+
l = DBus::Main.new
|
54
|
+
l << @bus
|
55
|
+
l.run
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
alias attach_wait attach
|
60
|
+
|
61
|
+
def invoke_prototype(cmd)
|
62
|
+
#@queue.push proc{do_hook :sent, cmd}
|
63
|
+
res = @invoker.Invoke(cmd)[0]
|
64
|
+
#@queue.push proc{do_hook :received, res}
|
65
|
+
return res
|
66
|
+
end
|
67
|
+
|
68
|
+
alias invoke_block invoke_prototype
|
69
|
+
|
70
|
+
def invoke_callback *args
|
71
|
+
raise SkypeAPI::Error::NotImprement
|
72
|
+
end
|
73
|
+
|
74
|
+
def start_messageloop
|
75
|
+
Thread.new{messageloop}
|
76
|
+
end
|
77
|
+
|
78
|
+
def messageloop
|
79
|
+
while callback = queue.shift
|
80
|
+
break unless message_process callback
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def messagepolling
|
85
|
+
return message_process(queue.shift) unless queue.empty?
|
86
|
+
return true
|
87
|
+
end
|
88
|
+
|
89
|
+
def message_process callback
|
90
|
+
#sleep 0.001 while paused?
|
91
|
+
return false if callback == :exit
|
92
|
+
callback.call
|
93
|
+
return true
|
94
|
+
end
|
95
|
+
private :message_process
|
96
|
+
|
97
|
+
def push_queue res
|
98
|
+
p res
|
99
|
+
#queue.push(proc{do_hook(:received, res)})
|
100
|
+
|
101
|
+
if res == 'CONNSTATUS LOGGEDOUT'
|
102
|
+
@attached = false
|
103
|
+
#queue.push(proc{do_hook(:detached)})
|
104
|
+
#SkypeAPI.attach
|
105
|
+
end
|
106
|
+
|
107
|
+
queue.push(proc{notify_selector.call res}) if notify_selector
|
108
|
+
end
|
109
|
+
|
110
|
+
def close
|
111
|
+
queue.push :exit
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|