SkypeR 0.0.5 → 0.0.6
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/MIT-LICENSE +21 -0
- data/README +1 -0
- data/bin/iskype.rb +2 -3
- data/lib/skyper/command.rb +522 -0
- data/lib/skyper/error.csv +149 -0
- data/lib/skyper/error.obj +0 -0
- data/lib/skyper/error.rb +16 -0
- data/lib/skyper/object.rb +79 -0
- data/lib/skyper/parser.rb +95 -0
- data/lib/skyper/response.rb +277 -0
- data/lib/skyper/service.rb +102 -0
- data/lib/skyper.rb +13 -0
- data/tests/test_parser.rb +192 -0
- data/tests/test_response.rb +45 -0
- data/tests/test_service.rb +36 -0
- metadata +73 -43
- data/bin/iskype.rb~ +0 -169
- data/bin/rbus_send +0 -3
- data/bin/rbus_skype.rb +0 -40
@@ -0,0 +1,149 @@
|
|
1
|
+
Code, Description, Possible reasons
|
2
|
+
1, General syntax error, Command missing (e.g. '' '' sent as command)
|
3
|
+
2, Unknown command, Command spelled incorrect (e.g. 'GRT' send instead of 'GET')
|
4
|
+
3, Search: unknown WHAT, Search target is missing or misspelled
|
5
|
+
4, Empty target not allowed,
|
6
|
+
5, Search CALLS: invalid target, An unpermitted character (e.g. '!'\, '#'\, '$' etc.) was used in the target username.
|
7
|
+
6, SEARCH MISSEDCALLS: target not allowed, e.g. 'SEARCH MISSEDCALLS echo123'
|
8
|
+
7, GET: invalid WHAT, Object/property name missing or misspelled
|
9
|
+
8, Invalid user handle, USERNAME missing or includes a not permitted character (e.g. 'GET USER ! HANDLE')
|
10
|
+
9, Unknown user,
|
11
|
+
10, Invalid PROP, Property name and/or ID missing or misspelled
|
12
|
+
11, Invalid call id, Call ID missing or misspelled (must be a numeric value)
|
13
|
+
12, Unknown call, Nonexistant call ID used
|
14
|
+
13, Invalid PROP, Returned to command GET CALL id PARTNER_DISPLAYNAME. Property name missing or misspelled
|
15
|
+
14, Invalid message id, GET - Message ID missing or misspelled (must be a numeric value)
|
16
|
+
15, Unknown message, Nonexistant message ID used in GET command
|
17
|
+
16, Invalid PROP, Returned to command GET MESSAGE id PARTNER_DISPLAYNAME. Property name missing or misspelled
|
18
|
+
17, (Not in use),
|
19
|
+
18, SET: invalid WHAT, Property name missing or misspelled
|
20
|
+
19, Invalid call id, Call ID missing or misspelled (must be a numeric value)
|
21
|
+
20, Unknown call, Nonexistant call ID used
|
22
|
+
21, Unknown/disallowed call prop, SET CALL value incorrect or misspelled (e.g. 'SET CALL 15 STATUS ONHOL')
|
23
|
+
22, Cannot hold this call at the moment, Trying to hold a call that is not in progress.
|
24
|
+
23, Cannot resume this call at the moment, Trying to resume/answer a call that is not in progress.
|
25
|
+
24, Cannot hangup inactive call, Trying to hang up a call that is not in progress.
|
26
|
+
25, Unknown WHAT, Property name missing or misspelled (e.g. 'SET CALL 15 STATU ONHOLD')
|
27
|
+
26, Invalid user handle, Target username missing or includes not permitted symbols (e.g. 'MESSAGE ')
|
28
|
+
27, Invalid version number, Invalid protocol number (e.g. 'PROTOCOL -12\,9')
|
29
|
+
28, Unknown userstatus, Unknown or misspelled value for user status (e.g. 'SET USERSTATUS RICH')
|
30
|
+
29, SEARCH what: target not allowed, Target is not permitted; e.g. 'SEARCH MISSEDMESSAGES echo123'
|
31
|
+
30, Invalid message id, SET - Message ID missing or misspelled (must be a numeric value)
|
32
|
+
31, Unknown message id, Nonexistant message ID used in SET command
|
33
|
+
32, Invalid WHAT, Property missing or misspelled
|
34
|
+
33, invalid parameter, Unknown or misspelled value for mute (e.g. 'SET MUTE O')
|
35
|
+
34, invalid user handle, Target username/number missing (e.g. 'CALL ')
|
36
|
+
35, Not connected,
|
37
|
+
36, Not online,
|
38
|
+
37, Not connected,
|
39
|
+
38, Not online,
|
40
|
+
39, user blocked, Destination user is blocked by caller. Also given\, if trying to call to a blocked user
|
41
|
+
40, Unknown privilege, Privilege is either misspelled or does not exist (e.g. 'GET PRIVILEGE SkypeOut').
|
42
|
+
41, Call not active, Trying to send DTMF\, when call is not active.
|
43
|
+
42, Invalid DTMF code, Invalid DTMF code is sent. Valid symbols for DTMF codes are {0..9\,#\,*}
|
44
|
+
43, cannot send empty message, Empty message is tried to sent\, e.g. 'MESSAGE echo123'.
|
45
|
+
50, cannot set device, An error occurred when changing audio device
|
46
|
+
51, invalid parameter, Parameter to READY command is not YES or NO
|
47
|
+
52, invalid parameter, Parameter to HOOK command is not ON or OFF
|
48
|
+
53, invalid value, Parameter to SET AUTOAWAY is not ON or OFF
|
49
|
+
66, Not connected, Skype is not connected i.e. user status is 'LOGGEDOUT'
|
50
|
+
67, Target not allowed with SEARCH FRIENDS, SEARCH FRIENDS had a parameter
|
51
|
+
68, Access denied,
|
52
|
+
69, Invalid open what, OPEN command had missing or misspelled TARGET e.g. 'OPEN IN'
|
53
|
+
70, Invalid handle, OPEN IM parameter USERNAME is missing or contains not permitted symbols
|
54
|
+
71, Invalid conference participant NO, Conference participant's number is either too large or invalid.
|
55
|
+
72, Cannot create conference,
|
56
|
+
73, too many participants, Conference is initiated to more than 4 people.
|
57
|
+
74, Invalid key, Key name in BTN_PRESSED or BTN_RELEASED command is invalid
|
58
|
+
91, call error, Cannot call an emergency number
|
59
|
+
92, call error, The called number is not a valid PSTN number
|
60
|
+
93, call error, Invalid Skype Name
|
61
|
+
94, call error, Cannot call yourself
|
62
|
+
95, Internal error, Destination user is blocked by caller right after call initialization
|
63
|
+
96, Internal error, An outgoing call exists in ROUTING/RINGING/EARLYMEDIA state
|
64
|
+
97, Internal error, Internal error
|
65
|
+
98, Internal error, Internal error
|
66
|
+
99, Internal error, Internal error
|
67
|
+
100, Internal error, Internal error
|
68
|
+
101, Internal error, A call to the destination user is already ongoing
|
69
|
+
103, Cannot hold, Internal error
|
70
|
+
104, Cannot resume, Internal error
|
71
|
+
105, Invalid chat name, Chat name missing or misspelled
|
72
|
+
106, Invalid PROP, Property name missing or misspelled for CHAT or CHATMESSAGE
|
73
|
+
107, Target not allowed with CHATS, No parameters allowed to SEARCH CHATS
|
74
|
+
108, User not contact, TRANSFER can only be initiated to contacts
|
75
|
+
109, directory doesn't exist, Directory given as a parameter to TRANSFER command does not exist
|
76
|
+
110, No voicemail capability, User given as a parameter to VOICEMAIL command doesn't have voicemail capability
|
77
|
+
111, File not found, File given as argument to SET AVATAR or SET RINGTONE command doesn't exist
|
78
|
+
112, Too many targets, Number of target users for OPEN FILETRANSFER command exceeds simultaneous filetransfer limit
|
79
|
+
113, Close: invalid WHAT, Invalid argument to CLOSE command
|
80
|
+
114, Invalid avatar, GET or SET AVATAR avatar index invalid
|
81
|
+
115, Invalid ringtone, GET or SET RINGTONE ringtone index invalid
|
82
|
+
500, CHAT: Invalid chat name given,
|
83
|
+
501, CHAT: No chat found for given chat,
|
84
|
+
502, CHAT: No action name given,
|
85
|
+
503, CHAT: Invalid or unknown action,
|
86
|
+
504, CHAT: action failed,
|
87
|
+
505, CHAT: LEAVE does not take arguments,
|
88
|
+
506, CHAT: ADDMEMBERS: invalid/missing user handle(s) as arguments,
|
89
|
+
507, CHAT: CREATE: invalid/missing user handle(s) as argument,
|
90
|
+
508, CHAT: CREATE: opening a dialog to the given user failed,
|
91
|
+
509, No chat name given,
|
92
|
+
510, Invalid/uknown chat name given,
|
93
|
+
511, Sending a message to chat failes,
|
94
|
+
512, Invalid voicemail id,
|
95
|
+
513, Invalid voicemail object,
|
96
|
+
514, No voicemail property given,
|
97
|
+
515, Assigning speeddial property failed,
|
98
|
+
516, Invalid value given to ISAUTHORIZED/ISBLOCKED,
|
99
|
+
517, Changing ISAUTHORIZED/ISBLOCKED failed,
|
100
|
+
518, Invalid status given for BUDDYSTATUS,
|
101
|
+
519, Updating BUDDYSTATUS failed,
|
102
|
+
520, CLEAR needs a target,
|
103
|
+
521, Invalid/unknown CLEAR target,
|
104
|
+
522, CLEAR CHATHISTORY takes no arguments,
|
105
|
+
523, CLEAR VOICEMAILHISTORY takes no arguments,
|
106
|
+
524, CLEAR CALLHISTORY: missing target argument,
|
107
|
+
525, CLEAR CALLHISTORY: invalid handle argument,
|
108
|
+
526, ALTER: no object type given,
|
109
|
+
527, ALTER: unknown object type given,
|
110
|
+
528, VOICEMAIL: No proper voicemail ID given,
|
111
|
+
529, VOICEMAIL: Invalid voicemail ID given,
|
112
|
+
530, VOICEMAIL: No action given,
|
113
|
+
531, VOICEMAIL: Action failed,
|
114
|
+
532, VOICEMAIL: Unknown action,
|
115
|
+
534, SEARCH GREETING: invalid handle,
|
116
|
+
535, SEARCH GREETING: unable to get greeting
|
117
|
+
536, CREATE: no object type given,
|
118
|
+
537, CREATE : Unknown object type given.,
|
119
|
+
538, DELETE : no object type given.,
|
120
|
+
539, DELETE : unknown object type given.,
|
121
|
+
540, CREATE APPLICATION : missing of invalid name.,
|
122
|
+
541, APPLICATION : Operation Failed.,
|
123
|
+
542, DELETE APPLICATION : missing or invalid application name.,
|
124
|
+
543, GET APPLICATION : missing or invalid application name.,
|
125
|
+
544, GET APPLICATION : missing or invalid property name.,
|
126
|
+
545, ALTER APPLICATION : missing or invalid action.,
|
127
|
+
546, ALTER APPLICATION : Missing or invalid action,
|
128
|
+
547, ALTER APPLICATION CONNECT: Invalid user handle,
|
129
|
+
548, ALTER APPLICATION DISCONNECT: Invalid stream identifier,
|
130
|
+
549, ALTER APPLICATION WRITE : Missing or invalid stream identifier,
|
131
|
+
550, ALTER APPLICATION READ : Missing or invalid stream identifier,
|
132
|
+
551, ALTER APPLICATION DATAGRAM : Missing or invalid stream identifier,property
|
133
|
+
552, SET PROFILE : invalid property profile given,
|
134
|
+
553, SET PROFILE CALL_SEND_TO_VM : no voicemail privledge\, can't forward to voicemail.,
|
135
|
+
555, CALL: No proper call ID given,
|
136
|
+
556, CALL: Invalid call ID given,
|
137
|
+
557, CALL: No action given,
|
138
|
+
558, CALL: Missing or invalid arguments,
|
139
|
+
559, CALL: Action failed,
|
140
|
+
560, CALL: Unknown action,
|
141
|
+
561, SEARCH GROUPS: invalid target,
|
142
|
+
562, SEARCH GROUPS: Invalid group id,
|
143
|
+
563, SEARCH GROUPS: Invalid group object,
|
144
|
+
564, SEARCH GROUPS: Invalid group property given,
|
145
|
+
569, GET AEC: target not allowed,
|
146
|
+
570, SET AEC: invalid value,
|
147
|
+
571, GET AGC: target not allowed,
|
148
|
+
572, SET AGC: invalid value,
|
149
|
+
9901, Internal error,
|
Binary file
|
data/lib/skyper/error.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__))
|
2
|
+
require 'pstore'
|
3
|
+
|
4
|
+
module SkypeR
|
5
|
+
class Error
|
6
|
+
@@table = PStore.new('error.obj')
|
7
|
+
|
8
|
+
def self.lookup(num)
|
9
|
+
table = PStore.new('error.obj')
|
10
|
+
table.transaction do
|
11
|
+
p table[num]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
class Time
|
4
|
+
def to_datetime
|
5
|
+
seconds = sec + Rational(usec, 10**6)
|
6
|
+
offset = Rational(utc_offset, 60*60*24)
|
7
|
+
DateTime.new(year, month, day, hour, min, seconds, offset)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
module SkypeR
|
13
|
+
module Object
|
14
|
+
class User
|
15
|
+
attr_accessor :handle, :fullname, :birthday, :sex, :language, :country, :buddystatus, :isauthorized, :isblocked, :onlinestatus, :lastonlinetimestamp, :can_leave_vm
|
16
|
+
def initialize(args={})
|
17
|
+
@handle = args[:handle] if args[:handle]
|
18
|
+
@fullname = args[:fullname] if args[:fullname]
|
19
|
+
@birthday = args[:birthday] if args[:birthday]
|
20
|
+
@sex = args[:sex] if args[:sex]
|
21
|
+
@language = args[:language] if args[:language]
|
22
|
+
@country = args[:country] if args[:country]
|
23
|
+
@buddystatus = args[:buddystatus] if args[:buddystatus]
|
24
|
+
@isauthorized = args[:isauthorized] if args[:isauthorized]
|
25
|
+
@isblocked = args[:isblocked] if args[:isblocked]
|
26
|
+
@onlinestatus = args[:onlinestatus] if args[:onlinestatus]
|
27
|
+
@lastonlinetimestamp = args[:lastonlinetimestamp] if args[:lastonlinetimestamp]
|
28
|
+
@can_leave_vm = args[:can_leave_vm] if args[:can_leave_vm]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Profile
|
33
|
+
attr_accessor :pstn_balance, :fullname, :birthday, :sex, :languages, :timezone
|
34
|
+
def initialize(args={})
|
35
|
+
@pstn_balance = args[:pstn_balance] if args[:pstn_balance]
|
36
|
+
@fullname = args[:fullname] if args[:fullname]
|
37
|
+
@birthday = args[:birthday] if args[:birthday]
|
38
|
+
@sex = args[:sex] if args[:sex]
|
39
|
+
@languages = args[:languages] if args[:languages]
|
40
|
+
@timezone = args[:timezone] if args[:timezone]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Call
|
45
|
+
attr_accessor :timestamp, :partner_handle, :partner_dispname, :target_identity, :conf_id, :type, :status, :video_status, :video_send_status, :failurereason, :subject, :pstn_number, :duration, :pstn_status, :conf_participants_count, :conf_participant, :vm_duration, :vm_allowed_duration, :rate, :rate_currency, :rate_precision, :input, :output, :capture_mic, :vaa_input_status, :forwarded_by, :transfer_active, :transfer_status, :transferred_by, :transferred_to
|
46
|
+
|
47
|
+
PROPERTIES = %w{TIMESTAMP PARTNER_HANDLE PARTNER_DISPNAME TARGET_IDENTITY CONF_ID TYPE STATUS VIDEO_STATUS VIDEO_SEND_STATUS FAILUREREASON SUBJECT PSTN_NUMBER DURATION PSTN_STATUS CONF_PARTICIPANTS_COUNT CONF_PARTICIPANT VM_DURATION VM_ALLOWED_DURATION RATE RATE_CURRENCY RATE_PRECISION INPUT OUTPUT CAPTURE_MIC VAA_INPUT_STATUS FORWARDED_BY TRANSFER_ACTIVE TRANSFER_STATUS TRANSFERRED_BY TRANSFERRED_TO}
|
48
|
+
def initialize
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class Chat
|
53
|
+
def initialize(args={})
|
54
|
+
@name = args[:name] if args[:name]
|
55
|
+
@timestamp = args[:timestamp] if args[:timestamp]
|
56
|
+
@status = args[:status] if args[:status]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class ChatMessage
|
61
|
+
def initialize(args={})
|
62
|
+
@timestamp = args[:timestamp] if args[:timestamp]
|
63
|
+
@partner_handle = args[:partner_handle] if args[:partner_handle]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class Application
|
68
|
+
def initialize(args={})
|
69
|
+
@connectable = args[:connectable] if args[:connectable]
|
70
|
+
@streams = args[:streams] if args[:streams]
|
71
|
+
@sending = args[:sending] if args[:sending]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class VoiceMail
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__))
|
2
|
+
require 'rubygems'
|
3
|
+
#require_gem 'yaparc'
|
4
|
+
require 'yaparc'
|
5
|
+
require "logger"
|
6
|
+
|
7
|
+
=begin
|
8
|
+
(insert-image-file "~/develop/ruby/skyper/docs/parser.png")
|
9
|
+
=end
|
10
|
+
|
11
|
+
module SkypeR
|
12
|
+
|
13
|
+
module Parser
|
14
|
+
class Identifier < Yaparc::AbstractParser
|
15
|
+
def initialize
|
16
|
+
@parser = lambda do
|
17
|
+
Yaparc::Token.new(Yaparc::Ident.new)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Comma < Yaparc::AbstractParser
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
@parser = lambda do
|
26
|
+
Yaparc::Token.new(Yaparc::Char.new(','))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class OpenParen < Yaparc::AbstractParser
|
32
|
+
def initialize
|
33
|
+
@parser = lambda do
|
34
|
+
Token.new(Char.new('('))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class CloseParen < Yaparc::AbstractParser
|
40
|
+
def initialize
|
41
|
+
@parser = lambda do
|
42
|
+
Yaparc::Token.new(Yaparc::Char.new(')'))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class CommandID < Yaparc::AbstractParser
|
48
|
+
def initialize
|
49
|
+
@parser = lambda do
|
50
|
+
Yaparc::Token.new(Yaparc::RegexParser.new(/#[A-Z0-9]+/))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# <chat_id> # - chat identifier; string (usually looks like “#me/$target;012345679012345”)
|
56
|
+
class ChatID < Yaparc::AbstractParser
|
57
|
+
def initialize
|
58
|
+
@parser = lambda do
|
59
|
+
Yaparc::Token.new(Yaparc::RegexParser.new(/#[A-Za-z]*\/\$[A-Za-z]*;[0-9]*/))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
class UserProperty < Yaparc::AbstractParser
|
66
|
+
def initialize
|
67
|
+
properties = %w{HANDLE FULLNAME BIRTHDAY SEX LANGUAGE COUNTRY PROVINCE CITY PHONE_HOME PHONE_OFFICE PHONE_MOBILE HOMEPAGE ABOUT HASCALLEQUIPMENT BUDDYSTATUS ISAUTHORIZED ISBLOCKED DISPLAYNAME ONLINESTATUS LASTONLINETIMESTAMP CAN_LEAVE_VM SPEEDDIAL RECEIVEDAUTHERREQUEST TIMEZONE IS_CF_ACTIVE}.map {|item| Yaparc::Symbol.new(item)}
|
68
|
+
@parser = lambda do
|
69
|
+
Yaparc::AltParser.new(*properties)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# <profile_property> := PSTN_BALANCE | FULLNAME | BIRTHDAY | SEX | LANGUAGES | TIMEZONE
|
75
|
+
class ProfileProperty < Yaparc::AbstractParser
|
76
|
+
def initialize
|
77
|
+
properties = %w{PSTN_BALANCE FULLNAME BIRTHDAY SEX LANGUAGES TIMEZONE}.map {|item| Yaparc::Symbol.new(item)}
|
78
|
+
@parser = lambda do
|
79
|
+
Yaparc::AltParser.new(*properties)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# <call_property> := TIMESTAMP | PARTNER_HANDLE | PARTNER_DISPNAME | TARGET_IDENTITY | CONF_ID | TYPE | STATUS | VIDEO_STATUS | VIDEO_SEND_STATUS | FAILUREREASON | SUBJECT | PSTN_NUMBER | DURATION | PSTN_STATUS | CONF_PARTICIPANTS_COUNT | CONF_PARTICIPANT | VM_DURATION | VM_ALLOWED_DURATION | RATE | RATE_CURRENCY | RATE_PRECISION | INPUT | OUTPUT | CAPTURE_MIC | VAA_INPUT_STATUS | FORWARDED_BY | TRANSFER_ACTIVE | TRANSFER_STATUS | TRANSFERRED_BY | TRANSFERRED_TO
|
85
|
+
class CallProperty < Yaparc::AbstractParser
|
86
|
+
def initialize
|
87
|
+
properties = SkypeR::Object::Call::PROPERTIES.map {|item| Yaparc::Symbol.new(item)}
|
88
|
+
@parser = lambda do
|
89
|
+
Yaparc::AltParser.new(*properties)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end # of Parser
|
95
|
+
end # of Skyper
|
@@ -0,0 +1,277 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__))
|
2
|
+
require 'rubygems'
|
3
|
+
#require_gem 'yaparc'
|
4
|
+
require 'yaparc'
|
5
|
+
require "logger"
|
6
|
+
|
7
|
+
|
8
|
+
=begin
|
9
|
+
(insert-image-file "~/develop/ruby/skyper/docs/parser.png")
|
10
|
+
=end
|
11
|
+
|
12
|
+
module SkypeR
|
13
|
+
module Parser
|
14
|
+
class ResponseBase < Yaparc::AbstractParser
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
# <response_statement> := [<command_id>] <response>
|
20
|
+
# | [<command_id>] error
|
21
|
+
class ResponseStatement < ResponseBase
|
22
|
+
def initialize
|
23
|
+
@parser = lambda do
|
24
|
+
Yaparc::AltParser.new(Yaparc::SeqParser.new(Yaparc::ZeroOneParser.new(CommandID.new),
|
25
|
+
Response.new) do |command_id, response|
|
26
|
+
response
|
27
|
+
end,
|
28
|
+
Yaparc::SeqParser.new(Yaparc::ZeroOneParser.new(CommandID.new),
|
29
|
+
Error.new) do |command_id, error|
|
30
|
+
error
|
31
|
+
end)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class AnyValue < ResponseBase
|
37
|
+
def initialize
|
38
|
+
@parser = lambda do
|
39
|
+
Yaparc::Token.new(Yaparc::RegexParser.new(/[a-zA-Z0-9]+/))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# <get_user_response> := USER <identifier> <user_property> <value>
|
45
|
+
class GetUserResponse < ResponseBase
|
46
|
+
def initialize
|
47
|
+
@parser = lambda do
|
48
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("USER"),
|
49
|
+
Yaparc::Identifier.new,
|
50
|
+
SkypeR::Parser::UserProperty.new,
|
51
|
+
AnyValue.new) do |_,identifier,property, value|
|
52
|
+
{:identifier => identifier, :property => property, :value => value}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# <get_userstatus_response> := USERSTATUS <value>
|
59
|
+
class GetUserstatusResponse < ResponseBase
|
60
|
+
def initialize
|
61
|
+
@parser = lambda do
|
62
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("USERSTATUS"),
|
63
|
+
AnyValue.new) do |_,value|
|
64
|
+
{:value => value}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# <get_profile_response> := PROFILE <profile_property> <value>
|
71
|
+
class GetProfileResponse < ResponseBase
|
72
|
+
def initialize
|
73
|
+
@parser = lambda do
|
74
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("PROFILE"),
|
75
|
+
ProfileProperty.new,
|
76
|
+
AnyValue.new) do |_,property, value|
|
77
|
+
{:property => property, :value => value}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# <get_call_response> := CALL <identifier> <call_property> <value>
|
84
|
+
class GetCallResponse < ResponseBase
|
85
|
+
def initialize
|
86
|
+
@parser = lambda do
|
87
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("CALL"),
|
88
|
+
Yaparc::Identifier.new,
|
89
|
+
CallProperty.new,
|
90
|
+
AnyValue.new) do |_,identifier, property, value|
|
91
|
+
{:identifier => identifier, :property => property, :value => value}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# <get_chat_chatmessages_response> := CHAT <chat_id> CHATMESSAGES <identifier_sequence>
|
98
|
+
class GetChatChatmessagesResponse < ResponseBase
|
99
|
+
def initialize
|
100
|
+
@parser = lambda do
|
101
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("CHAT"),
|
102
|
+
ChatID.new,
|
103
|
+
Yaparc::Symbol.new("CHATMESSAGES"),
|
104
|
+
Yaparc::ManyParser.new(
|
105
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new(','),
|
106
|
+
Target.new) do |_, target|
|
107
|
+
target
|
108
|
+
end
|
109
|
+
)
|
110
|
+
)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# <search_users_response> := USERS [<username>[,<username>]*]
|
116
|
+
# FIXME for multiple users response
|
117
|
+
class SearchUsersResponse < ResponseBase
|
118
|
+
def initialize
|
119
|
+
@parser = lambda do
|
120
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("USERS"),
|
121
|
+
Username.new,
|
122
|
+
Yaparc::ManyParser.new(
|
123
|
+
Yaparc::SeqParser.new(
|
124
|
+
Yaparc::Symbol.new(','),
|
125
|
+
Username.new) do |_, username|
|
126
|
+
[username]
|
127
|
+
end,
|
128
|
+
[]
|
129
|
+
)
|
130
|
+
) do |_,username,usernames|
|
131
|
+
{:usernames => [username] + usernames}
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# <search_friends_response> := USERS [user[,user]*]
|
138
|
+
class SearchFriendsResponse < ResponseBase
|
139
|
+
def initialize
|
140
|
+
@parser = lambda do
|
141
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("USERS"),
|
142
|
+
Username.new,
|
143
|
+
Yaparc::ManyParser.new(
|
144
|
+
Yaparc::SeqParser.new(
|
145
|
+
Yaparc::Symbol.new(','),
|
146
|
+
Username.new) do |_, username|
|
147
|
+
[username]
|
148
|
+
end,
|
149
|
+
[]
|
150
|
+
)
|
151
|
+
) do |_,username,usernames|
|
152
|
+
{:usernames => [username] + usernames}
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# <search_calls_response> := CALLS [<identifier_sequence>]
|
159
|
+
class SearchCallsResponse < ResponseBase
|
160
|
+
def initialize
|
161
|
+
@parser = lambda do
|
162
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("CALLS"),
|
163
|
+
Yaparc::Identifier.new,
|
164
|
+
Yaparc::ManyParser.new(
|
165
|
+
Yaparc::SeqParser.new(
|
166
|
+
Yaparc::Symbol.new(','),
|
167
|
+
Yaparc::Identifier.new) do |_, identifier|
|
168
|
+
[identifier]
|
169
|
+
end,
|
170
|
+
[]
|
171
|
+
)
|
172
|
+
) do |_,identifier,identifiers|
|
173
|
+
{:identifiers => [identifier] + identifiers}
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
# <search_activecalls_response> := CALLS [<identifier_sequence>]
|
180
|
+
class SearchActivecallsResponse < ResponseBase
|
181
|
+
def initialize
|
182
|
+
@parser = lambda do
|
183
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("CALLS"),
|
184
|
+
Yaparc::Identifier.new,
|
185
|
+
Yaparc::ManyParser.new(
|
186
|
+
Yaparc::SeqParser.new(
|
187
|
+
Yaparc::Symbol.new(','),
|
188
|
+
Yaparc::Identifier.new) do |_, identifier|
|
189
|
+
[identifier]
|
190
|
+
end,
|
191
|
+
[]
|
192
|
+
)
|
193
|
+
) do |_,identifier,identifiers|
|
194
|
+
{:identifiers => [identifier] + identifiers}
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# <search_missedcalls_response> := CALLS [<identifier_sequence>]
|
201
|
+
class SearchMissedcallsResponse < ResponseBase
|
202
|
+
def initialize
|
203
|
+
@parser = lambda do
|
204
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("CALLS"),
|
205
|
+
Yaparc::Identifier.new,
|
206
|
+
Yaparc::ManyParser.new(
|
207
|
+
Yaparc::SeqParser.new(
|
208
|
+
Yaparc::Symbol.new(','),
|
209
|
+
Yaparc::Identifier.new) do |_, identifier|
|
210
|
+
[identifier]
|
211
|
+
end,
|
212
|
+
[]
|
213
|
+
)
|
214
|
+
) do |_,identifier,identifiers|
|
215
|
+
{:identifiers => [identifier] + identifiers}
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# <search_userswaitingmyauthorization_response> := USERS [<identifier_sequence>]
|
222
|
+
# FIXME for multiple users response
|
223
|
+
class SearchUserswaitingmyauthorizationResponse < ResponseBase
|
224
|
+
def initialize
|
225
|
+
@parser = lambda do
|
226
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("USERS"),
|
227
|
+
Yaparc::Identifier.new,
|
228
|
+
Yaparc::ManyParser.new(
|
229
|
+
Yaparc::SeqParser.new(
|
230
|
+
Yaparc::Symbol.new(','),
|
231
|
+
Yaparc::Identifier.new) do |_, identifier|
|
232
|
+
[identifier]
|
233
|
+
end,
|
234
|
+
[]
|
235
|
+
)
|
236
|
+
) do |_,identifier,identifiers|
|
237
|
+
{:identifiers => [identifier] + identifiers}
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# <voicemail_response> := VOICEMAIL <id> STATUS <value>
|
244
|
+
class VoicemailResponse < ResponseBase
|
245
|
+
def initialize
|
246
|
+
@parser = lambda do
|
247
|
+
Yaparc::SeqParser.new(
|
248
|
+
Yaparc::Symbol.new("VOICEMAIL"),
|
249
|
+
CallId.new,
|
250
|
+
Yaparc::Symbol.new("STATUS"),
|
251
|
+
AnyValue.new
|
252
|
+
) do |_,call_id,_,value|
|
253
|
+
{:call_id => call_id, :value => value}
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
# <chat_create_response> := CHAT <chat_id> STATUS <value>
|
260
|
+
class ChatCreateResponse < ResponseBase
|
261
|
+
def initialize
|
262
|
+
@parser = lambda do
|
263
|
+
Yaparc::SeqParser.new(
|
264
|
+
Yaparc::Symbol.new("CHAT"),
|
265
|
+
CallId.new,
|
266
|
+
Yaparc::Symbol.new("STATUS"),
|
267
|
+
AnyValue.new
|
268
|
+
) do |_,call_id,_,value|
|
269
|
+
{:call_id => call_id, :value => value}
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
|
276
|
+
end # of Parser
|
277
|
+
end # of Skyper
|