StropheCappuccino API 1.0.0
/tmp/tempDoc.doc/Build/StropheCappuccino.build/Debug/Browser.environment/Sources/PubSub/TNPubSubNode.j
Go to the documentation of this file.
00001 @STATIC;1.0;I;23;Foundation/Foundation.jI;33;Foundation/CPNotificationCenter.ji;31;../Resources/Strophe/strophe.jsi;24;../TNStropheConnection.ji;20;../TNStropheStanza.ji;17;../TNStropheJID.jt;49362;objj_executeFile("Foundation/Foundation.j", NO);objj_executeFile("Foundation/CPNotificationCenter.j", NO);objj_executeFile("../Resources/Strophe/strophe.js", YES);objj_executeFile("../TNStropheConnection.j", YES);objj_executeFile("../TNStropheStanza.j", YES);objj_executeFile("../TNStropheJID.j", YES);TNStrophePubSubVarAccessModel = "pubsub#access_model";
00002 TNStrophePubSubVarBodyXSLT = "pubsub#body_xslt";
00003 TNStrophePubSubVarDeliverNotification = "pubsub#deliver_notifications";
00004 TNStrophePubSubVarDeliverPayloads = "pubsub#deliver_payloads";
00005 TNStrophePubSubVarItemExpire = "pubsub#item_expire";
00006 TNStrophePubSubVarMaxItems = "pubsub#max_items";
00007 TNStrophePubSubVarMaxPayloadSize = "pubsub#max_payload_size";
00008 TNStrophePubSubVarNotificationType = "pubsub#notification_type";
00009 TNStrophePubSubVarNotifyConfig = "pubsub#notify_config";
00010 TNStrophePubSubVarNotifyDelete = "pubsub#notify_delete";
00011 TNStrophePubSubVarNotifyRectract = "pubsub#notify_retract";
00012 TNStrophePubSubVarNotifySub = "pubsub#notify_sub";
00013 TNStrophePubSubVarPersistItems = "pubsub#persist_items";
00014 TNStrophePubSubVarPresenceBasedDelivery = "pubsub#presence_based_delivery";
00015 TNStrophePubSubVarPublishModel = "pubsub#publish_model";
00016 TNStrophePubSubVarPurgeOffline = "pubsub#purge_offline";
00017 TNStrophePubSubVarRosterGroupAllowed = "pubsub#roster_groups_allowed";
00018 TNStrophePubSubVarSendLastPublishedItem = "pubsub#send_last_published_item";
00019 TNStrophePubSubVarTitle = "pubsub#title";
00020 TNStrophePubSubVarType = "pubsub#type";
00021 TNStrophePubSubVarAccessModelAuthorize = "authorize";
00022 TNStrophePubSubVarAccessModelOpen = "open";
00023 TNStrophePubSubVarAccessModelRoster = "roster";
00024 TNStrophePubSubVarAccessModelWhitelist = "whitelist";
00025 TNPubSubNodeAffiliationMember = "member";
00026 TNPubSubNodeAffiliationNone = "none";
00027 TNPubSubNodeAffiliationOutcast = "outcast";
00028 TNPubSubNodeAffiliationOwner = "owner";
00029 TNPubSubNodeAffiliationPublisher = "publisher";
00030 TNPubSubNodeAffiliationPublisherOnly = "publish-only";
00031 TNStrophePubSubItemPublishedNotification = "TNStrophePubSubItemPublishedNotification";
00032 TNStrophePubSubItemPublishErrorNotification = "TNStrophePubSubItemPublishErrorNotification";
00033 TNStrophePubSubItemRetractedNotification = "TNStrophePubSubItemRetractedNotification";
00034 TNStrophePubSubItemRetractErrorNotification = "TNStrophePubSubItemRetractErrorNotification";
00035 TNStrophePubSubNodeConfiguredNotification = "TNStrophePubSubNodeConfiguredNotification";
00036 TNStrophePubSubNodeCreatedNotification = "TNStrophePubSubNodeCreatedNotification";
00037 TNStrophePubSubNodeDeletedNotification = "TNStrophePubSubNodeDeletedNotification";
00038 TNStrophePubSubNodeEventNotification = "TNStrophePubSubNodeEventNotification";
00039 TNStrophePubSubNodeRetrievedNotification = "TNStrophePubSubNodeRetrievedNotification";
00040 TNStrophePubSubNodeSubscribedNotification = "TNStrophePubSubNodeSubscribedNotification";
00041 TNStrophePubSubNodeUnsubscribedNotification = "TNStrophePubSubNodeUnsubscribedNotification";
00042 {var the_class = objj_allocateClassPair(CPObject, "TNPubSubNode"),
00043 meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_content"), new objj_ivar("_subscriptionIDs"), new objj_ivar("_affiliations"), new objj_ivar("_nodeName"), new objj_ivar("_delegate"), new objj_ivar("_pubSubServer"), new objj_ivar("_eventSelectorID"), new objj_ivar("_connection")]);objj_registerClassPair(the_class);
00044 class_addMethods(the_class, [new objj_method(sel_getUid("content"), function $TNPubSubNode__content(self, _cmd)
00045 {
00046     return self._content;
00047 }
00048 ,["CPArray"]), new objj_method(sel_getUid("_setContent:"), function $TNPubSubNode___setContent_(self, _cmd, newValue)
00049 {
00050     self._content = newValue;
00051 }
00052 ,["void","CPArray"]), new objj_method(sel_getUid("subscriptionIDs"), function $TNPubSubNode__subscriptionIDs(self, _cmd)
00053 {
00054     return self._subscriptionIDs;
00055 }
00056 ,["CPArray"]), new objj_method(sel_getUid("_setSubscriptionIDs:"), function $TNPubSubNode___setSubscriptionIDs_(self, _cmd, newValue)
00057 {
00058     self._subscriptionIDs = newValue;
00059 }
00060 ,["void","CPArray"]), new objj_method(sel_getUid("affiliations"), function $TNPubSubNode__affiliations(self, _cmd)
00061 {
00062     return self._affiliations;
00063 }
00064 ,["CPDictionary"]), new objj_method(sel_getUid("_setAffiliations:"), function $TNPubSubNode___setAffiliations_(self, _cmd, newValue)
00065 {
00066     self._affiliations = newValue;
00067 }
00068 ,["void","CPDictionary"]), new objj_method(sel_getUid("name"), function $TNPubSubNode__name(self, _cmd)
00069 {
00070     return self._nodeName;
00071 }
00072 ,["CPString"]), new objj_method(sel_getUid("_setNodeName:"), function $TNPubSubNode___setNodeName_(self, _cmd, newValue)
00073 {
00074     self._nodeName = newValue;
00075 }
00076 ,["void","CPString"]), new objj_method(sel_getUid("delegate"), function $TNPubSubNode__delegate(self, _cmd)
00077 {
00078     return self._delegate;
00079 }
00080 ,["id"]), new objj_method(sel_getUid("setDelegate:"), function $TNPubSubNode__setDelegate_(self, _cmd, newValue)
00081 {
00082     self._delegate = newValue;
00083 }
00084 ,["void","id"]), new objj_method(sel_getUid("server"), function $TNPubSubNode__server(self, _cmd)
00085 {
00086     return self._pubSubServer;
00087 }
00088 ,["TNStropheJID"]), new objj_method(sel_getUid("_setPubSubServer:"), function $TNPubSubNode___setPubSubServer_(self, _cmd, newValue)
00089 {
00090     self._pubSubServer = newValue;
00091 }
00092 ,["void","TNStropheJID"]), new objj_method(sel_getUid("initWithNodeName:connection:pubSubServer:"), function $TNPubSubNode__initWithNodeName_connection_pubSubServer_(self, _cmd, aNodeName, aConnection, aPubSubServer)
00093 {
00094     if (self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("TNPubSubNode").super_class }, "init"))
00095     {
00096         self._nodeName = aNodeName;
00097         self._connection = aConnection;
00098         self._pubSubServer = aPubSubServer ? aPubSubServer : TNStropheJID.isa.objj_msgSend1(TNStropheJID, "stropheJIDWithString:", "pubsub." + ((___r1 = ((___r2 = self._connection), ___r2 == null ? null : ___r2.isa.objj_msgSend0(___r2, "JID"))), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "domain")));
00099         self._subscriptionIDs = CPArray.isa.objj_msgSend0(CPArray, "array");
00100         self._affiliations = CPDictionary.isa.objj_msgSend0(CPDictionary, "dictionary");
00101         (self == null ? null : self.isa.objj_msgSend0(self, "_setEventHandler"));
00102     }
00103     return self;
00104     var ___r1, ___r2;
00105 }
00106 ,["TNPubSubNode","CPString","TNStropheConnection","TNStropheJID"]), new objj_method(sel_getUid("initWithNodeName:connection:pubSubServer:subscriptionIDs:"), function $TNPubSubNode__initWithNodeName_connection_pubSubServer_subscriptionIDs_(self, _cmd, aNodeName, aConnection, aPubSubServer, aSubscriptionIDs)
00107 {
00108     if (self = (self == null ? null : self.isa.objj_msgSend3(self, "initWithNodeName:connection:pubSubServer:", aNodeName, aConnection, aPubSubServer)))
00109     {
00110         self._subscriptionIDs = aSubscriptionIDs;
00111     }
00112     return self;
00113 }
00114 ,["TNPubSubNode","CPString","TNStropheConnection","CPString","CPArray"]), new objj_method(sel_getUid("retrieveItems"), function $TNPubSubNode__retrieveItems(self, _cmd)
00115 {
00116     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00117         stanza = TNStropheStanza.isa.objj_msgSend0(TNStropheStanza, "iq"),
00118         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00119     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setTo:", self._pubSubServer));
00120     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setType:", "get"));
00121     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setID:", uid));
00122     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB}));
00123     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "items", {"node": self._nodeName}));
00124     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didRetrievePubSubNode:"), self, params));
00125     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00126     var ___r1;
00127 }
00128 ,["void"]), new objj_method(sel_getUid("_didRetrievePubSubNode:"), function $TNPubSubNode___didRetrievePubSubNode_(self, _cmd, aStanza)
00129 {
00130     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00131     {
00132         self._content = (aStanza == null ? null : aStanza.isa.objj_msgSend1(aStanza, "childrenWithName:", "item"));
00133         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "postNotificationName:object:", TNStrophePubSubNodeRetrievedNotification, self));
00134         if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:retrievedItems:"))))
00135             ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:retrievedItems:", self, YES));
00136     }
00137     else
00138     {
00139         if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:retrievedItems:"))))
00140             ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:retrievedItems:", self, NO));
00141         CPLog.error("Cannot retrieve the contents of pubsub node");
00142         CPLog.error(aStanza);
00143     }
00144     return NO;
00145     var ___r1;
00146 }
00147 ,["BOOL","TNStropheStanza"]), new objj_method(sel_getUid("create"), function $TNPubSubNode__create(self, _cmd)
00148 {
00149     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00150         stanza = TNStropheStanza.isa.objj_msgSend0(TNStropheStanza, "iq"),
00151         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00152     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setTo:", self._pubSubServer));
00153     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setType:", "set"));
00154     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setID:", uid));
00155     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB}));
00156     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "create", {"node": self._nodeName}));
00157     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didCreatePubSubNode:"), self, params));
00158     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00159     var ___r1;
00160 }
00161 ,["void"]), new objj_method(sel_getUid("_didCreatePubSubNode:"), function $TNPubSubNode___didCreatePubSubNode_(self, _cmd, aStanza)
00162 {
00163     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00164         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "postNotificationName:object:", TNStrophePubSubNodeCreatedNotification, self));
00165     else
00166     {
00167         CPLog.error("Cannot create the pubsub node");
00168         CPLog.error(aStanza);
00169     }
00170     return NO;
00171     var ___r1;
00172 }
00173 ,["BOOL","TNStropheStanza"]), new objj_method(sel_getUid("delete"), function $TNPubSubNode__delete(self, _cmd)
00174 {
00175     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00176         stanza = TNStropheStanza.isa.objj_msgSend0(TNStropheStanza, "iq"),
00177         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00178     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setTo:", self._pubSubServer));
00179     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setType:", "set"));
00180     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setID:", uid));
00181     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB_OWNER}));
00182     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "delete", {"node": self._nodeName}));
00183     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("didDeletePubSubNode:"), self, params));
00184     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00185     var ___r1;
00186 }
00187 ,["void"]), new objj_method(sel_getUid("_didCreatePubSubNode:"), function $TNPubSubNode___didCreatePubSubNode_(self, _cmd, aStanza)
00188 {
00189     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00190         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "postNotificationName:object:", TNStrophePubSubNodeDeletedNotification, self));
00191     else
00192     {
00193         CPLog.error("Cannot delete the pubsub node");
00194         CPLog.error(aStanza);
00195     }
00196     return NO;
00197     var ___r1;
00198 }
00199 ,["BOOL","TNStropheStanza"]), new objj_method(sel_getUid("configureWithDict:"), function $TNPubSubNode__configureWithDict_(self, _cmd, aDictionary)
00200 {
00201     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00202         stanza = TNStropheStanza.isa.objj_msgSend0(TNStropheStanza, "iq"),
00203         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00204     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setTo:", self._pubSubServer));
00205     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setType:", "set"));
00206     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setID:", uid));
00207     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB_OWNER}));
00208     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "configure", {"node": self._nodeName}));
00209     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "x", {"xmlns": "jabber:x:data", "type": "submit"}));
00210     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "field", {"var": "FORM_TYPE", "type": "hidden"}));
00211     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addChildWithName:", "value"));
00212     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addTextNode:", Strophe.NS.PUBSUB_NODE_CONFIG));
00213     (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00214     (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00215     for (var i = 0; i < ((___r1 = (aDictionary == null ? null : aDictionary.isa.objj_msgSend0(aDictionary, "allKeys"))), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "count")); i++)
00216     {
00217         var key = ((___r1 = (aDictionary == null ? null : aDictionary.isa.objj_msgSend0(aDictionary, "allKeys"))), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "objectAtIndex:", i)),
00218             value = (aDictionary == null ? null : aDictionary.isa.objj_msgSend1(aDictionary, "objectForKey:", key));
00219         (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "field", {"var": key}));
00220         if ((value == null ? null : value.isa.objj_msgSend1(value, "isKindOfClass:", CPArray)))
00221         {
00222             for (var j = 0; j < (value == null ? null : value.isa.objj_msgSend0(value, "count")); j++)
00223             {
00224                 (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addChildWithName:", "value"));
00225                 (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addTextNode:", "" + (value == null ? null : value.isa.objj_msgSend1(value, "objectAtIndex:", j)) + ""));
00226                 (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00227             }
00228         }
00229         else
00230         {
00231             (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addChildWithName:", "value"));
00232             (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addTextNode:", "" + value + ""));
00233             (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00234         }
00235         (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00236     }
00237     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didConfigurePubSubNode:"), self, params));
00238     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00239     var ___r1;
00240 }
00241 ,["void","CPDictionary"]), new objj_method(sel_getUid("_didConfigurePubSubNode:"), function $TNPubSubNode___didConfigurePubSubNode_(self, _cmd, aStanza)
00242 {
00243     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00244         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "postNotificationName:object:", TNStrophePubSubNodeConfiguredNotification, self));
00245     else
00246     {
00247         CPLog.error("Cannot configure the pubsub node");
00248         CPLog.error(aStanza);
00249     }
00250     return NO;
00251     var ___r1;
00252 }
00253 ,["BOOL","TNStropheStanza"]), new objj_method(sel_getUid("publishItem:"), function $TNPubSubNode__publishItem_(self, _cmd, anItem)
00254 {
00255     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00256         stanza = TNStropheStanza.isa.objj_msgSend0(TNStropheStanza, "iq"),
00257         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00258     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setTo:", self._pubSubServer));
00259     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setType:", "set"));
00260     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setID:", uid));
00261     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB}));
00262     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "publish", {"node": self._nodeName}));
00263     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "item", {"id": CPString.isa.objj_msgSend0(CPString, "UUID")}));
00264     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addNode:", anItem));
00265     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didPublishPubSubItem:"), self, params));
00266     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00267     var ___r1;
00268 }
00269 ,["void","TNXMLNode"]), new objj_method(sel_getUid("_didPublishPubSubItem:"), function $TNPubSubNode___didPublishPubSubItem_(self, _cmd, aStanza)
00270 {
00271     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00272     {
00273         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend(___r1, "addObserver:selector:name:object:", self, sel_getUid("_didUpdateContentAfterPublishing:"), TNStrophePubSubNodeRetrievedNotification, self));
00274         self.isa.objj_msgSend0(self, "retrieveItems");
00275     }
00276     else
00277     {
00278         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "postNotificationName:object:userInfo:", TNStrophePubSubItemPublishErrorNotification, self, aStanza));
00279         CPLog.error("Cannot publish the pubsub item in node");
00280         CPLog.error(aStanza);
00281     }
00282     if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:publishedItem:"))))
00283         ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:publishedItem:", self, aStanza));
00284     return NO;
00285     var ___r1;
00286 }
00287 ,["BOOL","TNStropheStanza"]), new objj_method(sel_getUid("_didUpdateContentAfterPublishing:"), function $TNPubSubNode___didUpdateContentAfterPublishing_(self, _cmd, aNotification)
00288 {
00289     ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "removeObserver:name:object:", self, TNStrophePubSubNodeRetrievedNotification, self));
00290     ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "postNotificationName:object:", TNStrophePubSubItemPublishedNotification, self));
00291     var ___r1;
00292 }
00293 ,["void","CPNotification"]), new objj_method(sel_getUid("retractItem:"), function $TNPubSubNode__retractItem_(self, _cmd, aNode)
00294 {
00295     self.isa.objj_msgSend1(self, "retractItemWithID:", (aNode == null ? null : aNode.isa.objj_msgSend1(aNode, "valueForAttribute:", "id")));
00296 }
00297 ,["void","TNXMLNode"]), new objj_method(sel_getUid("retractItemWithID:"), function $TNPubSubNode__retractItemWithID_(self, _cmd, anID)
00298 {
00299     self.isa.objj_msgSend1(self, "retractItemsWithIDs:", [anID]);
00300 }
00301 ,["void","CPString"]), new objj_method(sel_getUid("retractItemsWithIDs:"), function $TNPubSubNode__retractItemsWithIDs_(self, _cmd, someIDs)
00302 {
00303     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00304         stanza = TNStropheStanza.isa.objj_msgSend0(TNStropheStanza, "iq"),
00305         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00306     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setTo:", self._pubSubServer));
00307     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setType:", "set"));
00308     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setID:", uid));
00309     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB}));
00310     for (var i = 0; i < (someIDs == null ? null : someIDs.isa.objj_msgSend0(someIDs, "count")); i++)
00311     {
00312         (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "retract", {"node": self._nodeName}));
00313         (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "item", {"id": (someIDs == null ? null : someIDs.isa.objj_msgSend1(someIDs, "objectAtIndex:", i))}));
00314         (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00315         (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00316     }
00317     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didRetractPubSubItems:"), self, params));
00318     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00319     var ___r1;
00320 }
00321 ,["void","CPArray"]), new objj_method(sel_getUid("_didRetractPubSubItems:"), function $TNPubSubNode___didRetractPubSubItems_(self, _cmd, aStanza)
00322 {
00323     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00324     {
00325         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend(___r1, "addObserver:selector:name:object:", self, sel_getUid("_didUpdateContentAfterRetracting:"), TNStrophePubSubNodeRetrievedNotification, self));
00326         self.isa.objj_msgSend0(self, "retrieveItems");
00327     }
00328     else
00329     {
00330         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "postNotificationName:object:userInfo:", TNStrophePubSubItemRetractErrorNotification, self, aStanza));
00331         CPLog.error("Cannot remove the pubsub items from node");
00332         CPLog.error(aStanza);
00333     }
00334     if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:retractedItem:"))))
00335         ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:retractedItem:", self, aStanza));
00336     return NO;
00337     var ___r1;
00338 }
00339 ,["BOOL","TNStropheStanza"]), new objj_method(sel_getUid("_didUpdateContentAfterRetracting:"), function $TNPubSubNode___didUpdateContentAfterRetracting_(self, _cmd, aNotification)
00340 {
00341     ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "removeObserver:name:object:", self, TNStrophePubSubNodeRetrievedNotification, self));
00342     ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "postNotificationName:object:", TNStrophePubSubItemRetractedNotification, self));
00343     var ___r1;
00344 }
00345 ,["void","CPNotification"]), new objj_method(sel_getUid("recoverSubscriptions"), function $TNPubSubNode__recoverSubscriptions(self, _cmd)
00346 {
00347     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00348         stanza = TNStropheStanza.isa.objj_msgSend1(TNStropheStanza, "iqWithAttributes:", {"type": "get", "to": self._pubSubServer, "id": uid}),
00349         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00350     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB}));
00351     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "subscriptions", {"node": self._nodeName}));
00352     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didRetrieveSubscriptions:"), self, params));
00353     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00354     var ___r1;
00355 }
00356 ,["void"]), new objj_method(sel_getUid("_didRetrieveSubscriptions:"), function $TNPubSubNode___didRetrieveSubscriptions_(self, _cmd, aStanza)
00357 {
00358     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00359     {
00360         var subscriptions = (aStanza == null ? null : aStanza.isa.objj_msgSend1(aStanza, "childrenWithName:", "subscription"));
00361         for (var i = 0; i < (subscriptions == null ? null : subscriptions.isa.objj_msgSend0(subscriptions, "count")); i++)
00362         {
00363             var subscription = (subscriptions == null ? null : subscriptions.isa.objj_msgSend1(subscriptions, "objectAtIndex:", i)),
00364                 nodeName = (subscription == null ? null : subscription.isa.objj_msgSend1(subscription, "valueForAttribute:", "node")),
00365                 subid = (subscription == null ? null : subscription.isa.objj_msgSend1(subscription, "valueForAttribute:", "subid"));
00366             self.isa.objj_msgSend1(self, "addSubscriptionID:", subid);
00367         }
00368         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "postNotificationName:object:", TNStrophePubSubSubscriptionsRetrievedNotification, self));
00369         if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:retrievedSubscriptions:"))))
00370             ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:retrievedSubscriptions:", self, YES));
00371     }
00372     else
00373     {
00374         if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:retrievedSubscriptions:"))))
00375             ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:retrievedSubscriptions:", self, NO));
00376     }
00377     return NO;
00378     var ___r1;
00379 }
00380 ,["BOOL","TNStropheStanza"]), new objj_method(sel_getUid("subscribe"), function $TNPubSubNode__subscribe(self, _cmd)
00381 {
00382     self.isa.objj_msgSend1(self, "subscribeWithOptions:", nil);
00383 }
00384 ,["void"]), new objj_method(sel_getUid("subscribeWithOptions:"), function $TNPubSubNode__subscribeWithOptions_(self, _cmd, options)
00385 {
00386     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00387         stanza = TNStropheStanza.isa.objj_msgSend0(TNStropheStanza, "iq"),
00388         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00389     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setType:", "set"));
00390     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setID:", uid));
00391     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setTo:", self._pubSubServer));
00392     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB}));
00393     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "subscribe", {"node": self._nodeName, "jid": ((___r1 = ((___r2 = self._connection), ___r2 == null ? null : ___r2.isa.objj_msgSend0(___r2, "JID"))), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "bare"))}));
00394     if (options && (options == null ? null : options.isa.objj_msgSend0(options, "count")) > 0)
00395     {
00396         (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00397         (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addChildWithName:", "options"));
00398         (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "x", {"xmlns": Strophe.NS.X_DATA, "type": "submit"}));
00399         (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "field", {"var": "FORM_TYPE", "type": "hidden"}));
00400         (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addChildWithName:", "value"));
00401         (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addTextNode:", Strophe.NS.PUBSUB_SUBSCRIBE_OPTIONS));
00402         (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00403         (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00404         var keys = (options == null ? null : options.isa.objj_msgSend0(options, "allKeys"));
00405         for (var i = 0; i < (keys == null ? null : keys.isa.objj_msgSend0(keys, "count")); i++)
00406         {
00407             var key = (keys == null ? null : keys.isa.objj_msgSend1(keys, "objectAtIndex:", i)),
00408                 value = (options == null ? null : options.isa.objj_msgSend1(options, "valueForKey:", key));
00409             (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "field", {"var": key}));
00410             (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addChildWithName:", "value"));
00411             (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "addTextNode:", value));
00412             (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00413             (stanza == null ? null : stanza.isa.objj_msgSend0(stanza, "up"));
00414         }
00415     }
00416     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didSubscribe:"), self, params));
00417     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00418     var ___r1, ___r2;
00419 }
00420 ,["void","CPDictionary"]), new objj_method(sel_getUid("_didSubscribe:"), function $TNPubSubNode___didSubscribe_(self, _cmd, aStanza)
00421 {
00422     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00423     {
00424         var subscription = (aStanza == null ? null : aStanza.isa.objj_msgSend1(aStanza, "firstChildWithName:", "subscription")),
00425             subID = (subscription == null ? null : subscription.isa.objj_msgSend1(subscription, "valueForAttribute:", "subid")),
00426             status = (subscription == null ? null : subscription.isa.objj_msgSend1(subscription, "valueForAttribute:", "subscription"));
00427         if ((subID == null ? null : subID.isa.objj_msgSend0(subID, "length")) > 0)
00428             ((___r1 = self._subscriptionIDs), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "addObject:", subID));
00429         if (status === "subscribed")
00430         {
00431             ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "postNotificationName:object:", TNStrophePubSubNodeSubscribedNotification, self));
00432             if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:subscribed:"))))
00433                 ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:subscribed:", self, YES));
00434         }
00435         self.isa.objj_msgSend0(self, "_setEventHandler");
00436     }
00437     else
00438     {
00439         if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:subscribed:"))))
00440             ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:subscribed:", self, NO));
00441         CPLog.error("Cannot subscribe the pubsub node");
00442         CPLog.error(aStanza);
00443     }
00444     return NO;
00445     var ___r1;
00446 }
00447 ,["BOOL","TNStropheStanza"]), new objj_method(sel_getUid("addSubscriptionID:"), function $TNPubSubNode__addSubscriptionID_(self, _cmd, aSubscriptionID)
00448 {
00449     ((___r1 = self._subscriptionIDs), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "addObject:", aSubscriptionID));
00450     var ___r1;
00451 }
00452 ,["void","CPString"]), new objj_method(sel_getUid("unsubscribeWithSubID:"), function $TNPubSubNode__unsubscribeWithSubID_(self, _cmd, aSubID)
00453 {
00454     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00455         stanza = TNStropheStanza.isa.objj_msgSend0(TNStropheStanza, "iq"),
00456         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00457     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setType:", "set"));
00458     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setID:", uid));
00459     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setTo:", self._pubSubServer));
00460     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB}));
00461     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "unsubscribe", {"node": self._nodeName, "jid": ((___r1 = ((___r2 = self._connection), ___r2 == null ? null : ___r2.isa.objj_msgSend0(___r2, "JID"))), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "bare"))}));
00462     if (aSubID)
00463         (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "setValue:forAttribute:", aSubID, "subid"));
00464     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didUnsubscribe:"), self, params));
00465     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00466     var ___r1, ___r2;
00467 }
00468 ,["void","CPString"]), new objj_method(sel_getUid("unsubscribe"), function $TNPubSubNode__unsubscribe(self, _cmd)
00469 {
00470     if (((___r1 = self._subscriptionIDs), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "count")) > 0)
00471     {
00472         for (var i = 0; i < ((___r1 = self._subscriptionIDs), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "count")); i++)
00473         {
00474             self.isa.objj_msgSend1(self, "unsubscribeWithSubID:", ((___r1 = self._subscriptionIDs), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "objectAtIndex:", i)));
00475         }
00476     }
00477     else
00478     {
00479         self.isa.objj_msgSend1(self, "unsubscribeWithSubID:", nil);
00480     }
00481     var ___r1;
00482 }
00483 ,["void"]), new objj_method(sel_getUid("_didUnsubscribe:"), function $TNPubSubNode___didUnsubscribe_(self, _cmd, aStanza)
00484 {
00485     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00486     {
00487         var params = CPDictionary.isa.objj_msgSend0(CPDictionary, "dictionary"),
00488             subID = ((___r1 = ((___r2 = (aStanza == null ? null : aStanza.isa.objj_msgSend1(aStanza, "firstChildWithName:", "pubsub"))), ___r2 == null ? null : ___r2.isa.objj_msgSend1(___r2, "firstChildWithName:", "subscription"))), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "valueForAttribute:", "subid"));
00489         if ((subID == null ? null : subID.isa.objj_msgSend0(subID, "length")) > 0)
00490         {
00491             ((___r1 = self._subscriptionIDs), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "removeObject:", subID));
00492             (params == null ? null : params.isa.objj_msgSend2(params, "setObject:forKey:", subID, "subscriptionID"));
00493         }
00494         else if (((___r1 = self._subscriptionIDs), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "count")) === 1)
00495         {
00496             ((___r1 = self._subscriptionIDs), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "removeAllObjects"));
00497         }
00498         if (((___r1 = self._subscriptionIDs), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "count")) === 0)
00499         {
00500             if (self._eventSelectorID)
00501             {
00502                 ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "deleteRegisteredSelector:", self._eventSelectorID));
00503                 self._eventSelectorID = nil;
00504             }
00505         }
00506         ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "postNotificationName:object:userInfo:", TNStrophePubSubNodeUnsubscribedNotification, self, params));
00507         if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:unsubscribed:"))))
00508             ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:unsubscribed:", self, YES));
00509     }
00510     else
00511     {
00512         if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:unsubscribed:"))))
00513             ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:unsubscribed:", self, NO));
00514         CPLog.error("Cannot unsubscribe the pubsub node");
00515         CPLog.error(aStanza);
00516     }
00517     return NO;
00518     var ___r1, ___r2;
00519 }
00520 ,["BOOL","TNStropheStanza"]), new objj_method(sel_getUid("numberOfSubscriptions"), function $TNPubSubNode__numberOfSubscriptions(self, _cmd)
00521 {
00522     return ((___r1 = self._subscriptionIDs), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "count"));
00523     var ___r1;
00524 }
00525 ,["int"]), new objj_method(sel_getUid("retrieveAffiliations"), function $TNPubSubNode__retrieveAffiliations(self, _cmd)
00526 {
00527     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00528         stanza = TNStropheStanza.isa.objj_msgSend0(TNStropheStanza, "iq"),
00529         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00530     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setTo:", self._pubSubServer));
00531     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setType:", "get"));
00532     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setID:", uid));
00533     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB_OWNER}));
00534     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "affiliations", {"node": self._nodeName}));
00535     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didRetrieveAffiliations:"), self, params));
00536     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00537     var ___r1;
00538 }
00539 ,["void"]), new objj_method(sel_getUid("_didRetrieveAffiliations:"), function $TNPubSubNode___didRetrieveAffiliations_(self, _cmd, aStanza)
00540 {
00541     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00542     {
00543         var affiliations = (aStanza == null ? null : aStanza.isa.objj_msgSend1(aStanza, "childrenWithName:", "affiliation"));
00544         for (var i = 0; i < (affiliations == null ? null : affiliations.isa.objj_msgSend0(affiliations, "count")); i++)
00545         {
00546             var affiliation = (affiliations == null ? null : affiliations.isa.objj_msgSend1(affiliations, "objectAtIndex:", i));
00547             ((___r1 = self._affiliations), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "setObject:forKey:", (affiliation == null ? null : affiliation.isa.objj_msgSend1(affiliation, "valueForAttribute:", "affiliation")), TNStropheJID.isa.objj_msgSend1(TNStropheJID, "stropheJIDWithString:", (affiliation == null ? null : affiliation.isa.objj_msgSend1(affiliation, "valueForAttribute:", "jid")))));
00548         }
00549     }
00550     else
00551     {
00552         CPLog.error("Cannot get affiliations");
00553         CPLog.error(aStanza);
00554     }
00555     if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:retrievedAffiliations:"))))
00556         ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:retrievedAffiliations:", self, aStanza));
00557     return NO;
00558     var ___r1;
00559 }
00560 ,["void","TNStropheStanza"]), new objj_method(sel_getUid("changeAffiliation:forJID:"), function $TNPubSubNode__changeAffiliation_forJID_(self, _cmd, anAffiliation, aJID)
00561 {
00562     var uid = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "getUniqueId")),
00563         stanza = TNStropheStanza.isa.objj_msgSend0(TNStropheStanza, "iq"),
00564         params = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObjectsAndKeys:", uid, "id");
00565     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setTo:", self._pubSubServer));
00566     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setType:", "set"));
00567     (stanza == null ? null : stanza.isa.objj_msgSend1(stanza, "setID:", uid));
00568     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "pubsub", {"xmlns": Strophe.NS.PUBSUB_OWNER}));
00569     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "affiliations", {"node": self._nodeName}));
00570     (stanza == null ? null : stanza.isa.objj_msgSend2(stanza, "addChildWithName:andAttributes:", "affiliation", {"jid": (aJID == null ? null : aJID.isa.objj_msgSend0(aJID, "bare")), "affiliation": anAffiliation}));
00571     var affiliationInformations = CPDictionary.isa.objj_msgSend(CPDictionary, "dictionaryWithObjectsAndKeys:", (aJID == null ? null : aJID.isa.objj_msgSend0(aJID, "bare")), "jid", anAffiliation, "affiliation");
00572     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend(___r1, "registerSelector:ofObject:withDict:userInfo:", sel_getUid("_didChangeAffiliations:userInfo:"), self, params, affiliationInformations));
00573     ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "send:", stanza));
00574     var ___r1;
00575 }
00576 ,["void","CPString","TNStropheJID"]), new objj_method(sel_getUid("_didChangeAffiliations:userInfo:"), function $TNPubSubNode___didChangeAffiliations_userInfo_(self, _cmd, aStanza, newAffiliation)
00577 {
00578     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) == "result")
00579     {
00580         ((___r1 = self._affiliations), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "setObject:forKey:", (newAffiliation == null ? null : newAffiliation.isa.objj_msgSend1(newAffiliation, "objectForKey:", "affiliation")), (newAffiliation == null ? null : newAffiliation.isa.objj_msgSend1(newAffiliation, "objectForKey:", "jid"))));
00581         self.isa.objj_msgSend0(self, "retrieveAffiliations");
00582     }
00583     else
00584     {
00585         CPLog.error("Cannot change affiliations");
00586         CPLog.error(aStanza);
00587     }
00588     if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:changedAffiliations:"))))
00589         ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:changedAffiliations:", self, aStanza));
00590     return NO;
00591     var ___r1;
00592 }
00593 ,["void","TNStropheStanza","CPDictionary"]), new objj_method(sel_getUid("_setEventHandler"), function $TNPubSubNode___setEventHandler(self, _cmd)
00594 {
00595     var params = CPDictionary.isa.objj_msgSend(CPDictionary, "dictionaryWithObjectsAndKeys:", "message", "name", ((___r1 = self._pubSubServer), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "node")), "from");
00596     if (self._eventSelectorID)
00597         ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "deleteRegisteredSelector:", self._eventSelectorID));
00598     self._eventSelectorID = ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didReceiveEvent:"), self, params));
00599     var ___r1;
00600 }
00601 ,["void"]), new objj_method(sel_getUid("_didReceiveEvent:"), function $TNPubSubNode___didReceiveEvent_(self, _cmd, aStanza)
00602 {
00603     var pubsubEvent = (aStanza == null ? null : aStanza.isa.objj_msgSend1(aStanza, "firstChildWithName:", "event"));
00604     if ((pubsubEvent == null ? null : pubsubEvent.isa.objj_msgSend0(pubsubEvent, "namespace")) != Strophe.NS.PUBSUB_EVENT)
00605         return YES;
00606     if ((pubsubEvent == null ? null : pubsubEvent.isa.objj_msgSend1(pubsubEvent, "containsChildrenWithName:", "subscription")))
00607     {
00608         var subscription = (pubsubEvent == null ? null : pubsubEvent.isa.objj_msgSend1(pubsubEvent, "firstChildWithName:", "subscription")),
00609             status = (subscription == null ? null : subscription.isa.objj_msgSend1(subscription, "valueForAttribute:", "subscription")),
00610             nodeName = (subscription == null ? null : subscription.isa.objj_msgSend1(subscription, "valueForAttribute:", "node"));
00611         if (status === "subscribed" && nodeName === self._nodeName)
00612             ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "postNotificationName:object:", TNStrophePubSubNodeSubscribedNotification, self));
00613         return YES;
00614     }
00615     if (self._nodeName != ((___r1 = (pubsubEvent == null ? null : pubsubEvent.isa.objj_msgSend1(pubsubEvent, "firstChildWithName:", "items"))), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "valueForAttribute:", "node")))
00616         return YES;
00617     if (self._delegate && ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "respondsToSelector:", sel_getUid("pubSubNode:receivedEvent:"))))
00618         ((___r1 = self._delegate), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "pubSubNode:receivedEvent:", self, aStanza));
00619     ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "postNotificationName:object:userInfo:", TNStrophePubSubNodeEventNotification, self, aStanza));
00620     return YES;
00621     var ___r1;
00622 }
00623 ,["BOOL","TNStropheStanza"]), new objj_method(sel_getUid("description"), function $TNPubSubNode__description(self, _cmd)
00624 {
00625     return self._nodeName;
00626 }
00627 ,["CPString"])]);
00628 class_addMethods(meta_class, [new objj_method(sel_getUid("registerSelector:ofObject:forPubSubEventWithConnection:"), function $TNPubSubNode__registerSelector_ofObject_forPubSubEventWithConnection_(self, _cmd, aSelector, anObject, aConnection)
00629 {
00630     var params = CPDictionary.isa.objj_msgSend(CPDictionary, "dictionaryWithObjectsAndKeys:", "message", "name", "headline", "type", {"matchBare": YES}, "options", Strophe.NS.PUBSUB_EVENT, "namespace");
00631     return (aConnection == null ? null : aConnection.isa.objj_msgSend3(aConnection, "registerSelector:ofObject:withDict:", aSelector, anObject, params));
00632 }
00633 ,["void","SEL","id","TNStropheConnection"]), new objj_method(sel_getUid("pubSubNodeWithNodeName:connection:pubSubServer:"), function $TNPubSubNode__pubSubNodeWithNodeName_connection_pubSubServer_(self, _cmd, aNodeName, aConnection, aPubSubServer)
00634 {
00635     return ((___r1 = TNPubSubNode.isa.objj_msgSend0(TNPubSubNode, "alloc")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "initWithNodeName:connection:pubSubServer:", aNodeName, aConnection, aPubSubServer));
00636     var ___r1;
00637 }
00638 ,["TNPubSubNode","CPString","TNStropheConnection","CPString"]), new objj_method(sel_getUid("pubSubNodeWithNodeName:connection:pubSubServer:subscriptionIDs:"), function $TNPubSubNode__pubSubNodeWithNodeName_connection_pubSubServer_subscriptionIDs_(self, _cmd, aNodeName, aConnection, aPubSubServer, aSubscriptionIDs)
00639 {
00640     return ((___r1 = TNPubSubNode.isa.objj_msgSend0(TNPubSubNode, "alloc")), ___r1 == null ? null : ___r1.isa.objj_msgSend(___r1, "initWithNodeName:connection:pubSubServer:subscriptionIDs:", aNodeName, aConnection, aPubSubServer, aSubscriptionIDs));
00641     var ___r1;
00642 }
00643 ,["TNPubSubNode","CPString","TNStropheConnection","TNStropheJID","CPArray"])]);
00644 }
 All Classes Namespaces Files Functions Variables