StropheCappuccino API 1.0.0
/tmp/tempDoc.doc/Build/StropheCappuccino.build/Debug/CommonJS.environment/Sources/MUC/TNStropheMUCRoster.j
Go to the documentation of this file.
00001 @STATIC;1.0;I;23;Foundation/Foundation.ji;24;../TNStropheRosterBase.ji;19;../TNStropheGroup.jt;9242;objj_executeFile("Foundation/Foundation.j", NO);objj_executeFile("../TNStropheRosterBase.j", YES);objj_executeFile("../TNStropheGroup.j", YES);TNStropheMUCContactJoinedNotification = "TNStropheMUCContactJoinedNotification";
00002 TNStropheMUCContactLeftNotification = "TNStropheMUCContactLeftNotification";
00003 {var the_class = objj_allocateClassPair(TNStropheRosterBase, "TNStropheMUCRoster"),
00004 meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_admins"), new objj_ivar("_moderators"), new objj_ivar("_owners"), new objj_ivar("_participants"), new objj_ivar("_visitors"), new objj_ivar("_room")]);objj_registerClassPair(the_class);
00005 class_addMethods(the_class, [new objj_method(sel_getUid("admins"), function $TNStropheMUCRoster__admins(self, _cmd)
00006 {
00007     return self._admins;
00008 }
00009 ,["TNStropheGroup"]), new objj_method(sel_getUid("_setAdmins:"), function $TNStropheMUCRoster___setAdmins_(self, _cmd, newValue)
00010 {
00011     self._admins = newValue;
00012 }
00013 ,["void","TNStropheGroup"]), new objj_method(sel_getUid("moderators"), function $TNStropheMUCRoster__moderators(self, _cmd)
00014 {
00015     return self._moderators;
00016 }
00017 ,["TNStropheGroup"]), new objj_method(sel_getUid("_setModerators:"), function $TNStropheMUCRoster___setModerators_(self, _cmd, newValue)
00018 {
00019     self._moderators = newValue;
00020 }
00021 ,["void","TNStropheGroup"]), new objj_method(sel_getUid("owners"), function $TNStropheMUCRoster__owners(self, _cmd)
00022 {
00023     return self._owners;
00024 }
00025 ,["TNStropheGroup"]), new objj_method(sel_getUid("_setOwners:"), function $TNStropheMUCRoster___setOwners_(self, _cmd, newValue)
00026 {
00027     self._owners = newValue;
00028 }
00029 ,["void","TNStropheGroup"]), new objj_method(sel_getUid("participants"), function $TNStropheMUCRoster__participants(self, _cmd)
00030 {
00031     return self._participants;
00032 }
00033 ,["TNStropheGroup"]), new objj_method(sel_getUid("_setParticipants:"), function $TNStropheMUCRoster___setParticipants_(self, _cmd, newValue)
00034 {
00035     self._participants = newValue;
00036 }
00037 ,["void","TNStropheGroup"]), new objj_method(sel_getUid("visitors"), function $TNStropheMUCRoster__visitors(self, _cmd)
00038 {
00039     return self._visitors;
00040 }
00041 ,["TNStropheGroup"]), new objj_method(sel_getUid("_setVisitors:"), function $TNStropheMUCRoster___setVisitors_(self, _cmd, newValue)
00042 {
00043     self._visitors = newValue;
00044 }
00045 ,["void","TNStropheGroup"]), new objj_method(sel_getUid("room"), function $TNStropheMUCRoster__room(self, _cmd)
00046 {
00047     return self._room;
00048 }
00049 ,["TNStropheMUCRoom"]), new objj_method(sel_getUid("_setRoom:"), function $TNStropheMUCRoster___setRoom_(self, _cmd, newValue)
00050 {
00051     self._room = newValue;
00052 }
00053 ,["void","TNStropheMUCRoom"]), new objj_method(sel_getUid("initWithConnection:forRoom:"), function $TNStropheMUCRoster__initWithConnection_forRoom_(self, _cmd, aConnection, aRoom)
00054 {
00055     if (self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("TNStropheMUCRoster").super_class }, "initWithConnection:", aConnection))
00056     {
00057         self._room = aRoom;
00058         self._visitors = TNStropheGroup.isa.objj_msgSend1(TNStropheGroup, "stropheGroupWithName:", "Visitors");
00059         self._participants = TNStropheGroup.isa.objj_msgSend1(TNStropheGroup, "stropheGroupWithName:", "Participants");
00060         self._moderators = TNStropheGroup.isa.objj_msgSend1(TNStropheGroup, "stropheGroupWithName:", "Moderators");
00061         self._admins = TNStropheGroup.isa.objj_msgSend1(TNStropheGroup, "stropheGroupWithName:", "Admins");
00062         self._owners = TNStropheGroup.isa.objj_msgSend1(TNStropheGroup, "stropheGroupWithName:", "Owners");
00063         var params = CPDictionary.isa.objj_msgSend(CPDictionary, "dictionaryWithObjectsAndKeys:", "presence", "name", ((___r1 = ((___r2 = self._room), ___r2 == null ? null : ___r2.isa.objj_msgSend0(___r2, "roomJID"))), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "full")), "from", {matchBare: true}, "options");
00064         ((___r1 = self._connection), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "registerSelector:ofObject:withDict:", sel_getUid("_didReceivePresence:"), self, params));
00065     }
00066     return self;
00067     var ___r1, ___r2;
00068 }
00069 ,["id","TNStropheConnection","TNStropheMUCRoom"]), new objj_method(sel_getUid("_didReceivePresence:"), function $TNStropheMUCRoster___didReceivePresence_(self, _cmd, aStanza)
00070 {
00071     var contact = self.isa.objj_msgSend1(self, "contactWithFullJID:", (aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "from"))),
00072         data = (aStanza == null ? null : aStanza.isa.objj_msgSend1(aStanza, "firstChildWithName:", "x")),
00073         group;
00074     if (data && (data == null ? null : data.isa.objj_msgSend0(data, "namespace")) == "http://jabber.org/protocol/muc#user")
00075     {
00076         switch(((___r1 = (data == null ? null : data.isa.objj_msgSend1(data, "firstChildWithName:", "item"))), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "valueForAttribute:", "role"))) {
00077         case "visitor":
00078             group = self._visitors;
00079             break;
00080         case "participant":
00081             group = self._participants;
00082             break;
00083         case "moderator":
00084             group = self._moderators;
00085             break;
00086         }
00087     }
00088     if (contact)
00089         (contact == null ? null : contact.isa.objj_msgSend1(contact, "_didReceivePresence:", aStanza));
00090     else
00091         contact = self.isa.objj_msgSend3(self, "addContact:withName:inGroup:", (aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "from")), ((___r1 = (aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "from"))), ___r1 == null ? null : ___r1.isa.objj_msgSend0(___r1, "resource")), group);
00092     if ((aStanza == null ? null : aStanza.isa.objj_msgSend0(aStanza, "type")) === "unavailable")
00093     {
00094         var statusCode;
00095         if ((data == null ? null : data.isa.objj_msgSend1(data, "containsChildrenWithName:", "status")))
00096             statusCode = ((___r1 = (data == null ? null : data.isa.objj_msgSend1(data, "firstChildWithName:", "status"))), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "valueForAttribute:", "code"));
00097         self.isa.objj_msgSend2(self, "removeContact:withStatusCode:", contact, statusCode);
00098     }
00099     return YES;
00100     var ___r1;
00101 }
00102 ,["BOOL","id"]), new objj_method(sel_getUid("addContact:withName:inGroup:"), function $TNStropheMUCRoster__addContact_withName_inGroup_(self, _cmd, aJID, aName, aGroup)
00103 {
00104     if (self.isa.objj_msgSend1(self, "containsFullJID:", aJID))
00105         return;
00106     if (!aGroup)
00107         aGroup = self._visitors;
00108     var contact = TNStropheContact.isa.objj_msgSend3(TNStropheContact, "contactWithConnection:JID:group:", self._connection, aJID, aGroup);
00109     (contact == null ? null : contact.isa.objj_msgSend1(contact, "setNickname:", aName));
00110     ((___r1 = (aGroup == null ? null : aGroup.isa.objj_msgSend0(aGroup, "contacts"))), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "addObject:", contact));
00111     self.isa.objj_msgSend1(self, "cacheContact:", contact);
00112     var userInfo = CPDictionary.isa.objj_msgSend2(CPDictionary, "dictionaryWithObject:forKey:", contact, "contact");
00113     ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "postNotificationName:object:userInfo:", TNStropheMUCContactJoinedNotification, self, userInfo));
00114     return contact;
00115     var ___r1;
00116 }
00117 ,["TNStropheContact","TNStropheJID","CPString","TNStropheGroup"]), new objj_method(sel_getUid("removeContact:withStatusCode:"), function $TNStropheMUCRoster__removeContact_withStatusCode_(self, _cmd, aContact, aStatusCode)
00118 {
00119     objj_msgSendSuper({ receiver:self, super_class:objj_getClass("TNStropheMUCRoster").super_class }, "uncacheContact:", aContact);
00120     var userInfo = CPDictionary.isa.objj_msgSend(CPDictionary, "dictionaryWithObjectsAndKeys:", aStatusCode, "statusCode", aContact, "contact");
00121     ((___r1 = CPNotificationCenter.isa.objj_msgSend0(CPNotificationCenter, "defaultCenter")), ___r1 == null ? null : ___r1.isa.objj_msgSend3(___r1, "postNotificationName:object:userInfo:", TNStropheMUCContactLeftNotification, self, userInfo));
00122     var ___r1;
00123 }
00124 ,["void","TNStropheContact","CPString"]), new objj_method(sel_getUid("groupOfContact:"), function $TNStropheMUCRoster__groupOfContact_(self, _cmd, aContact)
00125 {
00126     var groups = CPArray.isa.objj_msgSend(CPArray, "arrayWithObjects:", self._visitors, self._participants, self._moderators, self._admins, self._owners);
00127     for (var i = 0; i < (groups == null ? null : groups.isa.objj_msgSend0(groups, "count")); i++)
00128     {
00129         var group = (groups == null ? null : groups.isa.objj_msgSend1(groups, "objectAtIndex:", i));
00130         if (((___r1 = (group == null ? null : group.isa.objj_msgSend0(group, "contacts"))), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "containsObject:", aContact)))
00131             return group;
00132     }
00133     return;
00134     var ___r1;
00135 }
00136 ,["TNStropheGroup","TNStropheContact"])]);
00137 class_addMethods(meta_class, [new objj_method(sel_getUid("rosterWithConnection:forRoom:"), function $TNStropheMUCRoster__rosterWithConnection_forRoom_(self, _cmd, aConnection, aRoom)
00138 {
00139     return ((___r1 = TNStropheMUCRoster.isa.objj_msgSend0(TNStropheMUCRoster, "alloc")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "initWithConnection:forRoom:", aConnection, aRoom));
00140     var ___r1;
00141 }
00142 ,["id","TNStropheConnection","TNStropheMUCRoom"])]);
00143 }
 All Classes Namespaces Files Functions Variables