@@ -169,14 +169,13 @@ Stringprep_rc rc; if ((rc = stringprep_profile([username UTF8String], &node, "SASLprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException - exceptionWithClass: [self class] - connection: self - profile: @"SASLprep" - string: username]; + exceptionWithConnection: self + profile: @"SASLprep" + string: username]; @try { _username = [[OFString alloc] initWithUTF8String: node]; } @finally { free(node); @@ -201,14 +200,13 @@ Stringprep_rc rc; if ((rc = stringprep_profile([resource UTF8String], &res, "Resourceprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException - exceptionWithClass: [self class] - connection: self - profile: @"Resourceprep" - string: resource]; + exceptionWithConnection: self + profile: @"Resourceprep" + string: resource]; @try { _resource = [[OFString alloc] initWithUTF8String: res]; } @finally { free(res); @@ -251,14 +249,13 @@ Stringprep_rc rc; if ((rc = stringprep_profile([domain_ UTF8String], &srv, "Nameprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException - exceptionWithClass: [self class] - connection: self - profile: @"Nameprep" - string: domain_]; + exceptionWithConnection: self + profile: @"Nameprep" + string: domain_]; @try { _domain = [[OFString alloc] initWithUTF8String: srv]; } @finally { free(srv); @@ -288,14 +285,13 @@ Stringprep_rc rc; if ((rc = stringprep_profile([password UTF8String], &pass, "SASLprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException - exceptionWithClass: [self class] - connection: self - profile: @"SASLprep" - string: password]; + exceptionWithConnection: self + profile: @"SASLprep" + string: password]; @try { _password = [[OFString alloc] initWithUTF8String: pass]; } @finally { free(pass); @@ -337,12 +333,11 @@ XMPPSRVEntry *candidate = nil; XMPPSRVLookup *SRVLookup = nil; OFEnumerator *enumerator; if (_socket != nil) - @throw [OFAlreadyConnectedException - exceptionWithClass: [self class]]; + @throw [OFAlreadyConnectedException exception]; _socket = [[OFTCPSocket alloc] init]; if (_server) [_socket connectToHost: _server @@ -689,13 +684,11 @@ prefix: (OFString*)prefix namespace: (OFString*)ns { if (![name isEqual: @"stream"] || ![prefix isEqual: @"stream"] || ![ns isEqual: XMPP_NS_STREAM]) - @throw [OFMalformedXMLException - exceptionWithClass: [builder class] - parser: nil]; + @throw [OFMalformedXMLException exception]; else { [self close]; } } @@ -871,14 +864,13 @@ reason = [[element elementForName: @"text" namespace: XMPP_NS_XMPP_STREAM] stringValue]; @throw [XMPPStreamErrorException - exceptionWithClass: [self class] - connection: self - condition: condition - reason: reason]; + exceptionWithConnection: self + condition: condition + reason: reason]; return; } assert(0); } @@ -913,11 +905,11 @@ return; } if ([[element name] isEqual: @"failure"]) /* TODO: Find/create an exception to throw here */ - @throw [OFException exceptionWithClass: [self class]]; + @throw [OFException exception]; assert(0); } - (void)XMPP_handleSASL: (OFXMLElement*)element @@ -959,13 +951,12 @@ if ([[element name] isEqual: @"failure"]) { of_log(@"Auth failed!"); // FIXME: Do more parsing/handling @throw [XMPPAuthFailedException - exceptionWithClass: [self class] - connection: self - reason: [element XMLString]]; + exceptionWithConnection: self + reason: [element XMLString]]; } assert(0); } @@ -1026,11 +1017,11 @@ return; } if (_encryptionRequired && !_encrypted) /* TODO: Find/create an exception to throw here */ - @throw [OFException exceptionWithClass: [self class]]; + @throw [OFException exception]; if ([element elementForName: @"ver" namespace: XMPP_NS_ROSTERVER] != nil) _supportsRosterVersioning = YES; @@ -1219,14 +1210,13 @@ Idna_rc rc; if ((rc = idna_to_ascii_8z([domain_ UTF8String], &cDomain, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS) @throw [XMPPIDNATranslationFailedException - exceptionWithClass: [self class] - connection: self - operation: @"ToASCII" - string: domain_]; + exceptionWithConnection: self + operation: @"ToASCII" + string: domain_]; @try { ret = [[OFString alloc] initWithUTF8String: cDomain]; } @finally { free(cDomain); @@ -1251,12 +1241,12 @@ } - (void)setDataStorage: (id )dataStorage { if (_streamOpen) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class]]; + /* FIXME: Find a better exception! */ + @throw [OFInvalidArgumentException exception]; _dataStorage = dataStorage; } - (id )dataStorage