Ruby4Skype 0.2.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +3 -0
- data/README +14 -0
- data/Rakefile +67 -0
- data/lib/skypeapi.rb +570 -509
- data/lib/skypeapi/application.rb +79 -77
- data/lib/skypeapi/call.rb +243 -230
- data/lib/skypeapi/chat.rb +162 -172
- data/lib/skypeapi/chatmember.rb +26 -28
- data/lib/skypeapi/chatmessage.rb +81 -65
- data/lib/skypeapi/error.rb +8 -0
- data/lib/skypeapi/event.rb +25 -26
- data/lib/skypeapi/filetransfer.rb +47 -28
- data/lib/skypeapi/group.rb +72 -73
- data/lib/skypeapi/menuitem.rb +44 -44
- data/lib/skypeapi/message.rb +39 -41
- data/lib/skypeapi/object.rb +246 -82
- data/lib/skypeapi/os/etc.rb +48 -98
- data/lib/skypeapi/os/mac.rb +92 -4
- data/lib/skypeapi/os/notifier.rb +31 -0
- data/lib/skypeapi/os/window_event_queue.rb +198 -0
- data/lib/skypeapi/os/window_messagehandler.rb +120 -0
- data/lib/skypeapi/os/windows.rb +170 -306
- data/lib/skypeapi/profile.rb +190 -120
- data/lib/skypeapi/sharefunctions.rb +31 -23
- data/lib/skypeapi/sms.rb +87 -67
- data/lib/skypeapi/user.rb +159 -99
- data/lib/skypeapi/version.rb +3 -3
- data/lib/skypeapi/voicemail.rb +59 -52
- data/spec/matcher_be_boolean.rb +10 -0
- data/spec/skypeapi/application_spec.rb +76 -0
- data/spec/skypeapi/chat_spec.rb +356 -0
- data/spec/skypeapi/chatmember_spec.rb +42 -0
- data/spec/skypeapi/chatmessage_spec.rb +89 -0
- data/spec/skypeapi/event_spec.rb +31 -0
- data/spec/skypeapi/filetransfer_spec.rb +67 -0
- data/spec/skypeapi/group_spec.rb +16 -0
- data/spec/skypeapi/menuitem_spec.rb +37 -0
- data/spec/skypeapi/os/windows_spec.rb +305 -0
- data/spec/skypeapi/profile_spec.rb +22 -0
- data/spec/skypeapi/user_spec.rb +25 -0
- data/spec/skypeapi_spec.rb +528 -0
- metadata +32 -12
- data/lib/skypeapi/os/timer.rb +0 -108
data/lib/skypeapi/chat.rb
CHANGED
@@ -1,186 +1,176 @@
|
|
1
|
+
|
1
2
|
module SkypeAPI
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
def
|
7
|
-
|
8
|
-
retVal =~ /^CHAT ([^ ]+) STATUS (.+)$/
|
3
|
+
class Chat < AbstractObject
|
4
|
+
OBJECT_NAME = "CHAT"
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def create *users
|
8
|
+
SkypeAPI.invoke("CHAT CREATE #{users.join(', ')}") =~ /^CHAT ([^ ]+) STATUS (.+)$/
|
9
9
|
chatID, status = $1, $2
|
10
10
|
return SkypeAPI::Chat.new(chatID)#, status
|
11
11
|
end
|
12
|
-
|
13
|
-
def
|
14
|
-
|
15
|
-
retVal =~ /^CHAT ([^ ]+) STATUS (.+)$/
|
12
|
+
|
13
|
+
def find_using_blob blob
|
14
|
+
SkypeAPI.invoke("CHAT FINDUSINGBLOB #{blob}") =~ /^CHAT ([^ ]+) STATUS (.+)$/
|
16
15
|
chatID, status = $1, $2
|
17
16
|
return SkypeAPI::Chat.new(chatID)#, status
|
18
17
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
alias findUsingBlob find_using_blob
|
19
|
+
|
20
|
+
def create_using_blob blob
|
21
|
+
SkypeAPI.invoke("CHAT CREATEUSINGBLOB #{blob}") =~ /^CHAT ([^ ]+) STATUS (.+)$/
|
23
22
|
chatID, status = $1, $2
|
24
23
|
return SkypeAPI::Chat.new(chatID)#, status
|
25
24
|
end
|
26
|
-
|
27
|
-
|
28
|
-
getter :Timestamp, 'TIMESTAMP' do |str|
|
29
|
-
if str.empty? then nil else Time.at(str.to_i) end
|
30
|
-
end
|
31
|
-
getter :Adder, 'ADDER' do |str|
|
32
|
-
str.empty? ? nil : SkypeAPI::User.new(str)
|
33
|
-
end
|
34
|
-
getter :Status, 'STATUS'
|
35
|
-
getter :Posters, 'POSTERS' do |str|
|
36
|
-
str.split(', ').map do |handle|
|
37
|
-
SkypeAPI::User.new handle
|
38
|
-
end
|
39
|
-
end
|
40
|
-
getter :Members, 'MEMBERS' do |str|
|
41
|
-
str.split(' ').map do |handle|
|
42
|
-
SkypeAPI::User.new handle
|
43
|
-
end
|
44
|
-
end
|
45
|
-
getter :Topic, 'TOPIC'
|
46
|
-
getter :TopicXML, 'TOPICXML'
|
47
|
-
getter :ChatMessages, 'CHATMESSAGES' do |str|
|
48
|
-
str.split(' ').map do |id|
|
49
|
-
SkypeAPI::ChatMessage.new id
|
50
|
-
end
|
51
|
-
end
|
52
|
-
getter :ActiveMembers, 'ACTIVEMEMBERS' do |str|
|
53
|
-
str.split(' ').map do |handle|
|
54
|
-
SkypeAPI::User.new handle
|
55
|
-
end
|
56
|
-
end
|
57
|
-
getter :FriendlyName, 'FRIENDLYNAME'
|
58
|
-
getter :RecentChatMessages, 'RECENTCHATMESSAGES' do |str|
|
59
|
-
str.split(' ').map do |handle|
|
60
|
-
SkypeAPI::ChatMessage.new handle
|
61
|
-
end
|
62
|
-
end
|
63
|
-
getter :Bookmarked, 'BOOKMARKED' do |str|
|
64
|
-
str._flag
|
65
|
-
end
|
66
|
-
getter :MemberObjects, 'MEMBEROBJECTS' do |str|
|
67
|
-
str.split(', ').map do |id|
|
68
|
-
SkypeAPI::ChatMember.new id
|
69
|
-
end
|
70
|
-
end
|
71
|
-
getter :PasswordHint, 'PASSWORDHINT'
|
72
|
-
getter :GuideLines, 'GUIDELINES'
|
73
|
-
getter :Options, 'OPTIONS' do |str|
|
74
|
-
str.to_i
|
75
|
-
end
|
76
|
-
getter :Description, 'DESCRIPTION'
|
77
|
-
getter :DialogPartner, 'DIALOG_PARTNER' do |str|
|
78
|
-
if str.empty?
|
79
|
-
nil
|
80
|
-
else
|
81
|
-
SkypeAPI::User.new str
|
82
|
-
end
|
83
|
-
end
|
84
|
-
getter :ActivityTimestamp, 'ACTIVITY_TIMESTAMP' do |str|
|
85
|
-
if str.empty? then nil else Time.at(str.to_i) end
|
86
|
-
end
|
87
|
-
getter :Type, 'TYPE'
|
88
|
-
getter :MyStatus, 'MYSTATUS'
|
89
|
-
getter :MyRole, 'MYROLE'
|
90
|
-
getter :Blob, 'BLOB'
|
91
|
-
getter :Applicants, 'APPLICANTS' do |str|
|
92
|
-
str.split(' ').map do |handle|
|
93
|
-
SkypeAPI::User.new handle
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
#���[
|
98
|
-
#def open
|
99
|
-
# retVal = invoke "OPEN CHAT #{@id}"
|
100
|
-
# retVal =~ /^OPEN CHAT (.+)$/
|
101
|
-
# return SkypeAPI.chat($1)
|
102
|
-
#end
|
103
|
-
|
104
|
-
def setTopic topic
|
105
|
-
invoke_alter "SETTOPIC", topic
|
106
|
-
end
|
25
|
+
alias createUsingBlob create_using_blob
|
26
|
+
end
|
107
27
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
28
|
+
def get_name() invoke_get('NAME') end
|
29
|
+
def_parser(:name)
|
30
|
+
alias getName get_name
|
31
|
+
|
32
|
+
def get_timestamp() parse :timestamp, invoke_get('TIMESTAMP') end
|
33
|
+
def_parser(:timestamp){|str| str.empty? ? nil : Time.at(str.to_i) }
|
34
|
+
alias getTimestamp get_timestamp
|
35
|
+
|
36
|
+
def get_adder() parse :adder, invoke_get('ADDER') end
|
37
|
+
def_parser(:adder){|str| str.empty? ? nil : SkypeAPI::User.new(str) }
|
38
|
+
alias getAdder get_adder
|
39
|
+
|
40
|
+
def get_status() invoke_get 'STATUS' end
|
41
|
+
def_parser :status
|
42
|
+
alias getStatus get_status
|
43
|
+
|
44
|
+
def get_posters() parse :posters, invoke_get('POSTERS') end
|
45
|
+
def_parser(:posters){|str| str.split(', ').map{|handle| SkypeAPI::User.new handle}}
|
46
|
+
alias getPosters get_posters
|
47
|
+
|
48
|
+
def get_members() parse :members, invoke_get('MEMBERS') end
|
49
|
+
def_parser(:members){|str| str.split(' ').map{|handle| SkypeAPI::User.new handle}}
|
50
|
+
alias getMembers get_members
|
51
|
+
|
52
|
+
def get_topic() invoke_get('TOPIC') end
|
53
|
+
def_parser(:topic)
|
54
|
+
alias getTopic get_topic
|
55
|
+
|
56
|
+
def get_topic_xml() invoke_get('TOPICXML') end
|
57
|
+
def_parser(:topic_xml,'TOPICXML')
|
58
|
+
alias getTopicXML get_topic_xml
|
59
|
+
|
60
|
+
def get_chat_messages() parse :chat_messages, invoke_get('CHATMESSAGES') end
|
61
|
+
def_parser(:chat_messages, 'CHATMESSAGES'){|str| str.split(' ').map{|id| SkypeAPI::ChatMessage.new id}}
|
62
|
+
alias getChatMessages get_chat_messages
|
63
|
+
|
64
|
+
def get_active_members() parse :active_members, invoke_get('ACTIVEMEMBERS') end
|
65
|
+
def_parser(:active_members, 'ACTIVEMEMBERS'){|str| str.split(' ').map{|handle| SkypeAPI::User.new handle}}
|
66
|
+
alias getActiveMembers get_active_members
|
67
|
+
|
68
|
+
def get_friendly_name() invoke_get('FRIENDLYNAME') end
|
69
|
+
def_parser :friendly_name, 'FRIENDLYNAME'
|
70
|
+
alias getFriendlyName get_friendly_name
|
71
|
+
|
72
|
+
def get_recent_chat_messages() parse :recent_chat_messages, invoke_get('RECENTCHATMESSAGES') end
|
73
|
+
def_parser(:recent_chat_messages, 'RECENTCHATMESSAGES'){|str| str.split(' ').map{|handle| SkypeAPI::ChatMessage.new handle}}
|
74
|
+
alias getRecentChatMessages get_recent_chat_messages
|
75
|
+
|
76
|
+
def get_bookmarked() parse :bookmarked, invoke_get("BOOKMARKED") end
|
77
|
+
def_parser(:bookmarked){|str| str._flag}
|
78
|
+
alias getBookmarked get_bookmarked
|
79
|
+
|
80
|
+
def get_member_objects() parse :member_objects, invoke_get('MEMBEROBJECTS') end
|
81
|
+
def_parser(:member_objects, 'MEMBEROBJECTS'){|str| str.split(', ').map{|id| SkypeAPI::ChatMember.new id}}
|
82
|
+
alias getMemberObjects get_member_objects
|
83
|
+
|
84
|
+
def get_password_hint() invoke_get 'PASSWORDHINT' end
|
85
|
+
def_parser :password_hint, 'PASSWORDHINT'
|
86
|
+
alias getPasswordHint get_password_hint
|
87
|
+
|
88
|
+
def get_guidelines() invoke_get 'GUIDELINES' end
|
89
|
+
def_parser :guidelines
|
90
|
+
alias getGuidelines get_guidelines
|
91
|
+
|
92
|
+
def get_options() parse :options, invoke_get('OPTIONS') end
|
93
|
+
def_parser(:options){|str| str.to_i}
|
94
|
+
alias getOptions get_options
|
95
|
+
|
96
|
+
def get_description() invoke_get('DESCRIPTION') end
|
97
|
+
def_parser :description
|
98
|
+
alias getDescription get_description
|
99
|
+
|
100
|
+
def get_dialog_partner() parse :dialog_partner, invoke_get('DIALOG_PARTNER') end
|
101
|
+
def_parser(:dialog_partner){|str| str.empty? ? nil : SkypeAPI::User.new(str)}
|
102
|
+
alias getDialogPartner get_dialog_partner
|
103
|
+
|
104
|
+
def get_activity_timestamp() parse :activity_timestamp, invoke_get('ACTIVITY_TIMESTAMP') end
|
105
|
+
def_parser(:activity_timestamp){|str| str.empty? ? nil : Time.at(str.to_i)}
|
106
|
+
alias getActivityTimestamp get_activity_timestamp
|
107
|
+
|
108
|
+
def get_type() invoke_get 'TYPE' end
|
109
|
+
def_parser :type
|
110
|
+
alias getType get_type
|
111
|
+
|
112
|
+
def get_my_status() invoke_get 'MYSTATUS' end
|
113
|
+
def_parser :my_status, 'MYSTATUS'
|
114
|
+
alias getMyStatus get_my_status
|
115
|
+
|
116
|
+
def get_my_role() invoke_get 'MYROLE' end
|
117
|
+
def_parser :my_role, 'MYROLE'
|
118
|
+
alias getMyRole get_my_role
|
119
|
+
|
120
|
+
def get_blob() invoke_get 'BLOB' end
|
121
|
+
def_parser :blob
|
122
|
+
alias getBlob get_blob
|
123
|
+
|
124
|
+
def get_applicants() parse :applicants, invoke_get('APPLICANTS') end
|
125
|
+
def_parser(:applicants){|str| str.split(' ').map{|handle| SkypeAPI::User.new handle}}
|
126
|
+
alias getApplicants get_applicants
|
127
|
+
|
128
|
+
def set_topic(topic) invoke_alter "SETTOPIC", topic end
|
129
|
+
alias setTopic set_topic
|
130
|
+
|
131
|
+
def set_topic_xml(topic) invoke_alter "SETTOPICXML", topic end
|
132
|
+
alias setTopicXML set_topic_xml
|
133
|
+
|
134
|
+
def add_members(*members) invoke_alter "ADDMEMBERS", members.join(', ') end
|
135
|
+
alias addMembers add_members
|
136
|
+
|
137
|
+
def leave() invoke_alter "LEAVE" end
|
138
|
+
|
139
|
+
def bookmarked() invoke_alter "BOOKMARK" end
|
140
|
+
|
141
|
+
def unbookmarked() invoke_alter "UNBOOKMARK" end
|
142
|
+
|
143
|
+
def join() invoke_alter "JOIN" end
|
144
|
+
|
145
|
+
def clear_recent_messages() invoke_alter "CLEARRECENTMESSAGES" end
|
146
|
+
alias clearRecentMessages clear_recent_messages
|
147
|
+
|
148
|
+
def set_alert_string(string) invoke_alter "SETALERTSTRING", string end
|
149
|
+
alias setAlertString set_alert_string
|
150
|
+
|
151
|
+
def acceptadd() invoke_alter "ACCEPTADD" end
|
152
|
+
|
153
|
+
def disband() invoke_alter "DISBAND" end
|
154
|
+
|
155
|
+
def set_password(password, passwordHint='') invoke_alter "SETPASSWORD", password + ' ' + passwordHint end
|
156
|
+
alias setPassword set_password
|
157
|
+
|
158
|
+
def enter_password(password) invoke_alter "ENTERPASSWORD", password end
|
159
|
+
alias enterPassword enter_password
|
160
|
+
|
161
|
+
def set_options(option) invoke_alter "SETOPTIONS", option.to_s end
|
162
|
+
alias setOptions set_options
|
163
|
+
|
164
|
+
def kick(*users) invoke_alter "KICK", users.join(', ') end
|
165
|
+
|
166
|
+
def kickban(*users) invoke_alter "KICKBAN", users.join(', ') end
|
167
|
+
|
168
|
+
def set_guidelines(guidlines) invoke_alter 'SETGUIDELINES', guidlines end
|
169
|
+
alias setGuideLines set_guidelines
|
170
|
+
|
171
|
+
|
172
|
+
def send_message(strings) SkypeAPI::ChatMessage.create self, strings end
|
173
|
+
alias sendMessage send_message
|
161
174
|
|
162
|
-
def kick *users
|
163
|
-
users = users.join ', '
|
164
|
-
invoke_alter "KICK", users
|
165
|
-
end
|
166
|
-
|
167
|
-
def kickBan *users
|
168
|
-
users = users.join ', '
|
169
|
-
invoke_alter "KICKBAN", users
|
170
|
-
end
|
171
|
-
|
172
|
-
def setGuideLines guidlines
|
173
|
-
invoke_alter 'SETGUIDELINES', guidlines
|
174
|
-
end
|
175
|
-
|
176
|
-
def setOptions optionsBitmap
|
177
|
-
invoke_alter 'SETOPTIONS', optionsBitmap.to_s
|
178
|
-
end
|
179
|
-
|
180
|
-
def sendMessage msg
|
181
|
-
SkypeAPI::ChatMessage.create self, msg
|
182
|
-
end
|
183
|
-
alias send_message sendMessage
|
184
|
-
end
|
185
175
|
end
|
186
176
|
end
|
data/lib/skypeapi/chatmember.rb
CHANGED
@@ -1,33 +1,31 @@
|
|
1
1
|
module SkypeAPI
|
2
|
-
|
3
|
-
|
4
|
-
OBJECT_NAME = "CHATMEMBER"
|
2
|
+
class ChatMember < AbstractObject
|
3
|
+
OBJECT_NAME = "CHATMEMBER"
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
|
5
|
+
def get_chat() parse :chat, invoke_get('CHATNAME') end
|
6
|
+
def_parser(:chat, 'CHATNAME'){|str| SkypeAPI::Chat.new(str)}
|
7
|
+
alias getChat get_chat
|
8
|
+
|
9
|
+
def get_user() parse :user, invoke_get('IDENTITY') end
|
10
|
+
def_parser(:user, 'IDENTITY'){|str| SkypeAPI::User.new(str)}
|
11
|
+
alias getUser get_user
|
12
|
+
|
13
|
+
def get_role() invoke_get('ROLE') end
|
14
|
+
def_parser :role
|
15
|
+
alias getRole get_role
|
16
|
+
|
17
|
+
def get_is_active?() parse :is_active, invoke_get('IS_ACTIVE') end
|
18
|
+
def_parser(:is_active){|str| str == 'TRUE' ? true : false}
|
19
|
+
alias getIsActive? get_is_active?
|
20
|
+
|
21
|
+
|
22
|
+
def set_role_to(role) invoke_alter('SETROLETO', role) end
|
23
|
+
alias setRoleTo set_role_to
|
24
|
+
|
25
|
+
def can_set_role_to?(role)
|
26
|
+
invoke("ALTER CHATMEMBER #{@id} CANSETROLETO #{role}") =~ /ALTER CHATMEMBER CANSETROLETO (TRUE|FALSE)/
|
27
|
+
$1 == 'TRUE' ? true : false
|
31
28
|
end
|
29
|
+
alias canSetRoleTo? can_set_role_to?
|
32
30
|
end
|
33
31
|
end
|
data/lib/skypeapi/chatmessage.rb
CHANGED
@@ -1,70 +1,86 @@
|
|
1
1
|
module SkypeAPI
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
return SkypeAPI.chatMessage($1)#, $2
|
10
|
-
else
|
11
|
-
raise res
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
getter :Body, 'BODY'
|
16
|
-
getter :Timestamp, 'TIMESTAMP' do |str|
|
17
|
-
if str.empty? then nil else Time.at(str.to_i) end
|
18
|
-
end
|
19
|
-
getter :Partner, 'PARTNER_HANDLE' do |str|
|
20
|
-
SkypeAPI::User.new str
|
21
|
-
end
|
22
|
-
getter :PartnerDispname, 'PARTNER_DISPNAME'
|
23
|
-
getter :From, 'FROM_HANDLE' do |str|
|
24
|
-
SkypeAPI::User.new str
|
25
|
-
end
|
26
|
-
getter :FromDispname, 'FROM_DISPNAME'
|
27
|
-
getter :Type, 'TYPE'
|
28
|
-
getter :Status, 'STATUS'
|
29
|
-
getter :LeaveReason, 'LEAVEREASON' do |str|
|
30
|
-
if str.empty?
|
31
|
-
nil
|
32
|
-
else
|
33
|
-
str
|
34
|
-
end
|
35
|
-
end
|
36
|
-
getter :Chat, 'CHATNAME' do |str|
|
37
|
-
SkypeAPI::Chat.new str
|
38
|
-
end
|
39
|
-
getter :Users, 'USERS' do |str|
|
40
|
-
str.split(',').map do |handle|
|
41
|
-
SkypeAPI::User.new handle
|
42
|
-
end
|
43
|
-
end
|
44
|
-
getter :IsEditable, 'IS_EDITABLE' do |str|
|
45
|
-
str._flag
|
46
|
-
end
|
47
|
-
getter :EditedBy, 'EDITED_BY' do |str|
|
48
|
-
if str.empty? then nil else SkypeAPI::User.new(str) end
|
49
|
-
end
|
50
|
-
getter :EditedTimestamp, 'EDITED_TIMESTAMP' do |str|
|
51
|
-
if str.empty? then nil else Time.at(str.to_i) end
|
52
|
-
end
|
53
|
-
getter :Options, 'OPTIONS' do |str|
|
54
|
-
str.to_i
|
55
|
-
end
|
56
|
-
getter :Role, 'ROLE'
|
57
|
-
|
58
|
-
def setSeen
|
59
|
-
str = SkypeAPI.invoke "SET CHATMESSAGE #{@id} SEEN"
|
60
|
-
if str =~ /^CHATMESSAGE #{@id} STATUS (.+)$/
|
61
|
-
return true
|
62
|
-
else
|
63
|
-
raise #????
|
64
|
-
end
|
2
|
+
class ChatMessage < AbstractObject
|
3
|
+
OBJECT_NAME = "CHATMESSAGE"
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def create chat ,msg
|
7
|
+
SkypeAPI.invoke("CHATMESSAGE #{chat} #{msg}") =~ /^CHATMESSAGE (\d+) STATUS (.+)$/
|
8
|
+
SkypeAPI::ChatMessage.new($1)#, $2
|
65
9
|
end
|
66
|
-
|
67
|
-
def setBody(text) invoke_set('BODY',text._str); end
|
68
10
|
end
|
11
|
+
|
12
|
+
def get_body() invoke_get 'BODY' end
|
13
|
+
def_parser :body
|
14
|
+
alias getBody get_body
|
15
|
+
|
16
|
+
def get_timestamp() parse :timestamp, invoke_get('TIMESTAMP') end
|
17
|
+
def_parser(:timestamp){|str| str.empty? ? nil : Time.at(str.to_i)}
|
18
|
+
alias getTimestamp get_timestamp
|
19
|
+
|
20
|
+
#OBS
|
21
|
+
# def get_partner() parse :partner, invoke_get('PARTNER_HANDLE') end
|
22
|
+
# def_parser(:partner, 'PARTNER_HANDLE'){|str| SkypeAPI::User.new str}
|
23
|
+
# alias getPartner get_partner
|
24
|
+
#
|
25
|
+
# def get_partner_dispname() invoke_get('PARTNER_DISPNAME') end
|
26
|
+
# def_parser(:partner_dispname)
|
27
|
+
# alias getPartnerDispname get_partner_dispname
|
28
|
+
|
29
|
+
def get_from() parse :from, invoke_get('FROM_HANDLE') end
|
30
|
+
def_parser(:from, 'FROM_HANDLE'){|str| SkypeAPI::User.new str}
|
31
|
+
alias getFrom get_from
|
32
|
+
|
33
|
+
def get_from_dispname() invoke_get('FROM_DISPNAME') end
|
34
|
+
def_parser :from_dispname
|
35
|
+
alias getFromDispname get_from_dispname
|
36
|
+
|
37
|
+
def get_type() invoke_get 'TYPE' end
|
38
|
+
def_parser :type
|
39
|
+
alias getType get_type
|
40
|
+
|
41
|
+
def get_status() invoke_get 'STATUS' end
|
42
|
+
def_parser :status
|
43
|
+
alias getStatus get_status
|
44
|
+
|
45
|
+
def get_leave_reason() parse :leave_reason, invoke_get('LEAVEREASON') end
|
46
|
+
def_parser(:leave_reason, 'LEAVEREASON'){|str| str.empty? ? nil : str}
|
47
|
+
alias getLeaveReason get_leave_reason
|
48
|
+
|
49
|
+
def get_chat() parse :chat, invoke_get('CHATNAME') end
|
50
|
+
def_parser(:chat, 'CHATNAME'){|str| SkypeAPI::Chat.new str}
|
51
|
+
alias getChat get_chat
|
52
|
+
|
53
|
+
def get_users() parse :users, invoke_get('USERS') end
|
54
|
+
def_parser(:users){|str| str.split(',').map{|handle| SkypeAPI::User.new handle}}
|
55
|
+
alias getUsers get_users
|
56
|
+
|
57
|
+
def get_is_editable?() parse :is_editable, invoke_get('IS_EDITABLE') end
|
58
|
+
def_parser(:is_editable){|str| str == 'TRUE' ? true : false}
|
59
|
+
alias getIsEditable? get_is_editable?
|
60
|
+
|
61
|
+
def get_edited_by() parse :edited_by, invoke_get("EDITED_BY") end
|
62
|
+
def_parser(:edited_by){|str| str.empty? ? nil : SkypeAPI::User.new(str)}
|
63
|
+
alias getEditedBy get_edited_by
|
64
|
+
|
65
|
+
def get_edited_timestamp() parse :edited_timestamp, invoke_get('EDITED_TIMESTAMP') end
|
66
|
+
def_parser(:edited_timestamp){|str| str.empty? ? nil : Time.at(str.to_i)}
|
67
|
+
alias getEditedTimestamp get_edited_timestamp
|
68
|
+
|
69
|
+
def get_options() parse :options, invoke_get('OPTIONS') end
|
70
|
+
def_parser(:options){|str| str.to_i}
|
71
|
+
alias getOptions get_options
|
72
|
+
|
73
|
+
def get_role() invoke_get('ROLE') end
|
74
|
+
def_parser(:role)
|
75
|
+
alias getRole get_role
|
76
|
+
|
77
|
+
def set_seen
|
78
|
+
return true if SkypeAPI.invoke("SET CHATMESSAGE #{@id} SEEN") =~ /^CHATMESSAGE #{@id} STATUS (.+)$/
|
79
|
+
raise 'hogehoge'
|
80
|
+
end
|
81
|
+
alias setSeen set_seen
|
82
|
+
|
83
|
+
def set_body(text) invoke_set('BODY', text) end
|
84
|
+
alias setBody set_body
|
69
85
|
end
|
70
86
|
end
|