8331
by kakaroto
Add SVN $Id$ tag to the new files and add the keywords property on them... |
1 |
::Version::setSubversionId {$Id$} |
2 |
||
3 |
snit::type ContentRoaming { |
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
4 |
# GetProfile, UpdateProfile,
|
5 |
# CreateDocument, FindDocuments,
|
|
6 |
# CreateRelationships, DeleteRelationships
|
|
7 |
||
8 |
# url : "https://storage.msn.com/storageservice/SchematizedStore.asmx"
|
|
9 |
||
10 |
variable affinity_cache "" |
|
11 |
variable soap_requests [list] |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
12 |
|
13 |
destructor { |
|
14 |
foreach soap_req $soap_requests { |
|
15 |
catch { $soap_req destroy } |
|
16 |
}
|
|
17 |
set soap_requests [list] |
|
18 |
||
19 |
}
|
|
20 |
||
21 |
method _destroySoapReq { soap } { |
|
22 |
$soap destroy |
|
23 |
set idx [lsearch $soap_requests $soap] |
|
24 |
if {$idx >= 0} { |
|
25 |
set soap_requests [lreplace $soap_requests $idx $idx] |
|
26 |
}
|
|
27 |
}
|
|
28 |
||
29 |
||
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
30 |
method GetProfile { callbk {email ""}} { |
9743
by vivia
Reverting 11890 as requested by kkrt |
31 |
$::sso RequireSecurityToken Storage [list $self GetProfileSSOCB $callbk $email] |
32 |
#TODO: s/Storage/MessengerSecure ?
|
|
8862
by vivia
Might fix issue reported in http://www.amsn-project.net/forums/viewtopic.php?t=6240 . Fixed the same issue on my N810 |
33 |
}
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
34 |
|
35 |
method GetProfileSSOCB { callbk email ticket} { |
|
9743
by vivia
Reverting 11890 as requested by kkrt |
36 |
set request [SOAPRequest create %AUTO% \ |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
37 |
-url "https://storage.msn.com/storageservice/SchematizedStore.asmx" \ |
38 |
-action "http://www.msn.com/webservices/storage/w10/GetProfile" \ |
|
39 |
-header [$self getCommonHeaderXML RoamingSeed $ticket] \ |
|
8320
by kakaroto
initial GetProfile scenario is actually RoamingSeed |
40 |
-body [$self getGetProfileBodyXML $email] \ |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
41 |
-callback [list $self GetProfileCallback $callbk $email]] |
42 |
||
43 |
lappend soap_requests $request |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
44 |
$request SendSOAPRequest |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
45 |
|
46 |
}
|
|
47 |
||
48 |
||
49 |
method getGetProfileBodyXML { email } { |
|
50 |
if {$email == "" } { |
|
51 |
set cid [::abook::getPersonal cid] |
|
52 |
} else { |
|
53 |
set cid [::abook::getContactData $email cid] |
|
8319
by kakaroto
Make the GetProfile SOAP identical to wlm's.. even the initial request has a RoamingIdentityChanged scenario... |
54 |
}
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
55 |
|
56 |
# LastModified tags are set to false since we don't need those and it will
|
|
57 |
# decrease the bandwidth used... might be set to true later if needed...
|
|
58 |
append xml {<GetProfile xmlns="http://www.msn.com/webservices/storage/w10">} |
|
59 |
append xml {<profileHandle>} |
|
60 |
append xml {<Alias>} |
|
61 |
append xml {<Name>} |
|
62 |
append xml $cid |
|
63 |
append xml {</Name>} |
|
64 |
append xml {<NameSpace>MyCidStuff</NameSpace>} |
|
65 |
append xml {</Alias>} |
|
66 |
append xml {<RelationshipName>MyProfile</RelationshipName>} |
|
67 |
append xml {</profileHandle>} |
|
68 |
append xml {<profileAttributes>} |
|
8319
by kakaroto
Make the GetProfile SOAP identical to wlm's.. even the initial request has a RoamingIdentityChanged scenario... |
69 |
append xml {<ResourceID>true</ResourceID>} |
70 |
append xml {<DateModified>true</DateModified>} |
|
71 |
append xml {<ExpressionProfileAttributes>} |
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
72 |
append xml {<ResourceID>true</ResourceID>} |
73 |
append xml {<DateModified>true</DateModified>} |
|
8319
by kakaroto
Make the GetProfile SOAP identical to wlm's.. even the initial request has a RoamingIdentityChanged scenario... |
74 |
append xml {<DisplayName>true</DisplayName>} |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
75 |
append xml {<DisplayNameLastModified>true</DisplayNameLastModified>} |
8319
by kakaroto
Make the GetProfile SOAP identical to wlm's.. even the initial request has a RoamingIdentityChanged scenario... |
76 |
append xml {<PersonalStatus>true</PersonalStatus>} |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
77 |
append xml {<PersonalStatusLastModified>true</PersonalStatusLastModified>} |
8319
by kakaroto
Make the GetProfile SOAP identical to wlm's.. even the initial request has a RoamingIdentityChanged scenario... |
78 |
append xml {<StaticUserTilePublicURL>true</StaticUserTilePublicURL>} |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
79 |
if {$email == "" } { |
9689
by kakaroto
Do not do a ABContactUpdate anymore since the server is screwed.. and now use the roaming GetProfile to get everyone's nickname/psm when available at startup.. this should make it easier for users : http://www.amsn-project.net/forums/viewtopic.php?t=7433&postdays=0&postorder=asc&start=0 |
80 |
append xml {<Photo>true</Photo>} |
81 |
append xml {<Flags>true</Flags>} |
|
82 |
}
|
|
83 |
append xml {</ExpressionProfileAttributes>} |
|
8319
by kakaroto
Make the GetProfile SOAP identical to wlm's.. even the initial request has a RoamingIdentityChanged scenario... |
84 |
append xml {</profileAttributes>} |
85 |
append xml {</GetProfile>} |
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
86 |
|
87 |
return $xml |
|
88 |
}
|
|
89 |
||
90 |
||
8325
by kakaroto
Better implementation than WLM.. we now check for the last modification date for both the profile and the roaming content. This way, if the AB is newer, we use the nickname from the AB, if the roaming is newer, we use the nickname from the roaming content. This fixes issues we might have and that WLM has... |
91 |
method GetProfileCallback { callbk email soap } { |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
92 |
set nick "" |
93 |
set last_modif "" |
|
8325
by kakaroto
Better implementation than WLM.. we now check for the last modification date for both the profile and the roaming content. This way, if the AB is newer, we use the nickname from the AB, if the roaming is newer, we use the nickname from the roaming content. This fixes issues we might have and that WLM has... |
94 |
set psm "" |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
95 |
set dp "" |
96 |
#puts [$soap GetResponse]
|
|
97 |
if { [$soap GetStatus] == "success" } { |
|
98 |
set fail 0 |
|
99 |
set xml [$soap GetResponse] |
|
100 |
$self UpdateCacheKey $xml |
|
8323
by kakaroto
small code cleaning and added code for CreateProfile and ShareItem SOAP actions... needed when we have no profile created... |
101 |
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
102 |
set result [GetXmlNode $xml "soap:Envelope:soap:Body:GetProfileResponse:GetProfileResult"] |
103 |
if {$result != "" } { |
|
104 |
set rid [GetXmlEntry $result "GetProfileResult:ExpressionProfile:ResourceID"] |
|
8462
by kakaroto
Revert my previous commit that apparently didn't help.. |
105 |
if {$rid != "" } { |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
106 |
if {$email == "" } { |
107 |
::abook::setPersonal profile_resourceid $rid |
|
108 |
} else { |
|
109 |
::abook::setContactData $email profile_resourceid $rid |
|
110 |
}
|
|
111 |
set nick [GetXmlEntry $result "GetProfileResult:ExpressionProfile:DisplayName"] |
|
8463
by kakaroto
create the roaming profile if we can't get the resource id. This was the fix for reeky (see previous commits). Now hacking this through |
112 |
set last_modif [GetXmlEntry $result "GetProfileResult:ExpressionProfile:DisplayNameLastModified"] |
113 |
set psm [GetXmlEntry $result "GetProfileResult:ExpressionProfile:PersonalStatus"] |
|
114 |
||
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
115 |
if {$email == "" } { |
9689
by kakaroto
Do not do a ABContactUpdate anymore since the server is screwed.. and now use the roaming GetProfile to get everyone's nickname/psm when available at startup.. this should make it easier for users : http://www.amsn-project.net/forums/viewtopic.php?t=7433&postdays=0&postorder=asc&start=0 |
116 |
#DP stuff
|
117 |
set dp_resourceid [GetXmlEntry $result "GetProfileResult:ExpressionProfile:Photo:ResourceID"] |
|
118 |
::abook::setPersonal dp_resourceid $dp_resourceid |
|
119 |
set dp_filename [GetXmlEntry $result "GetProfileResult:ExpressionProfile:Photo:Name"] |
|
120 |
::abook::setPersonal dp_filename $dp_filename |
|
121 |
set dp_url [GetXmlEntry $result "GetProfileResult:ExpressionProfile:StaticUserTilePublicURL"] |
|
122 |
::abook::setPersonal dp_url $dp_url |
|
123 |
set i 0 |
|
124 |
while {1} { |
|
125 |
set subxml [GetXmlNode $result "GetProfileResult:ExpressionProfile:Photo:DocumentStreams" $i] |
|
126 |
incr i
|
|
127 |
if { $subxml == "" } { |
|
128 |
break
|
|
129 |
}
|
|
130 |
set dsn [GetXmlEntry $subxml "DocumentStreams:DocumentStream:DocumentStreamName"] |
|
131 |
if {$dsn == "UserTileStatic"} { |
|
132 |
set dp_mimetype [GetXmlEntry $subxml "DocumentStreams:DocumentStream:MimeType"] |
|
133 |
::abook::setPersonal dp_mimetype $dp_mimetype |
|
134 |
# set dp_url [GetXmlEntry $subxml "DocumentStreams:DocumentStream:PreAuthURL"]
|
|
135 |
# ::abook::setPersonal dp_url $dp_url
|
|
136 |
}
|
|
137 |
}
|
|
8651
by baaazen
DP roaming part #2: DP downloading now works, too!!! |
138 |
}
|
139 |
} else { |
|
8463
by kakaroto
create the roaming profile if we can't get the resource id. This was the fix for reeky (see previous commits). Now hacking this through |
140 |
set fail 4 |
141 |
}
|
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
142 |
}
|
143 |
||
144 |
} elseif { [$soap GetStatus] == "fault" } { |
|
145 |
set errorcode [$soap GetFaultDetail] |
|
146 |
if {$errorcode == "ItemDoesNotExist"} { |
|
8320
by kakaroto
initial GetProfile scenario is actually RoamingSeed |
147 |
set fail 3 |
148 |
} elseif {$errorcode == "InvalidObjectHandle"} { |
|
149 |
set fail 2 |
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
150 |
} else { |
151 |
set fail 1 |
|
152 |
}
|
|
153 |
} else { |
|
154 |
set fail 1 |
|
155 |
}
|
|
156 |
||
157 |
$self _destroySoapReq $soap |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
158 |
if {[catch {eval $callbk [list $nick $last_modif $psm $fail]} result]} { |
8651
by baaazen
DP roaming part #2: DP downloading now works, too!!! |
159 |
bgerror $result |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
160 |
}
|
161 |
}
|
|
162 |
||
163 |
method UpdateProfile { callbk nickname psm } { |
|
164 |
$::sso RequireSecurityToken Storage [list $self UpdateProfileSSOCB $callbk $nickname $psm] |
|
8318
by kakaroto
Remove unused Voice SSO token, and add storage token.. it's used for Roaming Content.. also make Roaming content use the new storage token.. it should make it more stable now. |
165 |
}
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
166 |
|
167 |
method UpdateProfileSSOCB { callbk nickname psm ticket} { |
|
168 |
set rid [::abook::getPersonal profile_resourceid] |
|
169 |
if {$rid == "" } { |
|
170 |
if {[catch {eval $callbk [list -1]} result]} { |
|
171 |
bgerror $result |
|
172 |
}
|
|
173 |
} else { |
|
174 |
set request [SOAPRequest create %AUTO% \ |
|
175 |
-url "https://storage.msn.com/storageservice/SchematizedStore.asmx" \ |
|
176 |
-action "http://www.msn.com/webservices/storage/w10/UpdateProfile" \ |
|
177 |
-header [$self getCommonHeaderXML RoamingIdentityChanged $ticket] \ |
|
178 |
-body [$self getUpdateProfileBodyXML $rid $nickname $psm] \ |
|
179 |
-callback [list $self UpdateProfileCallback $callbk]] |
|
180 |
||
181 |
lappend soap_requests $request |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
182 |
$request SendSOAPRequest |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
183 |
}
|
184 |
||
185 |
}
|
|
186 |
||
187 |
method getUpdateProfileBodyXML { rid nickname psm } { |
|
188 |
append xml {<UpdateProfile xmlns="http://www.msn.com/webservices/storage/w10">} |
|
189 |
append xml {<profile>} |
|
190 |
append xml {<ResourceID>} |
|
191 |
append xml [xmlencode $rid] |
|
192 |
append xml {</ResourceID>} |
|
193 |
append xml {<ExpressionProfile>} |
|
194 |
append xml {<FreeText>Update</FreeText>} |
|
195 |
append xml {<DisplayName>} |
|
196 |
append xml [xmlencode $nickname] |
|
8345
by kakaroto
force utf-8 directly in soap.tcl to avoid any possible future errors |
197 |
append xml {</DisplayName>} |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
198 |
append xml {<PersonalStatus>} |
199 |
append xml [xmlencode $psm] |
|
8345
by kakaroto
force utf-8 directly in soap.tcl to avoid any possible future errors |
200 |
append xml {</PersonalStatus>} |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
201 |
append xml {<Flags>0</Flags>} |
202 |
append xml {</ExpressionProfile>} |
|
203 |
append xml {</profile>} |
|
204 |
append xml {</UpdateProfile>} |
|
205 |
||
206 |
return $xml |
|
207 |
}
|
|
208 |
||
209 |
method UpdateProfileCallback { callbk soap } { |
|
210 |
#puts [$soap GetResponse]
|
|
211 |
if { [$soap GetStatus] == "success" } { |
|
212 |
set fail 0 |
|
8323
by kakaroto
small code cleaning and added code for CreateProfile and ShareItem SOAP actions... needed when we have no profile created... |
213 |
$self UpdateCacheKey [$soap GetResponse] |
214 |
} elseif { [$soap GetStatus] == "fault" } { |
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
215 |
set errorcode [$soap GetFaultDetail] |
216 |
if {$errorcode == "AccessDenied" } { |
|
217 |
set fail 2 |
|
218 |
} else { |
|
219 |
set fail 1 |
|
220 |
}
|
|
221 |
} else { |
|
222 |
set fail 1 |
|
223 |
}
|
|
224 |
||
225 |
$self _destroySoapReq $soap |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
226 |
if {[catch {eval $callbk [list $fail]} result]} { |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
227 |
bgerror $result |
228 |
}
|
|
229 |
}
|
|
230 |
||
231 |
||
8323
by kakaroto
small code cleaning and added code for CreateProfile and ShareItem SOAP actions... needed when we have no profile created... |
232 |
method CreateProfile { callbk } { |
233 |
$::sso RequireSecurityToken Storage [list $self CreateProfileSSOCB $callbk] |
|
234 |
}
|
|
235 |
||
236 |
method CreateProfileSSOCB { callbk ticket} { |
|
237 |
set request [SOAPRequest create %AUTO% \ |
|
238 |
-url "https://storage.msn.com/storageservice/SchematizedStore.asmx" \ |
|
239 |
-action "http://www.msn.com/webservices/storage/w10/CreateProfile" \ |
|
240 |
-header [$self getCommonHeaderXML RoamingSeed $ticket] \ |
|
241 |
-body [$self getCreateProfileBodyXML] \ |
|
242 |
-callback [list $self CreateProfileCallback $callbk]] |
|
243 |
||
244 |
lappend soap_requests $request |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
245 |
$request SendSOAPRequest |
8323
by kakaroto
small code cleaning and added code for CreateProfile and ShareItem SOAP actions... needed when we have no profile created... |
246 |
|
247 |
}
|
|
248 |
||
249 |
||
250 |
method getCreateProfileBodyXML { } { |
|
251 |
append xml {<CreateProfile xmlns="http://www.msn.com/webservices/storage/w10">} |
|
252 |
append xml {<profile>} |
|
253 |
append xml {<ExpressionProfile>} |
|
254 |
append xml {<PersonalStatus/>} |
|
255 |
append xml {<RoleDefinitionName>ExpressionProfileDefault</RoleDefinitionName>} |
|
256 |
append xml {</ExpressionProfile>} |
|
257 |
append xml {</profile>} |
|
258 |
append xml {</CreateProfile>} |
|
259 |
||
260 |
return $xml |
|
261 |
}
|
|
262 |
||
263 |
method CreateProfileCallback { callbk soap } { |
|
264 |
set rid "" |
|
265 |
#puts [$soap GetResponse]
|
|
266 |
if { [$soap GetStatus] == "success" } { |
|
267 |
set fail 0 |
|
268 |
set xml [$soap GetResponse] |
|
269 |
$self UpdateCacheKey $xml |
|
270 |
set rid [GetXmlEntry $xml "soap:Envelope:soap:Body:CreateProfileResponse:CreateProfileResult"] |
|
271 |
if {$rid != "" } { |
|
272 |
::abook::setPersonal profile_resourceid $rid |
|
273 |
}
|
|
274 |
} elseif { [$soap GetStatus] == "fault" } { |
|
275 |
set errorcode [$soap GetFaultDetail] |
|
276 |
if {$errorcode == "ItemAlreadyExists"} { |
|
277 |
set fail 2 |
|
278 |
} else { |
|
279 |
set fail 1 |
|
280 |
}
|
|
281 |
} else { |
|
282 |
set fail 1 |
|
283 |
}
|
|
284 |
||
285 |
$self _destroySoapReq $soap |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
286 |
if {[catch {eval $callbk [list $rid $fail]} result]} { |
8323
by kakaroto
small code cleaning and added code for CreateProfile and ShareItem SOAP actions... needed when we have no profile created... |
287 |
bgerror $result |
288 |
}
|
|
289 |
}
|
|
290 |
||
291 |
method ShareItem { callbk rid } { |
|
292 |
$::sso RequireSecurityToken Storage [list $self ShareItemSSOCB $callbk $rid] |
|
293 |
}
|
|
294 |
||
295 |
method ShareItemSSOCB { callbk rid ticket} { |
|
296 |
set request [SOAPRequest create %AUTO% \ |
|
297 |
-url "https://storage.msn.com/storageservice/SchematizedStore.asmx" \ |
|
298 |
-action "http://www.msn.com/webservices/storage/w10/ShareItem" \ |
|
299 |
-header [$self getCommonHeaderXML RoamingSeed $ticket] \ |
|
300 |
-body [$self getShareItemBodyXML $rid] \ |
|
301 |
-callback [list $self ShareItemCallback $callbk]] |
|
302 |
||
303 |
lappend soap_requests $request |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
304 |
$request SendSOAPRequest |
8323
by kakaroto
small code cleaning and added code for CreateProfile and ShareItem SOAP actions... needed when we have no profile created... |
305 |
|
306 |
}
|
|
307 |
||
308 |
||
309 |
method getShareItemBodyXML { rid } { |
|
310 |
append xml {<ShareItem xmlns="http://www.msn.com/webservices/storage/w10">} |
|
311 |
append xml {<resourceID>} |
|
312 |
append xml [xmlencode $rid] |
|
313 |
append xml {</resourceID>} |
|
314 |
append xml {<displayName>Messenger Roaming Identity</displayName>} |
|
315 |
append xml {</ShareItem>} |
|
316 |
||
317 |
return $xml |
|
318 |
}
|
|
319 |
||
320 |
method ShareItemCallback { callbk soap } { |
|
321 |
#puts [$soap GetResponse]
|
|
322 |
if { [$soap GetStatus] == "success" } { |
|
323 |
set fail 0 |
|
324 |
$self UpdateCacheKey [$soap GetResponse] |
|
325 |
} else { |
|
326 |
set fail 1 |
|
327 |
}
|
|
328 |
||
329 |
$self _destroySoapReq $soap |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
330 |
if {[catch {eval $callbk [list $fail]} result]} { |
8323
by kakaroto
small code cleaning and added code for CreateProfile and ShareItem SOAP actions... needed when we have no profile created... |
331 |
bgerror $result |
332 |
}
|
|
333 |
}
|
|
334 |
||
335 |
||
336 |
method FindDocuments { callbk } { |
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
337 |
$::sso RequireSecurityToken Storage [list $self FindDocumentsSSOCB $callbk] |
8318
by kakaroto
Remove unused Voice SSO token, and add storage token.. it's used for Roaming Content.. also make Roaming content use the new storage token.. it should make it more stable now. |
338 |
}
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
339 |
|
340 |
method FindDocumentsSSOCB { callbk ticket} { |
|
341 |
set request [SOAPRequest create %AUTO% \ |
|
342 |
-url "https://storage.msn.com/storageservice/SchematizedStore.asmx" \ |
|
343 |
-action "http://www.msn.com/webservices/storage/w10/FindDocuments" \ |
|
344 |
-header [$self getCommonHeaderXML RoamingIdentityChanged $ticket] \ |
|
345 |
-body [$self getFindDocumentsBodyXML] \ |
|
346 |
-callback [list $self FindDocumentsCallback $callbk]] |
|
347 |
||
348 |
lappend soap_requests $request |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
349 |
$request SendSOAPRequest |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
350 |
}
|
351 |
||
352 |
method getFindDocumentsBodyXML { } { |
|
353 |
set cid [::abook::getPersonal cid] |
|
354 |
||
355 |
append xml {<FindDocuments xmlns="http://www.msn.com/webservices/storage/w10">} |
|
356 |
append xml {<objectHandle>} |
|
357 |
append xml {<RelationshipName>/UserTiles</RelationshipName>} |
|
358 |
append xml {<Alias>} |
|
359 |
append xml {<Name>} |
|
360 |
append xml [xmlencode $cid] |
|
361 |
append xml {</Name>} |
|
362 |
append xml {<NameSpace>MyCidStuff</NameSpace>} |
|
363 |
append xml {</Alias>} |
|
364 |
append xml {</objectHandle>} |
|
365 |
append xml {<documentAttributes>} |
|
366 |
append xml {<ResourceID>true</ResourceID>} |
|
367 |
append xml {<Name>true</Name>} |
|
368 |
append xml {</documentAttributes>} |
|
369 |
append xml {<documentFilter>} |
|
370 |
append xml {<FilterAttributes>None</FilterAttributes>} |
|
371 |
append xml {</documentFilter>} |
|
372 |
append xml {<documentSort>} |
|
373 |
append xml {<SortBy>DateModified</SortBy>} |
|
374 |
append xml {</documentSort>} |
|
375 |
append xml {<findContext>} |
|
376 |
append xml {<FindMethod>Default</FindMethod>} |
|
377 |
append xml {<ChunkSize>25</ChunkSize>} |
|
378 |
append xml {</findContext>} |
|
379 |
append xml {</FindDocuments>} |
|
380 |
||
381 |
return $xml |
|
382 |
}
|
|
383 |
||
384 |
method FindDocumentsCallback { callbk soap } { |
|
385 |
#puts [$soap GetResponse]
|
|
386 |
if { [$soap GetStatus] == "success" } { |
|
387 |
set fail 0 |
|
388 |
||
389 |
set xml [$soap GetResponse] |
|
390 |
$self UpdateCacheKey $xml |
|
8323
by kakaroto
small code cleaning and added code for CreateProfile and ShareItem SOAP actions... needed when we have no profile created... |
391 |
set documents [list] |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
392 |
set i 0 |
393 |
while {1} { |
|
394 |
set subxml [GetXmlNode $xml "soap:Envelope:soap:Body:FindDocumentsResponse:FindDocumentsResult:Document" $i] |
|
395 |
incr i
|
|
396 |
if { $subxml == "" } { |
|
397 |
break
|
|
398 |
}
|
|
399 |
set rid [GetXmlEntry $subxml "Document:ResourceID"] |
|
400 |
set name [GetXmlEntry $subxml "Document:Name"] |
|
401 |
lappend documents [list $rid $name] |
|
402 |
}
|
|
403 |
||
404 |
} else { |
|
405 |
set documents [list] |
|
406 |
}
|
|
407 |
||
408 |
$self _destroySoapReq $soap |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
409 |
if {[catch {eval $callbk [list $documents]} result]} { |
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
410 |
bgerror $result |
411 |
}
|
|
412 |
}
|
|
413 |
||
414 |
method CreateDocument { callbk dpfile dpcontent } { |
|
8736
by baaazen
fixed the problem with disappearing dps in the dp browser for jpeg images + now using the correct filename when uploading a dp |
415 |
$::sso RequireSecurityToken Storage [list $self CreateDocumentSSOCB $callbk $dpfile $dpcontent] |
416 |
}
|
|
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
417 |
|
418 |
method CreateDocumentSSOCB { callbk dpfile dpcontent ticket} { |
|
8736
by baaazen
fixed the problem with disappearing dps in the dp browser for jpeg images + now using the correct filename when uploading a dp |
419 |
set request [SOAPRequest create %AUTO% \ |
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
420 |
-url "https://storage.msn.com/storageservice/SchematizedStore.asmx" \ |
421 |
-action "http://www.msn.com/webservices/storage/w10/CreateDocument" \ |
|
422 |
-header [$self getCommonHeaderXML RoamingSeed $ticket] \ |
|
423 |
-body [$self getCreateDocumentBodyXML $dpfile $dpcontent] \ |
|
8736
by baaazen
fixed the problem with disappearing dps in the dp browser for jpeg images + now using the correct filename when uploading a dp |
424 |
-callback [list $self CreateDocumentCallback $callbk]] |
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
425 |
|
426 |
lappend soap_requests $request |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
427 |
$request SendSOAPRequest |
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
428 |
|
429 |
}
|
|
430 |
||
431 |
||
432 |
method getCreateDocumentBodyXML { dpfile dpcontent } { |
|
8736
by baaazen
fixed the problem with disappearing dps in the dp browser for jpeg images + now using the correct filename when uploading a dp |
433 |
set cid [::abook::getPersonal cid] |
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
434 |
|
435 |
append xml {<CreateDocument xmlns="http://www.msn.com/webservices/storage/w10">} |
|
436 |
append xml {<parentHandle>} |
|
437 |
append xml {<RelationshipName>/UserTiles</RelationshipName>} |
|
438 |
append xml {<Alias>} |
|
439 |
append xml {<Name>} |
|
440 |
append xml $cid |
|
441 |
append xml {</Name>} |
|
442 |
append xml {<NameSpace>MyCidStuff</NameSpace>} |
|
443 |
append xml {</Alias>} |
|
444 |
append xml {</parentHandle>} |
|
445 |
append xml {<document xsi:type="Photo">} |
|
446 |
append xml {<Name>} |
|
8736
by baaazen
fixed the problem with disappearing dps in the dp browser for jpeg images + now using the correct filename when uploading a dp |
447 |
append xml $dpfile |
448 |
append xml {</Name>} |
|
449 |
append xml {<DocumentStreams>} |
|
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
450 |
append xml {<DocumentStream xsi:type="PhotoStream">} |
451 |
append xml {<DocumentStreamType>UserTileStatic</DocumentStreamType>} |
|
452 |
append xml {<MimeType>png</MimeType>} |
|
453 |
append xml {<Data>} |
|
454 |
append xml $dpcontent |
|
8736
by baaazen
fixed the problem with disappearing dps in the dp browser for jpeg images + now using the correct filename when uploading a dp |
455 |
append xml {</Data>} |
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
456 |
append xml {<DataSize>0</DataSize>} |
457 |
append xml {</DocumentStream>} |
|
458 |
append xml {</DocumentStreams>} |
|
459 |
append xml {</document>} |
|
460 |
append xml {<relationshipName>Messenger User Tile</relationshipName>} |
|
461 |
append xml {</CreateDocument>} |
|
462 |
||
463 |
return $xml |
|
464 |
}
|
|
465 |
||
466 |
method CreateDocumentCallback { callbk soap } { |
|
467 |
set dpid "" |
|
468 |
#puts [$soap GetResponse]
|
|
469 |
if { [$soap GetStatus] == "success" } { |
|
470 |
set fail 0 |
|
471 |
set xml [$soap GetResponse] |
|
472 |
$self UpdateCacheKey $xml |
|
473 |
set dpid [GetXmlEntry $xml "soap:Envelope:soap:Body:CreateDocumentResponse:CreateDocumentResult"] |
|
474 |
} elseif { [$soap GetStatus] == "fault" } { |
|
475 |
set errorcode [$soap GetFaultDetail] |
|
476 |
if {$errorcode == "AccessDenied" } { |
|
477 |
set fail 2 |
|
478 |
} else { |
|
479 |
set fail 1 |
|
480 |
}
|
|
481 |
} else { |
|
482 |
set fail 1 |
|
483 |
}
|
|
484 |
||
485 |
$self _destroySoapReq $soap |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
486 |
if {[catch {eval $callbk [list $dpid $fail]} result]} { |
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
487 |
bgerror $result |
488 |
}
|
|
489 |
}
|
|
490 |
||
491 |
method DeleteRelationships { callbk dpid {rid ""} } { |
|
492 |
if {$rid == ""} { |
|
493 |
$::sso RequireSecurityToken Storage [list $self DeleteRelationships1SSOCB $callbk $dpid] |
|
494 |
} else { |
|
495 |
$::sso RequireSecurityToken Storage [list $self DeleteRelationships2SSOCB $callbk $dpid $rid] |
|
496 |
}
|
|
497 |
}
|
|
498 |
||
499 |
method DeleteRelationships1SSOCB { callbk dpid ticket} { |
|
500 |
set request [SOAPRequest create %AUTO% \ |
|
501 |
-url "https://storage.msn.com/storageservice/SchematizedStore.asmx" \ |
|
502 |
-action "http://www.msn.com/webservices/storage/w10/DeleteRelationships" \ |
|
503 |
-header [$self getCommonHeaderXML RoamingSeed $ticket] \ |
|
504 |
-body [$self getDeleteRelationships1BodyXML $dpid] \ |
|
505 |
-callback [list $self DeleteRelationshipsCallback $callbk]] |
|
506 |
||
507 |
lappend soap_requests $request |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
508 |
$request SendSOAPRequest |
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
509 |
|
510 |
}
|
|
511 |
||
512 |
method DeleteRelationships2SSOCB { callbk dpid rid ticket} { |
|
513 |
set request [SOAPRequest create %AUTO% \ |
|
514 |
-url "https://storage.msn.com/storageservice/SchematizedStore.asmx" \ |
|
515 |
-action "http://www.msn.com/webservices/storage/w10/DeleteRelationships" \ |
|
516 |
-header [$self getCommonHeaderXML RoamingSeed $ticket] \ |
|
517 |
-body [$self getDeleteRelationships2BodyXML $dpid $rid] \ |
|
518 |
-callback [list $self DeleteRelationshipsCallback $callbk]] |
|
519 |
||
520 |
lappend soap_requests $request |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
521 |
$request SendSOAPRequest |
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
522 |
|
523 |
}
|
|
524 |
||
525 |
||
526 |
method getDeleteRelationships1BodyXML { dpid } { |
|
527 |
set cid [::abook::getPersonal cid] |
|
528 |
||
529 |
append xml {<DeleteRelationships xmlns="http://www.msn.com/webservices/storage/w10">} |
|
530 |
append xml {<sourceHandle>} |
|
531 |
append xml {<RelationshipName>/UserTiles</RelationshipName>} |
|
532 |
append xml {<Alias>} |
|
533 |
append xml {<Name>} |
|
534 |
append xml $cid |
|
535 |
append xml {</Name>} |
|
536 |
append xml {<NameSpace>MyCidStuff</NameSpace>} |
|
537 |
append xml {</Alias>} |
|
538 |
append xml {</sourceHandle>} |
|
539 |
||
540 |
append xml {<targetHandles>} |
|
541 |
append xml {<ObjectHandle>} |
|
542 |
append xml {<ResourceID>} |
|
543 |
append xml $dpid |
|
544 |
append xml {</ResourceID>} |
|
545 |
append xml {</ObjectHandle>} |
|
546 |
append xml {</targetHandles>} |
|
547 |
append xml {</DeleteRelationships>} |
|
548 |
||
549 |
return $xml |
|
550 |
}
|
|
551 |
||
552 |
method getDeleteRelationships2BodyXML { dpid rid } { |
|
553 |
set cid [::abook::getPersonal cid] |
|
554 |
||
555 |
append xml {<DeleteRelationships xmlns="http://www.msn.com/webservices/storage/w10">} |
|
556 |
append xml {<sourceHandle>} |
|
557 |
append xml {<ResourceID>} |
|
558 |
append xml $rid |
|
559 |
append xml {</ResourceID>} |
|
560 |
append xml {</sourceHandle>} |
|
561 |
||
562 |
append xml {<targetHandles>} |
|
563 |
append xml {<ObjectHandle>} |
|
564 |
append xml {<ResourceID>} |
|
565 |
append xml $dpid |
|
566 |
append xml {</ResourceID>} |
|
567 |
append xml {</ObjectHandle>} |
|
568 |
append xml {</targetHandles>} |
|
569 |
append xml {</DeleteRelationships>} |
|
570 |
||
571 |
return $xml |
|
572 |
}
|
|
573 |
||
574 |
method DeleteRelationshipsCallback { callbk soap } { |
|
575 |
#puts [$soap GetResponse]
|
|
576 |
if { [$soap GetStatus] == "success" } { |
|
577 |
set fail 0 |
|
578 |
$self UpdateCacheKey [$soap GetResponse] |
|
579 |
} elseif { [$soap GetStatus] == "fault" } { |
|
580 |
set errorcode [$soap GetFaultDetail] |
|
581 |
if {$errorcode == "AccessDenied" } { |
|
582 |
set fail 2 |
|
583 |
} else { |
|
584 |
set fail 1 |
|
585 |
}
|
|
586 |
} else { |
|
587 |
set fail 1 |
|
588 |
}
|
|
589 |
||
590 |
$self _destroySoapReq $soap |
|
8854
by kakaroto
Commit from the plane: Fix the Addressbook, romaing, etc.. soap request stuff to make sure a soap request is destroyed if the |
591 |
if {[catch {eval $callbk [list $fail]} result]} { |
8647
by baaazen
two extracted wisdom teeth combined with creative urge bring good results: |
592 |
bgerror $result |
593 |
}
|
|
594 |
}
|
|
595 |
||
596 |
method UpdateCacheKey { xml } { |
|
8323
by kakaroto
small code cleaning and added code for CreateProfile and ShareItem SOAP actions... needed when we have no profile created... |
597 |
set cache [GetXmlEntry $xml "soap:Envelope:soap:Header:AffinityCacheHeader:CacheKey"] |
598 |
if {$cache != "" } { |
|
599 |
set affinity_cache $cache |
|
600 |
}
|
|
601 |
}
|
|
602 |
||
603 |
method getCommonHeaderXML { scenario ticket } { |
|
8288
by kakaroto
Add support for content roaming (nickname+psm.. not dp.. for now) |
604 |
if {$affinity_cache != "" } { |
605 |
append xml {<AffinityCacheHeader xmlns="http://www.msn.com/webservices/storage/w10">} |
|
606 |
append xml {<CacheKey>} |
|
607 |
append xml [xmlencode $affinity_cache] |
|
608 |
append xml {</CacheKey>} |
|
609 |
append xml {</AffinityCacheHeader>} |
|
610 |
}
|
|
611 |
||
612 |
append xml {<StorageApplicationHeader xmlns="http://www.msn.com/webservices/storage/w10">} |
|
613 |
append xml {<ApplicationID>Messenger Client 8.5</ApplicationID>} |
|
614 |
append xml {<Scenario>} |
|
615 |
append xml $scenario |
|
616 |
append xml {</Scenario>} |
|
617 |
append xml {</StorageApplicationHeader>} |
|
618 |
||
619 |
append xml {<StorageUserHeader xmlns="http://www.msn.com/webservices/storage/w10">} |
|
620 |
append xml {<Puid>0</Puid>} |
|
621 |
append xml {<TicketToken>} |
|
622 |
append xml [xmlencode $ticket] |
|
623 |
append xml {</TicketToken>} |
|
624 |
append xml {</StorageUserHeader>} |
|
625 |
||
626 |
return $xml |
|
627 |
||
628 |
}
|
|
629 |
}
|
|
8289
by kakaroto
Fixes group names and psm/nickname when it contains a non ascii char (accented chars) by encoding to utf-8 before sending to server. |
630 |