Adjust to recent ObjFW changes.

This commit is contained in:
Jonathan Schleifer 2011-09-23 01:38:03 +02:00
parent 74727c159c
commit df5e8f04b4
8 changed files with 139 additions and 133 deletions

View file

@ -98,10 +98,11 @@
if ((rc = stringprep_profile([username_ UTF8String], &node,
"SASLprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: self
profile: @"SASLprep"
string: username_];
@throw [XMPPStringPrepFailedException
exceptionWithClass: isa
connection: self
profile: @"SASLprep"
string: username_];
@try {
username = [[OFString alloc] initWithUTF8String: node];
@ -126,10 +127,10 @@
if ((rc = stringprep_profile([resource_ UTF8String], &res,
"Resourceprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException
newWithClass: isa
connection: self
profile: @"Resourceprep"
string: resource_];
exceptionWithClass: isa
connection: self
profile: @"Resourceprep"
string: resource_];
@try {
resource = [[OFString alloc] initWithUTF8String: res];
@ -154,10 +155,10 @@
if ((rc = idna_to_ascii_8z([server_ UTF8String],
&srv, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
@throw [XMPPIDNATranslationFailedException
newWithClass: isa
connection: self
operation: @"ToASCII"
string: server_];
exceptionWithClass: isa
connection: self
operation: @"ToASCII"
string: server_];
@try {
server = [[OFString alloc] initWithUTF8String: srv];
@ -181,10 +182,11 @@
if ((rc = stringprep_profile([domain_ UTF8String], &srv,
"Nameprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: self
profile: @"Nameprep"
string: domain_];
@throw [XMPPStringPrepFailedException
exceptionWithClass: isa
connection: self
profile: @"Nameprep"
string: domain_];
@try {
domain = [[OFString alloc] initWithUTF8String: srv];
@ -208,10 +210,11 @@
if ((rc = stringprep_profile([password_ UTF8String], &pass,
"SASLprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: self
profile: @"SASLprep"
string: password_];
@throw [XMPPStringPrepFailedException
exceptionWithClass: isa
connection: self
profile: @"SASLprep"
string: password_];
@try {
password = [[OFString alloc] initWithUTF8String: pass];
@ -244,10 +247,10 @@
if ((rc = idna_to_ascii_8z([domain UTF8String], &cDomainToASCII,
IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
@throw [XMPPIDNATranslationFailedException
newWithClass: isa
connection: self
operation: @"ToASCII"
string: domain];
exceptionWithClass: isa
connection: self
operation: @"ToASCII"
string: domain];
@try {
domainToASCII = [OFString
@ -260,7 +263,6 @@
SRVLookup = [XMPPSRVLookup
lookupWithDomain: domainToASCII];
} @catch (id e) {
[e release];
}
enumerator = [SRVLookup objectEnumerator];
@ -274,9 +276,7 @@
break;
} @catch (OFAddressTranslationFailedException
*e) {
[e release];
} @catch (OFConnectionFailedException *e) {
[e release];
}
} while ((candidate = [enumerator nextObject]) != nil);
} else
@ -569,10 +569,10 @@
elementForName: @"text"
namespace: XMPP_NS_XMPP_STREAM] stringValue];
@throw [XMPPStreamErrorException newWithClass: isa
connection: self
condition: condition
reason: reason];
@throw [XMPPStreamErrorException exceptionWithClass: isa
connection: self
condition: condition
reason: reason];
return;
}
@ -607,7 +607,7 @@
if ([[element name] isEqual: @"failure"])
/* TODO: Find/create an exception to throw here */
@throw [OFException newWithClass: isa];
@throw [OFException exceptionWithClass: isa];
assert(0);
}
@ -655,9 +655,9 @@
of_log(@"Auth failed!");
// FIXME: Do more parsing/handling
@throw [XMPPAuthFailedException
newWithClass: isa
connection: self
reason: [element XMLString]];
exceptionWithClass: isa
connection: self
reason: [element XMLString]];
}
assert(0);
@ -730,7 +730,7 @@
if (encryptionRequired && !encrypted)
/* TODO: Find/create an exception to throw here */
@throw [OFException newWithClass: isa];
@throw [OFException exceptionWithClass: isa];
if (mechs != nil) {
OFEnumerator *enumerator;

View file

@ -34,8 +34,8 @@
@property (readonly, nonatomic) XMPPConnection *connection;
#endif
+ newWithClass: (Class)class_
connection: (XMPPConnection*)conn;
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)conn;
- initWithClass: (Class)class_
connection: (XMPPConnection*)conn;
- (XMPPConnection*)connection;
@ -52,8 +52,8 @@
@property (readonly, nonatomic) OFString *reason;
#endif
+ newWithClass: (Class)class_
connection: (XMPPConnection*)conn
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)conn
condition: (OFString*)condition_
reason: (OFString*)reason_;
- initWithClass: (Class)class_
@ -74,10 +74,10 @@
@property (readonly, nonatomic) OFString *profile, *string;
#endif
+ newWithClass: (Class)class_
connection: (XMPPConnection*)conn
profile: (OFString*)profile
string: (OFString*)string;
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)conn
profile: (OFString*)profile
string: (OFString*)string;
- initWithClass: (Class)class_
connection: (XMPPConnection*)conn
profile: (OFString*)profile
@ -96,10 +96,10 @@
@property (readonly, nonatomic) OFString *operation, *string;
#endif
+ newWithClass: (Class)class_
connection: (XMPPConnection*)conn
operation: (OFString*)operation
string: (OFString*)string;
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)conn
operation: (OFString*)operation
string: (OFString*)string;
- initWithClass: (Class)class_
connection: (XMPPConnection*)conn
operation: (OFString*)operation
@ -117,9 +117,9 @@
@property (readonly, nonatomic) OFString *reason;
#endif
+ newWithClass: (Class)class_
connection: (XMPPConnection*)conn
reason: (OFString*)reason_;
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)conn
reason: (OFString*)reason_;
- initWithClass: (Class)class_
connection: (XMPPConnection*)conn
reason: (OFString*)reason_;

View file

@ -27,19 +27,19 @@
#import "XMPPExceptions.h"
@implementation XMPPException
+ newWithClass: (Class)class_
connection: (XMPPConnection*)conn
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)conn
{
return [[self alloc] initWithClass: class_
connection: conn];
return [[[self alloc] initWithClass: class_
connection: conn] autorelease];
}
- initWithClass: (Class)class_
{
Class c = isa;
[self release];
@throw [OFNotImplementedException newWithClass: c
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
- initWithClass: (Class)class_
@ -82,15 +82,15 @@
@end
@implementation XMPPStreamErrorException
+ newWithClass: (Class)class_
connection: (XMPPConnection*)conn
condition: (OFString*)condition_
reason: (OFString*)reason_;
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)conn
condition: (OFString*)condition_
reason: (OFString*)reason_;
{
return [[self alloc] initWithClass: class_
connection: conn
condition: condition_
reason: reason_];
return [[[self alloc] initWithClass: class_
connection: conn
condition: condition_
reason: reason_] autorelease];
}
- initWithClass: (Class)class_
@ -98,8 +98,8 @@
{
Class c = isa;
[self release];
@throw [OFNotImplementedException newWithClass: c
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
- initWithClass: (Class)class_
@ -152,15 +152,15 @@
@end
@implementation XMPPStringPrepFailedException
+ newWithClass: (Class)class_
connection: (XMPPConnection*)conn
profile: (OFString*)profile
string: (OFString*)string
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)conn
profile: (OFString*)profile
string: (OFString*)string
{
return [[self alloc] initWithClass: class_
connection: conn
profile: profile
string: string];
return [[[self alloc] initWithClass: class_
connection: conn
profile: profile
string: string] autorelease];
}
- initWithClass: (Class)class_
@ -168,8 +168,8 @@
{
Class c = isa;
[self release];
@throw [OFNotImplementedException newWithClass: c
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
- initWithClass: (Class)class_
@ -223,15 +223,15 @@
@end
@implementation XMPPIDNATranslationFailedException
+ newWithClass: (Class)class_
connection: (XMPPConnection*)conn
operation: (OFString*)operation
string: (OFString*)string
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)conn
operation: (OFString*)operation
string: (OFString*)string
{
return [[self alloc] initWithClass: class_
connection: conn
operation: operation
string: string];
return [[[self alloc] initWithClass: class_
connection: conn
operation: operation
string: string] autorelease];
}
- initWithClass: (Class)class_
@ -239,8 +239,8 @@
{
Class c = isa;
[self release];
@throw [OFNotImplementedException newWithClass: c
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
- initWithClass: (Class)class_
@ -293,13 +293,13 @@
@end
@implementation XMPPAuthFailedException
+ newWithClass: (Class)class_
connection: (XMPPConnection*)conn
reason: (OFString*)reason_;
+ exceptionWithClass: (Class)class_
connection: (XMPPConnection*)conn
reason: (OFString*)reason_;
{
return [[self alloc] initWithClass: class_
connection: conn
reason: reason_];
return [[[self alloc] initWithClass: class_
connection: conn
reason: reason_] autorelease];
}
- initWithClass: (Class)class_
@ -307,8 +307,8 @@
{
Class c = isa;
[self release];
@throw [OFNotImplementedException newWithClass: c
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
- initWithClass: (Class)class_

View file

@ -46,8 +46,9 @@
@try {
if (![type_ isEqual: @"get"] && ![type_ isEqual: @"set"] &&
![type_ isEqual: @"result"] && ![type_ isEqual: @"error"])
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
@throw [OFInvalidArgumentException
exceptionWithClass: isa
selector: _cmd];
} @catch (id e) {
[self release];
@throw e;

View file

@ -112,10 +112,11 @@
if ((rc = stringprep_profile([node_ UTF8String], &nodepart,
"Nodeprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: nil
profile: @"Nodeprep"
string: node_];
@throw [XMPPStringPrepFailedException
exceptionWithClass: isa
connection: nil
profile: @"Nodeprep"
string: node_];
@try {
node = [[OFString alloc] initWithUTF8String: nodepart];
@ -139,10 +140,11 @@
if ((rc = stringprep_profile([domain_ UTF8String], &srv,
"Nameprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: nil
profile: @"Nameprep"
string: domain_];
@throw [XMPPStringPrepFailedException
exceptionWithClass: isa
connection: nil
profile: @"Nameprep"
string: domain_];
@try {
domain = [[OFString alloc] initWithUTF8String: srv];
@ -173,10 +175,10 @@
if ((rc = stringprep_profile([resource_ UTF8String], &res,
"Resourceprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException
newWithClass: isa
connection: nil
profile: @"Resourceprep"
string: resource_];
exceptionWithClass: isa
connection: nil
profile: @"Resourceprep"
string: resource_];
@try {
resource = [[OFString alloc] initWithUTF8String: res];

View file

@ -231,9 +231,10 @@
if ([comp hasPrefix: @"r="]) {
if (![entry hasPrefix: cNonce])
@throw [XMPPAuthFailedException
newWithClass: isa
connection: nil
reason: @"Received wrong nonce"];
exceptionWithClass: isa
connection: nil
reason: @"Received wrong "
@"nonce"];
sNonce = entry;
got |= GOT_SNONCE;
@ -248,7 +249,7 @@
}
if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT))
@throw [OFInvalidServerReplyException newWithClass: isa];
@throw [OFInvalidServerReplyException exceptionWithClass: isa];
// Add c=<base64(GS2Header+channelBindingData)>
tmpArray = [OFDataArray dataArrayWithItemSize: 1];
@ -389,14 +390,15 @@
if ([mess hasPrefix: @"v="]) {
if (![value isEqual: [serverSignature stringByBase64Encoding]])
@throw [XMPPAuthFailedException
newWithClass: isa
connection: nil
reason: @"Received wrong ServerSignature"];
exceptionWithClass: isa
connection: nil
reason: @"Received wrong "
@"ServerSignature"];
authenticated = YES;
} else
@throw [XMPPAuthFailedException newWithClass: isa
connection: nil
reason: value];
@throw [XMPPAuthFailedException exceptionWithClass: isa
connection: nil
reason: value];
return nil;
}

View file

@ -59,8 +59,8 @@
{
Class c = isa;
[self release];
@throw [OFNotImplementedException newWithClass: c
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
- initWithPriority: (uint16_t)priority_
@ -100,7 +100,7 @@
if (dn_expand(ns_msg_base(handle), ns_msg_end(handle),
(uint8_t*)&rdata[3], buffer, NS_MAXDNAME) < 1)
@throw [OFInitializationFailedException
newWithClass: isa];
exceptionWithClass: isa];
target = [[OFString alloc]
initWithCString: buffer
@ -210,9 +210,9 @@
if (res_ninit(&resState))
@throw [OFAddressTranslationFailedException
newWithClass: isa
socket: nil
host: domain];
exceptionWithClass: isa
socket: nil
host: domain];
answer = [self allocMemoryWithSize: of_pagesize];
answerLen = res_nsearch(&resState, [request cStringWithEncoding:
@ -225,16 +225,16 @@
if (answerLen < 1 || answerLen > of_pagesize) {
@throw [OFAddressTranslationFailedException
newWithClass: isa
socket: nil
host: domain];
exceptionWithClass: isa
socket: nil
host: domain];
}
if (ns_initparse(answer, answerLen, &handle))
@throw [OFAddressTranslationFailedException
newWithClass: isa
socket: nil
host: domain];
exceptionWithClass: isa
socket: nil
host: domain];
resourceRecordCount = ns_msg_count(handle, ns_s_an);
for (i = 0; i < resourceRecordCount; i++) {

View file

@ -96,8 +96,9 @@
@try {
if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] &&
![name_ isEqual: @"presence"])
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
@throw [OFInvalidArgumentException
exceptionWithClass: isa
selector: _cmd];
[self setDefaultNamespace: XMPP_NS_CLIENT];
[self setPrefix: @"stream"