From 4a016c271fe0ae46e20203a4023c8f1d24e42f9c Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Tue, 12 Feb 2013 22:35:02 +0100 Subject: [PATCH] Prefix all ivars with an underscore. --- src/XMPPAuthenticator.h | 6 +- src/XMPPAuthenticator.m | 44 ++-- src/XMPPCallback.h | 4 +- src/XMPPCallback.m | 12 +- src/XMPPConnection.h | 40 +-- src/XMPPConnection.m | 482 ++++++++++++++++++------------------ src/XMPPContact.h | 6 +- src/XMPPContact.m | 38 +-- src/XMPPContactManager.h | 8 +- src/XMPPContactManager.m | 84 +++---- src/XMPPEXTERNALAuth.m | 8 +- src/XMPPExceptions.h | 2 +- src/XMPPExceptions.m | 48 ++-- src/XMPPIQ.m | 20 +- src/XMPPJID.h | 12 +- src/XMPPJID.m | 106 ++++---- src/XMPPJSONFileStorage.h | 4 +- src/XMPPJSONFileStorage.m | 18 +- src/XMPPMessage.m | 32 +-- src/XMPPMulticastDelegate.h | 2 +- src/XMPPMulticastDelegate.m | 34 +-- src/XMPPPLAINAuth.m | 12 +- src/XMPPPresence.h | 6 +- src/XMPPPresence.m | 82 +++--- src/XMPPRoster.h | 10 +- src/XMPPRoster.m | 120 ++++----- src/XMPPRosterItem.h | 8 +- src/XMPPRosterItem.m | 48 ++-- src/XMPPSCRAMAuth.h | 16 +- src/XMPPSCRAMAuth.m | 188 +++++++------- src/XMPPSRVLookup.h | 16 +- src/XMPPSRVLookup.m | 78 +++--- src/XMPPStanza.h | 10 +- src/XMPPStanza.m | 122 ++++----- src/XMPPStreamManagement.h | 2 +- src/XMPPStreamManagement.m | 6 +- 36 files changed, 866 insertions(+), 868 deletions(-) diff --git a/src/XMPPAuthenticator.h b/src/XMPPAuthenticator.h index 160b2d9..72b7e69 100644 --- a/src/XMPPAuthenticator.h +++ b/src/XMPPAuthenticator.h @@ -28,9 +28,9 @@ @interface XMPPAuthenticator: OFObject { /// \cond internal - OFString *authzid; - OFString *authcid; - OFString *password; + OFString *_authzid; + OFString *_authcid; + OFString *_password; /// \endcond } diff --git a/src/XMPPAuthenticator.m b/src/XMPPAuthenticator.m index 018a15d..917d469 100644 --- a/src/XMPPAuthenticator.m +++ b/src/XMPPAuthenticator.m @@ -27,24 +27,24 @@ #import "XMPPAuthenticator.h" @implementation XMPPAuthenticator -- initWithAuthcid: (OFString*)authcid_ - password: (OFString*)password_ +- initWithAuthcid: (OFString*)authcid + password: (OFString*)password { return [self initWithAuthzid: nil - authcid: authcid_ - password: password_]; + authcid: authcid + password: password]; } -- initWithAuthzid: (OFString*)authzid_ - authcid: (OFString*)authcid_ - password: (OFString*)password_ +- initWithAuthzid: (OFString*)authzid + authcid: (OFString*)authcid + password: (OFString*)password { self = [super init]; @try { - authzid = [authzid_ copy]; - authcid = [authcid_ copy]; - password = [password_ copy]; + _authzid = [authzid copy]; + _authcid = [authcid copy]; + _password = [password copy]; } @catch (id e) { [self release]; @throw e; @@ -55,41 +55,41 @@ - (void)dealloc { - [authzid release]; - [authcid release]; - [password release]; + [_authzid release]; + [_authcid release]; + [_password release]; [super dealloc]; } -- (void)setAuthzid: (OFString*)authzid_ +- (void)setAuthzid: (OFString*)authzid { - OF_SETTER(authzid, authzid_, YES, YES) + OF_SETTER(_authzid, authzid, YES, YES) } - (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 { - 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 { - OF_GETTER(password, YES) + OF_GETTER(_password, YES) } - (OFDataArray*)initialMessage diff --git a/src/XMPPCallback.h b/src/XMPPCallback.h index 09f3d67..bbe2e73 100644 --- a/src/XMPPCallback.h +++ b/src/XMPPCallback.h @@ -31,8 +31,8 @@ typedef void(^xmpp_callback_block_t)(XMPPConnection*, XMPPIQ*); @interface XMPPCallback: OFObject { - id target; - SEL selector; + id _target; + SEL _selector; #ifdef OF_HAVE_BLOCKS xmpp_callback_block_t block; #endif diff --git a/src/XMPPCallback.m b/src/XMPPCallback.m index db71cea..ac70f61 100644 --- a/src/XMPPCallback.m +++ b/src/XMPPCallback.m @@ -60,15 +60,15 @@ { self = [super init]; - target = [target_ retain]; - selector = selector_; + _target = [target_ retain]; + _selector = selector_; return self; } - (void)dealloc { - [target release]; + [_target release]; #ifdef OF_HAVE_BLOCKS [block release]; #endif @@ -84,8 +84,8 @@ block(connection, iq); else #endif - [target performSelector: selector - withObject: connection - withObject: iq]; + [_target performSelector: _selector + withObject: connection + withObject: iq]; } @end diff --git a/src/XMPPConnection.h b/src/XMPPConnection.h index 5bdafe8..a6828b4 100644 --- a/src/XMPPConnection.h +++ b/src/XMPPConnection.h @@ -153,25 +153,25 @@ #endif { /// \cond internal - id sock; - OFXMLParser *parser, *oldParser; - OFXMLElementBuilder *elementBuilder, *oldElementBuilder; - OFString *username, *password, *server, *resource; - OFString *privateKeyFile, *certificateFile; - OFString *domain, *domainToASCII; - XMPPJID *JID; - uint16_t port; - id dataStorage; - OFString *language; - XMPPMulticastDelegate *delegates; - OFMutableDictionary *callbacks; - XMPPAuthenticator *authModule; - BOOL streamOpen; - BOOL needsSession; - BOOL encryptionRequired, encrypted; - BOOL supportsRosterVersioning; - BOOL supportsStreamManagement; - unsigned int lastID; + id _socket; + OFXMLParser *_parser, *_oldParser; + OFXMLElementBuilder *_elementBuilder, *_oldElementBuilder; + OFString *_username, *_password, *_server, *_resource; + OFString *_privateKeyFile, *_certificateFile; + OFString *_domain, *_domainToASCII; + XMPPJID *_JID; + uint16_t _port; + id _dataStorage; + OFString *_language; + XMPPMulticastDelegate *_delegates; + OFMutableDictionary *_callbacks; + XMPPAuthenticator *_authModule; + BOOL _streamOpen; + BOOL _needsSession; + BOOL _encryptionRequired, _encrypted; + BOOL _supportsRosterVersioning; + BOOL _supportsStreamManagement; + unsigned int _lastID; /// \endcond } @@ -203,7 +203,7 @@ /// \brief An object for data storage, conforming to the XMPPStorage protocol @property (assign) id dataStorage; /// \brief The socket used for the connection -@property (readonly, retain, getter=socket) OFTCPSocket *sock; +@property (readonly, retain) OFTCPSocket *socket; /// \brief Whether encryption is required @property BOOL encryptionRequired; /// \brief Whether the connection is encrypted diff --git a/src/XMPPConnection.m b/src/XMPPConnection.m index 22c8ba8..84e1e11 100644 --- a/src/XMPPConnection.m +++ b/src/XMPPConnection.m @@ -127,11 +127,11 @@ self = [super init]; @try { - port = 5222; - encrypted = NO; - streamOpen = NO; - delegates = [[XMPPMulticastDelegate alloc] init]; - callbacks = [[OFMutableDictionary alloc] init]; + _port = 5222; + _encrypted = NO; + _streamOpen = NO; + _delegates = [[XMPPMulticastDelegate alloc] init]; + _callbacks = [[OFMutableDictionary alloc] init]; } @catch (id e) { [self release]; @throw e; @@ -142,109 +142,109 @@ - (void)dealloc { - [sock release]; - [parser release]; - [elementBuilder release]; - [username release]; - [password release]; - [privateKeyFile release]; - [certificateFile release]; - [server release]; - [domain release]; - [resource release]; - [JID release]; - [delegates release]; - [callbacks release]; - [authModule release]; + [_socket release]; + [_parser release]; + [_elementBuilder release]; + [_username release]; + [_password release]; + [_privateKeyFile release]; + [_certificateFile release]; + [_server release]; + [_domain release]; + [_resource release]; + [_JID release]; + [_delegates release]; + [_callbacks release]; + [_authModule release]; [super dealloc]; } -- (void)setUsername: (OFString*)username_ +- (void)setUsername: (OFString*)username { - OFString *old = username; + OFString *old = _username; - if (username_ != nil) { + if (username != nil) { char *node; Stringprep_rc rc; - if ((rc = stringprep_profile([username_ UTF8String], &node, + if ((rc = stringprep_profile([username UTF8String], &node, "SASLprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException exceptionWithClass: [self class] connection: self profile: @"SASLprep" - string: username_]; + string: username]; @try { - username = [[OFString alloc] initWithUTF8String: node]; + _username = [[OFString alloc] initWithUTF8String: node]; } @finally { free(node); } } else - username = nil; + _username = nil; [old release]; } - (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; Stringprep_rc rc; - if ((rc = stringprep_profile([resource_ UTF8String], &res, + if ((rc = stringprep_profile([resource UTF8String], &res, "Resourceprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException exceptionWithClass: [self class] connection: self profile: @"Resourceprep" - string: resource_]; + string: resource]; @try { - resource = [[OFString alloc] initWithUTF8String: res]; + _resource = [[OFString alloc] initWithUTF8String: res]; } @finally { free(res); } } else - resource = nil; + _resource = nil; [old release]; } - (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) - server = [self XMPP_IDNAToASCII: server_]; + if (server != nil) + _server = [self XMPP_IDNAToASCII: server]; else - server = nil; + _server = nil; [old release]; } - (OFString*)server { - return [[server copy] autorelease]; + return [[_server copy] autorelease]; } - (void)setDomain: (OFString*)domain_ { - OFString *oldDomain = domain; - OFString *oldDomainToASCII = domainToASCII; + OFString *oldDomain = _domain; + OFString *oldDomainToASCII = _domainToASCII; if (domain_ != nil) { char *srv; @@ -259,15 +259,15 @@ string: domain_]; @try { - domain = [[OFString alloc] initWithUTF8String: srv]; + _domain = [[OFString alloc] initWithUTF8String: srv]; } @finally { free(srv); } - domainToASCII = [self XMPP_IDNAToASCII: domain]; + _domainToASCII = [self XMPP_IDNAToASCII: _domain]; } else { - domain = nil; - domainToASCII = nil; + _domain = nil; + _domainToASCII = nil; } [oldDomain release]; @@ -276,59 +276,59 @@ - (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; Stringprep_rc rc; - if ((rc = stringprep_profile([password_ UTF8String], &pass, + if ((rc = stringprep_profile([password UTF8String], &pass, "SASLprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException exceptionWithClass: [self class] connection: self profile: @"SASLprep" - string: password_]; + string: password]; @try { - password = [[OFString alloc] initWithUTF8String: pass]; + _password = [[OFString alloc] initWithUTF8String: pass]; } @finally { free(pass); } } else - password = nil; + _password = nil; [old release]; } - (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 { - 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 { - OF_GETTER(certificateFile, YES) + OF_GETTER(_certificateFile, YES) } - (void)connect @@ -338,19 +338,19 @@ XMPPSRVLookup *SRVLookup = nil; OFEnumerator *enumerator; - if (sock != nil) + if (_socket != nil) @throw [OFAlreadyConnectedException exceptionWithClass: [self class]]; - sock = [[OFTCPSocket alloc] init]; + _socket = [[OFTCPSocket alloc] init]; - if (server) - [sock connectToHost: server - port: port]; + if (_server) + [_socket connectToHost: _server + port: _port]; else { @try { SRVLookup = [XMPPSRVLookup - lookupWithDomain: domainToASCII]; + lookupWithDomain: _domainToASCII]; } @catch (id e) { } @@ -360,8 +360,9 @@ if ((candidate = [enumerator nextObject]) != nil) { do { @try { - [sock connectToHost: [candidate target] - port: [candidate port]]; + [_socket + connectToHost: [candidate target] + port: [candidate port]]; break; } @catch (OFAddressTranslationFailedException *e) { @@ -370,8 +371,8 @@ } while ((candidate = [enumerator nextObject]) != nil); } else /* No SRV records -> fall back to A / AAAA record */ - [sock connectToHost: domainToASCII - port: port]; + [_socket connectToHost: _domainToASCII + port: _port]; } [self XMPP_startStream]; @@ -383,11 +384,11 @@ { char *buffer = [self allocMemoryWithSize: BUFFER_LENGTH]; - [sock asyncReadIntoBuffer: buffer - length: BUFFER_LENGTH - target: self - selector: @selector(stream:didReadIntoBuffer:length: - exception:)]; + [_socket asyncReadIntoBuffer: buffer + length: BUFFER_LENGTH + target: self + selector: @selector(stream:didReadIntoBuffer:length: + exception:)]; } - (void)asyncConnectAndHandle @@ -404,14 +405,14 @@ - (BOOL)XMPP_parseBuffer: (const void*)buffer length: (size_t)length { - if ([sock isAtEndOfStream]) { - [delegates broadcastSelector: @selector(connectionWasClosed:) - withObject: self]; + if ([_socket isAtEndOfStream]) { + [_delegates broadcastSelector: @selector(connectionWasClosed:) + withObject: self]; return NO; } @try { - [parser parseBuffer: buffer + [_parser parseBuffer: buffer length: length]; } @catch (OFMalformedXMLException *e) { [self XMPP_sendStreamError: @"bad-format" @@ -429,11 +430,11 @@ [self XMPP_parseBuffer: buffer length: length]; - [oldParser release]; - [oldElementBuilder release]; + [_oldParser release]; + [_oldElementBuilder release]; - oldParser = nil; - oldElementBuilder = nil; + _oldParser = nil; + _oldElementBuilder = nil; } - (BOOL)stream: (OFStream*)stream @@ -442,10 +443,10 @@ exception: (OFException*)exception { if (exception != nil) { - [delegates broadcastSelector: @selector(connection: - didThrowException:) - withObject: self - withObject: exception]; + [_delegates broadcastSelector: @selector(connection: + didThrowException:) + withObject: self + withObject: exception]; [self close]; return NO; } @@ -455,26 +456,27 @@ length: length]) return NO; } @catch (id e) { - [delegates broadcastSelector: @selector(connection: - didThrowException:) - withObject: self - withObject: e]; + [_delegates broadcastSelector: @selector(connection: + didThrowException:) + withObject: self + withObject: e]; [self close]; return NO; } - if (oldParser != nil || oldElementBuilder != nil) { - [oldParser release]; - [oldElementBuilder release]; + if (_oldParser != nil || _oldElementBuilder != nil) { + [_oldParser release]; + [_oldElementBuilder release]; - oldParser = nil; - oldElementBuilder = nil; + _oldParser = nil; + _oldElementBuilder = nil; - [sock asyncReadIntoBuffer: buffer - length: BUFFER_LENGTH - target: self - selector: @selector(stream:didReadIntoBuffer: - length:exception:)]; + [_socket asyncReadIntoBuffer: buffer + length: BUFFER_LENGTH + target: self + selector: @selector(stream: + didReadIntoBuffer:length: + exception:)]; return NO; } @@ -484,37 +486,37 @@ - (OFTCPSocket*)socket { - return [[sock retain] autorelease]; + return [[_socket retain] autorelease]; } - (BOOL)encryptionRequired { - return encryptionRequired; + return _encryptionRequired; } -- (void)setEncryptionRequired: (BOOL)required +- (void)setEncryptionRequired: (BOOL)encryptionRequired { - encryptionRequired = required; + _encryptionRequired = encryptionRequired; } - (BOOL)encrypted { - return encrypted; + return _encrypted; } - (BOOL)streamOpen { - return streamOpen; + return _streamOpen; } - (BOOL)supportsRosterVersioning { - return supportsRosterVersioning; + return _supportsRosterVersioning; } - (BOOL)supportsStreamManagement { - return supportsStreamManagement; + return _supportsStreamManagement; } - (BOOL)checkCertificateAndGetReason: (OFString**)reason @@ -524,7 +526,7 @@ BOOL serviceSpecific = NO; @try { - [sock verifyPeerCertificate]; + [_socket verifyPeerCertificate]; } @catch (SSLInvalidCertificateException *e) { if (reason != NULL) *reason = [[[e reason] copy] autorelease]; @@ -532,7 +534,7 @@ return NO; } - cert = [sock peerCertificate]; + cert = [_socket peerCertificate]; SANs = [cert subjectAlternativeName]; if ([[SANs objectForKey: @"otherName"] @@ -541,13 +543,13 @@ [SANs objectForKey: @"uniformResourceIdentifier"] != nil) serviceSpecific = YES; - if ([cert hasSRVNameMatchingDomain: domainToASCII + if ([cert hasSRVNameMatchingDomain: _domainToASCII service: @"xmpp-client"] || - [cert hasDNSNameMatchingDomain: domainToASCII]) + [cert hasDNSNameMatchingDomain: _domainToASCII]) return YES; if (!serviceSpecific && - [cert hasCommonNameMatchingDomain: domainToASCII]) + [cert hasCommonNameMatchingDomain: _domainToASCII]) return YES; return NO; @@ -555,11 +557,11 @@ - (void)sendStanza: (OFXMLElement*)element { - [delegates broadcastSelector: @selector(connection:didSendElement:) - withObject: self - withObject: element]; + [_delegates broadcastSelector: @selector(connection:didSendElement:) + withObject: self + withObject: element]; - [sock writeString: [element XMLString]]; + [_socket writeString: [element XMLString]]; } - (void)sendIQ: (XMPPIQ*)iq @@ -575,8 +577,8 @@ pool = [[OFAutoreleasePool alloc] init]; callback = [XMPPCallback callbackWithTarget: target selector: selector]; - [callbacks setObject: callback - forKey: [iq ID]]; + [_callbacks setObject: callback + forKey: [iq ID]]; [pool release]; [self sendStanza: iq]; @@ -594,8 +596,8 @@ pool = [[OFAutoreleasePool alloc] init]; callback = [XMPPCallback callbackWithBlock: block]; - [callbacks setObject: callback - forKey: [iq ID]]; + [_callbacks setObject: callback + forKey: [iq ID]]; [pool release]; [self sendStanza: iq]; @@ -604,7 +606,7 @@ - (OFString*)generateStanzaID { - return [OFString stringWithFormat: @"objxmpp_%u", lastID++]; + return [OFString stringWithFormat: @"objxmpp_%u", _lastID++]; } - (void)parser: (OFXMLParser*)p @@ -619,7 +621,7 @@ if (![name isEqual: @"stream"]) { // No dedicated stream error for this, may not even be XMPP [self close]; - [sock close]; + [_socket close]; return; } @@ -638,7 +640,7 @@ enumerator = [attributes objectEnumerator]; while ((attribute = [enumerator nextObject]) != nil) { if ([[attribute name] isEqual: @"from"] && - ![[attribute stringValue] isEqual: domain]) { + ![[attribute stringValue] isEqual: _domain]) { [self XMPP_sendStreamError: @"invalid-from" text: nil]; return; @@ -651,7 +653,7 @@ } } - [parser setDelegate: elementBuilder]; + [_parser setDelegate: _elementBuilder]; } - (void)elementBuilder: (OFXMLElementBuilder*)builder @@ -665,9 +667,9 @@ [element setPrefix: @"stream" forNamespace: XMPP_NS_STREAM]; - [delegates broadcastSelector: @selector(connection:didReceiveElement:) - withObject: self - withObject: element]; + [_delegates broadcastSelector: @selector(connection:didReceiveElement:) + withObject: self + withObject: element]; if ([[element namespace] isEqual: XMPP_NS_CLIENT]) [self XMPP_handleStanza: element]; @@ -702,54 +704,54 @@ OFString *langString = @""; /* Make sure we don't get any old events */ - [parser setDelegate: nil]; - [elementBuilder setDelegate: nil]; + [_parser setDelegate: nil]; + [_elementBuilder setDelegate: nil]; /* * We can't release them now, as we are currently inside them. Release * them the next time the parser returns. */ - oldParser = parser; - oldElementBuilder = elementBuilder; + _oldParser = _parser; + _oldElementBuilder = _elementBuilder; - parser = [[OFXMLParser alloc] init]; - [parser setDelegate: self]; + _parser = [[OFXMLParser alloc] init]; + [_parser setDelegate: self]; - elementBuilder = [[XMPPXMLElementBuilder alloc] init]; - [elementBuilder setDelegate: self]; + _elementBuilder = [[XMPPXMLElementBuilder alloc] init]; + [_elementBuilder setDelegate: self]; - if (language != nil) + if (_language != nil) langString = [OFString stringWithFormat: @"xml:lang='%@' ", - language]; + _language]; - [sock writeFormat: @"\n" - @"", domain, langString]; + [_socket writeFormat: @"\n" + @"", _domain, langString]; - streamOpen = YES; + _streamOpen = YES; } - (void)close { - if (streamOpen) - [sock writeString: @""]; + if (_streamOpen) + [_socket writeString: @""]; - [oldParser release]; - oldParser = nil; - [oldElementBuilder release]; - oldElementBuilder = nil; - [authModule release]; - authModule = nil; - [sock release]; - sock = nil; - [JID release]; - JID = nil; - streamOpen = needsSession = encrypted = NO; - supportsRosterVersioning = supportsStreamManagement = NO; - lastID = 0; + [_oldParser release]; + _oldParser = nil; + [_oldElementBuilder release]; + _oldElementBuilder = nil; + [_authModule release]; + _authModule = nil; + [_socket release]; + _socket = nil; + [_JID release]; + _JID = nil; + _streamOpen = _needsSession = _encrypted = NO; + _supportsRosterVersioning = _supportsStreamManagement = NO; + _lastID = 0; } - (void)XMPP_handleStanza: (OFXMLElement*)element @@ -786,7 +788,7 @@ if ([[element name] isEqual: @"error"]) { OFString *condition, *reason; [self close]; - [sock close]; // Remote has already closed his stream + [_socket close]; // Remote has already closed his stream if ([element elementForName: @"bad-format" namespace: XMPP_NS_XMPP_STREAM]) @@ -887,21 +889,21 @@ /* FIXME: Catch errors here */ SSLSocket *newSock; - [delegates broadcastSelector: @selector( - connectionWillUpgradeToTLS:) - withObject: self]; + [_delegates broadcastSelector: @selector( + connectionWillUpgradeToTLS:) + withObject: self]; - newSock = [[SSLSocket alloc] initWithSocket: sock - privateKeyFile: privateKeyFile - certificateFile: certificateFile]; - [sock release]; - sock = newSock; + newSock = [[SSLSocket alloc] initWithSocket: _socket + privateKeyFile: _privateKeyFile + certificateFile: _certificateFile]; + [_socket release]; + _socket = newSock; - encrypted = YES; + _encrypted = YES; - [delegates broadcastSelector: @selector( - connectionDidUpgradeToTLS:) - withObject: self]; + [_delegates broadcastSelector: @selector( + connectionDidUpgradeToTLS:) + withObject: self]; /* Stream restart */ [self XMPP_startStream]; @@ -922,7 +924,7 @@ OFXMLElement *responseTag; OFDataArray *challenge = [OFDataArray dataArrayWithBase64EncodedString: [element stringValue]]; - OFDataArray *response = [authModule + OFDataArray *response = [_authModule continueWithData: challenge]; responseTag = [OFXMLElement elementWithName: @"response" @@ -940,12 +942,12 @@ } if ([[element name] isEqual: @"success"]) { - [authModule continueWithData: [OFDataArray + [_authModule continueWithData: [OFDataArray dataArrayWithBase64EncodedString: [element stringValue]]]; - [delegates broadcastSelector: @selector( - connectionWasAuthenticated:) - withObject: self]; + [_delegates broadcastSelector: @selector( + connectionWasAuthenticated:) + withObject: self]; /* Stream restart */ [self XMPP_startStream]; @@ -970,17 +972,17 @@ BOOL handled = NO; XMPPCallback *callback; - if ((callback = [callbacks objectForKey: [iq ID]])) { + if ((callback = [_callbacks objectForKey: [iq ID]])) { [callback runWithIQ: iq connection: self]; - [callbacks removeObjectForKey: [iq ID]]; + [_callbacks removeObjectForKey: [iq ID]]; return; } - handled = [delegates broadcastSelector: @selector( - connection:didReceiveIQ:) - withObject: self - withObject: iq]; + handled = [_delegates broadcastSelector: @selector( + connection:didReceiveIQ:) + withObject: self + withObject: iq]; if (!handled && ![[iq type] isEqual: @"error"] && ![[iq type] isEqual: @"result"]) { @@ -991,21 +993,21 @@ - (void)XMPP_handleMessage: (XMPPMessage*)message { - [delegates broadcastSelector: @selector(connection:didReceiveMessage:) - withObject: self - withObject: message]; + [_delegates broadcastSelector: @selector(connection:didReceiveMessage:) + withObject: self + withObject: message]; } - (void)XMPP_handlePresence: (XMPPPresence*)presence { - [delegates broadcastSelector: @selector(connection:didReceivePresence:) - withObject: self - withObject: presence]; + [_delegates broadcastSelector: @selector(connection:didReceivePresence:) + withObject: self + withObject: presence]; } - (void)XMPP_handleFeatures: (OFXMLElement*)element { - OFXMLElement *starttls = [element elementForName: @"starttls" + OFXMLElement *startTLS = [element elementForName: @"starttls" namespace: XMPP_NS_STARTTLS]; OFXMLElement *bind = [element elementForName: @"bind" namespace: XMPP_NS_BIND]; @@ -1015,24 +1017,24 @@ namespace: XMPP_NS_SASL]; OFMutableSet *mechanisms = [OFMutableSet set]; - if (!encrypted && starttls != nil) { + if (!_encrypted && startTLS != nil) { [self sendStanza: [OFXMLElement elementWithName: @"starttls" namespace: XMPP_NS_STARTTLS]]; return; } - if (encryptionRequired && !encrypted) + if (_encryptionRequired && !_encrypted) /* TODO: Find/create an exception to throw here */ @throw [OFException exceptionWithClass: [self class]]; if ([element elementForName: @"ver" namespace: XMPP_NS_ROSTERVER] != nil) - supportsRosterVersioning = YES; + _supportsRosterVersioning = YES; if ([element elementForName: @"sm" namespace: XMPP_NS_SM] != nil) - supportsStreamManagement = YES; + _supportsStreamManagement = YES; if (mechs != nil) { OFEnumerator *enumerator; @@ -1042,17 +1044,17 @@ while ((mech = [enumerator nextObject]) != nil) [mechanisms addObject: [mech stringValue]]; - if (privateKeyFile && certificateFile && + if (_privateKeyFile && _certificateFile && [mechanisms containsObject: @"EXTERNAL"]) { - authModule = [[XMPPEXTERNALAuth alloc] init]; + _authModule = [[XMPPEXTERNALAuth alloc] init]; [self XMPP_sendAuth: @"EXTERNAL"]; return; } if ([mechanisms containsObject: @"SCRAM-SHA-1-PLUS"]) { - authModule = [[XMPPSCRAMAuth alloc] - initWithAuthcid: username - password: password + _authModule = [[XMPPSCRAMAuth alloc] + initWithAuthcid: _username + password: _password connection: self hash: [OFSHA1Hash class] plusAvailable: YES]; @@ -1061,9 +1063,9 @@ } if ([mechanisms containsObject: @"SCRAM-SHA-1"]) { - authModule = [[XMPPSCRAMAuth alloc] - initWithAuthcid: username - password: password + _authModule = [[XMPPSCRAMAuth alloc] + initWithAuthcid: _username + password: _password connection: self hash: [OFSHA1Hash class] plusAvailable: NO]; @@ -1071,10 +1073,10 @@ return; } - if ([mechanisms containsObject: @"PLAIN"] && encrypted) { - authModule = [[XMPPPLAINAuth alloc] - initWithAuthcid: username - password: password]; + if ([mechanisms containsObject: @"PLAIN"] && _encrypted) { + _authModule = [[XMPPPLAINAuth alloc] + initWithAuthcid: _username + password: _password]; [self XMPP_sendAuth: @"PLAIN"]; return; } @@ -1083,7 +1085,7 @@ } if (session != nil) - needsSession = YES; + _needsSession = YES; if (bind != nil) { [self XMPP_sendResourceBind]; @@ -1096,7 +1098,7 @@ - (void)XMPP_sendAuth: (OFString*)authName { OFXMLElement *authTag; - OFDataArray *initialMessage = [authModule initialMessage]; + OFDataArray *initialMessage = [_authModule initialMessage]; authTag = [OFXMLElement elementWithName: @"auth" namespace: XMPP_NS_SASL]; @@ -1115,23 +1117,23 @@ - (void)XMPP_sendResourceBind { - XMPPIQ *iq; + XMPPIQ *IQ; OFXMLElement *bind; - iq = [XMPPIQ IQWithType: @"set" + IQ = [XMPPIQ IQWithType: @"set" ID: [self generateStanzaID]]; bind = [OFXMLElement elementWithName: @"bind" namespace: XMPP_NS_BIND]; - if (resource != nil) + if (_resource != nil) [bind addChild: [OFXMLElement elementWithName: @"resource" namespace: XMPP_NS_BIND - stringValue: resource]]; + stringValue: _resource]]; - [iq addChild: bind]; + [IQ addChild: bind]; - [self sendIQ: iq + [self sendIQ: IQ callbackTarget: self selector: @selector(XMPP_handleResourceBindForConnection: IQ:)]; @@ -1152,7 +1154,7 @@ elementWithName: @"text" namespace: XMPP_NS_XMPP_STREAM stringValue: text]]; - [parser setDelegate: nil]; + [_parser setDelegate: nil]; [self sendStanza: error]; [self close]; } @@ -1172,16 +1174,16 @@ jidElement = [bindElement elementForName: @"jid" namespace: XMPP_NS_BIND]; - JID = [[XMPPJID alloc] initWithString: [jidElement stringValue]]; + _JID = [[XMPPJID alloc] initWithString: [jidElement stringValue]]; - if (needsSession) { + if (_needsSession) { [self XMPP_sendSession]; return; } - [delegates broadcastSelector: @selector(connection:wasBoundToJID:) - withObject: self - withObject: JID]; + [_delegates broadcastSelector: @selector(connection:wasBoundToJID:) + withObject: self + withObject: _JID]; } - (void)XMPP_sendSession @@ -1203,9 +1205,9 @@ if (![[iq type] isEqual: @"result"]) assert(0); - [delegates broadcastSelector: @selector(connection:wasBoundToJID:) - withObject: self - withObject: JID]; + [_delegates broadcastSelector: @selector(connection:wasBoundToJID:) + withObject: self + withObject: _JID]; } - (OFString*)XMPP_IDNAToASCII: (OFString*)domain_ @@ -1233,55 +1235,55 @@ - (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 { - return port; + return _port; } -- (void)setDataStorage: (id )dataStorage_ +- (void)setDataStorage: (id )dataStorage { - if (streamOpen) + if (_streamOpen) @throw [OFInvalidArgumentException exceptionWithClass: [self class]]; - dataStorage = dataStorage_; + _dataStorage = dataStorage; } - (id )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 { - OF_GETTER(language, YES) + OF_GETTER(_language, YES) } - (void)addDelegate: (id )delegate { - [delegates addDelegate: delegate]; + [_delegates addDelegate: delegate]; } - (void)removeDelegate: (id )delegate { - [delegates removeDelegate: delegate]; + [_delegates removeDelegate: delegate]; } - (XMPPMulticastDelegate*)XMPP_delegates { - return delegates; + return _delegates; } @end diff --git a/src/XMPPContact.h b/src/XMPPContact.h index cba39fd..de13a7b 100644 --- a/src/XMPPContact.h +++ b/src/XMPPContact.h @@ -34,9 +34,9 @@ @interface XMPPContact: OFObject { /// \cond internal - XMPPRosterItem *rosterItem; - OFMutableDictionary *presences; - XMPPJID *lockedOnJID; + XMPPRosterItem *_rosterItem; + OFMutableDictionary *_presences; + XMPPJID *_lockedOnJID; /// \endcond } #ifdef OF_HAVE_PROPERTIES diff --git a/src/XMPPContact.m b/src/XMPPContact.m index e3ae7b0..8b5ec5b 100644 --- a/src/XMPPContact.m +++ b/src/XMPPContact.m @@ -30,7 +30,7 @@ self = [super init]; @try { - presences = [[OFMutableDictionary alloc] init]; + _presences = [[OFMutableDictionary alloc] init]; } @catch (id e) { [self release]; @throw e; @@ -41,64 +41,64 @@ - (void)dealloc { - [presences release]; + [_presences release]; [super dealloc]; } - (XMPPRosterItem*)rosterItem { - OF_GETTER(rosterItem, YES); + OF_GETTER(_rosterItem, YES); } - (OFDictionary*)presences { - OF_GETTER(presences, YES); + OF_GETTER(_presences, YES); } - (void)sendMessage: (XMPPMessage*)message connection: (XMPPConnection*)connection { - if (lockedOnJID == nil) - [message setTo: [rosterItem JID]]; + if (_lockedOnJID == nil) + [message setTo: [_rosterItem JID]]; else - [message setTo: lockedOnJID]; + [message setTo: _lockedOnJID]; [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 resource: (OFString*)resource { if (resource != nil) - [presences setObject: presence - forKey: resource]; + [_presences setObject: presence + forKey: resource]; else - [presences setObject: presence - forKey: @""]; + [_presences setObject: presence + forKey: @""]; - OF_SETTER(lockedOnJID, nil, YES, 0); + OF_SETTER(_lockedOnJID, nil, YES, 0); } - (void)XMPP_removePresenceForResource: (OFString*)resource { if (resource != nil) { - [presences removeObjectForKey: resource]; + [_presences removeObjectForKey: resource]; } else { - [presences release]; - presences = [[OFMutableDictionary alloc] init]; + [_presences release]; + _presences = [[OFMutableDictionary alloc] init]; } - OF_SETTER(lockedOnJID, nil, YES, 0); + OF_SETTER(_lockedOnJID, nil, YES, 0); } - (void)XMPP_setLockedOnJID: (XMPPJID*)JID; { - OF_SETTER(lockedOnJID, JID, YES, 0); + OF_SETTER(_lockedOnJID, JID, YES, 0); } @end diff --git a/src/XMPPContactManager.h b/src/XMPPContactManager.h index b624a30..bcf3bbe 100644 --- a/src/XMPPContactManager.h +++ b/src/XMPPContactManager.h @@ -98,10 +98,10 @@ #endif { /// \cond internal - OFMutableDictionary *contacts; - XMPPConnection *connection; - XMPPRoster *roster; - XMPPMulticastDelegate *delegates; + OFMutableDictionary *_contacts; + XMPPConnection *_connection; + XMPPRoster *_roster; + XMPPMulticastDelegate *_delegates; /// \endcond } #ifdef OF_HAVE_PROPERTIES diff --git a/src/XMPPContactManager.m b/src/XMPPContactManager.m index c1f731a..c20442a 100644 --- a/src/XMPPContactManager.m +++ b/src/XMPPContactManager.m @@ -34,12 +34,12 @@ self = [super init]; @try { - connection = connection_; - [connection addDelegate: self]; - roster = roster_; - [roster addDelegate: self]; - contacts = [[OFMutableDictionary alloc] init]; - delegates = [[XMPPMulticastDelegate alloc] init]; + _connection = connection_; + [_connection addDelegate: self]; + _roster = roster_; + [_roster addDelegate: self]; + _contacts = [[OFMutableDictionary alloc] init]; + _delegates = [[XMPPMulticastDelegate alloc] init]; } @catch (id e) { [self release]; @throw e; @@ -50,27 +50,27 @@ - (void)dealloc { - [connection removeDelegate: self]; - [roster removeDelegate: self]; - [delegates release]; - [contacts release]; + [_connection removeDelegate: self]; + [_roster removeDelegate: self]; + [_delegates release]; + [_contacts release]; [super dealloc]; } - (void)addDelegate: (id )delegate { - [delegates addDelegate: delegate]; + [_delegates addDelegate: delegate]; } - (void)removeDelegate: (id )delegate { - [delegates removeDelegate: delegate]; + [_delegates removeDelegate: delegate]; } - (OFDictionary*)contacts { - OF_GETTER(contacts, YES); + OF_GETTER(_contacts, YES); } - (void)rosterWasReceived: (XMPPRoster*)roster_ @@ -81,28 +81,28 @@ OFEnumerator *rosterItemEnumerator; OFString *bareJID; - contactEnumerator = [contacts objectEnumerator]; + contactEnumerator = [_contacts objectEnumerator]; while ((contact = [contactEnumerator nextObject]) != nil) { - [delegates broadcastSelector: @selector(contactManager: - didRemoveContact:) - withObject: self - withObject: contact]; + [_delegates broadcastSelector: @selector(contactManager: + didRemoveContact:) + withObject: self + withObject: contact]; } - [contacts release]; + [_contacts release]; - contacts = [[OFMutableDictionary alloc] init]; + _contacts = [[OFMutableDictionary alloc] init]; rosterItems = [roster_ rosterItems]; rosterItemEnumerator = [rosterItems keyEnumerator]; while ((bareJID = [rosterItemEnumerator nextObject]) != nil) { contact = [[XMPPContact new] autorelease]; [contact XMPP_setRosterItem: [rosterItems objectForKey: bareJID]]; - [contacts setObject: contact - forKey: bareJID]; - [delegates broadcastSelector: @selector(contactManager: - didAddContact:) - withObject: self - withObject: contact]; + [_contacts setObject: contact + forKey: bareJID]; + [_delegates broadcastSelector: @selector(contactManager: + didAddContact:) + withObject: self + withObject: contact]; } } @@ -112,12 +112,12 @@ XMPPContact *contact; OFString *bareJID = [[rosterItem JID] bareJID]; - contact = [contacts objectForKey: bareJID]; + contact = [_contacts objectForKey: bareJID]; if ([[rosterItem subscription] isEqual: @"remove"]) { - [contacts removeObjectForKey: bareJID]; + [_contacts removeObjectForKey: bareJID]; if (contact != nil) - [delegates broadcastSelector: @selector(contactManager: + [_delegates broadcastSelector: @selector(contactManager: didRemoveContact:) withObject: self withObject: contact]; @@ -127,14 +127,14 @@ if (contact == nil) { contact = [[XMPPContact new] autorelease]; [contact XMPP_setRosterItem: rosterItem]; - [contacts setObject: contact + [_contacts setObject: contact forKey: bareJID]; - [delegates broadcastSelector: @selector(contactManager: + [_delegates broadcastSelector: @selector(contactManager: didAddContact:) withObject: self withObject: contact]; } else { - [delegates broadcastSelector: @selector(contact: + [_delegates broadcastSelector: @selector(contact: willUpdateWithRosterItem:) withObject: contact withObject: rosterItem]; @@ -146,7 +146,7 @@ didReceivePresence: (XMPPPresence*)presence { XMPPJID *JID = [presence from]; - XMPPContact *contact = [contacts objectForKey: [JID bareJID]]; + XMPPContact *contact = [_contacts objectForKey: [JID bareJID]]; if (contact == nil) return; @@ -155,16 +155,16 @@ if ([[presence type] isEqual: @"available"]) { [contact XMPP_setPresence: presence resource: [JID resource]]; - [delegates broadcastSelector: @selector(contact: + [_delegates broadcastSelector: @selector(contact: didSendPresence:) withObject: contact withObject: presence]; } else if ([[presence type] isEqual: @"unavailable"]) { [contact XMPP_removePresenceForResource: [JID resource]]; - [delegates broadcastSelector: @selector(contact: - didSendPresence:) - withObject: contact - withObject: presence]; + [_delegates broadcastSelector: @selector(contact: + didSendPresence:) + withObject: contact + withObject: presence]; } } @@ -172,15 +172,15 @@ didReceiveMessage: (XMPPMessage*)message { XMPPJID *JID = [message from]; - XMPPContact *contact = [contacts objectForKey: [JID bareJID]]; + XMPPContact *contact = [_contacts objectForKey: [JID bareJID]]; if (contact == nil) return; [contact XMPP_setLockedOnJID: JID]; - [delegates broadcastSelector: @selector(contact:didSendMessage:) - withObject: contact - withObject: message]; + [_delegates broadcastSelector: @selector(contact:didSendMessage:) + withObject: contact + withObject: message]; } @end diff --git a/src/XMPPEXTERNALAuth.m b/src/XMPPEXTERNALAuth.m index 3ec7486..2db03d4 100644 --- a/src/XMPPEXTERNALAuth.m +++ b/src/XMPPEXTERNALAuth.m @@ -33,9 +33,9 @@ password: nil] autorelease]; } -+ EXTERNALAuthWithAuthzid: (OFString*)authzid_ ++ EXTERNALAuthWithAuthzid: (OFString*)authzid { - return [[[self alloc] initWithAuthzid: authzid_ + return [[[self alloc] initWithAuthzid: authzid authcid: nil password: nil] autorelease]; } @@ -45,8 +45,8 @@ OFDataArray *message = [OFDataArray dataArray]; /* authzid */ - if (authzid) - [message addItem: authzid]; + if (_authzid) + [message addItem: _authzid]; return message; } diff --git a/src/XMPPExceptions.h b/src/XMPPExceptions.h index 462167b..1520b3a 100644 --- a/src/XMPPExceptions.h +++ b/src/XMPPExceptions.h @@ -31,7 +31,7 @@ @interface XMPPException: OFException { /// \cond internal - XMPPConnection *connection; + XMPPConnection *_connection; /// \endcond } diff --git a/src/XMPPExceptions.m b/src/XMPPExceptions.m index 37c1b69..be2713b 100644 --- a/src/XMPPExceptions.m +++ b/src/XMPPExceptions.m @@ -49,7 +49,7 @@ self = [super initWithClass: class_]; @try { - connection = [conn retain]; + _connection = [conn retain]; } @catch (id e) { [self release]; @throw e; @@ -60,25 +60,25 @@ - (void)dealloc { - [connection release]; + [_connection release]; [super dealloc]; } - (OFString*)description { - if (description != nil) - return description; + if (_description != nil) + return _description; - description = [[OFString alloc] initWithFormat: - @"An exception occurred in class %@!", inClass]; + _description = [[OFString alloc] initWithFormat: + @"An exception occurred in class %@!", _inClass]; - return description; + return _description; } - (XMPPConnection*)connection { - return connection; + return _connection; } @end @@ -132,13 +132,13 @@ - (OFString*)description { - if (description != nil) - return description; + if (_description != nil) + return _description; - description = [[OFString alloc] initWithFormat: + _description = [[OFString alloc] initWithFormat: @"Got stream error: %@. Reason: %@!", condition, reason]; - return description; + return _description; } - (OFString*)condition @@ -202,14 +202,14 @@ - (OFString*)description { - if (description != nil) - return description; + if (_description != nil) + return _description; - description = [[OFString alloc] initWithFormat: + _description = [[OFString alloc] initWithFormat: @"Stringprep with profile %@ failed on string '%@'!", profile, string]; - return description; + return _description; } - (OFString*)profile @@ -273,13 +273,13 @@ - (OFString*)description { - if (description != nil) - return description; + if (_description != nil) + return _description; - description = [[OFString alloc] initWithFormat: + _description = [[OFString alloc] initWithFormat: @"IDNA operation %@ failed on string '%@'!", operation, string]; - return description; + return _description; } - (OFString*)operation @@ -338,13 +338,13 @@ - (OFString*)description { - if (description != nil) - return description; + if (_description != nil) + return _description; - description = [[OFString alloc] initWithFormat: + _description = [[OFString alloc] initWithFormat: @"Authentication failed. Reason: %@!", reason]; - return description; + return _description; } - (OFString*)reason diff --git a/src/XMPPIQ.m b/src/XMPPIQ.m index 2b347e2..cfa53f3 100644 --- a/src/XMPPIQ.m +++ b/src/XMPPIQ.m @@ -29,23 +29,23 @@ #import "XMPPIQ.h" @implementation XMPPIQ -+ IQWithType: (OFString*)type_ - ID: (OFString*)ID_ ++ IQWithType: (OFString*)type + ID: (OFString*)ID { - return [[[self alloc] initWithType: type_ - ID: ID_] autorelease]; + return [[[self alloc] initWithType: type + ID: ID] autorelease]; } -- initWithType: (OFString*)type_ - ID: (OFString*)ID_ +- initWithType: (OFString*)type + ID: (OFString*)ID { self = [super initWithName: @"iq" - type: type_ - ID: ID_]; + type: type + ID: ID]; @try { - if (![type_ isEqual: @"get"] && ![type_ isEqual: @"set"] && - ![type_ isEqual: @"result"] && ![type_ isEqual: @"error"]) + if (![type isEqual: @"get"] && ![type isEqual: @"set"] && + ![type isEqual: @"result"] && ![type isEqual: @"error"]) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; diff --git a/src/XMPPJID.h b/src/XMPPJID.h index 37eee1e..ce8afcf 100644 --- a/src/XMPPJID.h +++ b/src/XMPPJID.h @@ -29,9 +29,9 @@ @interface XMPPJID: OFObject { /// \cond internal - OFString *node; - OFString *domain; - OFString *resource; + OFString *_node; + OFString *_domain; + OFString *_resource; /// \endcond } @@ -54,10 +54,10 @@ /** * \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 */ -+ JIDWithString: (OFString*)str; ++ JIDWithString: (OFString*)string; /** * \brief Initializes an already allocated XMPPJID with a string. @@ -65,7 +65,7 @@ * \param str The string to parse into a JID object * \return A initialized XMPPJID */ -- initWithString: (OFString*)str; +- initWithString: (OFString*)string; /** * \brief Returns the bare JID. diff --git a/src/XMPPJID.m b/src/XMPPJID.m index 97a310b..7f5792d 100644 --- a/src/XMPPJID.m +++ b/src/XMPPJID.m @@ -38,38 +38,41 @@ 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; self = [super init]; - if (str == nil) { + if (string == nil) { [self release]; return nil; } - nodesep = [str rangeOfString: @"@"].location; - resourcesep = [str rangeOfString: @"/"].location; + nodesep = [string rangeOfString: @"@"].location; + resourcesep = [string rangeOfString: @"/"].location; if (nodesep == SIZE_MAX) [self setNode: nil]; else - [self setNode: [str substringWithRange: of_range(0, nodesep)]]; + [self setNode: + [string substringWithRange: of_range(0, nodesep)]]; if (resourcesep == SIZE_MAX) { [self setResource: nil]; - resourcesep = [str length]; - } else - [self setResource: [str substringWithRange: - of_range(resourcesep + 1, [str length] - resourcesep - 1)]]; + resourcesep = [string length]; + } else { + of_range_t range = of_range(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)]]; return self; @@ -77,9 +80,9 @@ - (void)dealloc { - [node release]; - [domain release]; - [resource release]; + [_node release]; + [_domain release]; + [_resource release]; [super dealloc]; } @@ -89,9 +92,9 @@ XMPPJID *new = [[XMPPJID alloc] init]; @try { - new->node = [node copy]; - new->domain = [domain copy]; - new->resource = [resource copy]; + new->_node = [_node copy]; + new->_domain = [_domain copy]; + new->_resource = [_resource copy]; } @catch (id e) { [new release]; @throw e; @@ -100,29 +103,29 @@ return new; } -- (void)setNode: (OFString*)node_ +- (void)setNode: (OFString*)node { - OFString *old = node; + OFString *old = _node; char *nodepart; Stringprep_rc rc; - if (node_ == nil) { + if (node == nil) { [old release]; - node = nil; + _node = nil; return; } - if (((rc = stringprep_profile([node_ UTF8String], &nodepart, + if (((rc = stringprep_profile([node UTF8String], &nodepart, "Nodeprep", 0)) != STRINGPREP_OK) || (nodepart[0] == '\0') || (strlen(nodepart) > 1023)) @throw [XMPPStringPrepFailedException exceptionWithClass: [self class] connection: nil profile: @"Nodeprep" - string: node_]; + string: node]; @try { - node = [[OFString alloc] initWithUTF8String: nodepart]; + _node = [[OFString alloc] initWithUTF8String: nodepart]; } @finally { free(nodepart); } @@ -132,26 +135,26 @@ - (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; Stringprep_rc rc; - if (((rc = stringprep_profile([domain_ UTF8String], &srv, + if (((rc = stringprep_profile([domain UTF8String], &srv, "Nameprep", 0)) != STRINGPREP_OK) || (srv[0] == '\0') || (strlen(srv) > 1023)) @throw [XMPPStringPrepFailedException exceptionWithClass: [self class] connection: nil profile: @"Nameprep" - string: domain_]; + string: domain]; @try { - domain = [[OFString alloc] initWithUTF8String: srv]; + _domain = [[OFString alloc] initWithUTF8String: srv]; } @finally { free(srv); } @@ -161,32 +164,32 @@ - (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; Stringprep_rc rc; - if (resource_ == nil) { + if (resource == nil) { [old release]; - resource = nil; + _resource = nil; return; } - if (((rc = stringprep_profile([resource_ UTF8String], &res, + if (((rc = stringprep_profile([resource UTF8String], &res, "Resourceprep", 0)) != STRINGPREP_OK) || (res[0] == '\0') || (strlen(res) > 1023)) @throw [XMPPStringPrepFailedException exceptionWithClass: [self class] connection: nil profile: @"Resourceprep" - string: resource_]; + string: resource]; @try { - resource = [[OFString alloc] initWithUTF8String: res]; + _resource = [[OFString alloc] initWithUTF8String: res]; } @finally { free(res); } @@ -196,29 +199,29 @@ - (OFString*)resource { - return [[resource copy] autorelease]; + return [[_resource copy] autorelease]; } - (OFString*)bareJID { - if (node != nil) - return [OFString stringWithFormat: @"%@@%@", node, domain]; + if (_node != nil) + return [OFString stringWithFormat: @"%@@%@", _node, _domain]; else - return [OFString stringWithFormat: @"%@", domain]; + return [OFString stringWithFormat: @"%@", _domain]; } - (OFString*)fullJID { /* 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]; - if (node != nil) + if (_node != nil) return [OFString stringWithFormat: @"%@@%@/%@", - node, domain, resource]; + _node, _domain, _resource]; else return [OFString stringWithFormat: @"%@/%@", - domain, resource]; + _domain, _resource]; } - (OFString*)description @@ -228,7 +231,7 @@ - (BOOL)isEqual: (id)object { - XMPPJID *otherJID; + XMPPJID *JID; if (object == self) return YES; @@ -236,11 +239,10 @@ if (![object isKindOfClass: [XMPPJID class]]) return NO; - otherJID = object; + JID = object; - if ([node isEqual: [otherJID node]] && - [domain isEqual: [otherJID domain]] && - [resource isEqual: [otherJID resource]]) + if ([_node isEqual: JID->_node] && [_domain isEqual: JID->_domain] && + [_resource isEqual: JID->_resource]) return YES; return NO; diff --git a/src/XMPPJSONFileStorage.h b/src/XMPPJSONFileStorage.h index 2722dd4..d96d7d6 100644 --- a/src/XMPPJSONFileStorage.h +++ b/src/XMPPJSONFileStorage.h @@ -28,8 +28,8 @@ @interface XMPPJSONFileStorage: OFObject { - OFString *file; - OFMutableDictionary *data; + OFString *_file; + OFMutableDictionary *_data; } - initWithFile: (OFString*)file; diff --git a/src/XMPPJSONFileStorage.m b/src/XMPPJSONFileStorage.m index 8d0bcdd..ffde40b 100644 --- a/src/XMPPJSONFileStorage.m +++ b/src/XMPPJSONFileStorage.m @@ -50,12 +50,12 @@ @try { OFAutoreleasePool *pool = [OFAutoreleasePool new]; - file = [file_ copy]; + _file = [file_ copy]; @try { - data = [[[OFString stringWithContentsOfFile: - file] JSONValue] retain]; + _data = [[[OFString stringWithContentsOfFile: + _file] JSONValue] retain]; } @catch (id e) { - data = [OFMutableDictionary new]; + _data = [OFMutableDictionary new]; } [pool release]; @@ -69,22 +69,22 @@ - (void)dealloc { - [file release]; - [data release]; + [_file release]; + [_data release]; [super dealloc]; } - (void)save { - [[data JSONRepresentation] writeToFile: file]; + [[_data JSONRepresentation] writeToFile: _file]; } - (void)XMPP_setObject: (id)object forPath: (OFString*)path { OFArray *pathComponents = [path componentsSeparatedByString: @"."]; - OFMutableDictionary *iter = data; + OFMutableDictionary *iter = _data; OFEnumerator *enumerator = [pathComponents objectEnumerator]; OFString *component; size_t i = 0, components = [pathComponents count]; @@ -116,7 +116,7 @@ OFArray *pathComponents = [path componentsSeparatedByString: @"."]; OFEnumerator *enumerator = [pathComponents objectEnumerator]; OFString *component; - id object = data; + id object = _data; while ((component = [enumerator nextObject]) != nil) object = [object objectForKey: component]; diff --git a/src/XMPPMessage.m b/src/XMPPMessage.m index e430246..139a43a 100644 --- a/src/XMPPMessage.m +++ b/src/XMPPMessage.m @@ -34,21 +34,21 @@ 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_ - ID: (OFString*)ID_ ++ messageWithType: (OFString*)type + ID: (OFString*)ID { - return [[[self alloc] initWithType: type_ - ID: ID_] autorelease]; + return [[[self alloc] initWithType: type + ID: ID] autorelease]; } - init @@ -57,24 +57,24 @@ ID: nil]; } -- initWithID: (OFString*)ID_ +- initWithID: (OFString*)ID { return [self initWithType: nil - ID: ID_]; + ID: ID]; } -- initWithType: (OFString*)type_ +- initWithType: (OFString*)type { - return [self initWithType: type_ + return [self initWithType: type ID: nil]; } -- initWithType: (OFString*)type_ - ID: (OFString*)ID_ +- initWithType: (OFString*)type + ID: (OFString*)ID { return [super initWithName: @"message" - type: type_ - ID: ID_]; + type: type + ID: ID]; } - (void)setBody: (OFString*)body diff --git a/src/XMPPMulticastDelegate.h b/src/XMPPMulticastDelegate.h index 343c81c..5539ab9 100644 --- a/src/XMPPMulticastDelegate.h +++ b/src/XMPPMulticastDelegate.h @@ -30,7 +30,7 @@ @interface XMPPMulticastDelegate: OFObject { /// \cond internal - OFDataArray *delegates; + OFDataArray *_delegates; /// \endcond } diff --git a/src/XMPPMulticastDelegate.m b/src/XMPPMulticastDelegate.m index 748b505..afba301 100644 --- a/src/XMPPMulticastDelegate.m +++ b/src/XMPPMulticastDelegate.m @@ -34,7 +34,7 @@ self = [super init]; @try { - delegates = [[OFDataArray alloc] initWithItemSize: sizeof(id)]; + _delegates = [[OFDataArray alloc] initWithItemSize: sizeof(id)]; } @catch (id e) { [self release]; @throw e; @@ -45,24 +45,24 @@ - (void)dealloc { - [delegates release]; + [_delegates release]; [super dealloc]; } - (void)addDelegate: (id)delegate { - [delegates addItem: &delegate]; + [_delegates addItem: &delegate]; } - (void)removeDelegate: (id)delegate { - id *cArray = [delegates items]; - size_t i, count = [delegates count]; + id *items = [_delegates items]; + size_t i, count = [_delegates count]; for (i = 0; i < count; i++) { - if (cArray[i] == delegate) { - [delegates removeItemAtIndex: i]; + if (items[i] == delegate) { + [_delegates removeItemAtIndex: i]; return; } } @@ -71,18 +71,18 @@ - (BOOL)broadcastSelector: (SEL)selector withObject: (id)object { - id *cArray = [delegates items]; - size_t i, count = [delegates count]; + id *items = [_delegates items]; + size_t i, count = [_delegates count]; BOOL handled = NO; for (i = 0; i < count; i++) { - if (![cArray[i] respondsToSelector: selector]) + if (![items[i] respondsToSelector: selector]) continue; 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; @@ -92,18 +92,18 @@ withObject: (id)object1 withObject: (id)object2 { - id *cArray = [delegates items]; - size_t i, count = [delegates count]; + id *items = [_delegates items]; + size_t i, count = [_delegates count]; BOOL handled = NO; for (i = 0; i < count; i++) { - if (![cArray[i] respondsToSelector: selector]) + if (![items[i] respondsToSelector: selector]) continue; 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; diff --git a/src/XMPPPLAINAuth.m b/src/XMPPPLAINAuth.m index 4aa5434..4cbec60 100644 --- a/src/XMPPPLAINAuth.m +++ b/src/XMPPPLAINAuth.m @@ -49,22 +49,22 @@ OFDataArray *message = [OFDataArray dataArray]; /* authzid */ - if (authzid) - [message addItem: authzid]; + if (_authzid) + [message addItem: _authzid]; /* separator */ [message addItem: ""]; /* authcid */ - [message addItems: [authcid UTF8String] - count: [authcid UTF8StringLength]]; + [message addItems: [_authcid UTF8String] + count: [_authcid UTF8StringLength]]; /* separator */ [message addItem: ""]; /* passwd */ - [message addItems: [password UTF8String] - count: [password UTF8StringLength]]; + [message addItems: [_password UTF8String] + count: [_password UTF8StringLength]]; return message; } diff --git a/src/XMPPPresence.h b/src/XMPPPresence.h index b7c3627..1664c21 100644 --- a/src/XMPPPresence.h +++ b/src/XMPPPresence.h @@ -29,9 +29,9 @@ @interface XMPPPresence: XMPPStanza { /// \cond internal - OFString *status; - OFString *show; - OFNumber *priority; + OFString *_status; + OFString *_show; + OFNumber *_priority; /// \endcond } #ifdef OF_HAVE_PROPERTIES diff --git a/src/XMPPPresence.m b/src/XMPPPresence.m index 79b40b7..a38a84b 100644 --- a/src/XMPPPresence.m +++ b/src/XMPPPresence.m @@ -48,21 +48,21 @@ static int show_to_int(OFString *show) 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_ - ID: (OFString*)ID_ ++ presenceWithType: (OFString*)type + ID: (OFString*)ID { - return [[[self alloc] initWithType: type_ - ID: ID_] autorelease]; + return [[[self alloc] initWithType: type + ID: ID] autorelease]; } - init @@ -71,24 +71,24 @@ static int show_to_int(OFString *show) ID: nil]; } -- initWithID: (OFString*)ID_ +- initWithID: (OFString*)ID { return [self initWithType: nil - ID: ID_]; + ID: ID]; } -- initWithType: (OFString*)type_ +- initWithType: (OFString*)type { - return [self initWithType: type_ + return [self initWithType: type ID: nil]; } -- initWithType: (OFString*)type_ - ID: (OFString*)ID_ +- initWithType: (OFString*)type + ID: (OFString*)ID { return [super initWithName: @"presence" - type: type_ - ID: ID_]; + type: type + ID: ID]; } - initWithElement: (OFXMLElement*)element @@ -122,22 +122,22 @@ static int show_to_int(OFString *show) - (void)dealloc { - [status release]; - [show release]; - [priority release]; + [_status release]; + [_show release]; + [_priority release]; [super dealloc]; } - (OFString*)type { - if (type == nil) + if (_type == nil) return @"available"; - return [[type copy] autorelease]; + return [[_type copy] autorelease]; } -- (void)setShow: (OFString*)show_ +- (void)setShow: (OFString*)show { OFXMLElement *oldShow = [self elementForName: @"show" namespace: XMPP_NS_CLIENT]; @@ -145,20 +145,20 @@ static int show_to_int(OFString *show) if (oldShow != nil) [self removeChild: oldShow]; - if (show_ != nil) + if (show != nil) [self addChild: [OFXMLElement elementWithName: @"show" namespace: XMPP_NS_CLIENT - stringValue: show_]]; + stringValue: show]]; - OF_SETTER(show, show_, YES, 1); + OF_SETTER(_show, show, YES, 1); } - (OFString*)show { - return [[show copy] autorelease]; + return [[_show copy] autorelease]; } -- (void)setStatus: (OFString*)status_ +- (void)setStatus: (OFString*)status { OFXMLElement *oldStatus = [self elementForName: @"status" namespace: XMPP_NS_CLIENT]; @@ -166,22 +166,22 @@ static int show_to_int(OFString *show) if (oldStatus != nil) [self removeChild: oldStatus]; - if (status_ != nil) + if (status != nil) [self addChild: [OFXMLElement elementWithName: @"status" namespace: XMPP_NS_CLIENT - stringValue: status_]]; + stringValue: status]]; - OF_SETTER(status, status_, YES, 1); + OF_SETTER(_status, status, YES, 1); } - (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)) @throw [OFInvalidArgumentException @@ -195,17 +195,17 @@ static int show_to_int(OFString *show) [self removeChild: oldPriority]; OFString* priority_s = - [OFString stringWithFormat: @"%" @PRId8, [priority_ int8Value]]; + [OFString stringWithFormat: @"%" @PRId8, [priority int8Value]]; [self addChild: [OFXMLElement elementWithName: @"priority" namespace: XMPP_NS_CLIENT 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 )object @@ -228,8 +228,8 @@ static int show_to_int(OFString *show) if (otherPriority == nil) otherPriority = [OFNumber numberWithInt8: 0]; - if (priority != nil) - priorityOrder = [priority compare: otherPriority]; + if (_priority != nil) + priorityOrder = [_priority compare: otherPriority]; else priorityOrder = [[OFNumber numberWithInt8: 0] compare: otherPriority]; @@ -238,10 +238,10 @@ static int show_to_int(OFString *show) return priorityOrder; otherShow = [otherPresence show]; - if ([show isEqual: otherShow]) + if ([_show isEqual: otherShow]) 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_DESCENDING; diff --git a/src/XMPPRoster.h b/src/XMPPRoster.h index 0a5a6d3..14a800e 100644 --- a/src/XMPPRoster.h +++ b/src/XMPPRoster.h @@ -69,11 +69,11 @@ #endif { /// \cond internal - XMPPConnection *connection; - OFMutableDictionary *rosterItems; - XMPPMulticastDelegate *delegates; - id dataStorage; - BOOL rosterRequested; + XMPPConnection *_connection; + OFMutableDictionary *_rosterItems; + XMPPMulticastDelegate *_delegates; + id _dataStorage; + BOOL _rosterRequested; /// \endcond } diff --git a/src/XMPPRoster.m b/src/XMPPRoster.m index 2785460..2bc979b 100644 --- a/src/XMPPRoster.m +++ b/src/XMPPRoster.m @@ -45,11 +45,11 @@ self = [super init]; @try { - rosterItems = [[OFMutableDictionary alloc] init]; - connection = connection_; - [connection addDelegate: self]; - delegates = [[XMPPMulticastDelegate alloc] init]; - dataStorage = [connection dataStorage]; + _rosterItems = [[OFMutableDictionary alloc] init]; + _connection = connection_; + [_connection addDelegate: self]; + _delegates = [[XMPPMulticastDelegate alloc] init]; + _dataStorage = [_connection dataStorage]; } @catch (id e) { [self release]; @throw e; @@ -60,16 +60,16 @@ - (void)dealloc { - [connection removeDelegate: self]; - [delegates release]; - [rosterItems release]; + [_connection removeDelegate: self]; + [_delegates release]; + [_rosterItems release]; [super dealloc]; } - (OFDictionary*)rosterItems { - return [[rosterItems copy] autorelease]; + return [[_rosterItems copy] autorelease]; } - (void)requestRoster @@ -77,16 +77,16 @@ XMPPIQ *iq; OFXMLElement *query; - rosterRequested = YES; + _rosterRequested = YES; iq = [XMPPIQ IQWithType: @"get" - ID: [connection generateStanzaID]]; + ID: [_connection generateStanzaID]]; query = [OFXMLElement elementWithName: @"query" namespace: XMPP_NS_ROSTER]; - if ([connection supportsRosterVersioning]) { - OFString *ver = [dataStorage stringValueForPath: @"roster.ver"]; + if ([_connection supportsRosterVersioning]) { + OFString *ver = [_dataStorage stringValueForPath: @"roster.ver"]; if (ver == nil) ver = @""; @@ -97,13 +97,13 @@ [iq addChild: query]; - [connection sendIQ: iq - callbackTarget: self - selector: @selector(XMPP_handleInitialRosterForConnection: + [_connection sendIQ: iq + callbackTarget: self + selector: @selector(XMPP_handleInitialRosterForConnection: IQ:)]; } -- (BOOL)connection: (XMPPConnection*)connection_ +- (BOOL)connection: (XMPPConnection*)connection didReceiveIQ: (XMPPIQ*)iq { OFXMLElement *rosterElement; @@ -125,23 +125,23 @@ if (element != nil) { rosterItem = [self XMPP_rosterItemWithXMLElement: element]; - [delegates broadcastSelector: @selector( - roster:didReceiveRosterItem:) - withObject: self - withObject: rosterItem]; + [_delegates broadcastSelector: @selector( + roster:didReceiveRosterItem:) + withObject: self + withObject: rosterItem]; [self XMPP_updateRosterItem: rosterItem]; } - if ([connection supportsRosterVersioning]) { + if ([_connection supportsRosterVersioning]) { OFString *ver = [[rosterElement attributeForName: @"ver"] stringValue]; - [dataStorage setStringValue: ver - forPath: @"roster.ver"]; - [dataStorage save]; + [_dataStorage setStringValue: ver + forPath: @"roster.ver"]; + [_dataStorage save]; } - [connection_ sendStanza: [iq resultIQ]]; + [connection sendStanza: [iq resultIQ]]; return YES; } @@ -153,8 +153,8 @@ - (void)updateRosterItem: (XMPPRosterItem*)rosterItem { - XMPPIQ *iq = [XMPPIQ IQWithType: @"set" - ID: [connection generateStanzaID]]; + XMPPIQ *IQ = [XMPPIQ IQWithType: @"set" + ID: [_connection generateStanzaID]]; OFXMLElement *query = [OFXMLElement elementWithName: @"query" namespace: XMPP_NS_ROSTER]; OFXMLElement *item = [OFXMLElement elementWithName: @"item" @@ -175,15 +175,15 @@ stringValue: group]]; [query addChild: item]; - [iq addChild: query]; + [IQ addChild: query]; - [connection sendStanza: iq]; + [_connection sendStanza: IQ]; } - (void)deleteRosterItem: (XMPPRosterItem*)rosterItem { - XMPPIQ *iq = [XMPPIQ IQWithType: @"set" - ID: [connection generateStanzaID]]; + XMPPIQ *IQ = [XMPPIQ IQWithType: @"set" + ID: [_connection generateStanzaID]]; OFXMLElement *query = [OFXMLElement elementWithName: @"query" namespace: XMPP_NS_ROSTER]; OFXMLElement *item = [OFXMLElement elementWithName: @"item" @@ -195,44 +195,44 @@ stringValue: @"remove"]; [query addChild: item]; - [iq addChild: query]; + [IQ addChild: query]; - [connection sendStanza: iq]; + [_connection sendStanza: IQ]; } - (void)addDelegate: (id )delegate { - [delegates addDelegate: delegate]; + [_delegates addDelegate: delegate]; } - (void)removeDelegate: (id )delegate { - [delegates removeDelegate: delegate]; + [_delegates removeDelegate: delegate]; } -- (void)setDataStorage: (id )dataStorage_ +- (void)setDataStorage: (id )dataStorage { - if (rosterRequested) + if (_rosterRequested) @throw [OFInvalidArgumentException exceptionWithClass: [self class]]; - dataStorage = dataStorage_; + _dataStorage = dataStorage; } - (XMPPConnection*)connection { - return connection; + return _connection; } - (id )dataStorage { - return dataStorage; + return _dataStorage; } - (void)XMPP_updateRosterItem: (XMPPRosterItem*)rosterItem { - if ([connection supportsRosterVersioning]) { - OFMutableDictionary *items = [[[dataStorage dictionaryForPath: + if ([_connection supportsRosterVersioning]) { + OFMutableDictionary *items = [[[_dataStorage dictionaryForPath: @"roster.items"] mutableCopy] autorelease]; if (items == nil) @@ -258,15 +258,15 @@ } else [items removeObjectForKey: [[rosterItem JID] bareJID]]; - [dataStorage setDictionary: items - forPath: @"roster.items"]; + [_dataStorage setDictionary: items + forPath: @"roster.items"]; } if (![[rosterItem subscription] isEqual: @"remove"]) - [rosterItems setObject: rosterItem - forKey: [[rosterItem JID] bareJID]]; + [_rosterItems setObject: rosterItem + forKey: [[rosterItem JID] bareJID]]; else - [rosterItems removeObjectForKey: [[rosterItem JID] bareJID]]; + [_rosterItems removeObjectForKey: [[rosterItem JID] bareJID]]; } - (XMPPRosterItem*)XMPP_rosterItemWithXMLElement: (OFXMLElement*)element @@ -315,9 +315,9 @@ rosterElement = [iq elementForName: @"query" namespace: XMPP_NS_ROSTER]; - if ([connection supportsRosterVersioning]) { + if ([_connection supportsRosterVersioning]) { if (rosterElement == nil) { - OFDictionary *items = [dataStorage + OFDictionary *items = [_dataStorage dictionaryForPath: @"roster.items"]; OFEnumerator *enumerator = [items objectEnumerator]; OFDictionary *item; @@ -337,12 +337,12 @@ [rosterItem setGroups: [item objectForKey: @"groups"]]; - [rosterItems setObject: rosterItem - forKey: [JID bareJID]]; + [_rosterItems setObject: rosterItem + forKey: [JID bareJID]]; } } else - [dataStorage setDictionary: nil - forPath: @"roster.items"]; + [_dataStorage setDictionary: nil + forPath: @"roster.items"]; } enumerator = [[rosterElement children] objectEnumerator]; @@ -361,15 +361,15 @@ [pool release]; } - if ([connection supportsRosterVersioning] && rosterElement != nil) { + if ([_connection supportsRosterVersioning] && rosterElement != nil) { OFString *ver = [[rosterElement attributeForName: @"ver"] stringValue]; - [dataStorage setStringValue: ver - forPath: @"roster.ver"]; - [dataStorage save]; + [_dataStorage setStringValue: ver + forPath: @"roster.ver"]; + [_dataStorage save]; } - [delegates broadcastSelector: @selector(rosterWasReceived:) - withObject: self]; + [_delegates broadcastSelector: @selector(rosterWasReceived:) + withObject: self]; } @end diff --git a/src/XMPPRosterItem.h b/src/XMPPRosterItem.h index 688bae8..ee8d4f0 100644 --- a/src/XMPPRosterItem.h +++ b/src/XMPPRosterItem.h @@ -30,10 +30,10 @@ @interface XMPPRosterItem: OFObject { /// \cond internal - XMPPJID *JID; - OFString *name; - OFString *subscription; - OFArray *groups; + XMPPJID *_JID; + OFString *_name; + OFString *_subscription; + OFArray *_groups; /// \endcond } diff --git a/src/XMPPRosterItem.m b/src/XMPPRosterItem.m index e8548ea..3a9024b 100644 --- a/src/XMPPRosterItem.m +++ b/src/XMPPRosterItem.m @@ -37,10 +37,10 @@ - (void)dealloc { - [JID release]; - [name release]; - [subscription release]; - [groups release]; + [_JID release]; + [_name release]; + [_subscription release]; + [_groups release]; [super dealloc]; } @@ -50,10 +50,10 @@ XMPPRosterItem *new = [[XMPPRosterItem alloc] init]; @try { - new->JID = [JID copy]; - new->name = [name copy]; - new->subscription = [subscription copy]; - new->groups = [groups copy]; + new->_JID = [_JID copy]; + new->_name = [_name copy]; + new->_subscription = [_subscription copy]; + new->_groups = [_groups copy]; } @catch (id e) { [new release]; @throw e; @@ -66,52 +66,46 @@ { return [OFString stringWithFormat: @"", - JID, name, subscription, groups]; + _JID, _name, _subscription, _groups]; } -- (void)setJID: (XMPPJID*)JID_ +- (void)setJID: (XMPPJID*)JID { - XMPPJID *old = JID; - JID = [JID_ copy]; - [old release]; + OF_SETTER(_JID, JID, YES, YES) } - (XMPPJID*)JID { - return [[JID copy] autorelease]; + OF_GETTER(_JID, YES) } -- (void)setName: (OFString*)name_ +- (void)setName: (OFString*)name { - OFString *old = name; - name = [name_ copy]; - [old release]; + OF_SETTER(_name, name, YES, YES) } - (OFString*)name { - return [[name copy] autorelease]; + OF_GETTER(_name, YES) } -- (void)setSubscription: (OFString*)subscription_ +- (void)setSubscription: (OFString*)subscription { - OFString *old = subscription; - subscription = [subscription_ copy]; - [old release]; + OF_SETTER(_subscription, subscription, YES, YES) } - (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 { - OF_GETTER(groups, YES) + OF_GETTER(_groups, YES) } @end diff --git a/src/XMPPSCRAMAuth.h b/src/XMPPSCRAMAuth.h index 553dadf..d6ab7f5 100644 --- a/src/XMPPSCRAMAuth.h +++ b/src/XMPPSCRAMAuth.h @@ -30,14 +30,14 @@ @interface XMPPSCRAMAuth: XMPPAuthenticator { /// \cond internal - Class hashType; - OFString *cNonce; - OFString *GS2Header; - OFString *clientFirstMessageBare; - OFDataArray *serverSignature; - XMPPConnection *connection; - BOOL plusAvailable; - BOOL authenticated; + Class _hashType; + OFString *_cNonce; + OFString *_GS2Header; + OFString *_clientFirstMessageBare; + OFDataArray *_serverSignature; + XMPPConnection *_connection; + BOOL _plusAvailable; + BOOL _authenticated; /// \endcond } diff --git a/src/XMPPSCRAMAuth.m b/src/XMPPSCRAMAuth.m index 658dc8b..3775a41 100644 --- a/src/XMPPSCRAMAuth.m +++ b/src/XMPPSCRAMAuth.m @@ -40,105 +40,105 @@ @implementation XMPPSCRAMAuth + SCRAMAuthWithAuthcid: (OFString*)authcid password: (OFString*)password - connection: (XMPPConnection*)connection_ + connection: (XMPPConnection*)connection hash: (Class)hash - plusAvailable: (BOOL)plusAvailable_ + plusAvailable: (BOOL)plusAvailable { return [[[self alloc] initWithAuthcid: authcid password: password - connection: connection_ + connection: connection hash: hash - plusAvailable: plusAvailable_] autorelease]; + plusAvailable: plusAvailable] autorelease]; } + SCRAMAuthWithAuthzid: (OFString*)authzid authcid: (OFString*)authcid password: (OFString*)password - connection: (XMPPConnection*)connection_ + connection: (XMPPConnection*)connection hash: (Class)hash - plusAvailable: (BOOL)plusAvailable_ + plusAvailable: (BOOL)plusAvailable { return [[[self alloc] initWithAuthzid: authzid authcid: authcid password: password - connection: connection_ + connection: connection hash: hash - plusAvailable: plusAvailable_] autorelease]; + plusAvailable: plusAvailable] autorelease]; } -- initWithAuthcid: (OFString*)authcid_ - password: (OFString*)password_ - connection: (XMPPConnection*)connection_ +- initWithAuthcid: (OFString*)authcid + password: (OFString*)password + connection: (XMPPConnection*)connection hash: (Class)hash - plusAvailable: (BOOL)plusAvailable_ + plusAvailable: (BOOL)plusAvailable { return [self initWithAuthzid: nil - authcid: authcid_ - password: password_ - connection: connection_ + authcid: authcid + password: password + connection: connection hash: hash - plusAvailable: plusAvailable_]; + plusAvailable: plusAvailable]; } -- initWithAuthzid: (OFString*)authzid_ - authcid: (OFString*)authcid_ - password: (OFString*)password_ - connection: (XMPPConnection*)connection_ +- initWithAuthzid: (OFString*)authzid + authcid: (OFString*)authcid + password: (OFString*)password + connection: (XMPPConnection*)connection hash: (Class)hash - plusAvailable: (BOOL)plusAvailable_ + plusAvailable: (BOOL)plusAvailable { - self = [super initWithAuthzid: authzid_ - authcid: authcid_ - password: password_]; + self = [super initWithAuthzid: authzid + authcid: authcid + password: password]; - hashType = hash; - plusAvailable = plusAvailable_; - connection = [connection_ retain]; + _hashType = hash; + _plusAvailable = plusAvailable; + _connection = [connection retain]; return self; } - (void)dealloc { - [GS2Header release]; - [clientFirstMessageBare release]; - [serverSignature release]; - [cNonce release]; - [connection release]; + [_GS2Header release]; + [_clientFirstMessageBare release]; + [_serverSignature release]; + [_cNonce release]; + [_connection release]; [super dealloc]; } -- (void)setAuthzid: (OFString*)authzid_ +- (void)setAuthzid: (OFString*)authzid { - OFString *old = authzid; + OFString *old = _authzid; - if (authzid_) { - OFMutableString *new = [[authzid_ mutableCopy] autorelease]; + if (authzid) { + OFMutableString *new = [[authzid mutableCopy] autorelease]; [new replaceOccurrencesOfString: @"=" withString: @"=3D"]; [new replaceOccurrencesOfString: @"," withString: @"=2C"]; - authzid = [new retain]; + _authzid = [new retain]; } else - authzid = nil; + _authzid = nil; [old release]; } -- (void)setAuthcid: (OFString*)authcid_ +- (void)setAuthcid: (OFString*)authcid { - OFString *old = authcid; + OFString *old = _authcid; - if (authcid_) { - OFMutableString *new = [[authcid_ mutableCopy] autorelease]; + if (authcid) { + OFMutableString *new = [[authcid mutableCopy] autorelease]; [new replaceOccurrencesOfString: @"=" withString: @"=3D"]; [new replaceOccurrencesOfString: @"," withString: @"=2C"]; - authcid = [new retain]; + _authcid = [new retain]; } else - authcid = nil; + _authcid = nil; [old release]; } @@ -148,35 +148,35 @@ OFDataArray *ret = [OFDataArray dataArray]; /* New authentication attempt, reset status */ - [cNonce release]; - cNonce = nil; - [GS2Header release]; - GS2Header = nil; - [serverSignature release]; - serverSignature = nil; - authenticated = NO; + [_cNonce release]; + _cNonce = nil; + [_GS2Header release]; + _GS2Header = nil; + [_serverSignature release]; + _serverSignature = nil; + _authenticated = NO; - if (authzid) - GS2Header = [[OFString alloc] + if (_authzid) + _GS2Header = [[OFString alloc] initWithFormat: @"%@,a=%@,", - (plusAvailable ? @"p=tls-unique" : @"y"), - authzid]; + (_plusAvailable ? @"p=tls-unique" : @"y"), + _authzid]; 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 = nil; - clientFirstMessageBare = [[OFString alloc] initWithFormat: @"n=%@,r=%@", - authcid, - cNonce]; + [_clientFirstMessageBare release]; + _clientFirstMessageBare = nil; + _clientFirstMessageBare = [[OFString alloc] initWithFormat: @"n=%@,r=%@", + _authcid, + _cNonce]; - [ret addItems: [GS2Header UTF8String] - count: [GS2Header UTF8StringLength]]; + [ret addItems: [_GS2Header UTF8String] + count: [_GS2Header UTF8StringLength]]; - [ret addItems: [clientFirstMessageBare UTF8String] - count: [clientFirstMessageBare UTF8StringLength]]; + [ret addItems: [_clientFirstMessageBare UTF8String] + count: [_clientFirstMessageBare UTF8StringLength]]; return ret; } @@ -186,7 +186,7 @@ OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFDataArray *ret; - if (!serverSignature) + if (!_serverSignature) ret = [self XMPP_parseServerFirstMessage: data]; else ret = [self XMPP_parseServerFinalMessage: data]; @@ -213,7 +213,7 @@ GOT_ITERCOUNT = 0x04 } got = 0; - hash = [[[hashType alloc] init] autorelease]; + hash = [[[_hashType alloc] init] autorelease]; ret = [OFDataArray dataArray]; authMessage = [OFDataArray dataArray]; @@ -228,7 +228,7 @@ of_range(2, [comp length] - 2)]; if ([comp hasPrefix: @"r="]) { - if (![entry hasPrefix: cNonce]) + if (![entry hasPrefix: _cNonce]) @throw [XMPPAuthFailedException exceptionWithClass: [self class] connection: nil @@ -253,10 +253,10 @@ // Add c= tmpArray = [OFDataArray dataArray]; - [tmpArray addItems: [GS2Header UTF8String] - count: [GS2Header UTF8StringLength]]; - if (plusAvailable && [connection encrypted]) { - OFDataArray *channelBinding = [((SSLSocket*)[connection socket]) + [tmpArray addItems: [_GS2Header UTF8String] + count: [_GS2Header UTF8StringLength]]; + if (_plusAvailable && [_connection encrypted]) { + OFDataArray *channelBinding = [((SSLSocket*)[_connection socket]) channelBindingDataWithType: @"tls-unique"]; [tmpArray addItems: [channelBinding items] count: [channelBinding count]]; @@ -279,8 +279,8 @@ * SaltedPassword := Hi(Normalize(password), salt, i) */ tmpArray = [OFDataArray dataArray]; - [tmpArray addItems: [password UTF8String] - count: [password UTF8StringLength]]; + [tmpArray addItems: [_password UTF8String] + count: [_password UTF8StringLength]]; saltedPassword = [self XMPP_hiWithData: tmpArray salt: salt @@ -292,8 +292,8 @@ * server-first-message + "," + * client-final-message-without-proof */ - [authMessage addItems: [clientFirstMessageBare UTF8String] - count: [clientFirstMessageBare UTF8StringLength]]; + [authMessage addItems: [_clientFirstMessageBare UTF8String] + count: [_clientFirstMessageBare UTF8StringLength]]; [authMessage addItem: ","]; [authMessage addItems: [data items] count: [data count] * [data itemSize]]; @@ -316,10 +316,10 @@ * StoredKey := H(ClientKey) */ [hash updateWithBuffer: (void*) clientKey - length: [hashType digestSize]]; + length: [_hashType digestSize]]; tmpArray = [OFDataArray dataArray]; [tmpArray addItems: [hash digest] - count: [hashType digestSize]]; + count: [_hashType digestSize]]; /* * IETF RFC 5802: @@ -344,18 +344,18 @@ */ tmpArray = [OFDataArray dataArray]; [tmpArray addItems: serverKey - count: [hashType digestSize]]; - serverSignature = [[OFDataArray alloc] init]; - [serverSignature addItems: [self XMPP_HMACWithKey: tmpArray + count: [_hashType digestSize]]; + _serverSignature = [[OFDataArray alloc] init]; + [_serverSignature addItems: [self XMPP_HMACWithKey: tmpArray data: authMessage] - count: [hashType digestSize]]; + count: [_hashType digestSize]]; /* * IETF RFC 5802: * ClientProof := ClientKey XOR ClientSignature */ tmpArray = [OFDataArray dataArray]; - for (i = 0; i < [hashType digestSize]; i++) { + for (i = 0; i < [_hashType digestSize]; i++) { uint8_t c = clientKey[i] ^ clientSignature[i]; [tmpArray addItem: &c]; } @@ -379,7 +379,7 @@ * server-final-message already received, * we were just waiting for the last word from the server */ - if (authenticated) + if (_authenticated) return nil; mess = [OFString stringWithUTF8String: [data items] @@ -388,13 +388,13 @@ value = [mess substringWithRange: of_range(2, [mess length] - 2)]; if ([mess hasPrefix: @"v="]) { - if (![value isEqual: [serverSignature stringByBase64Encoding]]) + if (![value isEqual: [_serverSignature stringByBase64Encoding]]) @throw [XMPPAuthFailedException exceptionWithClass: [self class] connection: nil reason: @"Received wrong " @"ServerSignature"]; - authenticated = YES; + _authenticated = YES; } else @throw [XMPPAuthFailedException exceptionWithClass: [self class] connection: nil @@ -429,16 +429,16 @@ { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFDataArray *k = [OFDataArray dataArray]; - size_t i, kSize, blockSize = [hashType blockSize]; + size_t i, kSize, blockSize = [_hashType blockSize]; uint8_t *kI = NULL, *kO = NULL; OFHash *hashI, *hashO; if ([key itemSize] * [key count] > blockSize) { - hashI = [[[hashType alloc] init] autorelease]; + hashI = [[[_hashType alloc] init] autorelease]; [hashI updateWithBuffer: [key items] length: [key itemSize] * [key count]]; [k addItems: [hashI digest] - count: [hashType digestSize]]; + count: [_hashType digestSize]]; } else [k addItems: [key items] count: [key itemSize] * [key count]]; @@ -457,17 +457,17 @@ kO[i] ^= HMAC_OPAD; } - hashI = [[[hashType alloc] init] autorelease]; + hashI = [[[_hashType alloc] init] autorelease]; [hashI updateWithBuffer: (char*)kI length: blockSize]; [hashI updateWithBuffer: [data items] length: [data itemSize] * [data count]]; - hashO = [[[hashType alloc] init] autorelease]; + hashO = [[[_hashType alloc] init] autorelease]; [hashO updateWithBuffer: (char*)kO length: blockSize]; [hashO updateWithBuffer: (char*)[hashI digest] - length: [hashType digestSize]]; + length: [_hashType digestSize]]; } @finally { [self freeMemory: kI]; [self freeMemory: kO]; @@ -484,7 +484,7 @@ iterationCount: (intmax_t)i { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; - size_t digestSize = [hashType digestSize]; + size_t digestSize = [_hashType digestSize]; uint8_t *result = NULL, *u, *uOld; intmax_t j, k; OFDataArray *salty, *tmp, *ret; diff --git a/src/XMPPSRVLookup.h b/src/XMPPSRVLookup.h index d913918..bae467e 100644 --- a/src/XMPPSRVLookup.h +++ b/src/XMPPSRVLookup.h @@ -28,11 +28,11 @@ @interface XMPPSRVEntry: OFObject { - uint16_t priority; - uint16_t weight; - uint32_t accumulatedWeight; - uint16_t port; - OFString *target; + uint16_t _priority; + uint16_t _weight; + uint32_t _accumulatedWeight; + uint16_t _port; + OFString *_target; } #ifdef OF_HAVE_PROPERTIES @@ -65,9 +65,9 @@ @interface XMPPSRVLookup: OFObject { - OFString *domain; - struct __res_state resState; - OFList *list; + OFString *_domain; + struct __res_state _resState; + OFList *_list; } #ifdef OF_HAVE_PROPERTIES diff --git a/src/XMPPSRVLookup.m b/src/XMPPSRVLookup.m index 30725f7..be66c32 100644 --- a/src/XMPPSRVLookup.m +++ b/src/XMPPSRVLookup.m @@ -61,18 +61,18 @@ selector: _cmd]; } -- initWithPriority: (uint16_t)priority_ - weight: (uint16_t)weight_ - port: (uint16_t)port_ - target: (OFString*)target_ +- initWithPriority: (uint16_t)priority + weight: (uint16_t)weight + port: (uint16_t)port + target: (OFString*)target { self = [super init]; @try { - priority = priority_; - weight = weight_; - port = port_; - target = [target_ copy]; + _priority = priority; + _weight = weight; + _port = port; + _target = [target copy]; } @catch (id e) { [self release]; @throw e; @@ -91,16 +91,16 @@ char buffer[NS_MAXDNAME]; rdata = (const uint16_t*)(void*)ns_rr_rdata(resourceRecord); - priority = ntohs(rdata[0]); - weight = ntohs(rdata[1]); - port = ntohs(rdata[2]); + _priority = ntohs(rdata[0]); + _weight = ntohs(rdata[1]); + _port = ntohs(rdata[2]); if (dn_expand(ns_msg_base(handle), ns_msg_end(handle), (uint8_t*)&rdata[3], buffer, NS_MAXDNAME) < 1) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; - target = [[OFString alloc] + _target = [[OFString alloc] initWithCString: buffer encoding: OF_STRING_ENCODING_NATIVE]; } @catch (id e) { @@ -113,7 +113,7 @@ - (void)dealloc { - [target release]; + [_target release]; [super dealloc]; } @@ -122,37 +122,37 @@ { return [OFString stringWithFormat: @"<%@ priority: %" PRIu16 @", weight: %" PRIu16 @", target: %@:%" - PRIu16 @">", [self class], priority, weight, target, port]; + PRIu16 @">", [self class], _priority, _weight, _target, _port]; } - (uint16_t)priority { - return priority; + return _priority; } - (uint16_t)weight { - return weight; + return _weight; } -- (void)setAccumulatedWeight: (uint32_t)accumulatedWeight_ +- (void)setAccumulatedWeight: (uint32_t)accumulatedWeight { - accumulatedWeight = accumulatedWeight_; + _accumulatedWeight = accumulatedWeight; } - (uint32_t)accumulatedWeight { - return accumulatedWeight; + return _accumulatedWeight; } - (uint16_t)port { - return port; + return _port; } - (OFString*)target { - OF_GETTER(target, YES) + OF_GETTER(_target, YES) } @end @@ -162,13 +162,13 @@ return [[[self alloc] initWithDomain: domain] autorelease]; } -- initWithDomain: (OFString*)domain_ +- initWithDomain: (OFString*)domain { self = [super init]; @try { - list = [[OFList alloc] init]; - domain = [domain_ copy]; + _list = [[OFList alloc] init]; + _domain = [domain copy]; [self XMPP_lookup]; } @catch (id e) { @@ -181,15 +181,15 @@ - (void)dealloc { - [list release]; - [domain release]; + [_list release]; + [_domain release]; [super dealloc]; } - (OFString*)domain; { - OF_GETTER(domain, YES) + OF_GETTER(_domain, YES) } - (void)XMPP_lookup @@ -199,21 +199,21 @@ size_t pageSize = [OFSystemInfo pageSize]; OFString *request; - request = [OFString stringWithFormat: @"_xmpp-client._tcp.%@", domain]; + request = [OFString stringWithFormat: @"_xmpp-client._tcp.%@", _domain]; @try { int answerLen, resourceRecordCount, i; ns_rr resourceRecord; ns_msg handle; - if (res_ninit(&resState)) + if (res_ninit(&_resState)) @throw [OFAddressTranslationFailedException exceptionWithClass: [self class] socket: nil - host: domain]; + host: _domain]; answer = [self allocMemoryWithSize: pageSize]; - answerLen = res_nsearch(&resState, + answerLen = res_nsearch(&_resState, [request cStringWithEncoding: OF_STRING_ENCODING_NATIVE], ns_c_in, ns_t_srv, answer, (int)pageSize); @@ -225,14 +225,14 @@ @throw [OFAddressTranslationFailedException exceptionWithClass: [self class] socket: nil - host: domain]; + host: _domain]; } if (ns_initparse(answer, answerLen, &handle)) @throw [OFAddressTranslationFailedException exceptionWithClass: [self class] socket: nil - host: domain]; + host: _domain]; resourceRecordCount = ns_msg_count(handle, ns_s_an); for (i = 0; i < resourceRecordCount; i++) { @@ -250,7 +250,7 @@ } @finally { [self freeMemory: answer]; #ifdef HAVE_RES_NDESTROY - res_ndestroy(&resState); + res_ndestroy(&_resState); #endif } @@ -264,7 +264,7 @@ of_list_object_t *iter; /* 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]) { /* * RFC 2782 says those with weight 0 should be at the @@ -289,17 +289,17 @@ [subList appendObject: entry]; if (iter != NULL) - [list insertObject: subList - beforeListObject: iter]; + [_list insertObject: subList + beforeListObject: iter]; else - [list appendObject: subList]; + [_list appendObject: subList]; [pool release]; } - (OFEnumerator*)objectEnumerator { - return [[[XMPPSRVEnumerator alloc] initWithList: list] autorelease]; + return [[[XMPPSRVEnumerator alloc] initWithList: _list] autorelease]; } @end diff --git a/src/XMPPStanza.h b/src/XMPPStanza.h index ce5f1c3..c1c92a0 100644 --- a/src/XMPPStanza.h +++ b/src/XMPPStanza.h @@ -31,11 +31,11 @@ @interface XMPPStanza: OFXMLElement { /// \cond internal - XMPPJID *from; - XMPPJID *to; - OFString *type; - OFString *ID; - OFString *language; + XMPPJID *_from; + XMPPJID *_to; + OFString *_type; + OFString *_ID; + OFString *_language; /// \endcond } diff --git a/src/XMPPStanza.m b/src/XMPPStanza.m index 7f1ea34..f30365c 100644 --- a/src/XMPPStanza.m +++ b/src/XMPPStanza.m @@ -36,26 +36,26 @@ } + stanzaWithName: (OFString*)name - type: (OFString*)type_ + type: (OFString*)type { return [[[self alloc] initWithName: name - type: type_] autorelease]; + type: type] autorelease]; } + stanzaWithName: (OFString*)name - ID: (OFString*)ID_ + ID: (OFString*)ID { return [[[self alloc] initWithName: name - ID: ID_] autorelease]; + ID: ID] autorelease]; } + stanzaWithName: (OFString*)name - type: (OFString*)type_ - ID: (OFString*)ID_ + type: (OFString*)type + ID: (OFString*)ID { return [[[self alloc] initWithName: name - type: type_ - ID: ID_] autorelease]; + type: type + ID: ID] autorelease]; } + stanzaWithElement: (OFXMLElement*)element @@ -63,39 +63,39 @@ return [[[self alloc] initWithElement: element] autorelease]; } -- initWithName: (OFString*)name_ +- initWithName: (OFString*)name { - return [self initWithName: name_ + return [self initWithName: name type: nil ID: nil]; } -- initWithName: (OFString*)name_ - type: (OFString*)type_ +- initWithName: (OFString*)name + type: (OFString*)type { - return [self initWithName: name_ - type: type_ + return [self initWithName: name + type: type ID: nil]; } -- initWithName: (OFString*)name_ - ID: (OFString*)ID_ +- initWithName: (OFString*)name + ID: (OFString*)ID { - return [self initWithName: name_ + return [self initWithName: name type: nil - ID: ID_]; + ID: ID]; } -- initWithName: (OFString*)name_ - type: (OFString*)type_ - ID: (OFString*)ID_ +- initWithName: (OFString*)name + type: (OFString*)type + ID: (OFString*)ID { - self = [super initWithName: name_ + self = [super initWithName: name namespace: XMPP_NS_CLIENT]; @try { - if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] && - ![name_ isEqual: @"presence"]) + if (![name isEqual: @"iq"] && ![name isEqual: @"message"] && + ![name isEqual: @"presence"]) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; @@ -104,11 +104,11 @@ [self setPrefix: @"stream" forNamespace: XMPP_NS_STREAM]; - if (type_ != nil) - [self setType: type_]; + if (type != nil) + [self setType: type]; - if (ID_ != nil) - [self setID: ID_]; + if (ID != nil) + [self setID: ID]; } @catch (id e) { [self release]; @throw e; @@ -147,104 +147,104 @@ - (void)dealloc { - [from release]; - [to release]; - [type release]; - [ID release]; + [_from release]; + [_to release]; + [_type release]; + [_ID release]; [super dealloc]; } -- (void)setFrom: (XMPPJID*)from_ +- (void)setFrom: (XMPPJID*)from { - XMPPJID *old = from; - from = [from_ copy]; + XMPPJID *old = _from; + _from = [from copy]; [old release]; [self removeAttributeForName: @"from"]; - if (from_ != nil) + if (from != nil) [self addAttributeWithName: @"from" - stringValue: [from_ fullJID]]; + stringValue: [from fullJID]]; } - (XMPPJID*)from { - return [[from copy] autorelease]; + return [[_from copy] autorelease]; } -- (void)setTo: (XMPPJID*)to_ +- (void)setTo: (XMPPJID*)to { - XMPPJID *old = to; - to = [to_ copy]; + XMPPJID *old = _to; + _to = [to copy]; [old release]; [self removeAttributeForName: @"to"]; - if (to_ != nil) + if (to != nil) [self addAttributeWithName: @"to" - stringValue: [to_ fullJID]]; + stringValue: [to fullJID]]; } - (XMPPJID*)to { - return [[to copy] autorelease]; + return [[_to copy] autorelease]; } -- (void)setType: (OFString*)type_ +- (void)setType: (OFString*)type { - OFString *old = type; - type = [type_ copy]; + OFString *old = _type; + _type = [type copy]; [old release]; [self removeAttributeForName: @"type"]; - if (type_ != nil) + if (type != nil) [self addAttributeWithName: @"type" stringValue: type]; } - (OFString*)type { - return [[type copy] autorelease]; + return [[_type copy] autorelease]; } -- (void)setID: (OFString*)ID_ +- (void)setID: (OFString*)ID { - OFString *old = ID; - ID = [ID_ copy]; + OFString *old = _ID; + _ID = [ID copy]; [old release]; [self removeAttributeForName: @"id"]; - if (ID_ != nil) + if (ID != nil) [self addAttributeWithName: @"id" - stringValue: ID_]; + stringValue: ID]; } - (OFString*)ID { - return [[ID copy] autorelease]; + return [[_ID copy] autorelease]; } -- (void)setLanguage: (OFString*)language_ +- (void)setLanguage: (OFString*)language { - OFString *old = language; - language = [language_ copy]; + OFString *old = _language; + _language = [language copy]; [old release]; [self removeAttributeForName: @"lang" namespace: @"http://www.w3.org/XML/1998/namespace"]; - if (language_ != nil) + if (language != nil) [self addAttributeWithName: @"lang" namespace: @"http://www.w3.org/XML/1998/" @"namespace" - stringValue: language_]; + stringValue: language]; } - (OFString*)language { - return [[language copy] autorelease]; + return [[_language copy] autorelease]; } @end diff --git a/src/XMPPStreamManagement.h b/src/XMPPStreamManagement.h index f3b2118..85a8b50 100644 --- a/src/XMPPStreamManagement.h +++ b/src/XMPPStreamManagement.h @@ -28,7 +28,7 @@ #endif { /// \cond internal - XMPPConnection *connection; + XMPPConnection *_connection; uint32_t receivedCount; /// \endcond } diff --git a/src/XMPPStreamManagement.m b/src/XMPPStreamManagement.m index 664162f..b28b5e0 100644 --- a/src/XMPPStreamManagement.m +++ b/src/XMPPStreamManagement.m @@ -29,8 +29,8 @@ self = [super init]; @try { - connection = connection_; - [connection addDelegate: self]; + _connection = connection_; + [_connection addDelegate: self]; receivedCount = 0; } @catch (id e) { [self release]; @@ -42,7 +42,7 @@ - (void)dealloc { - [connection removeDelegate: self]; + [_connection removeDelegate: self]; [super dealloc]; }