StropheCappuccino API 1.0.0
/tmp/tempDoc.doc/Build/StropheCappuccino.build/Debug/Browser.environment/Sources/TNStropheJID.j
Go to the documentation of this file.
00001 @STATIC;1.0;I;23;Foundation/Foundation.jt;8988;objj_executeFile("Foundation/Foundation.j", NO);
00002 TNStropheJIDExceptionJID = "TNStropheJIDExceptionJID";
00003 {var the_class = objj_allocateClassPair(CPObject, "TNStropheJID"),
00004 meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_isServer"), new objj_ivar("_domain"), new objj_ivar("_node"), new objj_ivar("_resource")]);//#pragma mark -
00005 //#pragma mark Class methods
00006 
00007 
00008 
00009 
00010 //#pragma mark -
00011 //#pragma mark Initialization
00012 
00013 
00014 
00015 //#pragma mark -
00016 //#pragma mark Setters and Getters
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 //#pragma mark -
00026 //#pragma mark Operations
00027 
00028 
00029 
00030 objj_registerClassPair(the_class);
00031 class_addMethods(the_class, [new objj_method(sel_getUid("isServer"), function $TNStropheJID__isServer(self, _cmd)
00032 {
00033 return self._isServer;
00034 }
00035 ,["BOOL"]), new objj_method(sel_getUid("_setIsServer:"), function $TNStropheJID___setIsServer_(self, _cmd, newValue)
00036 {
00037 self._isServer = newValue;
00038 }
00039 ,["void","BOOL"]), new objj_method(sel_getUid("domain"), function $TNStropheJID__domain(self, _cmd)
00040 {
00041 return self._domain;
00042 }
00043 ,["CPString"]), new objj_method(sel_getUid("setDomain:"), function $TNStropheJID__setDomain_(self, _cmd, newValue)
00044 {
00045 self._domain = newValue;
00046 }
00047 ,["void","CPString"]), new objj_method(sel_getUid("node"), function $TNStropheJID__node(self, _cmd)
00048 {
00049 return self._node;
00050 }
00051 ,["CPString"]), new objj_method(sel_getUid("setNode:"), function $TNStropheJID__setNode_(self, _cmd, newValue)
00052 {
00053 self._node = newValue;
00054 }
00055 ,["void","CPString"]), new objj_method(sel_getUid("resource"), function $TNStropheJID__resource(self, _cmd)
00056 {
00057 return self._resource;
00058 }
00059 ,["CPString"]), new objj_method(sel_getUid("setResource:"), function $TNStropheJID__setResource_(self, _cmd, newValue)
00060 {
00061 self._resource = newValue;
00062 }
00063 ,["void","CPString"]), new objj_method(sel_getUid("initWithNode:domain:resource:"), function $TNStropheJID__initWithNode_domain_resource_(self, _cmd, aNode, aDomain, aResource)
00064 {
00065     if (self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("TNStropheJID").super_class }, "init"))
00066     {
00067         objj_msgSend(self, "setNode:", aNode);
00068         objj_msgSend(self, "setDomain:", aDomain);
00069         objj_msgSend(self, "setResource:", aResource);
00070         self._isServer = (!aDomain && !aResource);
00071         if ((self._node && self._node.indexOf(" ") != -1) || (self._domain && self._domain.indexOf(" ") != -1) || (self._resource && self._resource.indexOf(" ") != -1))
00072             objj_msgSend(CPException, "raise:reason:", TNStropheJIDExceptionJID, "Given information are not a valid JID.");
00073     }
00074     return self;
00075 }
00076 ,["TNStropheJID","CPString","CPString","CPString"]), new objj_method(sel_getUid("initWithNode:domain:"), function $TNStropheJID__initWithNode_domain_(self, _cmd, aNode, aDomain)
00077 {
00078     return objj_msgSend(self, "initWithNode:domain:resource:", aNode, aDomain, nil);
00079 }
00080 ,["TNStropheJID","CPString","CPString"]), new objj_method(sel_getUid("initWithString:"), function $TNStropheJID__initWithString_(self, _cmd, aStringJID)
00081 {
00082     if (!aStringJID)
00083         return;
00084     var node = aStringJID.split("@")[0],
00085         domain,
00086         resource;
00087     if (aStringJID.indexOf("@") != -1)
00088     {
00089         domain = aStringJID.split("@")[1].split("/")[0],
00090         resource = aStringJID.split("/")[1];
00091     }
00092     if (!node)
00093         objj_msgSend(CPException, "raise:reason:", TNStropheJIDExceptionJID, aStringJID + " is not a valid JID");
00094     return objj_msgSend(self, "initWithNode:domain:resource:", node, domain, resource);
00095 }
00096 ,["TNStropheJID","CPString"]), new objj_method(sel_getUid("bare"), function $TNStropheJID__bare(self, _cmd)
00097 {
00098     if (self._domain)
00099         return self._node + "@" + self._domain;
00100     else
00101         return self._node;
00102 }
00103 ,["CPString"]), new objj_method(sel_getUid("setBare:"), function $TNStropheJID__setBare_(self, _cmd, aBareJID)
00104 {
00105     var node = aBareJID.split("@")[0],
00106         domain = aBareJID.split("@")[1].split("/")[0];
00107     if (!node || !domain)
00108         objj_msgSend(CPException, "raise:reason:", TNStropheJIDExceptionJID, aBareJID + " is not a valid JID");
00109     objj_msgSend(self, "setNode:", node);
00110     objj_msgSend(self, "setDomain:", domain);
00111 }
00112 ,["void","CPString"]), new objj_method(sel_getUid("full"), function $TNStropheJID__full(self, _cmd)
00113 {
00114     if (self._resource)
00115         return objj_msgSend(self, "bare") + "/" + self._resource;
00116     else
00117         return objj_msgSend(self, "bare");
00118 }
00119 ,["CPString"]), new objj_method(sel_getUid("setFull:"), function $TNStropheJID__setFull_(self, _cmd, aFullJID)
00120 {
00121     objj_msgSend(self, "setBare:", aFullJID);
00122     var resource = aFullJID.split("/")[1];
00123     if (!resource)
00124         objj_msgSend(CPException, "raise:reason:", TNStropheJIDExceptionJID, aFullJID + " is not a valid JID");
00125     objj_msgSend(self, "setResource:", resource)
00126 }
00127 ,["void","CPString"]), new objj_method(sel_getUid("description"), function $TNStropheJID__description(self, _cmd)
00128 {
00129     return objj_msgSend(self, "stringValue");
00130 }
00131 ,["CPString"]), new objj_method(sel_getUid("stringValue"), function $TNStropheJID__stringValue(self, _cmd)
00132 {
00133     return objj_msgSend(self, "full");
00134 }
00135 ,["CPString"]), new objj_method(sel_getUid("uppercaseString"), function $TNStropheJID__uppercaseString(self, _cmd)
00136 {
00137     return objj_msgSend(objj_msgSend(self, "stringValue"), "uppercaseString");
00138 }
00139 ,["CPString"]), new objj_method(sel_getUid("lowercaseString"), function $TNStropheJID__lowercaseString(self, _cmd)
00140 {
00141     return objj_msgSend(objj_msgSend(self, "stringValue"), "lowercaseString");
00142 }
00143 ,["CPString"]), new objj_method(sel_getUid("equals:"), function $TNStropheJID__equals_(self, _cmd, anotherJID)
00144 {
00145     return objj_msgSend(self, "fullEquals:", anotherJID);
00146 }
00147 ,["BOOL","TNStropheJID"]), new objj_method(sel_getUid("fullEquals:"), function $TNStropheJID__fullEquals_(self, _cmd, anotherJID)
00148 {
00149     return (objj_msgSend(self, "bareEquals:", anotherJID) && (objj_msgSend(objj_msgSend(anotherJID, "resource"), "uppercaseString") === objj_msgSend(objj_msgSend(self, "resource"), "uppercaseString")))
00150 }
00151 ,["BOOL","TNStropheJID"]), new objj_method(sel_getUid("bareEquals:"), function $TNStropheJID__bareEquals_(self, _cmd, anotherJID)
00152 {
00153     return ((objj_msgSend(objj_msgSend(anotherJID, "node"), "uppercaseString") === objj_msgSend(objj_msgSend(self, "node"), "uppercaseString")) && (objj_msgSend(objj_msgSend(anotherJID, "domain"), "uppercaseString") === objj_msgSend(objj_msgSend(self, "domain"), "uppercaseString")));
00154 }
00155 ,["BOOL","TNStropheJID"]), new objj_method(sel_getUid("compare:"), function $TNStropheJID__compare_(self, _cmd, anotherJID)
00156 {
00157     var stringRepA = objj_msgSend(self, "stringValue"),
00158         stringRepB = objj_msgSend(anotherJID, "stringValue");
00159     return objj_msgSend(stringRepA, "compare:", stringRepB);
00160 }
00161 ,["CPComparisonResult","TNStropheJID"])]);
00162 class_addMethods(meta_class, [new objj_method(sel_getUid("initialize"), function $TNStropheJID__initialize(self, _cmd)
00163 {
00164     objj_msgSend(self, "exposeBinding:", "domain");
00165     objj_msgSend(self, "exposeBinding:", "node");
00166     objj_msgSend(self, "exposeBinding:", "resource");
00167 }
00168 ,["void"]), new objj_method(sel_getUid("stropheJIDWithNode:domain:resource:"), function $TNStropheJID__stropheJIDWithNode_domain_resource_(self, _cmd, aNode, aDomain, aResource)
00169 {
00170     return objj_msgSend(objj_msgSend(TNStropheJID, "alloc"), "initWithNode:domain:resource:", aNode, aDomain, aResource);
00171 }
00172 ,["TNStropheJID","CPString","CPString","CPString"]), new objj_method(sel_getUid("stropheJIDWithNode:domain:"), function $TNStropheJID__stropheJIDWithNode_domain_(self, _cmd, aNode, aDomain)
00173 {
00174     return objj_msgSend(objj_msgSend(TNStropheJID, "alloc"), "initWithNode:domain:", aNode, aDomain);
00175 }
00176 ,["TNStropheJID","CPString","CPString"]), new objj_method(sel_getUid("stropheJIDWithString:"), function $TNStropheJID__stropheJIDWithString_(self, _cmd, aStringJID)
00177 {
00178     return objj_msgSend(objj_msgSend(TNStropheJID, "alloc"), "initWithString:", aStringJID);
00179 }
00180 ,["TNStropheJID","CPString"])]);
00181 }
00182 {
00183 var the_class = objj_getClass("TNStropheJID")
00184 if(!the_class) throw new SyntaxError("*** Could not find definition for class \"TNStropheJID\"");
00185 var meta_class = the_class.isa;
00186 class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $TNStropheJID__initWithCoder_(self, _cmd, aCoder)
00187 {
00188     if (self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("TNStropheJID").super_class }, "init"))
00189     {
00190         self._node = objj_msgSend(aCoder, "decodeObjectForKey:", "_node");
00191         self._domain = objj_msgSend(aCoder, "decodeObjectForKey:", "_domain");
00192         self._resource = objj_msgSend(aCoder, "decodeObjectForKey:", "_resource");
00193     }
00194     return self;
00195 }
00196 ,["id","CPCoder"]), new objj_method(sel_getUid("encodeWithCoder:"), function $TNStropheJID__encodeWithCoder_(self, _cmd, aCoder)
00197 {
00198     objj_msgSend(aCoder, "encodeObject:forKey:", self._node, "_node");
00199     if (self._domain)
00200         objj_msgSend(aCoder, "encodeObject:forKey:", self._domain, "_domain");
00201     if (self._resource)
00202         objj_msgSend(aCoder, "encodeObject:forKey:", self._resource, "_resource");
00203 }
00204 ,["void","CPCoder"])]);
00205 }
 All Classes Namespaces Files Functions Variables