StropheCappuccino API 1.0.0
/tmp/tempDoc.doc/Build/StropheCappuccino.build/Debug/Browser.environment/Sources/TNStrophePrivateStorage.j
Go to the documentation of this file.
00001 @STATIC;1.0;i;28;Resources/Strophe/strophe.jsi;21;TNStropheConnection.ji;16;TNStropheUtils.jt;6979;objj_executeFile("Resources/Strophe/strophe.js", YES);objj_executeFile("TNStropheConnection.j", YES);objj_executeFile("TNStropheUtils.j", YES);TNStrophePrivateStorageGetErrorNotification = "TNStrophePrivateStorageGetErrorNotification";
00002 TNStrophePrivateStorageSetErrorNotification = "TNStrophePrivateStorageSetErrorNotification";
00003 TNStrophePrivateStorageSetNotification = "TNStrophePrivateStorageSetNotification";
00004 {var the_class = objj_allocateClassPair(CPObject, "TNStrophePrivateStorage"),
00005 meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_namespace"), new objj_ivar("_connection")]);objj_registerClassPair(the_class);
00006 class_addMethods(the_class, [new objj_method(sel_getUid("namespace"), function $TNStrophePrivateStorage__namespace(self, _cmd)
00007 {
00008     return self._namespace;
00009 }
00010 ,["CPString"]), new objj_method(sel_getUid("setNamespace:"), function $TNStrophePrivateStorage__setNamespace_(self, _cmd, newValue)
00011 {
00012     self._namespace = newValue;
00013 }
00014 ,["void","CPString"]), new objj_method(sel_getUid("connection"), function $TNStrophePrivateStorage__connection(self, _cmd)
00015 {
00016     return self._connection;
00017 }
00018 ,["TNStropheConnection"]), new objj_method(sel_getUid("setConnection:"), function $TNStrophePrivateStorage__setConnection_(self, _cmd, newValue)
00019 {
00020     self._connection = newValue;
00021 }
00022 ,["void","TNStropheConnection"]), new objj_method(sel_getUid("initWithConnection:namespace:"), function $TNStrophePrivateStorage__initWithConnection_namespace_(self, _cmd, aConnection, aNamespace)
00023 {
00024     if (self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("TNStrophePrivateStorage").super_class }, "init"))
00025     {
00026         self._connection = aConnection;
00027         self._namespace = aNamespace;
00028     }
00029     return self;
00030 }
00031 ,["TNStropheConnection","TNStropheConnection","CPString"]), new objj_method(sel_getUid("setObject:forKey:"), function $TNStrophePrivateStorage__setObject_forKey_(self, _cmd, anObject, aKey)
00032 {
00033     var data = CPKeyedArchiver.isa.objj_msgSend1(CPKeyedArchiver, "archivedDataWithRootObject:", anObject),
00034         uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00035         stanza = TNStropheStanza.isa.objj_msgSend1(TNStropheStanza, "iqWithAttributes:", {"id": uid, "type": "set"}),
00036         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00037     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "query", {"xmlns": Strophe.NS.PRIVATE_STORAGE}));
00038     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", aKey, {"xmlns": self._namespace}));
00039     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addTextNode:", (data == null ? null : data.isa.objj_msgSend0(data, "rawString"))));
00040     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend(___r1, "registerSelector:ofObject:withDict:userInfo:", sel_getUid("_didSetObject:object:"), self, params, anObject));
00041     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00042     var ___r1;
00043 }
00044 ,["void","id","CPString"]), new objj_method(sel_getUid("_didSetObject:object:"), function $TNStrophePrivateStorage___didSetObject_object_(self, _cmd, aStanza, anObject)
00045 {
00046     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00047         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "postNotificationName:object:userInfo:", TNStrophePrivateStorageSetNotification, self, anObject));
00048     else
00049         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "postNotificationName:object:userInfo:", TNStrophePrivateStorageSetErrorNotification, self, aStanza));
00050     return NO;
00051     var ___r1;
00052 }
00053 ,["BOOL","TNStropheStanza","id"]), new objj_method(sel_getUid("objectForKey:target:selector:"), function $TNStrophePrivateStorage__objectForKey_target_selector_(self, _cmd, aKey, aTarget, aSelector)
00054 {
00055     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00056         stanza = TNStropheStanza.isa.objj_msgSend1(TNStropheStanza, "iqWithAttributes:", {"id": uid, "type": "get"}),
00057         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id"),
00058         listener = {"target": aTarget, "selector": aSelector, "key": aKey};
00059     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "query", {"xmlns": Strophe.NS.PRIVATE_STORAGE}));
00060     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", aKey, {"xmlns": self._namespace}));
00061     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend(___r1, "registerSelector:ofObject:withDict:userInfo:", sel_getUid("_didReceiveObject:userInfo:"), self, params, listener));
00062     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00063     var ___r1;
00064 }
00065 ,["id","CPString","id","SEL"]), new objj_method(sel_getUid("_didReceiveObject:userInfo:"), function $TNStrophePrivateStorage___didReceiveObject_userInfo_(self, _cmd, aStanza, listener)
00066 {
00067     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00068     {
00069         var dataString = ((___r1 = (aStanza == null ? null : aStanza.isa.objj_msgSend1(aStanza, "firstChildWithName:", listener.key))), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "text"));
00070         try        {
00071             if (dataString)
00072                 var obj = CPKeyedUnarchiver.isa.objj_msgSend1(CPKeyedUnarchiver, "unarchiveObjectWithData:", CPData.isa.objj_msgSend1(CPData, "dataWithRawString:", TNStropheStripHTMLCharCode(dataString)));
00073         }
00074         catch(ex)         {
00075             ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "postNotificationName:object:userInfo:", TNStrophePrivateStorageGetErrorNotification, self, ex));
00076             var ___r1;
00077         }    }
00078     ((___r1 = listener.target), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "performSelector:withObject:withObject:", listener.selector, aStanza, obj));
00079     return NO;
00080     var ___r1;
00081 }
00082 ,["BOOL","TNStropheStanza","id"])]);
00083 class_addMethods(meta_class, [new objj_method(sel_getUid("strophePrivateStorageWithConnection:namespace:"), function $TNStrophePrivateStorage__strophePrivateStorageWithConnection_namespace_(self, _cmd, aConnection, aNamespace)
00084 {
00085     return ((___r1 = TNStrophePrivateStorage.isa.objj_msgSend0(TNStrophePrivateStorage, "alloc")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "initWithConnection:namespace:", aConnection, aNamespace));
00086     var ___r1;
00087 }
00088 ,["TNStropheConnection","TNStropheConnection","CPString"])]);
00089 }
 All Classes Namespaces Files Functions Variables