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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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