SkypeR 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/MIT-LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2007-200 Akimichi Tatsukawa
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README
CHANGED
data/bin/iskype.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
#$:.unshift File.join(File.dirname(__FILE__))
|
3
3
|
|
4
4
|
require 'rubygems'
|
5
|
-
#require_gem 'yaparc'
|
6
5
|
require 'yaparc'
|
7
6
|
require 'readline'
|
8
7
|
require 'optparse'
|
9
8
|
require 'logger'
|
10
|
-
require "
|
9
|
+
require "skyper.rb"
|
11
10
|
|
12
11
|
module SkypeR
|
13
12
|
LOGGER = nil
|
@@ -0,0 +1,522 @@
|
|
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
|
+
|
14
|
+
|
15
|
+
module Parser
|
16
|
+
|
17
|
+
class CommandBase < Yaparc::AbstractParser
|
18
|
+
attr_accessor :response
|
19
|
+
end
|
20
|
+
|
21
|
+
# <command_statement> := [<command_id>] <command>
|
22
|
+
class CommandStatement < CommandBase
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
@parser = lambda do
|
26
|
+
Yaparc::SeqParser.new(Yaparc::ZeroOneParser.new(CommandID.new),
|
27
|
+
Command.new) do |command_id, command|
|
28
|
+
command
|
29
|
+
# if command_id == []
|
30
|
+
# {:command_id => nil, :command => command}
|
31
|
+
# else
|
32
|
+
# {:command_id => command_id, :command => command}
|
33
|
+
# end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# <command> := <name_command>
|
40
|
+
# | <get_command>
|
41
|
+
# | <search_command>
|
42
|
+
# | <set_command>
|
43
|
+
# | <call_command>
|
44
|
+
# | <voicemail_command>
|
45
|
+
# | <chat_command>
|
46
|
+
# | <history_command>
|
47
|
+
class Command < CommandBase
|
48
|
+
def initialize
|
49
|
+
@parser = lambda do
|
50
|
+
Yaparc::AltParser.new(
|
51
|
+
GetCommand.new,
|
52
|
+
SearchCommand.new,
|
53
|
+
SetCommand.new,
|
54
|
+
CallCommand.new,
|
55
|
+
VoicemailCommand.new,
|
56
|
+
ChatCommand.new,
|
57
|
+
HistoryCommand.new
|
58
|
+
)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end # of Command
|
62
|
+
|
63
|
+
# <get_command> := <get_user_command>
|
64
|
+
# | <get_profile_command>
|
65
|
+
# | <get_call_command>
|
66
|
+
# | <get_chat_chatmessages_command>
|
67
|
+
# | <get_chat_recentchatmessages_command>
|
68
|
+
class GetCommand < CommandBase
|
69
|
+
def initialize
|
70
|
+
@parser = lambda do
|
71
|
+
Yaparc::AltParser.new(
|
72
|
+
GetUserCommand.new,
|
73
|
+
GetUserstatusCommand.new,
|
74
|
+
GetProfileCommand.new,
|
75
|
+
GetCallCommand.new,
|
76
|
+
GetChatChatmessagesCommand.new
|
77
|
+
)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
# <get_chat_chatmessages_command> := GET CHAT <chat_id> CHATMESSAGES
|
84
|
+
# <get_chat_chatmessages_response> := CHAT <chat_id> CHATMESSAGES <identifier_sequence>
|
85
|
+
class GetChatChatmessagesCommand < CommandBase
|
86
|
+
def initialize
|
87
|
+
@parser = lambda do
|
88
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("GET"),
|
89
|
+
Yaparc::Symbol.new("CHAT"),
|
90
|
+
ChatID.new,
|
91
|
+
Yaparc::Symbol.new("CHATMESSAGES")) do |_,_,chat_id,_|
|
92
|
+
{:command_instance => self, :chat_id => chat_id}
|
93
|
+
end
|
94
|
+
end
|
95
|
+
@response = GetChatChatmessagesResponse.new
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
# <get_chat_recentchatmessages_command> := GET CHAT <chat_id> RECENTCHATMESSAGES
|
101
|
+
# <get_chat_recentchatmessages_response> := CHAT <chat_id> RECENTCHATMESSAGES <identifier_sequence>
|
102
|
+
class GetChatRecentmessagesCommand < CommandBase
|
103
|
+
def initialize
|
104
|
+
@parser = lambda do
|
105
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("GET"),
|
106
|
+
Yaparc::Symbol.new("CHAT"),
|
107
|
+
ChatID.new,
|
108
|
+
Yaparc::Symbol.new("RECENTCHATMESSAGES")) do |_,_,chat_id,_|
|
109
|
+
{:command_instance => self, :chat_id => chat_id}
|
110
|
+
end
|
111
|
+
end
|
112
|
+
@response = GetChatRecentchatmessagesResponse.new
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
# <get_user_command> := GET USER <username> <user_property>
|
118
|
+
class GetUserCommand < CommandBase
|
119
|
+
def initialize
|
120
|
+
@parser = lambda do
|
121
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("GET"),
|
122
|
+
Yaparc::Symbol.new("USER"),
|
123
|
+
Username.new,
|
124
|
+
SkypeR::Parser::UserProperty.new) do |_,_,username,property|
|
125
|
+
{:command_instance => self, :username => username, :property => property}
|
126
|
+
end
|
127
|
+
end
|
128
|
+
@response = GetUserResponse.new
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# <get_userstatus_command> := GET USERSTATUS
|
133
|
+
# <get_userstatus_response> := USERSTATUS <value>
|
134
|
+
class GetUserstatusCommand < CommandBase
|
135
|
+
def initialize
|
136
|
+
@parser = lambda do
|
137
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("GET"), Yaparc::Symbol.new("USERSTATUS"))
|
138
|
+
end
|
139
|
+
@response = GetUserstatusResponse.new
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# <get_profile_command> := GET PROFILE <profile_property>
|
144
|
+
class GetProfileCommand < CommandBase
|
145
|
+
def initialize
|
146
|
+
@parser = lambda do
|
147
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("GET"),
|
148
|
+
Yaparc::Symbol.new("PROFILE"),
|
149
|
+
ProfileProperty.new) do |_,_,property|
|
150
|
+
{:command_instance => self, :property => property}
|
151
|
+
end
|
152
|
+
end
|
153
|
+
@response = GetProfileResponse.new
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# <get_call_command> := GET CALL <call_id> <call_property>
|
158
|
+
class GetCallCommand < CommandBase
|
159
|
+
def initialize
|
160
|
+
@parser = lambda do
|
161
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("GET"),
|
162
|
+
Yaparc::Symbol.new("CALL"),
|
163
|
+
CallId.new,
|
164
|
+
SkypeR::Parser::CallProperty.new) do |_,_,call_id, property|
|
165
|
+
{:command_instance => self, :property => property, :call_id => call_id}
|
166
|
+
end
|
167
|
+
end
|
168
|
+
@response = GetCallResponse.new
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# <search_command> := <search_friends_command>
|
173
|
+
# | <search_users_command>
|
174
|
+
# | <search_calls_command>
|
175
|
+
# | <search_activecalls_command>
|
176
|
+
# | <search_missedcalls_command>
|
177
|
+
# | <search_voicemails_command>
|
178
|
+
# | <search_chats_command>
|
179
|
+
# | <search_missedchats_command>
|
180
|
+
# | <search_activechats_command>
|
181
|
+
# | <search_recentchats_command>
|
182
|
+
# | <search_bookmarkedchats_command>
|
183
|
+
# | <search_chatmessages_command>
|
184
|
+
# | <search_missedchatmessages_command>
|
185
|
+
# | <search_userswaitingmyauthorization_command>
|
186
|
+
class SearchCommand < CommandBase
|
187
|
+
def initialize
|
188
|
+
@parser = lambda do
|
189
|
+
Yaparc::AltParser.new(
|
190
|
+
SearchUsersCommand.new,
|
191
|
+
SearchFriendsCommand.new,
|
192
|
+
SearchCallsCommand.new,
|
193
|
+
SearchActivecallsCommand.new,
|
194
|
+
SearchMissedcallsCommand.new,
|
195
|
+
SearchUserswaitingmyauthorizationCommand.new
|
196
|
+
)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# SEARCH USERS <target>
|
202
|
+
class SearchUsersCommand < CommandBase
|
203
|
+
def initialize
|
204
|
+
@parser = lambda do
|
205
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("SEARCH"),
|
206
|
+
Yaparc::Symbol.new("USERS"),
|
207
|
+
Target.new) do |_,_,target|
|
208
|
+
{:command_instance => self, :target => target}
|
209
|
+
end
|
210
|
+
end
|
211
|
+
@response = SearchUsersResponse.new
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# <search_friends_command> := SEARCH FRIENDS
|
216
|
+
# <search_friends_response> := USERS [user[,user]*]
|
217
|
+
class SearchFriendsCommand < CommandBase
|
218
|
+
def initialize
|
219
|
+
@parser = lambda do
|
220
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("SEARCH"), Yaparc::Symbol.new("FRIENDS")) do |_,_|
|
221
|
+
{:command_instance => self}
|
222
|
+
end
|
223
|
+
end
|
224
|
+
@response = SearchFriendsResponse.new
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# <search_calls_command> := SEARCH CALLS
|
229
|
+
# <search_calls_response> := CALLS [<identifier_sequence>]
|
230
|
+
class SearchCallsCommand < CommandBase
|
231
|
+
def initialize
|
232
|
+
@parser = lambda do
|
233
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("SEARCH"), Yaparc::Symbol.new("CALLS")) do |_,_|
|
234
|
+
{:command_instance => self}
|
235
|
+
end
|
236
|
+
end
|
237
|
+
@response = SearchCallsResponse.new
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
# <search_activecalls_command> := SEARCH ACTIVECALLS
|
242
|
+
# <search_activecalls_response> := CALLS [<identifier_sequence>]
|
243
|
+
class SearchActivecallsCommand < CommandBase
|
244
|
+
def initialize
|
245
|
+
@parser = lambda do
|
246
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("SEARCH"), Yaparc::Symbol.new("ACTIVECALLS")) do |_,_|
|
247
|
+
{:command_instance => self}
|
248
|
+
end
|
249
|
+
end
|
250
|
+
@response = SearchActivecallsResponse.new
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# <search_missedcalls_command> := SEARCH MISSEDCALLS
|
255
|
+
# <search_missedcalls_response> := CALLS [<identifier_sequence>]
|
256
|
+
class SearchMissedcallsCommand < CommandBase
|
257
|
+
def initialize
|
258
|
+
@parser = lambda do
|
259
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("SEARCH"), Yaparc::Symbol.new("MISSEDCALLS")) do |_,_|
|
260
|
+
{:command_instance => self}
|
261
|
+
end
|
262
|
+
end
|
263
|
+
@response = SearchMissedcallsResponse.new
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
# <search_userswaitingmyauthorization_command> := SEARCH USERSWATINGMYAUTHORIZATION
|
268
|
+
# <search_userswaitingmyauthorization_response> := USERS [<identifier_sequence>]
|
269
|
+
class SearchUserswaitingmyauthorizationCommand < CommandBase
|
270
|
+
def initialize
|
271
|
+
@parser = lambda do
|
272
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("SEARCH"),
|
273
|
+
Yaparc::Symbol.new("USERSWATINGMYAUTHORIZATION")) do |_,_|
|
274
|
+
{:command_instance => self}
|
275
|
+
end
|
276
|
+
end
|
277
|
+
@response = SearchUserswaitingmyauthorizationResponse.new
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
# <set_command> := <set_call_inprogress_command>
|
282
|
+
# | <set_call_finished_command>
|
283
|
+
# | <set_call_onhold_command>
|
284
|
+
class SetCommand < CommandBase
|
285
|
+
def initialize
|
286
|
+
@parser = lambda do
|
287
|
+
Yaparc::AltParser.new(
|
288
|
+
SetCallInprogressCommand.new,
|
289
|
+
SetCallFinishedCommand.new,
|
290
|
+
SetCallOnholdCommand.new
|
291
|
+
)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
# <set_call_onhold_command> := SET CALL <id> STATUS [ONHOLD|INPROGRESS]
|
297
|
+
class SetCallOnholdCommand < CommandBase
|
298
|
+
def initialize
|
299
|
+
@parser = lambda do
|
300
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("SET"),
|
301
|
+
Yaparc::Symbol.new("CALL"),
|
302
|
+
CallId.new,
|
303
|
+
Yaparc::Symbol.new("STATUS"),
|
304
|
+
Yaparc::AltParser.new(Yaparc::Symbol.new("INPROGRESS"),Yaparc::Symbol.new("ONHOLD"))
|
305
|
+
) do |_,_,call_id,_,_|
|
306
|
+
{:command_instance => self, :call_id => call_id}
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
# <set_call_inprogress_command> := SET CALL <id> STATUS INPROGRESS
|
313
|
+
class SetCallInprogressCommand < CommandBase
|
314
|
+
def initialize
|
315
|
+
@parser = lambda do
|
316
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("SET"),
|
317
|
+
Yaparc::Symbol.new("CALL"),
|
318
|
+
CallId.new,
|
319
|
+
Yaparc::Symbol.new("STATUS"),
|
320
|
+
Yaparc::Symbol.new("INPROGRESS")) do |_,_,call_id,_,_|
|
321
|
+
{:command_instance => self, :call_id => call_id}
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
# <set_call_finished_command> := SET CALL <id> STATUS FINISHED
|
328
|
+
class SetCallFinishedCommand < CommandBase
|
329
|
+
def initialize
|
330
|
+
@parser = lambda do
|
331
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new("SET"),
|
332
|
+
Yaparc::Symbol.new("CALL"),
|
333
|
+
CallId.new,
|
334
|
+
Yaparc::Symbol.new("STATUS"),
|
335
|
+
Yaparc::Symbol.new("FINISHED")) do |_,_,call_id,_,_|
|
336
|
+
{:command_instance => self, :call_id => call_id}
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
# <call_command> := CALL <target>[, <target>]*
|
343
|
+
class CallCommand < CommandBase
|
344
|
+
def initialize
|
345
|
+
@parser = lambda do
|
346
|
+
Yaparc::SeqParser.new(
|
347
|
+
Yaparc::Symbol.new("CALL"),
|
348
|
+
Target.new,
|
349
|
+
Yaparc::ManyParser.new(
|
350
|
+
Yaparc::SeqParser.new(
|
351
|
+
Yaparc::Symbol.new(','),
|
352
|
+
Target.new) do |_, target|
|
353
|
+
[target]
|
354
|
+
end,
|
355
|
+
[]
|
356
|
+
)
|
357
|
+
) do |_,target,targets|
|
358
|
+
{:command_instance => self, :targets => [target] + targets}
|
359
|
+
end
|
360
|
+
end
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
|
365
|
+
# Send voicemail to user <target>
|
366
|
+
# <voicemail_command> := VOICEMAIL <target>
|
367
|
+
# <voicemail_response> := VOICEMAIL <id> STATUS <value>
|
368
|
+
class VoicemailCommand < CommandBase
|
369
|
+
def initialize
|
370
|
+
@parser = lambda do
|
371
|
+
Yaparc::SeqParser.new(
|
372
|
+
Yaparc::Symbol.new("VOICEMAIL"),
|
373
|
+
Target.new
|
374
|
+
) do |_,target|
|
375
|
+
{:command_instance => self,:target => target}
|
376
|
+
end
|
377
|
+
end
|
378
|
+
@response = VoicemailResponse.new
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
382
|
+
# <chat_command> := <chat_create_command>
|
383
|
+
class ChatCommand < CommandBase
|
384
|
+
def initialize
|
385
|
+
@parser = lambda do
|
386
|
+
ChatCreateCommand.new
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
# <chat_create_command> := CHAT CREATE <target>[, <target>]*
|
392
|
+
# <chat_create_response> := CHAT <chat_id> STATUS <value>
|
393
|
+
# <chat_message_command> := CHATMESSAGE <chat_id> <message>
|
394
|
+
# <chat_message_response> := CHATMESSAGE <id> STATUS SENDING
|
395
|
+
class ChatCreateCommand < CommandBase
|
396
|
+
def initialize
|
397
|
+
@parser = lambda do
|
398
|
+
Yaparc::SeqParser.new(
|
399
|
+
Yaparc::Symbol.new("CHAT"),
|
400
|
+
Yaparc::Symbol.new("CREATE"),
|
401
|
+
Target.new,
|
402
|
+
Yaparc::ManyParser.new(
|
403
|
+
Yaparc::SeqParser.new(Yaparc::Symbol.new(','),
|
404
|
+
Target.new) do |_, target|
|
405
|
+
[target]
|
406
|
+
end,
|
407
|
+
[]
|
408
|
+
)
|
409
|
+
) do |_,_,target,targets|
|
410
|
+
{:command_instance => self, :targets => [target] + targets}
|
411
|
+
end
|
412
|
+
end
|
413
|
+
@response = ChatCreateResponse.new
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
# <history_command> := <clear_chathistory_command>
|
418
|
+
# | <clear_voicemailhistory_command>
|
419
|
+
class HistoryCommand < CommandBase
|
420
|
+
def initialize
|
421
|
+
@parser = lambda do
|
422
|
+
Yaparc::AltParser.new(
|
423
|
+
ClearChathistoryCommand.new,
|
424
|
+
ClearVoicemailhistoryCommand.new
|
425
|
+
)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
430
|
+
# <clear_chathistory_command> := CLEAR CHATHISTORY
|
431
|
+
class ClearChathistoryCommand < CommandBase
|
432
|
+
def initialize
|
433
|
+
@parser = lambda do
|
434
|
+
Yaparc::SeqParser.new(
|
435
|
+
Yaparc::Symbol.new('CLEAR'),
|
436
|
+
Yaparc::Symbol.new('CHATHISTORY')
|
437
|
+
) do |_,_|
|
438
|
+
{:command_instance => self}
|
439
|
+
end
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
|
444
|
+
# <clear_voicemailhistory_command> := CLEAR VOICEMAILHISTORY
|
445
|
+
class ClearVoicemailhistoryCommand < CommandBase
|
446
|
+
def initialize
|
447
|
+
@parser = lambda do
|
448
|
+
Yaparc::SeqParser.new(
|
449
|
+
Yaparc::Symbol.new('CLEAR'),
|
450
|
+
Yaparc::Symbol.new('VOICEMAILHISTORY')
|
451
|
+
) do |_,_|
|
452
|
+
{:command_instance => self}
|
453
|
+
end
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
# <clear_callhistory_command> := CLEAR CALLHISTORY
|
459
|
+
class ClearCallhistoryCommand < CommandBase
|
460
|
+
def initialize
|
461
|
+
@parser = lambda do
|
462
|
+
Yaparc::SeqParser.new(
|
463
|
+
Yaparc::Symbol.new('CLEAR'),
|
464
|
+
Yaparc::Symbol.new('CALLHISTORY')
|
465
|
+
)do |_,_|
|
466
|
+
{:command_instance => self}
|
467
|
+
end
|
468
|
+
end
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
472
|
+
|
473
|
+
# <target> := <username>
|
474
|
+
# | <pstn> # {PSTN phone number}
|
475
|
+
# | <speed dial code>
|
476
|
+
# <username> := {Skype username}
|
477
|
+
# <speed dial code> := [a-zA-Z][1-2]
|
478
|
+
class Target < CommandBase
|
479
|
+
def initialize
|
480
|
+
@parser = lambda do
|
481
|
+
Yaparc::AltParser.new(Username.new,
|
482
|
+
PSTN.new,
|
483
|
+
SpeedDialCode.new)
|
484
|
+
end
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
488
|
+
class PSTN < CommandBase
|
489
|
+
def initialize
|
490
|
+
@parser = lambda do
|
491
|
+
Yaparc::RegexParser.new(/\+[a-zA-Z0-9][a-zA-Z0-9\-]*/)
|
492
|
+
end
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
class SpeedDialCode < CommandBase
|
497
|
+
def initialize
|
498
|
+
@parser = lambda do
|
499
|
+
Yaparc::RegexParser.new(/[a-zA-Z][1-2]/)
|
500
|
+
end
|
501
|
+
end
|
502
|
+
end
|
503
|
+
|
504
|
+
class Username < CommandBase
|
505
|
+
def initialize
|
506
|
+
@parser = lambda do
|
507
|
+
Yaparc::Token.new(Yaparc::RegexParser.new(/[a-zA-Z0-9]+/))
|
508
|
+
end
|
509
|
+
end
|
510
|
+
end
|
511
|
+
|
512
|
+
class CallId < CommandBase
|
513
|
+
def initialize
|
514
|
+
@parser = lambda do
|
515
|
+
Yaparc::Natural.new
|
516
|
+
end
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
520
|
+
|
521
|
+
end # of Parser
|
522
|
+
end # of Skyper
|