Prefix all ivars with an underscore.

This commit is contained in:
Jonathan Schleifer 2013-02-12 22:35:02 +01:00
parent f7999bda6a
commit 4a016c271f
36 changed files with 866 additions and 868 deletions

View file

@ -28,9 +28,9 @@
@interface XMPPAuthenticator: OFObject @interface XMPPAuthenticator: OFObject
{ {
/// \cond internal /// \cond internal
OFString *authzid; OFString *_authzid;
OFString *authcid; OFString *_authcid;
OFString *password; OFString *_password;
/// \endcond /// \endcond
} }

View file

@ -27,24 +27,24 @@
#import "XMPPAuthenticator.h" #import "XMPPAuthenticator.h"
@implementation XMPPAuthenticator @implementation XMPPAuthenticator
- initWithAuthcid: (OFString*)authcid_ - initWithAuthcid: (OFString*)authcid
password: (OFString*)password_ password: (OFString*)password
{ {
return [self initWithAuthzid: nil return [self initWithAuthzid: nil
authcid: authcid_ authcid: authcid
password: password_]; password: password];
} }
- initWithAuthzid: (OFString*)authzid_ - initWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid_ authcid: (OFString*)authcid
password: (OFString*)password_ password: (OFString*)password
{ {
self = [super init]; self = [super init];
@try { @try {
authzid = [authzid_ copy]; _authzid = [authzid copy];
authcid = [authcid_ copy]; _authcid = [authcid copy];
password = [password_ copy]; _password = [password copy];
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@throw e; @throw e;
@ -55,41 +55,41 @@
- (void)dealloc - (void)dealloc
{ {
[authzid release]; [_authzid release];
[authcid release]; [_authcid release];
[password release]; [_password release];
[super dealloc]; [super dealloc];
} }
- (void)setAuthzid: (OFString*)authzid_ - (void)setAuthzid: (OFString*)authzid
{ {
OF_SETTER(authzid, authzid_, YES, YES) OF_SETTER(_authzid, authzid, YES, YES)
} }
- (OFString*)authzid - (OFString*)authzid
{ {
OF_GETTER(authzid, YES) OF_GETTER(_authzid, YES)
} }
- (void)setAuthcid: (OFString*)authcid_ - (void)setAuthcid: (OFString*)authcid
{ {
OF_SETTER(authcid, authcid_, YES, YES) OF_SETTER(_authcid, authcid, YES, YES)
} }
- (OFString*)authcid - (OFString*)authcid
{ {
OF_GETTER(authcid, YES) OF_GETTER(_authcid, YES)
} }
- (void)setPassword: (OFString*)password_ - (void)setPassword: (OFString*)password
{ {
OF_SETTER(password, password_, YES, YES) OF_SETTER(_password, password, YES, YES)
} }
- (OFString*)password - (OFString*)password
{ {
OF_GETTER(password, YES) OF_GETTER(_password, YES)
} }
- (OFDataArray*)initialMessage - (OFDataArray*)initialMessage

View file

@ -31,8 +31,8 @@ typedef void(^xmpp_callback_block_t)(XMPPConnection*, XMPPIQ*);
@interface XMPPCallback: OFObject @interface XMPPCallback: OFObject
{ {
id target; id _target;
SEL selector; SEL _selector;
#ifdef OF_HAVE_BLOCKS #ifdef OF_HAVE_BLOCKS
xmpp_callback_block_t block; xmpp_callback_block_t block;
#endif #endif

View file

@ -60,15 +60,15 @@
{ {
self = [super init]; self = [super init];
target = [target_ retain]; _target = [target_ retain];
selector = selector_; _selector = selector_;
return self; return self;
} }
- (void)dealloc - (void)dealloc
{ {
[target release]; [_target release];
#ifdef OF_HAVE_BLOCKS #ifdef OF_HAVE_BLOCKS
[block release]; [block release];
#endif #endif
@ -84,7 +84,7 @@
block(connection, iq); block(connection, iq);
else else
#endif #endif
[target performSelector: selector [_target performSelector: _selector
withObject: connection withObject: connection
withObject: iq]; withObject: iq];
} }

View file

@ -153,25 +153,25 @@
#endif #endif
{ {
/// \cond internal /// \cond internal
id sock; id _socket;
OFXMLParser *parser, *oldParser; OFXMLParser *_parser, *_oldParser;
OFXMLElementBuilder *elementBuilder, *oldElementBuilder; OFXMLElementBuilder *_elementBuilder, *_oldElementBuilder;
OFString *username, *password, *server, *resource; OFString *_username, *_password, *_server, *_resource;
OFString *privateKeyFile, *certificateFile; OFString *_privateKeyFile, *_certificateFile;
OFString *domain, *domainToASCII; OFString *_domain, *_domainToASCII;
XMPPJID *JID; XMPPJID *_JID;
uint16_t port; uint16_t _port;
id <XMPPStorage> dataStorage; id <XMPPStorage> _dataStorage;
OFString *language; OFString *_language;
XMPPMulticastDelegate *delegates; XMPPMulticastDelegate *_delegates;
OFMutableDictionary *callbacks; OFMutableDictionary *_callbacks;
XMPPAuthenticator *authModule; XMPPAuthenticator *_authModule;
BOOL streamOpen; BOOL _streamOpen;
BOOL needsSession; BOOL _needsSession;
BOOL encryptionRequired, encrypted; BOOL _encryptionRequired, _encrypted;
BOOL supportsRosterVersioning; BOOL _supportsRosterVersioning;
BOOL supportsStreamManagement; BOOL _supportsStreamManagement;
unsigned int lastID; unsigned int _lastID;
/// \endcond /// \endcond
} }
@ -203,7 +203,7 @@
/// \brief An object for data storage, conforming to the XMPPStorage protocol /// \brief An object for data storage, conforming to the XMPPStorage protocol
@property (assign) id <XMPPStorage> dataStorage; @property (assign) id <XMPPStorage> dataStorage;
/// \brief The socket used for the connection /// \brief The socket used for the connection
@property (readonly, retain, getter=socket) OFTCPSocket *sock; @property (readonly, retain) OFTCPSocket *socket;
/// \brief Whether encryption is required /// \brief Whether encryption is required
@property BOOL encryptionRequired; @property BOOL encryptionRequired;
/// \brief Whether the connection is encrypted /// \brief Whether the connection is encrypted

View file

@ -127,11 +127,11 @@
self = [super init]; self = [super init];
@try { @try {
port = 5222; _port = 5222;
encrypted = NO; _encrypted = NO;
streamOpen = NO; _streamOpen = NO;
delegates = [[XMPPMulticastDelegate alloc] init]; _delegates = [[XMPPMulticastDelegate alloc] init];
callbacks = [[OFMutableDictionary alloc] init]; _callbacks = [[OFMutableDictionary alloc] init];
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@throw e; @throw e;
@ -142,109 +142,109 @@
- (void)dealloc - (void)dealloc
{ {
[sock release]; [_socket release];
[parser release]; [_parser release];
[elementBuilder release]; [_elementBuilder release];
[username release]; [_username release];
[password release]; [_password release];
[privateKeyFile release]; [_privateKeyFile release];
[certificateFile release]; [_certificateFile release];
[server release]; [_server release];
[domain release]; [_domain release];
[resource release]; [_resource release];
[JID release]; [_JID release];
[delegates release]; [_delegates release];
[callbacks release]; [_callbacks release];
[authModule release]; [_authModule release];
[super dealloc]; [super dealloc];
} }
- (void)setUsername: (OFString*)username_ - (void)setUsername: (OFString*)username
{ {
OFString *old = username; OFString *old = _username;
if (username_ != nil) { if (username != nil) {
char *node; char *node;
Stringprep_rc rc; Stringprep_rc rc;
if ((rc = stringprep_profile([username_ UTF8String], &node, if ((rc = stringprep_profile([username UTF8String], &node,
"SASLprep", 0)) != STRINGPREP_OK) "SASLprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: [self class] exceptionWithClass: [self class]
connection: self connection: self
profile: @"SASLprep" profile: @"SASLprep"
string: username_]; string: username];
@try { @try {
username = [[OFString alloc] initWithUTF8String: node]; _username = [[OFString alloc] initWithUTF8String: node];
} @finally { } @finally {
free(node); free(node);
} }
} else } else
username = nil; _username = nil;
[old release]; [old release];
} }
- (OFString*)username - (OFString*)username
{ {
return [[username copy] autorelease]; return [[_username copy] autorelease];
} }
- (void)setResource: (OFString*)resource_ - (void)setResource: (OFString*)resource
{ {
OFString *old = resource; OFString *old = _resource;
if (resource_ != nil) { if (resource != nil) {
char *res; char *res;
Stringprep_rc rc; Stringprep_rc rc;
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
exceptionWithClass: [self class] exceptionWithClass: [self class]
connection: self connection: self
profile: @"Resourceprep" profile: @"Resourceprep"
string: resource_]; string: resource];
@try { @try {
resource = [[OFString alloc] initWithUTF8String: res]; _resource = [[OFString alloc] initWithUTF8String: res];
} @finally { } @finally {
free(res); free(res);
} }
} else } else
resource = nil; _resource = nil;
[old release]; [old release];
} }
- (OFString*)resource - (OFString*)resource
{ {
return [[resource copy] autorelease]; return [[_resource copy] autorelease];
} }
- (void)setServer: (OFString*)server_ - (void)setServer: (OFString*)server
{ {
OFString *old = server; OFString *old = _server;
if (server_ != nil) if (server != nil)
server = [self XMPP_IDNAToASCII: server_]; _server = [self XMPP_IDNAToASCII: server];
else else
server = nil; _server = nil;
[old release]; [old release];
} }
- (OFString*)server - (OFString*)server
{ {
return [[server copy] autorelease]; return [[_server copy] autorelease];
} }
- (void)setDomain: (OFString*)domain_ - (void)setDomain: (OFString*)domain_
{ {
OFString *oldDomain = domain; OFString *oldDomain = _domain;
OFString *oldDomainToASCII = domainToASCII; OFString *oldDomainToASCII = _domainToASCII;
if (domain_ != nil) { if (domain_ != nil) {
char *srv; char *srv;
@ -259,15 +259,15 @@
string: domain_]; string: domain_];
@try { @try {
domain = [[OFString alloc] initWithUTF8String: srv]; _domain = [[OFString alloc] initWithUTF8String: srv];
} @finally { } @finally {
free(srv); free(srv);
} }
domainToASCII = [self XMPP_IDNAToASCII: domain]; _domainToASCII = [self XMPP_IDNAToASCII: _domain];
} else { } else {
domain = nil; _domain = nil;
domainToASCII = nil; _domainToASCII = nil;
} }
[oldDomain release]; [oldDomain release];
@ -276,59 +276,59 @@
- (OFString*)domain - (OFString*)domain
{ {
return [[domain copy] autorelease]; return [[_domain copy] autorelease];
} }
- (void)setPassword: (OFString*)password_ - (void)setPassword: (OFString*)password
{ {
OFString *old = password; OFString *old = _password;
if (password_ != nil) { if (password != nil) {
char *pass; char *pass;
Stringprep_rc rc; Stringprep_rc rc;
if ((rc = stringprep_profile([password_ UTF8String], &pass, if ((rc = stringprep_profile([password UTF8String], &pass,
"SASLprep", 0)) != STRINGPREP_OK) "SASLprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: [self class] exceptionWithClass: [self class]
connection: self connection: self
profile: @"SASLprep" profile: @"SASLprep"
string: password_]; string: password];
@try { @try {
password = [[OFString alloc] initWithUTF8String: pass]; _password = [[OFString alloc] initWithUTF8String: pass];
} @finally { } @finally {
free(pass); free(pass);
} }
} else } else
password = nil; _password = nil;
[old release]; [old release];
} }
- (OFString*)password - (OFString*)password
{ {
return [[password copy] autorelease]; return [[_password copy] autorelease];
} }
- (void)setPrivateKeyFile: (OFString*)file - (void)setPrivateKeyFile: (OFString*)privateKeyFile
{ {
OF_SETTER(privateKeyFile, file, YES, YES) OF_SETTER(_privateKeyFile, privateKeyFile, YES, YES)
} }
- (OFString*)privateKeyFile - (OFString*)privateKeyFile
{ {
OF_GETTER(privateKeyFile, YES) OF_GETTER(_privateKeyFile, YES)
} }
- (void)setCertificateFile: (OFString*)file - (void)setCertificateFile: (OFString*)certificateFile
{ {
OF_SETTER(certificateFile, file, YES, YES) OF_SETTER(_certificateFile, certificateFile, YES, YES)
} }
- (OFString*)certificateFile - (OFString*)certificateFile
{ {
OF_GETTER(certificateFile, YES) OF_GETTER(_certificateFile, YES)
} }
- (void)connect - (void)connect
@ -338,19 +338,19 @@
XMPPSRVLookup *SRVLookup = nil; XMPPSRVLookup *SRVLookup = nil;
OFEnumerator *enumerator; OFEnumerator *enumerator;
if (sock != nil) if (_socket != nil)
@throw [OFAlreadyConnectedException @throw [OFAlreadyConnectedException
exceptionWithClass: [self class]]; exceptionWithClass: [self class]];
sock = [[OFTCPSocket alloc] init]; _socket = [[OFTCPSocket alloc] init];
if (server) if (_server)
[sock connectToHost: server [_socket connectToHost: _server
port: port]; port: _port];
else { else {
@try { @try {
SRVLookup = [XMPPSRVLookup SRVLookup = [XMPPSRVLookup
lookupWithDomain: domainToASCII]; lookupWithDomain: _domainToASCII];
} @catch (id e) { } @catch (id e) {
} }
@ -360,7 +360,8 @@
if ((candidate = [enumerator nextObject]) != nil) { if ((candidate = [enumerator nextObject]) != nil) {
do { do {
@try { @try {
[sock connectToHost: [candidate target] [_socket
connectToHost: [candidate target]
port: [candidate port]]; port: [candidate port]];
break; break;
} @catch (OFAddressTranslationFailedException } @catch (OFAddressTranslationFailedException
@ -370,8 +371,8 @@
} while ((candidate = [enumerator nextObject]) != nil); } while ((candidate = [enumerator nextObject]) != nil);
} else } else
/* No SRV records -> fall back to A / AAAA record */ /* No SRV records -> fall back to A / AAAA record */
[sock connectToHost: domainToASCII [_socket connectToHost: _domainToASCII
port: port]; port: _port];
} }
[self XMPP_startStream]; [self XMPP_startStream];
@ -383,7 +384,7 @@
{ {
char *buffer = [self allocMemoryWithSize: BUFFER_LENGTH]; char *buffer = [self allocMemoryWithSize: BUFFER_LENGTH];
[sock asyncReadIntoBuffer: buffer [_socket asyncReadIntoBuffer: buffer
length: BUFFER_LENGTH length: BUFFER_LENGTH
target: self target: self
selector: @selector(stream:didReadIntoBuffer:length: selector: @selector(stream:didReadIntoBuffer:length:
@ -404,14 +405,14 @@
- (BOOL)XMPP_parseBuffer: (const void*)buffer - (BOOL)XMPP_parseBuffer: (const void*)buffer
length: (size_t)length length: (size_t)length
{ {
if ([sock isAtEndOfStream]) { if ([_socket isAtEndOfStream]) {
[delegates broadcastSelector: @selector(connectionWasClosed:) [_delegates broadcastSelector: @selector(connectionWasClosed:)
withObject: self]; withObject: self];
return NO; return NO;
} }
@try { @try {
[parser parseBuffer: buffer [_parser parseBuffer: buffer
length: length]; length: length];
} @catch (OFMalformedXMLException *e) { } @catch (OFMalformedXMLException *e) {
[self XMPP_sendStreamError: @"bad-format" [self XMPP_sendStreamError: @"bad-format"
@ -429,11 +430,11 @@
[self XMPP_parseBuffer: buffer [self XMPP_parseBuffer: buffer
length: length]; length: length];
[oldParser release]; [_oldParser release];
[oldElementBuilder release]; [_oldElementBuilder release];
oldParser = nil; _oldParser = nil;
oldElementBuilder = nil; _oldElementBuilder = nil;
} }
- (BOOL)stream: (OFStream*)stream - (BOOL)stream: (OFStream*)stream
@ -442,7 +443,7 @@
exception: (OFException*)exception exception: (OFException*)exception
{ {
if (exception != nil) { if (exception != nil) {
[delegates broadcastSelector: @selector(connection: [_delegates broadcastSelector: @selector(connection:
didThrowException:) didThrowException:)
withObject: self withObject: self
withObject: exception]; withObject: exception];
@ -455,7 +456,7 @@
length: length]) length: length])
return NO; return NO;
} @catch (id e) { } @catch (id e) {
[delegates broadcastSelector: @selector(connection: [_delegates broadcastSelector: @selector(connection:
didThrowException:) didThrowException:)
withObject: self withObject: self
withObject: e]; withObject: e];
@ -463,18 +464,19 @@
return NO; return NO;
} }
if (oldParser != nil || oldElementBuilder != nil) { if (_oldParser != nil || _oldElementBuilder != nil) {
[oldParser release]; [_oldParser release];
[oldElementBuilder release]; [_oldElementBuilder release];
oldParser = nil; _oldParser = nil;
oldElementBuilder = nil; _oldElementBuilder = nil;
[sock asyncReadIntoBuffer: buffer [_socket asyncReadIntoBuffer: buffer
length: BUFFER_LENGTH length: BUFFER_LENGTH
target: self target: self
selector: @selector(stream:didReadIntoBuffer: selector: @selector(stream:
length:exception:)]; didReadIntoBuffer:length:
exception:)];
return NO; return NO;
} }
@ -484,37 +486,37 @@
- (OFTCPSocket*)socket - (OFTCPSocket*)socket
{ {
return [[sock retain] autorelease]; return [[_socket retain] autorelease];
} }
- (BOOL)encryptionRequired - (BOOL)encryptionRequired
{ {
return encryptionRequired; return _encryptionRequired;
} }
- (void)setEncryptionRequired: (BOOL)required - (void)setEncryptionRequired: (BOOL)encryptionRequired
{ {
encryptionRequired = required; _encryptionRequired = encryptionRequired;
} }
- (BOOL)encrypted - (BOOL)encrypted
{ {
return encrypted; return _encrypted;
} }
- (BOOL)streamOpen - (BOOL)streamOpen
{ {
return streamOpen; return _streamOpen;
} }
- (BOOL)supportsRosterVersioning - (BOOL)supportsRosterVersioning
{ {
return supportsRosterVersioning; return _supportsRosterVersioning;
} }
- (BOOL)supportsStreamManagement - (BOOL)supportsStreamManagement
{ {
return supportsStreamManagement; return _supportsStreamManagement;
} }
- (BOOL)checkCertificateAndGetReason: (OFString**)reason - (BOOL)checkCertificateAndGetReason: (OFString**)reason
@ -524,7 +526,7 @@
BOOL serviceSpecific = NO; BOOL serviceSpecific = NO;
@try { @try {
[sock verifyPeerCertificate]; [_socket verifyPeerCertificate];
} @catch (SSLInvalidCertificateException *e) { } @catch (SSLInvalidCertificateException *e) {
if (reason != NULL) if (reason != NULL)
*reason = [[[e reason] copy] autorelease]; *reason = [[[e reason] copy] autorelease];
@ -532,7 +534,7 @@
return NO; return NO;
} }
cert = [sock peerCertificate]; cert = [_socket peerCertificate];
SANs = [cert subjectAlternativeName]; SANs = [cert subjectAlternativeName];
if ([[SANs objectForKey: @"otherName"] if ([[SANs objectForKey: @"otherName"]
@ -541,13 +543,13 @@
[SANs objectForKey: @"uniformResourceIdentifier"] != nil) [SANs objectForKey: @"uniformResourceIdentifier"] != nil)
serviceSpecific = YES; serviceSpecific = YES;
if ([cert hasSRVNameMatchingDomain: domainToASCII if ([cert hasSRVNameMatchingDomain: _domainToASCII
service: @"xmpp-client"] || service: @"xmpp-client"] ||
[cert hasDNSNameMatchingDomain: domainToASCII]) [cert hasDNSNameMatchingDomain: _domainToASCII])
return YES; return YES;
if (!serviceSpecific && if (!serviceSpecific &&
[cert hasCommonNameMatchingDomain: domainToASCII]) [cert hasCommonNameMatchingDomain: _domainToASCII])
return YES; return YES;
return NO; return NO;
@ -555,11 +557,11 @@
- (void)sendStanza: (OFXMLElement*)element - (void)sendStanza: (OFXMLElement*)element
{ {
[delegates broadcastSelector: @selector(connection:didSendElement:) [_delegates broadcastSelector: @selector(connection:didSendElement:)
withObject: self withObject: self
withObject: element]; withObject: element];
[sock writeString: [element XMLString]]; [_socket writeString: [element XMLString]];
} }
- (void)sendIQ: (XMPPIQ*)iq - (void)sendIQ: (XMPPIQ*)iq
@ -575,7 +577,7 @@
pool = [[OFAutoreleasePool alloc] init]; pool = [[OFAutoreleasePool alloc] init];
callback = [XMPPCallback callbackWithTarget: target callback = [XMPPCallback callbackWithTarget: target
selector: selector]; selector: selector];
[callbacks setObject: callback [_callbacks setObject: callback
forKey: [iq ID]]; forKey: [iq ID]];
[pool release]; [pool release];
@ -594,7 +596,7 @@
pool = [[OFAutoreleasePool alloc] init]; pool = [[OFAutoreleasePool alloc] init];
callback = [XMPPCallback callbackWithBlock: block]; callback = [XMPPCallback callbackWithBlock: block];
[callbacks setObject: callback [_callbacks setObject: callback
forKey: [iq ID]]; forKey: [iq ID]];
[pool release]; [pool release];
@ -604,7 +606,7 @@
- (OFString*)generateStanzaID - (OFString*)generateStanzaID
{ {
return [OFString stringWithFormat: @"objxmpp_%u", lastID++]; return [OFString stringWithFormat: @"objxmpp_%u", _lastID++];
} }
- (void)parser: (OFXMLParser*)p - (void)parser: (OFXMLParser*)p
@ -619,7 +621,7 @@
if (![name isEqual: @"stream"]) { if (![name isEqual: @"stream"]) {
// No dedicated stream error for this, may not even be XMPP // No dedicated stream error for this, may not even be XMPP
[self close]; [self close];
[sock close]; [_socket close];
return; return;
} }
@ -638,7 +640,7 @@
enumerator = [attributes objectEnumerator]; enumerator = [attributes objectEnumerator];
while ((attribute = [enumerator nextObject]) != nil) { while ((attribute = [enumerator nextObject]) != nil) {
if ([[attribute name] isEqual: @"from"] && if ([[attribute name] isEqual: @"from"] &&
![[attribute stringValue] isEqual: domain]) { ![[attribute stringValue] isEqual: _domain]) {
[self XMPP_sendStreamError: @"invalid-from" [self XMPP_sendStreamError: @"invalid-from"
text: nil]; text: nil];
return; return;
@ -651,7 +653,7 @@
} }
} }
[parser setDelegate: elementBuilder]; [_parser setDelegate: _elementBuilder];
} }
- (void)elementBuilder: (OFXMLElementBuilder*)builder - (void)elementBuilder: (OFXMLElementBuilder*)builder
@ -665,7 +667,7 @@
[element setPrefix: @"stream" [element setPrefix: @"stream"
forNamespace: XMPP_NS_STREAM]; forNamespace: XMPP_NS_STREAM];
[delegates broadcastSelector: @selector(connection:didReceiveElement:) [_delegates broadcastSelector: @selector(connection:didReceiveElement:)
withObject: self withObject: self
withObject: element]; withObject: element];
@ -702,54 +704,54 @@
OFString *langString = @""; OFString *langString = @"";
/* Make sure we don't get any old events */ /* Make sure we don't get any old events */
[parser setDelegate: nil]; [_parser setDelegate: nil];
[elementBuilder setDelegate: nil]; [_elementBuilder setDelegate: nil];
/* /*
* We can't release them now, as we are currently inside them. Release * We can't release them now, as we are currently inside them. Release
* them the next time the parser returns. * them the next time the parser returns.
*/ */
oldParser = parser; _oldParser = _parser;
oldElementBuilder = elementBuilder; _oldElementBuilder = _elementBuilder;
parser = [[OFXMLParser alloc] init]; _parser = [[OFXMLParser alloc] init];
[parser setDelegate: self]; [_parser setDelegate: self];
elementBuilder = [[XMPPXMLElementBuilder alloc] init]; _elementBuilder = [[XMPPXMLElementBuilder alloc] init];
[elementBuilder setDelegate: self]; [_elementBuilder setDelegate: self];
if (language != nil) if (_language != nil)
langString = [OFString stringWithFormat: @"xml:lang='%@' ", langString = [OFString stringWithFormat: @"xml:lang='%@' ",
language]; _language];
[sock writeFormat: @"<?xml version='1.0'?>\n" [_socket writeFormat: @"<?xml version='1.0'?>\n"
@"<stream:stream to='%@' " @"<stream:stream to='%@' "
@"xmlns='" XMPP_NS_CLIENT @"' " @"xmlns='" XMPP_NS_CLIENT @"' "
@"xmlns:stream='" XMPP_NS_STREAM @"' %@" @"xmlns:stream='" XMPP_NS_STREAM @"' %@"
@"version='1.0'>", domain, langString]; @"version='1.0'>", _domain, langString];
streamOpen = YES; _streamOpen = YES;
} }
- (void)close - (void)close
{ {
if (streamOpen) if (_streamOpen)
[sock writeString: @"</stream:stream>"]; [_socket writeString: @"</stream:stream>"];
[oldParser release]; [_oldParser release];
oldParser = nil; _oldParser = nil;
[oldElementBuilder release]; [_oldElementBuilder release];
oldElementBuilder = nil; _oldElementBuilder = nil;
[authModule release]; [_authModule release];
authModule = nil; _authModule = nil;
[sock release]; [_socket release];
sock = nil; _socket = nil;
[JID release]; [_JID release];
JID = nil; _JID = nil;
streamOpen = needsSession = encrypted = NO; _streamOpen = _needsSession = _encrypted = NO;
supportsRosterVersioning = supportsStreamManagement = NO; _supportsRosterVersioning = _supportsStreamManagement = NO;
lastID = 0; _lastID = 0;
} }
- (void)XMPP_handleStanza: (OFXMLElement*)element - (void)XMPP_handleStanza: (OFXMLElement*)element
@ -786,7 +788,7 @@
if ([[element name] isEqual: @"error"]) { if ([[element name] isEqual: @"error"]) {
OFString *condition, *reason; OFString *condition, *reason;
[self close]; [self close];
[sock close]; // Remote has already closed his stream [_socket close]; // Remote has already closed his stream
if ([element elementForName: @"bad-format" if ([element elementForName: @"bad-format"
namespace: XMPP_NS_XMPP_STREAM]) namespace: XMPP_NS_XMPP_STREAM])
@ -887,19 +889,19 @@
/* FIXME: Catch errors here */ /* FIXME: Catch errors here */
SSLSocket *newSock; SSLSocket *newSock;
[delegates broadcastSelector: @selector( [_delegates broadcastSelector: @selector(
connectionWillUpgradeToTLS:) connectionWillUpgradeToTLS:)
withObject: self]; withObject: self];
newSock = [[SSLSocket alloc] initWithSocket: sock newSock = [[SSLSocket alloc] initWithSocket: _socket
privateKeyFile: privateKeyFile privateKeyFile: _privateKeyFile
certificateFile: certificateFile]; certificateFile: _certificateFile];
[sock release]; [_socket release];
sock = newSock; _socket = newSock;
encrypted = YES; _encrypted = YES;
[delegates broadcastSelector: @selector( [_delegates broadcastSelector: @selector(
connectionDidUpgradeToTLS:) connectionDidUpgradeToTLS:)
withObject: self]; withObject: self];
@ -922,7 +924,7 @@
OFXMLElement *responseTag; OFXMLElement *responseTag;
OFDataArray *challenge = [OFDataArray OFDataArray *challenge = [OFDataArray
dataArrayWithBase64EncodedString: [element stringValue]]; dataArrayWithBase64EncodedString: [element stringValue]];
OFDataArray *response = [authModule OFDataArray *response = [_authModule
continueWithData: challenge]; continueWithData: challenge];
responseTag = [OFXMLElement elementWithName: @"response" responseTag = [OFXMLElement elementWithName: @"response"
@ -940,10 +942,10 @@
} }
if ([[element name] isEqual: @"success"]) { if ([[element name] isEqual: @"success"]) {
[authModule continueWithData: [OFDataArray [_authModule continueWithData: [OFDataArray
dataArrayWithBase64EncodedString: [element stringValue]]]; dataArrayWithBase64EncodedString: [element stringValue]]];
[delegates broadcastSelector: @selector( [_delegates broadcastSelector: @selector(
connectionWasAuthenticated:) connectionWasAuthenticated:)
withObject: self]; withObject: self];
@ -970,14 +972,14 @@
BOOL handled = NO; BOOL handled = NO;
XMPPCallback *callback; XMPPCallback *callback;
if ((callback = [callbacks objectForKey: [iq ID]])) { if ((callback = [_callbacks objectForKey: [iq ID]])) {
[callback runWithIQ: iq [callback runWithIQ: iq
connection: self]; connection: self];
[callbacks removeObjectForKey: [iq ID]]; [_callbacks removeObjectForKey: [iq ID]];
return; return;
} }
handled = [delegates broadcastSelector: @selector( handled = [_delegates broadcastSelector: @selector(
connection:didReceiveIQ:) connection:didReceiveIQ:)
withObject: self withObject: self
withObject: iq]; withObject: iq];
@ -991,21 +993,21 @@
- (void)XMPP_handleMessage: (XMPPMessage*)message - (void)XMPP_handleMessage: (XMPPMessage*)message
{ {
[delegates broadcastSelector: @selector(connection:didReceiveMessage:) [_delegates broadcastSelector: @selector(connection:didReceiveMessage:)
withObject: self withObject: self
withObject: message]; withObject: message];
} }
- (void)XMPP_handlePresence: (XMPPPresence*)presence - (void)XMPP_handlePresence: (XMPPPresence*)presence
{ {
[delegates broadcastSelector: @selector(connection:didReceivePresence:) [_delegates broadcastSelector: @selector(connection:didReceivePresence:)
withObject: self withObject: self
withObject: presence]; withObject: presence];
} }
- (void)XMPP_handleFeatures: (OFXMLElement*)element - (void)XMPP_handleFeatures: (OFXMLElement*)element
{ {
OFXMLElement *starttls = [element elementForName: @"starttls" OFXMLElement *startTLS = [element elementForName: @"starttls"
namespace: XMPP_NS_STARTTLS]; namespace: XMPP_NS_STARTTLS];
OFXMLElement *bind = [element elementForName: @"bind" OFXMLElement *bind = [element elementForName: @"bind"
namespace: XMPP_NS_BIND]; namespace: XMPP_NS_BIND];
@ -1015,24 +1017,24 @@
namespace: XMPP_NS_SASL]; namespace: XMPP_NS_SASL];
OFMutableSet *mechanisms = [OFMutableSet set]; OFMutableSet *mechanisms = [OFMutableSet set];
if (!encrypted && starttls != nil) { if (!_encrypted && startTLS != nil) {
[self sendStanza: [self sendStanza:
[OFXMLElement elementWithName: @"starttls" [OFXMLElement elementWithName: @"starttls"
namespace: XMPP_NS_STARTTLS]]; namespace: XMPP_NS_STARTTLS]];
return; return;
} }
if (encryptionRequired && !encrypted) if (_encryptionRequired && !_encrypted)
/* TODO: Find/create an exception to throw here */ /* TODO: Find/create an exception to throw here */
@throw [OFException exceptionWithClass: [self class]]; @throw [OFException exceptionWithClass: [self class]];
if ([element elementForName: @"ver" if ([element elementForName: @"ver"
namespace: XMPP_NS_ROSTERVER] != nil) namespace: XMPP_NS_ROSTERVER] != nil)
supportsRosterVersioning = YES; _supportsRosterVersioning = YES;
if ([element elementForName: @"sm" if ([element elementForName: @"sm"
namespace: XMPP_NS_SM] != nil) namespace: XMPP_NS_SM] != nil)
supportsStreamManagement = YES; _supportsStreamManagement = YES;
if (mechs != nil) { if (mechs != nil) {
OFEnumerator *enumerator; OFEnumerator *enumerator;
@ -1042,17 +1044,17 @@
while ((mech = [enumerator nextObject]) != nil) while ((mech = [enumerator nextObject]) != nil)
[mechanisms addObject: [mech stringValue]]; [mechanisms addObject: [mech stringValue]];
if (privateKeyFile && certificateFile && if (_privateKeyFile && _certificateFile &&
[mechanisms containsObject: @"EXTERNAL"]) { [mechanisms containsObject: @"EXTERNAL"]) {
authModule = [[XMPPEXTERNALAuth alloc] init]; _authModule = [[XMPPEXTERNALAuth alloc] init];
[self XMPP_sendAuth: @"EXTERNAL"]; [self XMPP_sendAuth: @"EXTERNAL"];
return; return;
} }
if ([mechanisms containsObject: @"SCRAM-SHA-1-PLUS"]) { if ([mechanisms containsObject: @"SCRAM-SHA-1-PLUS"]) {
authModule = [[XMPPSCRAMAuth alloc] _authModule = [[XMPPSCRAMAuth alloc]
initWithAuthcid: username initWithAuthcid: _username
password: password password: _password
connection: self connection: self
hash: [OFSHA1Hash class] hash: [OFSHA1Hash class]
plusAvailable: YES]; plusAvailable: YES];
@ -1061,9 +1063,9 @@
} }
if ([mechanisms containsObject: @"SCRAM-SHA-1"]) { if ([mechanisms containsObject: @"SCRAM-SHA-1"]) {
authModule = [[XMPPSCRAMAuth alloc] _authModule = [[XMPPSCRAMAuth alloc]
initWithAuthcid: username initWithAuthcid: _username
password: password password: _password
connection: self connection: self
hash: [OFSHA1Hash class] hash: [OFSHA1Hash class]
plusAvailable: NO]; plusAvailable: NO];
@ -1071,10 +1073,10 @@
return; return;
} }
if ([mechanisms containsObject: @"PLAIN"] && encrypted) { if ([mechanisms containsObject: @"PLAIN"] && _encrypted) {
authModule = [[XMPPPLAINAuth alloc] _authModule = [[XMPPPLAINAuth alloc]
initWithAuthcid: username initWithAuthcid: _username
password: password]; password: _password];
[self XMPP_sendAuth: @"PLAIN"]; [self XMPP_sendAuth: @"PLAIN"];
return; return;
} }
@ -1083,7 +1085,7 @@
} }
if (session != nil) if (session != nil)
needsSession = YES; _needsSession = YES;
if (bind != nil) { if (bind != nil) {
[self XMPP_sendResourceBind]; [self XMPP_sendResourceBind];
@ -1096,7 +1098,7 @@
- (void)XMPP_sendAuth: (OFString*)authName - (void)XMPP_sendAuth: (OFString*)authName
{ {
OFXMLElement *authTag; OFXMLElement *authTag;
OFDataArray *initialMessage = [authModule initialMessage]; OFDataArray *initialMessage = [_authModule initialMessage];
authTag = [OFXMLElement elementWithName: @"auth" authTag = [OFXMLElement elementWithName: @"auth"
namespace: XMPP_NS_SASL]; namespace: XMPP_NS_SASL];
@ -1115,23 +1117,23 @@
- (void)XMPP_sendResourceBind - (void)XMPP_sendResourceBind
{ {
XMPPIQ *iq; XMPPIQ *IQ;
OFXMLElement *bind; OFXMLElement *bind;
iq = [XMPPIQ IQWithType: @"set" IQ = [XMPPIQ IQWithType: @"set"
ID: [self generateStanzaID]]; ID: [self generateStanzaID]];
bind = [OFXMLElement elementWithName: @"bind" bind = [OFXMLElement elementWithName: @"bind"
namespace: XMPP_NS_BIND]; namespace: XMPP_NS_BIND];
if (resource != nil) if (_resource != nil)
[bind addChild: [OFXMLElement elementWithName: @"resource" [bind addChild: [OFXMLElement elementWithName: @"resource"
namespace: XMPP_NS_BIND namespace: XMPP_NS_BIND
stringValue: resource]]; stringValue: _resource]];
[iq addChild: bind]; [IQ addChild: bind];
[self sendIQ: iq [self sendIQ: IQ
callbackTarget: self callbackTarget: self
selector: @selector(XMPP_handleResourceBindForConnection: selector: @selector(XMPP_handleResourceBindForConnection:
IQ:)]; IQ:)];
@ -1152,7 +1154,7 @@
elementWithName: @"text" elementWithName: @"text"
namespace: XMPP_NS_XMPP_STREAM namespace: XMPP_NS_XMPP_STREAM
stringValue: text]]; stringValue: text]];
[parser setDelegate: nil]; [_parser setDelegate: nil];
[self sendStanza: error]; [self sendStanza: error];
[self close]; [self close];
} }
@ -1172,16 +1174,16 @@
jidElement = [bindElement elementForName: @"jid" jidElement = [bindElement elementForName: @"jid"
namespace: XMPP_NS_BIND]; namespace: XMPP_NS_BIND];
JID = [[XMPPJID alloc] initWithString: [jidElement stringValue]]; _JID = [[XMPPJID alloc] initWithString: [jidElement stringValue]];
if (needsSession) { if (_needsSession) {
[self XMPP_sendSession]; [self XMPP_sendSession];
return; return;
} }
[delegates broadcastSelector: @selector(connection:wasBoundToJID:) [_delegates broadcastSelector: @selector(connection:wasBoundToJID:)
withObject: self withObject: self
withObject: JID]; withObject: _JID];
} }
- (void)XMPP_sendSession - (void)XMPP_sendSession
@ -1203,9 +1205,9 @@
if (![[iq type] isEqual: @"result"]) if (![[iq type] isEqual: @"result"])
assert(0); assert(0);
[delegates broadcastSelector: @selector(connection:wasBoundToJID:) [_delegates broadcastSelector: @selector(connection:wasBoundToJID:)
withObject: self withObject: self
withObject: JID]; withObject: _JID];
} }
- (OFString*)XMPP_IDNAToASCII: (OFString*)domain_ - (OFString*)XMPP_IDNAToASCII: (OFString*)domain_
@ -1233,55 +1235,55 @@
- (XMPPJID*)JID - (XMPPJID*)JID
{ {
return [[JID copy] autorelease]; return [[_JID copy] autorelease];
} }
- (void)setPort: (uint16_t)port_ - (void)setPort: (uint16_t)port
{ {
port = port_; _port = port;
} }
- (uint16_t)port - (uint16_t)port
{ {
return port; return _port;
} }
- (void)setDataStorage: (id <XMPPStorage>)dataStorage_ - (void)setDataStorage: (id <XMPPStorage>)dataStorage
{ {
if (streamOpen) if (_streamOpen)
@throw [OFInvalidArgumentException @throw [OFInvalidArgumentException
exceptionWithClass: [self class]]; exceptionWithClass: [self class]];
dataStorage = dataStorage_; _dataStorage = dataStorage;
} }
- (id <XMPPStorage>)dataStorage - (id <XMPPStorage>)dataStorage
{ {
return dataStorage; return _dataStorage;
} }
- (void)setLanguage: (OFString*)language_ - (void)setLanguage: (OFString*)language
{ {
OF_SETTER(language, language_, YES, YES) OF_SETTER(_language, language, YES, YES)
} }
- (OFString*)language - (OFString*)language
{ {
OF_GETTER(language, YES) OF_GETTER(_language, YES)
} }
- (void)addDelegate: (id <XMPPConnectionDelegate>)delegate - (void)addDelegate: (id <XMPPConnectionDelegate>)delegate
{ {
[delegates addDelegate: delegate]; [_delegates addDelegate: delegate];
} }
- (void)removeDelegate: (id <XMPPConnectionDelegate>)delegate - (void)removeDelegate: (id <XMPPConnectionDelegate>)delegate
{ {
[delegates removeDelegate: delegate]; [_delegates removeDelegate: delegate];
} }
- (XMPPMulticastDelegate*)XMPP_delegates - (XMPPMulticastDelegate*)XMPP_delegates
{ {
return delegates; return _delegates;
} }
@end @end

View file

@ -34,9 +34,9 @@
@interface XMPPContact: OFObject @interface XMPPContact: OFObject
{ {
/// \cond internal /// \cond internal
XMPPRosterItem *rosterItem; XMPPRosterItem *_rosterItem;
OFMutableDictionary *presences; OFMutableDictionary *_presences;
XMPPJID *lockedOnJID; XMPPJID *_lockedOnJID;
/// \endcond /// \endcond
} }
#ifdef OF_HAVE_PROPERTIES #ifdef OF_HAVE_PROPERTIES

View file

@ -30,7 +30,7 @@
self = [super init]; self = [super init];
@try { @try {
presences = [[OFMutableDictionary alloc] init]; _presences = [[OFMutableDictionary alloc] init];
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@throw e; @throw e;
@ -41,64 +41,64 @@
- (void)dealloc - (void)dealloc
{ {
[presences release]; [_presences release];
[super dealloc]; [super dealloc];
} }
- (XMPPRosterItem*)rosterItem - (XMPPRosterItem*)rosterItem
{ {
OF_GETTER(rosterItem, YES); OF_GETTER(_rosterItem, YES);
} }
- (OFDictionary*)presences - (OFDictionary*)presences
{ {
OF_GETTER(presences, YES); OF_GETTER(_presences, YES);
} }
- (void)sendMessage: (XMPPMessage*)message - (void)sendMessage: (XMPPMessage*)message
connection: (XMPPConnection*)connection connection: (XMPPConnection*)connection
{ {
if (lockedOnJID == nil) if (_lockedOnJID == nil)
[message setTo: [rosterItem JID]]; [message setTo: [_rosterItem JID]];
else else
[message setTo: lockedOnJID]; [message setTo: _lockedOnJID];
[connection sendStanza: message]; [connection sendStanza: message];
} }
- (void)XMPP_setRosterItem: (XMPPRosterItem*)rosterItem_ - (void)XMPP_setRosterItem: (XMPPRosterItem*)rosterItem
{ {
OF_SETTER(rosterItem, rosterItem_, YES, 0); OF_SETTER(_rosterItem, rosterItem, YES, 0);
} }
- (void)XMPP_setPresence: (XMPPPresence*)presence - (void)XMPP_setPresence: (XMPPPresence*)presence
resource: (OFString*)resource resource: (OFString*)resource
{ {
if (resource != nil) if (resource != nil)
[presences setObject: presence [_presences setObject: presence
forKey: resource]; forKey: resource];
else else
[presences setObject: presence [_presences setObject: presence
forKey: @""]; forKey: @""];
OF_SETTER(lockedOnJID, nil, YES, 0); OF_SETTER(_lockedOnJID, nil, YES, 0);
} }
- (void)XMPP_removePresenceForResource: (OFString*)resource - (void)XMPP_removePresenceForResource: (OFString*)resource
{ {
if (resource != nil) { if (resource != nil) {
[presences removeObjectForKey: resource]; [_presences removeObjectForKey: resource];
} else { } else {
[presences release]; [_presences release];
presences = [[OFMutableDictionary alloc] init]; _presences = [[OFMutableDictionary alloc] init];
} }
OF_SETTER(lockedOnJID, nil, YES, 0); OF_SETTER(_lockedOnJID, nil, YES, 0);
} }
- (void)XMPP_setLockedOnJID: (XMPPJID*)JID; - (void)XMPP_setLockedOnJID: (XMPPJID*)JID;
{ {
OF_SETTER(lockedOnJID, JID, YES, 0); OF_SETTER(_lockedOnJID, JID, YES, 0);
} }
@end @end

View file

@ -98,10 +98,10 @@
#endif #endif
{ {
/// \cond internal /// \cond internal
OFMutableDictionary *contacts; OFMutableDictionary *_contacts;
XMPPConnection *connection; XMPPConnection *_connection;
XMPPRoster *roster; XMPPRoster *_roster;
XMPPMulticastDelegate *delegates; XMPPMulticastDelegate *_delegates;
/// \endcond /// \endcond
} }
#ifdef OF_HAVE_PROPERTIES #ifdef OF_HAVE_PROPERTIES

View file

@ -34,12 +34,12 @@
self = [super init]; self = [super init];
@try { @try {
connection = connection_; _connection = connection_;
[connection addDelegate: self]; [_connection addDelegate: self];
roster = roster_; _roster = roster_;
[roster addDelegate: self]; [_roster addDelegate: self];
contacts = [[OFMutableDictionary alloc] init]; _contacts = [[OFMutableDictionary alloc] init];
delegates = [[XMPPMulticastDelegate alloc] init]; _delegates = [[XMPPMulticastDelegate alloc] init];
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@throw e; @throw e;
@ -50,27 +50,27 @@
- (void)dealloc - (void)dealloc
{ {
[connection removeDelegate: self]; [_connection removeDelegate: self];
[roster removeDelegate: self]; [_roster removeDelegate: self];
[delegates release]; [_delegates release];
[contacts release]; [_contacts release];
[super dealloc]; [super dealloc];
} }
- (void)addDelegate: (id <XMPPConnectionDelegate>)delegate - (void)addDelegate: (id <XMPPConnectionDelegate>)delegate
{ {
[delegates addDelegate: delegate]; [_delegates addDelegate: delegate];
} }
- (void)removeDelegate: (id <XMPPConnectionDelegate>)delegate - (void)removeDelegate: (id <XMPPConnectionDelegate>)delegate
{ {
[delegates removeDelegate: delegate]; [_delegates removeDelegate: delegate];
} }
- (OFDictionary*)contacts - (OFDictionary*)contacts
{ {
OF_GETTER(contacts, YES); OF_GETTER(_contacts, YES);
} }
- (void)rosterWasReceived: (XMPPRoster*)roster_ - (void)rosterWasReceived: (XMPPRoster*)roster_
@ -81,25 +81,25 @@
OFEnumerator *rosterItemEnumerator; OFEnumerator *rosterItemEnumerator;
OFString *bareJID; OFString *bareJID;
contactEnumerator = [contacts objectEnumerator]; contactEnumerator = [_contacts objectEnumerator];
while ((contact = [contactEnumerator nextObject]) != nil) { while ((contact = [contactEnumerator nextObject]) != nil) {
[delegates broadcastSelector: @selector(contactManager: [_delegates broadcastSelector: @selector(contactManager:
didRemoveContact:) didRemoveContact:)
withObject: self withObject: self
withObject: contact]; withObject: contact];
} }
[contacts release]; [_contacts release];
contacts = [[OFMutableDictionary alloc] init]; _contacts = [[OFMutableDictionary alloc] init];
rosterItems = [roster_ rosterItems]; rosterItems = [roster_ rosterItems];
rosterItemEnumerator = [rosterItems keyEnumerator]; rosterItemEnumerator = [rosterItems keyEnumerator];
while ((bareJID = [rosterItemEnumerator nextObject]) != nil) { while ((bareJID = [rosterItemEnumerator nextObject]) != nil) {
contact = [[XMPPContact new] autorelease]; contact = [[XMPPContact new] autorelease];
[contact XMPP_setRosterItem: [contact XMPP_setRosterItem:
[rosterItems objectForKey: bareJID]]; [rosterItems objectForKey: bareJID]];
[contacts setObject: contact [_contacts setObject: contact
forKey: bareJID]; forKey: bareJID];
[delegates broadcastSelector: @selector(contactManager: [_delegates broadcastSelector: @selector(contactManager:
didAddContact:) didAddContact:)
withObject: self withObject: self
withObject: contact]; withObject: contact];
@ -112,12 +112,12 @@
XMPPContact *contact; XMPPContact *contact;
OFString *bareJID = [[rosterItem JID] bareJID]; OFString *bareJID = [[rosterItem JID] bareJID];
contact = [contacts objectForKey: bareJID]; contact = [_contacts objectForKey: bareJID];
if ([[rosterItem subscription] isEqual: @"remove"]) { if ([[rosterItem subscription] isEqual: @"remove"]) {
[contacts removeObjectForKey: bareJID]; [_contacts removeObjectForKey: bareJID];
if (contact != nil) if (contact != nil)
[delegates broadcastSelector: @selector(contactManager: [_delegates broadcastSelector: @selector(contactManager:
didRemoveContact:) didRemoveContact:)
withObject: self withObject: self
withObject: contact]; withObject: contact];
@ -127,14 +127,14 @@
if (contact == nil) { if (contact == nil) {
contact = [[XMPPContact new] autorelease]; contact = [[XMPPContact new] autorelease];
[contact XMPP_setRosterItem: rosterItem]; [contact XMPP_setRosterItem: rosterItem];
[contacts setObject: contact [_contacts setObject: contact
forKey: bareJID]; forKey: bareJID];
[delegates broadcastSelector: @selector(contactManager: [_delegates broadcastSelector: @selector(contactManager:
didAddContact:) didAddContact:)
withObject: self withObject: self
withObject: contact]; withObject: contact];
} else { } else {
[delegates broadcastSelector: @selector(contact: [_delegates broadcastSelector: @selector(contact:
willUpdateWithRosterItem:) willUpdateWithRosterItem:)
withObject: contact withObject: contact
withObject: rosterItem]; withObject: rosterItem];
@ -146,7 +146,7 @@
didReceivePresence: (XMPPPresence*)presence didReceivePresence: (XMPPPresence*)presence
{ {
XMPPJID *JID = [presence from]; XMPPJID *JID = [presence from];
XMPPContact *contact = [contacts objectForKey: [JID bareJID]]; XMPPContact *contact = [_contacts objectForKey: [JID bareJID]];
if (contact == nil) if (contact == nil)
return; return;
@ -155,13 +155,13 @@
if ([[presence type] isEqual: @"available"]) { if ([[presence type] isEqual: @"available"]) {
[contact XMPP_setPresence: presence [contact XMPP_setPresence: presence
resource: [JID resource]]; resource: [JID resource]];
[delegates broadcastSelector: @selector(contact: [_delegates broadcastSelector: @selector(contact:
didSendPresence:) didSendPresence:)
withObject: contact withObject: contact
withObject: presence]; withObject: presence];
} else if ([[presence type] isEqual: @"unavailable"]) { } else if ([[presence type] isEqual: @"unavailable"]) {
[contact XMPP_removePresenceForResource: [JID resource]]; [contact XMPP_removePresenceForResource: [JID resource]];
[delegates broadcastSelector: @selector(contact: [_delegates broadcastSelector: @selector(contact:
didSendPresence:) didSendPresence:)
withObject: contact withObject: contact
withObject: presence]; withObject: presence];
@ -172,14 +172,14 @@
didReceiveMessage: (XMPPMessage*)message didReceiveMessage: (XMPPMessage*)message
{ {
XMPPJID *JID = [message from]; XMPPJID *JID = [message from];
XMPPContact *contact = [contacts objectForKey: [JID bareJID]]; XMPPContact *contact = [_contacts objectForKey: [JID bareJID]];
if (contact == nil) if (contact == nil)
return; return;
[contact XMPP_setLockedOnJID: JID]; [contact XMPP_setLockedOnJID: JID];
[delegates broadcastSelector: @selector(contact:didSendMessage:) [_delegates broadcastSelector: @selector(contact:didSendMessage:)
withObject: contact withObject: contact
withObject: message]; withObject: message];
} }

View file

@ -33,9 +33,9 @@
password: nil] autorelease]; password: nil] autorelease];
} }
+ EXTERNALAuthWithAuthzid: (OFString*)authzid_ + EXTERNALAuthWithAuthzid: (OFString*)authzid
{ {
return [[[self alloc] initWithAuthzid: authzid_ return [[[self alloc] initWithAuthzid: authzid
authcid: nil authcid: nil
password: nil] autorelease]; password: nil] autorelease];
} }
@ -45,8 +45,8 @@
OFDataArray *message = [OFDataArray dataArray]; OFDataArray *message = [OFDataArray dataArray];
/* authzid */ /* authzid */
if (authzid) if (_authzid)
[message addItem: authzid]; [message addItem: _authzid];
return message; return message;
} }

View file

@ -31,7 +31,7 @@
@interface XMPPException: OFException @interface XMPPException: OFException
{ {
/// \cond internal /// \cond internal
XMPPConnection *connection; XMPPConnection *_connection;
/// \endcond /// \endcond
} }

View file

@ -49,7 +49,7 @@
self = [super initWithClass: class_]; self = [super initWithClass: class_];
@try { @try {
connection = [conn retain]; _connection = [conn retain];
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@throw e; @throw e;
@ -60,25 +60,25 @@
- (void)dealloc - (void)dealloc
{ {
[connection release]; [_connection release];
[super dealloc]; [super dealloc];
} }
- (OFString*)description - (OFString*)description
{ {
if (description != nil) if (_description != nil)
return description; return _description;
description = [[OFString alloc] initWithFormat: _description = [[OFString alloc] initWithFormat:
@"An exception occurred in class %@!", inClass]; @"An exception occurred in class %@!", _inClass];
return description; return _description;
} }
- (XMPPConnection*)connection - (XMPPConnection*)connection
{ {
return connection; return _connection;
} }
@end @end
@ -132,13 +132,13 @@
- (OFString*)description - (OFString*)description
{ {
if (description != nil) if (_description != nil)
return description; return _description;
description = [[OFString alloc] initWithFormat: _description = [[OFString alloc] initWithFormat:
@"Got stream error: %@. Reason: %@!", condition, reason]; @"Got stream error: %@. Reason: %@!", condition, reason];
return description; return _description;
} }
- (OFString*)condition - (OFString*)condition
@ -202,14 +202,14 @@
- (OFString*)description - (OFString*)description
{ {
if (description != nil) if (_description != nil)
return description; return _description;
description = [[OFString alloc] initWithFormat: _description = [[OFString alloc] initWithFormat:
@"Stringprep with profile %@ failed on string '%@'!", @"Stringprep with profile %@ failed on string '%@'!",
profile, string]; profile, string];
return description; return _description;
} }
- (OFString*)profile - (OFString*)profile
@ -273,13 +273,13 @@
- (OFString*)description - (OFString*)description
{ {
if (description != nil) if (_description != nil)
return description; return _description;
description = [[OFString alloc] initWithFormat: _description = [[OFString alloc] initWithFormat:
@"IDNA operation %@ failed on string '%@'!", operation, string]; @"IDNA operation %@ failed on string '%@'!", operation, string];
return description; return _description;
} }
- (OFString*)operation - (OFString*)operation
@ -338,13 +338,13 @@
- (OFString*)description - (OFString*)description
{ {
if (description != nil) if (_description != nil)
return description; return _description;
description = [[OFString alloc] initWithFormat: _description = [[OFString alloc] initWithFormat:
@"Authentication failed. Reason: %@!", reason]; @"Authentication failed. Reason: %@!", reason];
return description; return _description;
} }
- (OFString*)reason - (OFString*)reason

View file

@ -29,23 +29,23 @@
#import "XMPPIQ.h" #import "XMPPIQ.h"
@implementation XMPPIQ @implementation XMPPIQ
+ IQWithType: (OFString*)type_ + IQWithType: (OFString*)type
ID: (OFString*)ID_ ID: (OFString*)ID
{ {
return [[[self alloc] initWithType: type_ return [[[self alloc] initWithType: type
ID: ID_] autorelease]; ID: ID] autorelease];
} }
- initWithType: (OFString*)type_ - initWithType: (OFString*)type
ID: (OFString*)ID_ ID: (OFString*)ID
{ {
self = [super initWithName: @"iq" self = [super initWithName: @"iq"
type: type_ type: type
ID: ID_]; ID: ID];
@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 @throw [OFInvalidArgumentException
exceptionWithClass: [self class] exceptionWithClass: [self class]
selector: _cmd]; selector: _cmd];

View file

@ -29,9 +29,9 @@
@interface XMPPJID: OFObject <OFCopying> @interface XMPPJID: OFObject <OFCopying>
{ {
/// \cond internal /// \cond internal
OFString *node; OFString *_node;
OFString *domain; OFString *_domain;
OFString *resource; OFString *_resource;
/// \endcond /// \endcond
} }
@ -54,10 +54,10 @@
/** /**
* \brief Creates a new autoreleased XMPPJID from a string. * \brief Creates a new autoreleased XMPPJID from a string.
* *
* \param str The string to parse into a JID object * \param string The string to parse into a JID object
* \return A new autoreleased XMPPJID * \return A new autoreleased XMPPJID
*/ */
+ JIDWithString: (OFString*)str; + JIDWithString: (OFString*)string;
/** /**
* \brief Initializes an already allocated XMPPJID with a string. * \brief Initializes an already allocated XMPPJID with a string.
@ -65,7 +65,7 @@
* \param str The string to parse into a JID object * \param str The string to parse into a JID object
* \return A initialized XMPPJID * \return A initialized XMPPJID
*/ */
- initWithString: (OFString*)str; - initWithString: (OFString*)string;
/** /**
* \brief Returns the bare JID. * \brief Returns the bare JID.

View file

@ -38,38 +38,41 @@
return [[[self alloc] init] autorelease]; return [[[self alloc] init] autorelease];
} }
+ JIDWithString: (OFString*)str + JIDWithString: (OFString*)string
{ {
return [[[self alloc] initWithString: str] autorelease]; return [[[self alloc] initWithString: string] autorelease];
} }
- initWithString: (OFString*)str - initWithString: (OFString*)string
{ {
size_t nodesep, resourcesep; size_t nodesep, resourcesep;
self = [super init]; self = [super init];
if (str == nil) { if (string == nil) {
[self release]; [self release];
return nil; return nil;
} }
nodesep = [str rangeOfString: @"@"].location; nodesep = [string rangeOfString: @"@"].location;
resourcesep = [str rangeOfString: @"/"].location; resourcesep = [string rangeOfString: @"/"].location;
if (nodesep == SIZE_MAX) if (nodesep == SIZE_MAX)
[self setNode: nil]; [self setNode: nil];
else else
[self setNode: [str substringWithRange: of_range(0, nodesep)]]; [self setNode:
[string substringWithRange: of_range(0, nodesep)]];
if (resourcesep == SIZE_MAX) { if (resourcesep == SIZE_MAX) {
[self setResource: nil]; [self setResource: nil];
resourcesep = [str length]; resourcesep = [string length];
} else } else {
[self setResource: [str substringWithRange: of_range_t range = of_range(resourcesep + 1,
of_range(resourcesep + 1, [str length] - resourcesep - 1)]]; [string length] - resourcesep - 1);
[self setResource: [string substringWithRange: range]];
}
[self setDomain: [str substringWithRange: [self setDomain: [string substringWithRange:
of_range(nodesep + 1, resourcesep - nodesep - 1)]]; of_range(nodesep + 1, resourcesep - nodesep - 1)]];
return self; return self;
@ -77,9 +80,9 @@
- (void)dealloc - (void)dealloc
{ {
[node release]; [_node release];
[domain release]; [_domain release];
[resource release]; [_resource release];
[super dealloc]; [super dealloc];
} }
@ -89,9 +92,9 @@
XMPPJID *new = [[XMPPJID alloc] init]; XMPPJID *new = [[XMPPJID alloc] init];
@try { @try {
new->node = [node copy]; new->_node = [_node copy];
new->domain = [domain copy]; new->_domain = [_domain copy];
new->resource = [resource copy]; new->_resource = [_resource copy];
} @catch (id e) { } @catch (id e) {
[new release]; [new release];
@throw e; @throw e;
@ -100,29 +103,29 @@
return new; return new;
} }
- (void)setNode: (OFString*)node_ - (void)setNode: (OFString*)node
{ {
OFString *old = node; OFString *old = _node;
char *nodepart; char *nodepart;
Stringprep_rc rc; Stringprep_rc rc;
if (node_ == nil) { if (node == nil) {
[old release]; [old release];
node = nil; _node = nil;
return; return;
} }
if (((rc = stringprep_profile([node_ UTF8String], &nodepart, if (((rc = stringprep_profile([node UTF8String], &nodepart,
"Nodeprep", 0)) != STRINGPREP_OK) || (nodepart[0] == '\0') || "Nodeprep", 0)) != STRINGPREP_OK) || (nodepart[0] == '\0') ||
(strlen(nodepart) > 1023)) (strlen(nodepart) > 1023))
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: [self class] exceptionWithClass: [self class]
connection: nil connection: nil
profile: @"Nodeprep" profile: @"Nodeprep"
string: node_]; string: node];
@try { @try {
node = [[OFString alloc] initWithUTF8String: nodepart]; _node = [[OFString alloc] initWithUTF8String: nodepart];
} @finally { } @finally {
free(nodepart); free(nodepart);
} }
@ -132,26 +135,26 @@
- (OFString*)node - (OFString*)node
{ {
return [[node copy] autorelease]; return [[_node copy] autorelease];
} }
- (void)setDomain: (OFString*)domain_ - (void)setDomain: (OFString*)domain
{ {
OFString *old = domain; OFString *old = _domain;
char *srv; char *srv;
Stringprep_rc rc; Stringprep_rc rc;
if (((rc = stringprep_profile([domain_ UTF8String], &srv, if (((rc = stringprep_profile([domain UTF8String], &srv,
"Nameprep", 0)) != STRINGPREP_OK) || (srv[0] == '\0') || "Nameprep", 0)) != STRINGPREP_OK) || (srv[0] == '\0') ||
(strlen(srv) > 1023)) (strlen(srv) > 1023))
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: [self class] exceptionWithClass: [self class]
connection: nil connection: nil
profile: @"Nameprep" profile: @"Nameprep"
string: domain_]; string: domain];
@try { @try {
domain = [[OFString alloc] initWithUTF8String: srv]; _domain = [[OFString alloc] initWithUTF8String: srv];
} @finally { } @finally {
free(srv); free(srv);
} }
@ -161,32 +164,32 @@
- (OFString*)domain - (OFString*)domain
{ {
return [[domain copy] autorelease]; return [[_domain copy] autorelease];
} }
- (void)setResource: (OFString*)resource_ - (void)setResource: (OFString*)resource
{ {
OFString *old = resource; OFString *old = _resource;
char *res; char *res;
Stringprep_rc rc; Stringprep_rc rc;
if (resource_ == nil) { if (resource == nil) {
[old release]; [old release];
resource = nil; _resource = nil;
return; return;
} }
if (((rc = stringprep_profile([resource_ UTF8String], &res, if (((rc = stringprep_profile([resource UTF8String], &res,
"Resourceprep", 0)) != STRINGPREP_OK) || (res[0] == '\0') || "Resourceprep", 0)) != STRINGPREP_OK) || (res[0] == '\0') ||
(strlen(res) > 1023)) (strlen(res) > 1023))
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: [self class] exceptionWithClass: [self class]
connection: nil connection: nil
profile: @"Resourceprep" profile: @"Resourceprep"
string: resource_]; string: resource];
@try { @try {
resource = [[OFString alloc] initWithUTF8String: res]; _resource = [[OFString alloc] initWithUTF8String: res];
} @finally { } @finally {
free(res); free(res);
} }
@ -196,29 +199,29 @@
- (OFString*)resource - (OFString*)resource
{ {
return [[resource copy] autorelease]; return [[_resource copy] autorelease];
} }
- (OFString*)bareJID - (OFString*)bareJID
{ {
if (node != nil) if (_node != nil)
return [OFString stringWithFormat: @"%@@%@", node, domain]; return [OFString stringWithFormat: @"%@@%@", _node, _domain];
else else
return [OFString stringWithFormat: @"%@", domain]; return [OFString stringWithFormat: @"%@", _domain];
} }
- (OFString*)fullJID - (OFString*)fullJID
{ {
/* If we don't have a resource, the full JID is equal to the bare JID */ /* If we don't have a resource, the full JID is equal to the bare JID */
if (resource == nil) if (_resource == nil)
return [self bareJID]; return [self bareJID];
if (node != nil) if (_node != nil)
return [OFString stringWithFormat: @"%@@%@/%@", return [OFString stringWithFormat: @"%@@%@/%@",
node, domain, resource]; _node, _domain, _resource];
else else
return [OFString stringWithFormat: @"%@/%@", return [OFString stringWithFormat: @"%@/%@",
domain, resource]; _domain, _resource];
} }
- (OFString*)description - (OFString*)description
@ -228,7 +231,7 @@
- (BOOL)isEqual: (id)object - (BOOL)isEqual: (id)object
{ {
XMPPJID *otherJID; XMPPJID *JID;
if (object == self) if (object == self)
return YES; return YES;
@ -236,11 +239,10 @@
if (![object isKindOfClass: [XMPPJID class]]) if (![object isKindOfClass: [XMPPJID class]])
return NO; return NO;
otherJID = object; JID = object;
if ([node isEqual: [otherJID node]] && if ([_node isEqual: JID->_node] && [_domain isEqual: JID->_domain] &&
[domain isEqual: [otherJID domain]] && [_resource isEqual: JID->_resource])
[resource isEqual: [otherJID resource]])
return YES; return YES;
return NO; return NO;

View file

@ -28,8 +28,8 @@
@interface XMPPJSONFileStorage: OFObject <XMPPStorage> @interface XMPPJSONFileStorage: OFObject <XMPPStorage>
{ {
OFString *file; OFString *_file;
OFMutableDictionary *data; OFMutableDictionary *_data;
} }
- initWithFile: (OFString*)file; - initWithFile: (OFString*)file;

View file

@ -50,12 +50,12 @@
@try { @try {
OFAutoreleasePool *pool = [OFAutoreleasePool new]; OFAutoreleasePool *pool = [OFAutoreleasePool new];
file = [file_ copy]; _file = [file_ copy];
@try { @try {
data = [[[OFString stringWithContentsOfFile: _data = [[[OFString stringWithContentsOfFile:
file] JSONValue] retain]; _file] JSONValue] retain];
} @catch (id e) { } @catch (id e) {
data = [OFMutableDictionary new]; _data = [OFMutableDictionary new];
} }
[pool release]; [pool release];
@ -69,22 +69,22 @@
- (void)dealloc - (void)dealloc
{ {
[file release]; [_file release];
[data release]; [_data release];
[super dealloc]; [super dealloc];
} }
- (void)save - (void)save
{ {
[[data JSONRepresentation] writeToFile: file]; [[_data JSONRepresentation] writeToFile: _file];
} }
- (void)XMPP_setObject: (id)object - (void)XMPP_setObject: (id)object
forPath: (OFString*)path forPath: (OFString*)path
{ {
OFArray *pathComponents = [path componentsSeparatedByString: @"."]; OFArray *pathComponents = [path componentsSeparatedByString: @"."];
OFMutableDictionary *iter = data; OFMutableDictionary *iter = _data;
OFEnumerator *enumerator = [pathComponents objectEnumerator]; OFEnumerator *enumerator = [pathComponents objectEnumerator];
OFString *component; OFString *component;
size_t i = 0, components = [pathComponents count]; size_t i = 0, components = [pathComponents count];
@ -116,7 +116,7 @@
OFArray *pathComponents = [path componentsSeparatedByString: @"."]; OFArray *pathComponents = [path componentsSeparatedByString: @"."];
OFEnumerator *enumerator = [pathComponents objectEnumerator]; OFEnumerator *enumerator = [pathComponents objectEnumerator];
OFString *component; OFString *component;
id object = data; id object = _data;
while ((component = [enumerator nextObject]) != nil) while ((component = [enumerator nextObject]) != nil)
object = [object objectForKey: component]; object = [object objectForKey: component];

View file

@ -34,21 +34,21 @@
return [[[self alloc] init] autorelease]; return [[[self alloc] init] autorelease];
} }
+ messageWithID: (OFString*)ID_ + messageWithID: (OFString*)ID
{ {
return [[[self alloc] initWithID: ID_] autorelease]; return [[[self alloc] initWithID: ID] autorelease];
} }
+ messageWithType: (OFString*)type_ + messageWithType: (OFString*)type
{ {
return [[[self alloc] initWithType: type_] autorelease]; return [[[self alloc] initWithType: type] autorelease];
} }
+ messageWithType: (OFString*)type_ + messageWithType: (OFString*)type
ID: (OFString*)ID_ ID: (OFString*)ID
{ {
return [[[self alloc] initWithType: type_ return [[[self alloc] initWithType: type
ID: ID_] autorelease]; ID: ID] autorelease];
} }
- init - init
@ -57,24 +57,24 @@
ID: nil]; ID: nil];
} }
- initWithID: (OFString*)ID_ - initWithID: (OFString*)ID
{ {
return [self initWithType: nil return [self initWithType: nil
ID: ID_]; ID: ID];
} }
- initWithType: (OFString*)type_ - initWithType: (OFString*)type
{ {
return [self initWithType: type_ return [self initWithType: type
ID: nil]; ID: nil];
} }
- initWithType: (OFString*)type_ - initWithType: (OFString*)type
ID: (OFString*)ID_ ID: (OFString*)ID
{ {
return [super initWithName: @"message" return [super initWithName: @"message"
type: type_ type: type
ID: ID_]; ID: ID];
} }
- (void)setBody: (OFString*)body - (void)setBody: (OFString*)body

View file

@ -30,7 +30,7 @@
@interface XMPPMulticastDelegate: OFObject @interface XMPPMulticastDelegate: OFObject
{ {
/// \cond internal /// \cond internal
OFDataArray *delegates; OFDataArray *_delegates;
/// \endcond /// \endcond
} }

View file

@ -34,7 +34,7 @@
self = [super init]; self = [super init];
@try { @try {
delegates = [[OFDataArray alloc] initWithItemSize: sizeof(id)]; _delegates = [[OFDataArray alloc] initWithItemSize: sizeof(id)];
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@throw e; @throw e;
@ -45,24 +45,24 @@
- (void)dealloc - (void)dealloc
{ {
[delegates release]; [_delegates release];
[super dealloc]; [super dealloc];
} }
- (void)addDelegate: (id)delegate - (void)addDelegate: (id)delegate
{ {
[delegates addItem: &delegate]; [_delegates addItem: &delegate];
} }
- (void)removeDelegate: (id)delegate - (void)removeDelegate: (id)delegate
{ {
id *cArray = [delegates items]; id *items = [_delegates items];
size_t i, count = [delegates count]; size_t i, count = [_delegates count];
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (cArray[i] == delegate) { if (items[i] == delegate) {
[delegates removeItemAtIndex: i]; [_delegates removeItemAtIndex: i];
return; return;
} }
} }
@ -71,18 +71,18 @@
- (BOOL)broadcastSelector: (SEL)selector - (BOOL)broadcastSelector: (SEL)selector
withObject: (id)object withObject: (id)object
{ {
id *cArray = [delegates items]; id *items = [_delegates items];
size_t i, count = [delegates count]; size_t i, count = [_delegates count];
BOOL handled = NO; BOOL handled = NO;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (![cArray[i] respondsToSelector: selector]) if (![items[i] respondsToSelector: selector])
continue; continue;
BOOL (*imp)(id, SEL, id) = (BOOL(*)(id, SEL, id)) BOOL (*imp)(id, SEL, id) = (BOOL(*)(id, SEL, id))
[cArray[i] methodForSelector: selector]; [items[i] methodForSelector: selector];
handled |= imp(cArray[i], selector, object); handled |= imp(items[i], selector, object);
} }
return handled; return handled;
@ -92,18 +92,18 @@
withObject: (id)object1 withObject: (id)object1
withObject: (id)object2 withObject: (id)object2
{ {
id *cArray = [delegates items]; id *items = [_delegates items];
size_t i, count = [delegates count]; size_t i, count = [_delegates count];
BOOL handled = NO; BOOL handled = NO;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (![cArray[i] respondsToSelector: selector]) if (![items[i] respondsToSelector: selector])
continue; continue;
BOOL (*imp)(id, SEL, id, id) = (BOOL(*)(id, SEL, id, id)) BOOL (*imp)(id, SEL, id, id) = (BOOL(*)(id, SEL, id, id))
[cArray[i] methodForSelector: selector]; [items[i] methodForSelector: selector];
handled |= imp(cArray[i], selector, object1, object2); handled |= imp(items[i], selector, object1, object2);
} }
return handled; return handled;

View file

@ -49,22 +49,22 @@
OFDataArray *message = [OFDataArray dataArray]; OFDataArray *message = [OFDataArray dataArray];
/* authzid */ /* authzid */
if (authzid) if (_authzid)
[message addItem: authzid]; [message addItem: _authzid];
/* separator */ /* separator */
[message addItem: ""]; [message addItem: ""];
/* authcid */ /* authcid */
[message addItems: [authcid UTF8String] [message addItems: [_authcid UTF8String]
count: [authcid UTF8StringLength]]; count: [_authcid UTF8StringLength]];
/* separator */ /* separator */
[message addItem: ""]; [message addItem: ""];
/* passwd */ /* passwd */
[message addItems: [password UTF8String] [message addItems: [_password UTF8String]
count: [password UTF8StringLength]]; count: [_password UTF8StringLength]];
return message; return message;
} }

View file

@ -29,9 +29,9 @@
@interface XMPPPresence: XMPPStanza <OFComparing> @interface XMPPPresence: XMPPStanza <OFComparing>
{ {
/// \cond internal /// \cond internal
OFString *status; OFString *_status;
OFString *show; OFString *_show;
OFNumber *priority; OFNumber *_priority;
/// \endcond /// \endcond
} }
#ifdef OF_HAVE_PROPERTIES #ifdef OF_HAVE_PROPERTIES

View file

@ -48,21 +48,21 @@ static int show_to_int(OFString *show)
return [[[self alloc] init] autorelease]; return [[[self alloc] init] autorelease];
} }
+ presenceWithID: (OFString*)ID_ + presenceWithID: (OFString*)ID
{ {
return [[[self alloc] initWithID: ID_] autorelease]; return [[[self alloc] initWithID: ID] autorelease];
} }
+ presenceWithType: (OFString*)type_ + presenceWithType: (OFString*)type
{ {
return [[[self alloc] initWithType: type_] autorelease]; return [[[self alloc] initWithType: type] autorelease];
} }
+ presenceWithType: (OFString*)type_ + presenceWithType: (OFString*)type
ID: (OFString*)ID_ ID: (OFString*)ID
{ {
return [[[self alloc] initWithType: type_ return [[[self alloc] initWithType: type
ID: ID_] autorelease]; ID: ID] autorelease];
} }
- init - init
@ -71,24 +71,24 @@ static int show_to_int(OFString *show)
ID: nil]; ID: nil];
} }
- initWithID: (OFString*)ID_ - initWithID: (OFString*)ID
{ {
return [self initWithType: nil return [self initWithType: nil
ID: ID_]; ID: ID];
} }
- initWithType: (OFString*)type_ - initWithType: (OFString*)type
{ {
return [self initWithType: type_ return [self initWithType: type
ID: nil]; ID: nil];
} }
- initWithType: (OFString*)type_ - initWithType: (OFString*)type
ID: (OFString*)ID_ ID: (OFString*)ID
{ {
return [super initWithName: @"presence" return [super initWithName: @"presence"
type: type_ type: type
ID: ID_]; ID: ID];
} }
- initWithElement: (OFXMLElement*)element - initWithElement: (OFXMLElement*)element
@ -122,22 +122,22 @@ static int show_to_int(OFString *show)
- (void)dealloc - (void)dealloc
{ {
[status release]; [_status release];
[show release]; [_show release];
[priority release]; [_priority release];
[super dealloc]; [super dealloc];
} }
- (OFString*)type - (OFString*)type
{ {
if (type == nil) if (_type == nil)
return @"available"; return @"available";
return [[type copy] autorelease]; return [[_type copy] autorelease];
} }
- (void)setShow: (OFString*)show_ - (void)setShow: (OFString*)show
{ {
OFXMLElement *oldShow = [self elementForName: @"show" OFXMLElement *oldShow = [self elementForName: @"show"
namespace: XMPP_NS_CLIENT]; namespace: XMPP_NS_CLIENT];
@ -145,20 +145,20 @@ static int show_to_int(OFString *show)
if (oldShow != nil) if (oldShow != nil)
[self removeChild: oldShow]; [self removeChild: oldShow];
if (show_ != nil) if (show != nil)
[self addChild: [OFXMLElement elementWithName: @"show" [self addChild: [OFXMLElement elementWithName: @"show"
namespace: XMPP_NS_CLIENT namespace: XMPP_NS_CLIENT
stringValue: show_]]; stringValue: show]];
OF_SETTER(show, show_, YES, 1); OF_SETTER(_show, show, YES, 1);
} }
- (OFString*)show - (OFString*)show
{ {
return [[show copy] autorelease]; return [[_show copy] autorelease];
} }
- (void)setStatus: (OFString*)status_ - (void)setStatus: (OFString*)status
{ {
OFXMLElement *oldStatus = [self elementForName: @"status" OFXMLElement *oldStatus = [self elementForName: @"status"
namespace: XMPP_NS_CLIENT]; namespace: XMPP_NS_CLIENT];
@ -166,22 +166,22 @@ static int show_to_int(OFString *show)
if (oldStatus != nil) if (oldStatus != nil)
[self removeChild: oldStatus]; [self removeChild: oldStatus];
if (status_ != nil) if (status != nil)
[self addChild: [OFXMLElement elementWithName: @"status" [self addChild: [OFXMLElement elementWithName: @"status"
namespace: XMPP_NS_CLIENT namespace: XMPP_NS_CLIENT
stringValue: status_]]; stringValue: status]];
OF_SETTER(status, status_, YES, 1); OF_SETTER(_status, status, YES, 1);
} }
- (OFString*)status - (OFString*)status
{ {
return [[status copy] autorelease]; return [[_status copy] autorelease];
} }
- (void)setPriority: (OFNumber*)priority_ - (void)setPriority: (OFNumber*)priority
{ {
intmax_t prio = [priority_ intMaxValue]; intmax_t prio = [priority intMaxValue];
if ((prio < -128) || (prio > 127)) if ((prio < -128) || (prio > 127))
@throw [OFInvalidArgumentException @throw [OFInvalidArgumentException
@ -195,17 +195,17 @@ static int show_to_int(OFString *show)
[self removeChild: oldPriority]; [self removeChild: oldPriority];
OFString* priority_s = OFString* priority_s =
[OFString stringWithFormat: @"%" @PRId8, [priority_ int8Value]]; [OFString stringWithFormat: @"%" @PRId8, [priority int8Value]];
[self addChild: [OFXMLElement elementWithName: @"priority" [self addChild: [OFXMLElement elementWithName: @"priority"
namespace: XMPP_NS_CLIENT namespace: XMPP_NS_CLIENT
stringValue: priority_s]]; stringValue: priority_s]];
OF_SETTER(priority, priority_, YES, 1); OF_SETTER(_priority, priority, YES, 1);
} }
- (OFString*)priority - (OFNumber*)priority
{ {
return [[priority copy] autorelease]; return [[_priority copy] autorelease];
} }
- (of_comparison_result_t)compare: (id <OFComparing>)object - (of_comparison_result_t)compare: (id <OFComparing>)object
@ -228,8 +228,8 @@ static int show_to_int(OFString *show)
if (otherPriority == nil) if (otherPriority == nil)
otherPriority = [OFNumber numberWithInt8: 0]; otherPriority = [OFNumber numberWithInt8: 0];
if (priority != nil) if (_priority != nil)
priorityOrder = [priority compare: otherPriority]; priorityOrder = [_priority compare: otherPriority];
else else
priorityOrder = priorityOrder =
[[OFNumber numberWithInt8: 0] compare: otherPriority]; [[OFNumber numberWithInt8: 0] compare: otherPriority];
@ -238,10 +238,10 @@ static int show_to_int(OFString *show)
return priorityOrder; return priorityOrder;
otherShow = [otherPresence show]; otherShow = [otherPresence show];
if ([show isEqual: otherShow]) if ([_show isEqual: otherShow])
return OF_ORDERED_SAME; return OF_ORDERED_SAME;
if (show_to_int(show) < show_to_int(otherShow)) if (show_to_int(_show) < show_to_int(otherShow))
return OF_ORDERED_ASCENDING; return OF_ORDERED_ASCENDING;
return OF_ORDERED_DESCENDING; return OF_ORDERED_DESCENDING;

View file

@ -69,11 +69,11 @@
#endif #endif
{ {
/// \cond internal /// \cond internal
XMPPConnection *connection; XMPPConnection *_connection;
OFMutableDictionary *rosterItems; OFMutableDictionary *_rosterItems;
XMPPMulticastDelegate *delegates; XMPPMulticastDelegate *_delegates;
id <XMPPStorage> dataStorage; id <XMPPStorage> _dataStorage;
BOOL rosterRequested; BOOL _rosterRequested;
/// \endcond /// \endcond
} }

View file

@ -45,11 +45,11 @@
self = [super init]; self = [super init];
@try { @try {
rosterItems = [[OFMutableDictionary alloc] init]; _rosterItems = [[OFMutableDictionary alloc] init];
connection = connection_; _connection = connection_;
[connection addDelegate: self]; [_connection addDelegate: self];
delegates = [[XMPPMulticastDelegate alloc] init]; _delegates = [[XMPPMulticastDelegate alloc] init];
dataStorage = [connection dataStorage]; _dataStorage = [_connection dataStorage];
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@throw e; @throw e;
@ -60,16 +60,16 @@
- (void)dealloc - (void)dealloc
{ {
[connection removeDelegate: self]; [_connection removeDelegate: self];
[delegates release]; [_delegates release];
[rosterItems release]; [_rosterItems release];
[super dealloc]; [super dealloc];
} }
- (OFDictionary*)rosterItems - (OFDictionary*)rosterItems
{ {
return [[rosterItems copy] autorelease]; return [[_rosterItems copy] autorelease];
} }
- (void)requestRoster - (void)requestRoster
@ -77,16 +77,16 @@
XMPPIQ *iq; XMPPIQ *iq;
OFXMLElement *query; OFXMLElement *query;
rosterRequested = YES; _rosterRequested = YES;
iq = [XMPPIQ IQWithType: @"get" iq = [XMPPIQ IQWithType: @"get"
ID: [connection generateStanzaID]]; ID: [_connection generateStanzaID]];
query = [OFXMLElement elementWithName: @"query" query = [OFXMLElement elementWithName: @"query"
namespace: XMPP_NS_ROSTER]; namespace: XMPP_NS_ROSTER];
if ([connection supportsRosterVersioning]) { if ([_connection supportsRosterVersioning]) {
OFString *ver = [dataStorage stringValueForPath: @"roster.ver"]; OFString *ver = [_dataStorage stringValueForPath: @"roster.ver"];
if (ver == nil) if (ver == nil)
ver = @""; ver = @"";
@ -97,13 +97,13 @@
[iq addChild: query]; [iq addChild: query];
[connection sendIQ: iq [_connection sendIQ: iq
callbackTarget: self callbackTarget: self
selector: @selector(XMPP_handleInitialRosterForConnection: selector: @selector(XMPP_handleInitialRosterForConnection:
IQ:)]; IQ:)];
} }
- (BOOL)connection: (XMPPConnection*)connection_ - (BOOL)connection: (XMPPConnection*)connection
didReceiveIQ: (XMPPIQ*)iq didReceiveIQ: (XMPPIQ*)iq
{ {
OFXMLElement *rosterElement; OFXMLElement *rosterElement;
@ -125,7 +125,7 @@
if (element != nil) { if (element != nil) {
rosterItem = [self XMPP_rosterItemWithXMLElement: element]; rosterItem = [self XMPP_rosterItemWithXMLElement: element];
[delegates broadcastSelector: @selector( [_delegates broadcastSelector: @selector(
roster:didReceiveRosterItem:) roster:didReceiveRosterItem:)
withObject: self withObject: self
withObject: rosterItem]; withObject: rosterItem];
@ -133,15 +133,15 @@
[self XMPP_updateRosterItem: rosterItem]; [self XMPP_updateRosterItem: rosterItem];
} }
if ([connection supportsRosterVersioning]) { if ([_connection supportsRosterVersioning]) {
OFString *ver = OFString *ver =
[[rosterElement attributeForName: @"ver"] stringValue]; [[rosterElement attributeForName: @"ver"] stringValue];
[dataStorage setStringValue: ver [_dataStorage setStringValue: ver
forPath: @"roster.ver"]; forPath: @"roster.ver"];
[dataStorage save]; [_dataStorage save];
} }
[connection_ sendStanza: [iq resultIQ]]; [connection sendStanza: [iq resultIQ]];
return YES; return YES;
} }
@ -153,8 +153,8 @@
- (void)updateRosterItem: (XMPPRosterItem*)rosterItem - (void)updateRosterItem: (XMPPRosterItem*)rosterItem
{ {
XMPPIQ *iq = [XMPPIQ IQWithType: @"set" XMPPIQ *IQ = [XMPPIQ IQWithType: @"set"
ID: [connection generateStanzaID]]; ID: [_connection generateStanzaID]];
OFXMLElement *query = [OFXMLElement elementWithName: @"query" OFXMLElement *query = [OFXMLElement elementWithName: @"query"
namespace: XMPP_NS_ROSTER]; namespace: XMPP_NS_ROSTER];
OFXMLElement *item = [OFXMLElement elementWithName: @"item" OFXMLElement *item = [OFXMLElement elementWithName: @"item"
@ -175,15 +175,15 @@
stringValue: group]]; stringValue: group]];
[query addChild: item]; [query addChild: item];
[iq addChild: query]; [IQ addChild: query];
[connection sendStanza: iq]; [_connection sendStanza: IQ];
} }
- (void)deleteRosterItem: (XMPPRosterItem*)rosterItem - (void)deleteRosterItem: (XMPPRosterItem*)rosterItem
{ {
XMPPIQ *iq = [XMPPIQ IQWithType: @"set" XMPPIQ *IQ = [XMPPIQ IQWithType: @"set"
ID: [connection generateStanzaID]]; ID: [_connection generateStanzaID]];
OFXMLElement *query = [OFXMLElement elementWithName: @"query" OFXMLElement *query = [OFXMLElement elementWithName: @"query"
namespace: XMPP_NS_ROSTER]; namespace: XMPP_NS_ROSTER];
OFXMLElement *item = [OFXMLElement elementWithName: @"item" OFXMLElement *item = [OFXMLElement elementWithName: @"item"
@ -195,44 +195,44 @@
stringValue: @"remove"]; stringValue: @"remove"];
[query addChild: item]; [query addChild: item];
[iq addChild: query]; [IQ addChild: query];
[connection sendStanza: iq]; [_connection sendStanza: IQ];
} }
- (void)addDelegate: (id <XMPPRosterDelegate>)delegate - (void)addDelegate: (id <XMPPRosterDelegate>)delegate
{ {
[delegates addDelegate: delegate]; [_delegates addDelegate: delegate];
} }
- (void)removeDelegate: (id <XMPPRosterDelegate>)delegate - (void)removeDelegate: (id <XMPPRosterDelegate>)delegate
{ {
[delegates removeDelegate: delegate]; [_delegates removeDelegate: delegate];
} }
- (void)setDataStorage: (id <XMPPStorage>)dataStorage_ - (void)setDataStorage: (id <XMPPStorage>)dataStorage
{ {
if (rosterRequested) if (_rosterRequested)
@throw [OFInvalidArgumentException @throw [OFInvalidArgumentException
exceptionWithClass: [self class]]; exceptionWithClass: [self class]];
dataStorage = dataStorage_; _dataStorage = dataStorage;
} }
- (XMPPConnection*)connection - (XMPPConnection*)connection
{ {
return connection; return _connection;
} }
- (id <XMPPStorage>)dataStorage - (id <XMPPStorage>)dataStorage
{ {
return dataStorage; return _dataStorage;
} }
- (void)XMPP_updateRosterItem: (XMPPRosterItem*)rosterItem - (void)XMPP_updateRosterItem: (XMPPRosterItem*)rosterItem
{ {
if ([connection supportsRosterVersioning]) { if ([_connection supportsRosterVersioning]) {
OFMutableDictionary *items = [[[dataStorage dictionaryForPath: OFMutableDictionary *items = [[[_dataStorage dictionaryForPath:
@"roster.items"] mutableCopy] autorelease]; @"roster.items"] mutableCopy] autorelease];
if (items == nil) if (items == nil)
@ -258,15 +258,15 @@
} else } else
[items removeObjectForKey: [[rosterItem JID] bareJID]]; [items removeObjectForKey: [[rosterItem JID] bareJID]];
[dataStorage setDictionary: items [_dataStorage setDictionary: items
forPath: @"roster.items"]; forPath: @"roster.items"];
} }
if (![[rosterItem subscription] isEqual: @"remove"]) if (![[rosterItem subscription] isEqual: @"remove"])
[rosterItems setObject: rosterItem [_rosterItems setObject: rosterItem
forKey: [[rosterItem JID] bareJID]]; forKey: [[rosterItem JID] bareJID]];
else else
[rosterItems removeObjectForKey: [[rosterItem JID] bareJID]]; [_rosterItems removeObjectForKey: [[rosterItem JID] bareJID]];
} }
- (XMPPRosterItem*)XMPP_rosterItemWithXMLElement: (OFXMLElement*)element - (XMPPRosterItem*)XMPP_rosterItemWithXMLElement: (OFXMLElement*)element
@ -315,9 +315,9 @@
rosterElement = [iq elementForName: @"query" rosterElement = [iq elementForName: @"query"
namespace: XMPP_NS_ROSTER]; namespace: XMPP_NS_ROSTER];
if ([connection supportsRosterVersioning]) { if ([_connection supportsRosterVersioning]) {
if (rosterElement == nil) { if (rosterElement == nil) {
OFDictionary *items = [dataStorage OFDictionary *items = [_dataStorage
dictionaryForPath: @"roster.items"]; dictionaryForPath: @"roster.items"];
OFEnumerator *enumerator = [items objectEnumerator]; OFEnumerator *enumerator = [items objectEnumerator];
OFDictionary *item; OFDictionary *item;
@ -337,11 +337,11 @@
[rosterItem setGroups: [rosterItem setGroups:
[item objectForKey: @"groups"]]; [item objectForKey: @"groups"]];
[rosterItems setObject: rosterItem [_rosterItems setObject: rosterItem
forKey: [JID bareJID]]; forKey: [JID bareJID]];
} }
} else } else
[dataStorage setDictionary: nil [_dataStorage setDictionary: nil
forPath: @"roster.items"]; forPath: @"roster.items"];
} }
@ -361,15 +361,15 @@
[pool release]; [pool release];
} }
if ([connection supportsRosterVersioning] && rosterElement != nil) { if ([_connection supportsRosterVersioning] && rosterElement != nil) {
OFString *ver = OFString *ver =
[[rosterElement attributeForName: @"ver"] stringValue]; [[rosterElement attributeForName: @"ver"] stringValue];
[dataStorage setStringValue: ver [_dataStorage setStringValue: ver
forPath: @"roster.ver"]; forPath: @"roster.ver"];
[dataStorage save]; [_dataStorage save];
} }
[delegates broadcastSelector: @selector(rosterWasReceived:) [_delegates broadcastSelector: @selector(rosterWasReceived:)
withObject: self]; withObject: self];
} }
@end @end

View file

@ -30,10 +30,10 @@
@interface XMPPRosterItem: OFObject @interface XMPPRosterItem: OFObject
{ {
/// \cond internal /// \cond internal
XMPPJID *JID; XMPPJID *_JID;
OFString *name; OFString *_name;
OFString *subscription; OFString *_subscription;
OFArray *groups; OFArray *_groups;
/// \endcond /// \endcond
} }

View file

@ -37,10 +37,10 @@
- (void)dealloc - (void)dealloc
{ {
[JID release]; [_JID release];
[name release]; [_name release];
[subscription release]; [_subscription release];
[groups release]; [_groups release];
[super dealloc]; [super dealloc];
} }
@ -50,10 +50,10 @@
XMPPRosterItem *new = [[XMPPRosterItem alloc] init]; XMPPRosterItem *new = [[XMPPRosterItem alloc] init];
@try { @try {
new->JID = [JID copy]; new->_JID = [_JID copy];
new->name = [name copy]; new->_name = [_name copy];
new->subscription = [subscription copy]; new->_subscription = [_subscription copy];
new->groups = [groups copy]; new->_groups = [_groups copy];
} @catch (id e) { } @catch (id e) {
[new release]; [new release];
@throw e; @throw e;
@ -66,52 +66,46 @@
{ {
return [OFString stringWithFormat: @"<XMPPRosterItem, JID=%@, name=%@, " return [OFString stringWithFormat: @"<XMPPRosterItem, JID=%@, name=%@, "
@"subscription=%@, groups=%@>", @"subscription=%@, groups=%@>",
JID, name, subscription, groups]; _JID, _name, _subscription, _groups];
} }
- (void)setJID: (XMPPJID*)JID_ - (void)setJID: (XMPPJID*)JID
{ {
XMPPJID *old = JID; OF_SETTER(_JID, JID, YES, YES)
JID = [JID_ copy];
[old release];
} }
- (XMPPJID*)JID - (XMPPJID*)JID
{ {
return [[JID copy] autorelease]; OF_GETTER(_JID, YES)
} }
- (void)setName: (OFString*)name_ - (void)setName: (OFString*)name
{ {
OFString *old = name; OF_SETTER(_name, name, YES, YES)
name = [name_ copy];
[old release];
} }
- (OFString*)name - (OFString*)name
{ {
return [[name copy] autorelease]; OF_GETTER(_name, YES)
} }
- (void)setSubscription: (OFString*)subscription_ - (void)setSubscription: (OFString*)subscription
{ {
OFString *old = subscription; OF_SETTER(_subscription, subscription, YES, YES)
subscription = [subscription_ copy];
[old release];
} }
- (OFString*)subscription - (OFString*)subscription
{ {
return [[subscription copy] autorelease]; OF_GETTER(_subscription, YES)
} }
- (void)setGroups: (OFArray*)groups_ - (void)setGroups: (OFArray*)groups
{ {
OF_SETTER(groups, groups_, YES, YES) OF_SETTER(_groups, groups, YES, YES)
} }
- (OFArray*)groups - (OFArray*)groups
{ {
OF_GETTER(groups, YES) OF_GETTER(_groups, YES)
} }
@end @end

View file

@ -30,14 +30,14 @@
@interface XMPPSCRAMAuth: XMPPAuthenticator @interface XMPPSCRAMAuth: XMPPAuthenticator
{ {
/// \cond internal /// \cond internal
Class hashType; Class _hashType;
OFString *cNonce; OFString *_cNonce;
OFString *GS2Header; OFString *_GS2Header;
OFString *clientFirstMessageBare; OFString *_clientFirstMessageBare;
OFDataArray *serverSignature; OFDataArray *_serverSignature;
XMPPConnection *connection; XMPPConnection *_connection;
BOOL plusAvailable; BOOL _plusAvailable;
BOOL authenticated; BOOL _authenticated;
/// \endcond /// \endcond
} }

View file

@ -40,105 +40,105 @@
@implementation XMPPSCRAMAuth @implementation XMPPSCRAMAuth
+ SCRAMAuthWithAuthcid: (OFString*)authcid + SCRAMAuthWithAuthcid: (OFString*)authcid
password: (OFString*)password password: (OFString*)password
connection: (XMPPConnection*)connection_ connection: (XMPPConnection*)connection
hash: (Class)hash hash: (Class)hash
plusAvailable: (BOOL)plusAvailable_ plusAvailable: (BOOL)plusAvailable
{ {
return [[[self alloc] initWithAuthcid: authcid return [[[self alloc] initWithAuthcid: authcid
password: password password: password
connection: connection_ connection: connection
hash: hash hash: hash
plusAvailable: plusAvailable_] autorelease]; plusAvailable: plusAvailable] autorelease];
} }
+ SCRAMAuthWithAuthzid: (OFString*)authzid + SCRAMAuthWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid authcid: (OFString*)authcid
password: (OFString*)password password: (OFString*)password
connection: (XMPPConnection*)connection_ connection: (XMPPConnection*)connection
hash: (Class)hash hash: (Class)hash
plusAvailable: (BOOL)plusAvailable_ plusAvailable: (BOOL)plusAvailable
{ {
return [[[self alloc] initWithAuthzid: authzid return [[[self alloc] initWithAuthzid: authzid
authcid: authcid authcid: authcid
password: password password: password
connection: connection_ connection: connection
hash: hash hash: hash
plusAvailable: plusAvailable_] autorelease]; plusAvailable: plusAvailable] autorelease];
} }
- initWithAuthcid: (OFString*)authcid_ - initWithAuthcid: (OFString*)authcid
password: (OFString*)password_ password: (OFString*)password
connection: (XMPPConnection*)connection_ connection: (XMPPConnection*)connection
hash: (Class)hash hash: (Class)hash
plusAvailable: (BOOL)plusAvailable_ plusAvailable: (BOOL)plusAvailable
{ {
return [self initWithAuthzid: nil return [self initWithAuthzid: nil
authcid: authcid_ authcid: authcid
password: password_ password: password
connection: connection_ connection: connection
hash: hash hash: hash
plusAvailable: plusAvailable_]; plusAvailable: plusAvailable];
} }
- initWithAuthzid: (OFString*)authzid_ - initWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid_ authcid: (OFString*)authcid
password: (OFString*)password_ password: (OFString*)password
connection: (XMPPConnection*)connection_ connection: (XMPPConnection*)connection
hash: (Class)hash hash: (Class)hash
plusAvailable: (BOOL)plusAvailable_ plusAvailable: (BOOL)plusAvailable
{ {
self = [super initWithAuthzid: authzid_ self = [super initWithAuthzid: authzid
authcid: authcid_ authcid: authcid
password: password_]; password: password];
hashType = hash; _hashType = hash;
plusAvailable = plusAvailable_; _plusAvailable = plusAvailable;
connection = [connection_ retain]; _connection = [connection retain];
return self; return self;
} }
- (void)dealloc - (void)dealloc
{ {
[GS2Header release]; [_GS2Header release];
[clientFirstMessageBare release]; [_clientFirstMessageBare release];
[serverSignature release]; [_serverSignature release];
[cNonce release]; [_cNonce release];
[connection release]; [_connection release];
[super dealloc]; [super dealloc];
} }
- (void)setAuthzid: (OFString*)authzid_ - (void)setAuthzid: (OFString*)authzid
{ {
OFString *old = authzid; OFString *old = _authzid;
if (authzid_) { if (authzid) {
OFMutableString *new = [[authzid_ mutableCopy] autorelease]; OFMutableString *new = [[authzid mutableCopy] autorelease];
[new replaceOccurrencesOfString: @"=" [new replaceOccurrencesOfString: @"="
withString: @"=3D"]; withString: @"=3D"];
[new replaceOccurrencesOfString: @"," [new replaceOccurrencesOfString: @","
withString: @"=2C"]; withString: @"=2C"];
authzid = [new retain]; _authzid = [new retain];
} else } else
authzid = nil; _authzid = nil;
[old release]; [old release];
} }
- (void)setAuthcid: (OFString*)authcid_ - (void)setAuthcid: (OFString*)authcid
{ {
OFString *old = authcid; OFString *old = _authcid;
if (authcid_) { if (authcid) {
OFMutableString *new = [[authcid_ mutableCopy] autorelease]; OFMutableString *new = [[authcid mutableCopy] autorelease];
[new replaceOccurrencesOfString: @"=" [new replaceOccurrencesOfString: @"="
withString: @"=3D"]; withString: @"=3D"];
[new replaceOccurrencesOfString: @"," [new replaceOccurrencesOfString: @","
withString: @"=2C"]; withString: @"=2C"];
authcid = [new retain]; _authcid = [new retain];
} else } else
authcid = nil; _authcid = nil;
[old release]; [old release];
} }
@ -148,35 +148,35 @@
OFDataArray *ret = [OFDataArray dataArray]; OFDataArray *ret = [OFDataArray dataArray];
/* New authentication attempt, reset status */ /* New authentication attempt, reset status */
[cNonce release]; [_cNonce release];
cNonce = nil; _cNonce = nil;
[GS2Header release]; [_GS2Header release];
GS2Header = nil; _GS2Header = nil;
[serverSignature release]; [_serverSignature release];
serverSignature = nil; _serverSignature = nil;
authenticated = NO; _authenticated = NO;
if (authzid) if (_authzid)
GS2Header = [[OFString alloc] _GS2Header = [[OFString alloc]
initWithFormat: @"%@,a=%@,", initWithFormat: @"%@,a=%@,",
(plusAvailable ? @"p=tls-unique" : @"y"), (_plusAvailable ? @"p=tls-unique" : @"y"),
authzid]; _authzid];
else else
GS2Header = (plusAvailable ? @"p=tls-unique,," : @"y,,"); _GS2Header = (_plusAvailable ? @"p=tls-unique,," : @"y,,");
cNonce = [[self XMPP_genNonce] retain]; _cNonce = [[self XMPP_genNonce] retain];
[clientFirstMessageBare release]; [_clientFirstMessageBare release];
clientFirstMessageBare = nil; _clientFirstMessageBare = nil;
clientFirstMessageBare = [[OFString alloc] initWithFormat: @"n=%@,r=%@", _clientFirstMessageBare = [[OFString alloc] initWithFormat: @"n=%@,r=%@",
authcid, _authcid,
cNonce]; _cNonce];
[ret addItems: [GS2Header UTF8String] [ret addItems: [_GS2Header UTF8String]
count: [GS2Header UTF8StringLength]]; count: [_GS2Header UTF8StringLength]];
[ret addItems: [clientFirstMessageBare UTF8String] [ret addItems: [_clientFirstMessageBare UTF8String]
count: [clientFirstMessageBare UTF8StringLength]]; count: [_clientFirstMessageBare UTF8StringLength]];
return ret; return ret;
} }
@ -186,7 +186,7 @@
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFDataArray *ret; OFDataArray *ret;
if (!serverSignature) if (!_serverSignature)
ret = [self XMPP_parseServerFirstMessage: data]; ret = [self XMPP_parseServerFirstMessage: data];
else else
ret = [self XMPP_parseServerFinalMessage: data]; ret = [self XMPP_parseServerFinalMessage: data];
@ -213,7 +213,7 @@
GOT_ITERCOUNT = 0x04 GOT_ITERCOUNT = 0x04
} got = 0; } got = 0;
hash = [[[hashType alloc] init] autorelease]; hash = [[[_hashType alloc] init] autorelease];
ret = [OFDataArray dataArray]; ret = [OFDataArray dataArray];
authMessage = [OFDataArray dataArray]; authMessage = [OFDataArray dataArray];
@ -228,7 +228,7 @@
of_range(2, [comp length] - 2)]; of_range(2, [comp length] - 2)];
if ([comp hasPrefix: @"r="]) { if ([comp hasPrefix: @"r="]) {
if (![entry hasPrefix: cNonce]) if (![entry hasPrefix: _cNonce])
@throw [XMPPAuthFailedException @throw [XMPPAuthFailedException
exceptionWithClass: [self class] exceptionWithClass: [self class]
connection: nil connection: nil
@ -253,10 +253,10 @@
// Add c=<base64(GS2Header+channelBindingData)> // Add c=<base64(GS2Header+channelBindingData)>
tmpArray = [OFDataArray dataArray]; tmpArray = [OFDataArray dataArray];
[tmpArray addItems: [GS2Header UTF8String] [tmpArray addItems: [_GS2Header UTF8String]
count: [GS2Header UTF8StringLength]]; count: [_GS2Header UTF8StringLength]];
if (plusAvailable && [connection encrypted]) { if (_plusAvailable && [_connection encrypted]) {
OFDataArray *channelBinding = [((SSLSocket*)[connection socket]) OFDataArray *channelBinding = [((SSLSocket*)[_connection socket])
channelBindingDataWithType: @"tls-unique"]; channelBindingDataWithType: @"tls-unique"];
[tmpArray addItems: [channelBinding items] [tmpArray addItems: [channelBinding items]
count: [channelBinding count]]; count: [channelBinding count]];
@ -279,8 +279,8 @@
* SaltedPassword := Hi(Normalize(password), salt, i) * SaltedPassword := Hi(Normalize(password), salt, i)
*/ */
tmpArray = [OFDataArray dataArray]; tmpArray = [OFDataArray dataArray];
[tmpArray addItems: [password UTF8String] [tmpArray addItems: [_password UTF8String]
count: [password UTF8StringLength]]; count: [_password UTF8StringLength]];
saltedPassword = [self XMPP_hiWithData: tmpArray saltedPassword = [self XMPP_hiWithData: tmpArray
salt: salt salt: salt
@ -292,8 +292,8 @@
* server-first-message + "," + * server-first-message + "," +
* client-final-message-without-proof * client-final-message-without-proof
*/ */
[authMessage addItems: [clientFirstMessageBare UTF8String] [authMessage addItems: [_clientFirstMessageBare UTF8String]
count: [clientFirstMessageBare UTF8StringLength]]; count: [_clientFirstMessageBare UTF8StringLength]];
[authMessage addItem: ","]; [authMessage addItem: ","];
[authMessage addItems: [data items] [authMessage addItems: [data items]
count: [data count] * [data itemSize]]; count: [data count] * [data itemSize]];
@ -316,10 +316,10 @@
* StoredKey := H(ClientKey) * StoredKey := H(ClientKey)
*/ */
[hash updateWithBuffer: (void*) clientKey [hash updateWithBuffer: (void*) clientKey
length: [hashType digestSize]]; length: [_hashType digestSize]];
tmpArray = [OFDataArray dataArray]; tmpArray = [OFDataArray dataArray];
[tmpArray addItems: [hash digest] [tmpArray addItems: [hash digest]
count: [hashType digestSize]]; count: [_hashType digestSize]];
/* /*
* IETF RFC 5802: * IETF RFC 5802:
@ -344,18 +344,18 @@
*/ */
tmpArray = [OFDataArray dataArray]; tmpArray = [OFDataArray dataArray];
[tmpArray addItems: serverKey [tmpArray addItems: serverKey
count: [hashType digestSize]]; count: [_hashType digestSize]];
serverSignature = [[OFDataArray alloc] init]; _serverSignature = [[OFDataArray alloc] init];
[serverSignature addItems: [self XMPP_HMACWithKey: tmpArray [_serverSignature addItems: [self XMPP_HMACWithKey: tmpArray
data: authMessage] data: authMessage]
count: [hashType digestSize]]; count: [_hashType digestSize]];
/* /*
* IETF RFC 5802: * IETF RFC 5802:
* ClientProof := ClientKey XOR ClientSignature * ClientProof := ClientKey XOR ClientSignature
*/ */
tmpArray = [OFDataArray dataArray]; tmpArray = [OFDataArray dataArray];
for (i = 0; i < [hashType digestSize]; i++) { for (i = 0; i < [_hashType digestSize]; i++) {
uint8_t c = clientKey[i] ^ clientSignature[i]; uint8_t c = clientKey[i] ^ clientSignature[i];
[tmpArray addItem: &c]; [tmpArray addItem: &c];
} }
@ -379,7 +379,7 @@
* server-final-message already received, * server-final-message already received,
* we were just waiting for the last word from the server * we were just waiting for the last word from the server
*/ */
if (authenticated) if (_authenticated)
return nil; return nil;
mess = [OFString stringWithUTF8String: [data items] mess = [OFString stringWithUTF8String: [data items]
@ -388,13 +388,13 @@
value = [mess substringWithRange: of_range(2, [mess length] - 2)]; value = [mess substringWithRange: of_range(2, [mess length] - 2)];
if ([mess hasPrefix: @"v="]) { if ([mess hasPrefix: @"v="]) {
if (![value isEqual: [serverSignature stringByBase64Encoding]]) if (![value isEqual: [_serverSignature stringByBase64Encoding]])
@throw [XMPPAuthFailedException @throw [XMPPAuthFailedException
exceptionWithClass: [self class] exceptionWithClass: [self class]
connection: nil connection: nil
reason: @"Received wrong " reason: @"Received wrong "
@"ServerSignature"]; @"ServerSignature"];
authenticated = YES; _authenticated = YES;
} else } else
@throw [XMPPAuthFailedException exceptionWithClass: [self class] @throw [XMPPAuthFailedException exceptionWithClass: [self class]
connection: nil connection: nil
@ -429,16 +429,16 @@
{ {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFDataArray *k = [OFDataArray dataArray]; OFDataArray *k = [OFDataArray dataArray];
size_t i, kSize, blockSize = [hashType blockSize]; size_t i, kSize, blockSize = [_hashType blockSize];
uint8_t *kI = NULL, *kO = NULL; uint8_t *kI = NULL, *kO = NULL;
OFHash *hashI, *hashO; OFHash *hashI, *hashO;
if ([key itemSize] * [key count] > blockSize) { if ([key itemSize] * [key count] > blockSize) {
hashI = [[[hashType alloc] init] autorelease]; hashI = [[[_hashType alloc] init] autorelease];
[hashI updateWithBuffer: [key items] [hashI updateWithBuffer: [key items]
length: [key itemSize] * [key count]]; length: [key itemSize] * [key count]];
[k addItems: [hashI digest] [k addItems: [hashI digest]
count: [hashType digestSize]]; count: [_hashType digestSize]];
} else } else
[k addItems: [key items] [k addItems: [key items]
count: [key itemSize] * [key count]]; count: [key itemSize] * [key count]];
@ -457,17 +457,17 @@
kO[i] ^= HMAC_OPAD; kO[i] ^= HMAC_OPAD;
} }
hashI = [[[hashType alloc] init] autorelease]; hashI = [[[_hashType alloc] init] autorelease];
[hashI updateWithBuffer: (char*)kI [hashI updateWithBuffer: (char*)kI
length: blockSize]; length: blockSize];
[hashI updateWithBuffer: [data items] [hashI updateWithBuffer: [data items]
length: [data itemSize] * [data count]]; length: [data itemSize] * [data count]];
hashO = [[[hashType alloc] init] autorelease]; hashO = [[[_hashType alloc] init] autorelease];
[hashO updateWithBuffer: (char*)kO [hashO updateWithBuffer: (char*)kO
length: blockSize]; length: blockSize];
[hashO updateWithBuffer: (char*)[hashI digest] [hashO updateWithBuffer: (char*)[hashI digest]
length: [hashType digestSize]]; length: [_hashType digestSize]];
} @finally { } @finally {
[self freeMemory: kI]; [self freeMemory: kI];
[self freeMemory: kO]; [self freeMemory: kO];
@ -484,7 +484,7 @@
iterationCount: (intmax_t)i iterationCount: (intmax_t)i
{ {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
size_t digestSize = [hashType digestSize]; size_t digestSize = [_hashType digestSize];
uint8_t *result = NULL, *u, *uOld; uint8_t *result = NULL, *u, *uOld;
intmax_t j, k; intmax_t j, k;
OFDataArray *salty, *tmp, *ret; OFDataArray *salty, *tmp, *ret;

View file

@ -28,11 +28,11 @@
@interface XMPPSRVEntry: OFObject @interface XMPPSRVEntry: OFObject
{ {
uint16_t priority; uint16_t _priority;
uint16_t weight; uint16_t _weight;
uint32_t accumulatedWeight; uint32_t _accumulatedWeight;
uint16_t port; uint16_t _port;
OFString *target; OFString *_target;
} }
#ifdef OF_HAVE_PROPERTIES #ifdef OF_HAVE_PROPERTIES
@ -65,9 +65,9 @@
@interface XMPPSRVLookup: OFObject <OFEnumerating> @interface XMPPSRVLookup: OFObject <OFEnumerating>
{ {
OFString *domain; OFString *_domain;
struct __res_state resState; struct __res_state _resState;
OFList *list; OFList *_list;
} }
#ifdef OF_HAVE_PROPERTIES #ifdef OF_HAVE_PROPERTIES

View file

@ -61,18 +61,18 @@
selector: _cmd]; selector: _cmd];
} }
- initWithPriority: (uint16_t)priority_ - initWithPriority: (uint16_t)priority
weight: (uint16_t)weight_ weight: (uint16_t)weight
port: (uint16_t)port_ port: (uint16_t)port
target: (OFString*)target_ target: (OFString*)target
{ {
self = [super init]; self = [super init];
@try { @try {
priority = priority_; _priority = priority;
weight = weight_; _weight = weight;
port = port_; _port = port;
target = [target_ copy]; _target = [target copy];
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@throw e; @throw e;
@ -91,16 +91,16 @@
char buffer[NS_MAXDNAME]; char buffer[NS_MAXDNAME];
rdata = (const uint16_t*)(void*)ns_rr_rdata(resourceRecord); rdata = (const uint16_t*)(void*)ns_rr_rdata(resourceRecord);
priority = ntohs(rdata[0]); _priority = ntohs(rdata[0]);
weight = ntohs(rdata[1]); _weight = ntohs(rdata[1]);
port = ntohs(rdata[2]); _port = ntohs(rdata[2]);
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
exceptionWithClass: [self class]]; exceptionWithClass: [self class]];
target = [[OFString alloc] _target = [[OFString alloc]
initWithCString: buffer initWithCString: buffer
encoding: OF_STRING_ENCODING_NATIVE]; encoding: OF_STRING_ENCODING_NATIVE];
} @catch (id e) { } @catch (id e) {
@ -113,7 +113,7 @@
- (void)dealloc - (void)dealloc
{ {
[target release]; [_target release];
[super dealloc]; [super dealloc];
} }
@ -122,37 +122,37 @@
{ {
return [OFString stringWithFormat: return [OFString stringWithFormat:
@"<%@ priority: %" PRIu16 @", weight: %" PRIu16 @", target: %@:%" @"<%@ priority: %" PRIu16 @", weight: %" PRIu16 @", target: %@:%"
PRIu16 @">", [self class], priority, weight, target, port]; PRIu16 @">", [self class], _priority, _weight, _target, _port];
} }
- (uint16_t)priority - (uint16_t)priority
{ {
return priority; return _priority;
} }
- (uint16_t)weight - (uint16_t)weight
{ {
return weight; return _weight;
} }
- (void)setAccumulatedWeight: (uint32_t)accumulatedWeight_ - (void)setAccumulatedWeight: (uint32_t)accumulatedWeight
{ {
accumulatedWeight = accumulatedWeight_; _accumulatedWeight = accumulatedWeight;
} }
- (uint32_t)accumulatedWeight - (uint32_t)accumulatedWeight
{ {
return accumulatedWeight; return _accumulatedWeight;
} }
- (uint16_t)port - (uint16_t)port
{ {
return port; return _port;
} }
- (OFString*)target - (OFString*)target
{ {
OF_GETTER(target, YES) OF_GETTER(_target, YES)
} }
@end @end
@ -162,13 +162,13 @@
return [[[self alloc] initWithDomain: domain] autorelease]; return [[[self alloc] initWithDomain: domain] autorelease];
} }
- initWithDomain: (OFString*)domain_ - initWithDomain: (OFString*)domain
{ {
self = [super init]; self = [super init];
@try { @try {
list = [[OFList alloc] init]; _list = [[OFList alloc] init];
domain = [domain_ copy]; _domain = [domain copy];
[self XMPP_lookup]; [self XMPP_lookup];
} @catch (id e) { } @catch (id e) {
@ -181,15 +181,15 @@
- (void)dealloc - (void)dealloc
{ {
[list release]; [_list release];
[domain release]; [_domain release];
[super dealloc]; [super dealloc];
} }
- (OFString*)domain; - (OFString*)domain;
{ {
OF_GETTER(domain, YES) OF_GETTER(_domain, YES)
} }
- (void)XMPP_lookup - (void)XMPP_lookup
@ -199,21 +199,21 @@
size_t pageSize = [OFSystemInfo pageSize]; size_t pageSize = [OFSystemInfo pageSize];
OFString *request; OFString *request;
request = [OFString stringWithFormat: @"_xmpp-client._tcp.%@", domain]; request = [OFString stringWithFormat: @"_xmpp-client._tcp.%@", _domain];
@try { @try {
int answerLen, resourceRecordCount, i; int answerLen, resourceRecordCount, i;
ns_rr resourceRecord; ns_rr resourceRecord;
ns_msg handle; ns_msg handle;
if (res_ninit(&resState)) if (res_ninit(&_resState))
@throw [OFAddressTranslationFailedException @throw [OFAddressTranslationFailedException
exceptionWithClass: [self class] exceptionWithClass: [self class]
socket: nil socket: nil
host: domain]; host: _domain];
answer = [self allocMemoryWithSize: pageSize]; answer = [self allocMemoryWithSize: pageSize];
answerLen = res_nsearch(&resState, answerLen = res_nsearch(&_resState,
[request cStringWithEncoding: OF_STRING_ENCODING_NATIVE], [request cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
ns_c_in, ns_t_srv, answer, (int)pageSize); ns_c_in, ns_t_srv, answer, (int)pageSize);
@ -225,14 +225,14 @@
@throw [OFAddressTranslationFailedException @throw [OFAddressTranslationFailedException
exceptionWithClass: [self class] exceptionWithClass: [self class]
socket: nil socket: nil
host: domain]; host: _domain];
} }
if (ns_initparse(answer, answerLen, &handle)) if (ns_initparse(answer, answerLen, &handle))
@throw [OFAddressTranslationFailedException @throw [OFAddressTranslationFailedException
exceptionWithClass: [self class] exceptionWithClass: [self class]
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++) {
@ -250,7 +250,7 @@
} @finally { } @finally {
[self freeMemory: answer]; [self freeMemory: answer];
#ifdef HAVE_RES_NDESTROY #ifdef HAVE_RES_NDESTROY
res_ndestroy(&resState); res_ndestroy(&_resState);
#endif #endif
} }
@ -264,7 +264,7 @@
of_list_object_t *iter; of_list_object_t *iter;
/* Look if there already is a list with the priority */ /* Look if there already is a list with the priority */
for (iter = [list firstListObject]; iter != NULL; iter = iter->next) { for (iter = [_list firstListObject]; iter != NULL; iter = iter->next) {
if ([[iter->object firstObject] priority] == [entry priority]) { if ([[iter->object firstObject] priority] == [entry priority]) {
/* /*
* RFC 2782 says those with weight 0 should be at the * RFC 2782 says those with weight 0 should be at the
@ -289,17 +289,17 @@
[subList appendObject: entry]; [subList appendObject: entry];
if (iter != NULL) if (iter != NULL)
[list insertObject: subList [_list insertObject: subList
beforeListObject: iter]; beforeListObject: iter];
else else
[list appendObject: subList]; [_list appendObject: subList];
[pool release]; [pool release];
} }
- (OFEnumerator*)objectEnumerator - (OFEnumerator*)objectEnumerator
{ {
return [[[XMPPSRVEnumerator alloc] initWithList: list] autorelease]; return [[[XMPPSRVEnumerator alloc] initWithList: _list] autorelease];
} }
@end @end

View file

@ -31,11 +31,11 @@
@interface XMPPStanza: OFXMLElement @interface XMPPStanza: OFXMLElement
{ {
/// \cond internal /// \cond internal
XMPPJID *from; XMPPJID *_from;
XMPPJID *to; XMPPJID *_to;
OFString *type; OFString *_type;
OFString *ID; OFString *_ID;
OFString *language; OFString *_language;
/// \endcond /// \endcond
} }

View file

@ -36,26 +36,26 @@
} }
+ stanzaWithName: (OFString*)name + stanzaWithName: (OFString*)name
type: (OFString*)type_ type: (OFString*)type
{ {
return [[[self alloc] initWithName: name return [[[self alloc] initWithName: name
type: type_] autorelease]; type: type] autorelease];
} }
+ stanzaWithName: (OFString*)name + stanzaWithName: (OFString*)name
ID: (OFString*)ID_ ID: (OFString*)ID
{ {
return [[[self alloc] initWithName: name return [[[self alloc] initWithName: name
ID: ID_] autorelease]; ID: ID] autorelease];
} }
+ stanzaWithName: (OFString*)name + stanzaWithName: (OFString*)name
type: (OFString*)type_ type: (OFString*)type
ID: (OFString*)ID_ ID: (OFString*)ID
{ {
return [[[self alloc] initWithName: name return [[[self alloc] initWithName: name
type: type_ type: type
ID: ID_] autorelease]; ID: ID] autorelease];
} }
+ stanzaWithElement: (OFXMLElement*)element + stanzaWithElement: (OFXMLElement*)element
@ -63,39 +63,39 @@
return [[[self alloc] initWithElement: element] autorelease]; return [[[self alloc] initWithElement: element] autorelease];
} }
- initWithName: (OFString*)name_ - initWithName: (OFString*)name
{ {
return [self initWithName: name_ return [self initWithName: name
type: nil type: nil
ID: nil]; ID: nil];
} }
- initWithName: (OFString*)name_ - initWithName: (OFString*)name
type: (OFString*)type_ type: (OFString*)type
{ {
return [self initWithName: name_ return [self initWithName: name
type: type_ type: type
ID: nil]; ID: nil];
} }
- initWithName: (OFString*)name_ - initWithName: (OFString*)name
ID: (OFString*)ID_ ID: (OFString*)ID
{ {
return [self initWithName: name_ return [self initWithName: name
type: nil type: nil
ID: ID_]; ID: ID];
} }
- initWithName: (OFString*)name_ - initWithName: (OFString*)name
type: (OFString*)type_ type: (OFString*)type
ID: (OFString*)ID_ ID: (OFString*)ID
{ {
self = [super initWithName: name_ self = [super initWithName: name
namespace: XMPP_NS_CLIENT]; namespace: XMPP_NS_CLIENT];
@try { @try {
if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] && if (![name isEqual: @"iq"] && ![name isEqual: @"message"] &&
![name_ isEqual: @"presence"]) ![name isEqual: @"presence"])
@throw [OFInvalidArgumentException @throw [OFInvalidArgumentException
exceptionWithClass: [self class] exceptionWithClass: [self class]
selector: _cmd]; selector: _cmd];
@ -104,11 +104,11 @@
[self setPrefix: @"stream" [self setPrefix: @"stream"
forNamespace: XMPP_NS_STREAM]; forNamespace: XMPP_NS_STREAM];
if (type_ != nil) if (type != nil)
[self setType: type_]; [self setType: type];
if (ID_ != nil) if (ID != nil)
[self setID: ID_]; [self setID: ID];
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@throw e; @throw e;
@ -147,104 +147,104 @@
- (void)dealloc - (void)dealloc
{ {
[from release]; [_from release];
[to release]; [_to release];
[type release]; [_type release];
[ID release]; [_ID release];
[super dealloc]; [super dealloc];
} }
- (void)setFrom: (XMPPJID*)from_ - (void)setFrom: (XMPPJID*)from
{ {
XMPPJID *old = from; XMPPJID *old = _from;
from = [from_ copy]; _from = [from copy];
[old release]; [old release];
[self removeAttributeForName: @"from"]; [self removeAttributeForName: @"from"];
if (from_ != nil) if (from != nil)
[self addAttributeWithName: @"from" [self addAttributeWithName: @"from"
stringValue: [from_ fullJID]]; stringValue: [from fullJID]];
} }
- (XMPPJID*)from - (XMPPJID*)from
{ {
return [[from copy] autorelease]; return [[_from copy] autorelease];
} }
- (void)setTo: (XMPPJID*)to_ - (void)setTo: (XMPPJID*)to
{ {
XMPPJID *old = to; XMPPJID *old = _to;
to = [to_ copy]; _to = [to copy];
[old release]; [old release];
[self removeAttributeForName: @"to"]; [self removeAttributeForName: @"to"];
if (to_ != nil) if (to != nil)
[self addAttributeWithName: @"to" [self addAttributeWithName: @"to"
stringValue: [to_ fullJID]]; stringValue: [to fullJID]];
} }
- (XMPPJID*)to - (XMPPJID*)to
{ {
return [[to copy] autorelease]; return [[_to copy] autorelease];
} }
- (void)setType: (OFString*)type_ - (void)setType: (OFString*)type
{ {
OFString *old = type; OFString *old = _type;
type = [type_ copy]; _type = [type copy];
[old release]; [old release];
[self removeAttributeForName: @"type"]; [self removeAttributeForName: @"type"];
if (type_ != nil) if (type != nil)
[self addAttributeWithName: @"type" [self addAttributeWithName: @"type"
stringValue: type]; stringValue: type];
} }
- (OFString*)type - (OFString*)type
{ {
return [[type copy] autorelease]; return [[_type copy] autorelease];
} }
- (void)setID: (OFString*)ID_ - (void)setID: (OFString*)ID
{ {
OFString *old = ID; OFString *old = _ID;
ID = [ID_ copy]; _ID = [ID copy];
[old release]; [old release];
[self removeAttributeForName: @"id"]; [self removeAttributeForName: @"id"];
if (ID_ != nil) if (ID != nil)
[self addAttributeWithName: @"id" [self addAttributeWithName: @"id"
stringValue: ID_]; stringValue: ID];
} }
- (OFString*)ID - (OFString*)ID
{ {
return [[ID copy] autorelease]; return [[_ID copy] autorelease];
} }
- (void)setLanguage: (OFString*)language_ - (void)setLanguage: (OFString*)language
{ {
OFString *old = language; OFString *old = _language;
language = [language_ copy]; _language = [language copy];
[old release]; [old release];
[self removeAttributeForName: @"lang" [self removeAttributeForName: @"lang"
namespace: @"http://www.w3.org/XML/1998/namespace"]; namespace: @"http://www.w3.org/XML/1998/namespace"];
if (language_ != nil) if (language != nil)
[self addAttributeWithName: @"lang" [self addAttributeWithName: @"lang"
namespace: @"http://www.w3.org/XML/1998/" namespace: @"http://www.w3.org/XML/1998/"
@"namespace" @"namespace"
stringValue: language_]; stringValue: language];
} }
- (OFString*)language - (OFString*)language
{ {
return [[language copy] autorelease]; return [[_language copy] autorelease];
} }
@end @end

View file

@ -28,7 +28,7 @@
#endif #endif
{ {
/// \cond internal /// \cond internal
XMPPConnection *connection; XMPPConnection *_connection;
uint32_t receivedCount; uint32_t receivedCount;
/// \endcond /// \endcond
} }

View file

@ -29,8 +29,8 @@
self = [super init]; self = [super init];
@try { @try {
connection = connection_; _connection = connection_;
[connection addDelegate: self]; [_connection addDelegate: self];
receivedCount = 0; receivedCount = 0;
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@ -42,7 +42,7 @@
- (void)dealloc - (void)dealloc
{ {
[connection removeDelegate: self]; [_connection removeDelegate: self];
[super dealloc]; [super dealloc];
} }