Index: src/XMPPAuthenticator.h ================================================================== --- src/XMPPAuthenticator.h +++ src/XMPPAuthenticator.h @@ -1,9 +1,10 @@ /* * Copyright (c) 2011, Florian Zeitz + * Copyright (c) 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -28,18 +29,16 @@ @interface XMPPAuthenticator: OFObject { OFString *_authzid, *_authcid, *_password; } -#ifdef OF_HAVE_PROPERTIES /// \brief The authzid to get authorization for @property (copy) OFString *authzid; /// \brief The authcid to authenticate with @property (copy) OFString *authcid; /// \brief The password to authenticate with @property (copy) OFString *password; -#endif /** * \brief Initializes an already allocated XMPPAuthenticator with an authcid * and password. * @@ -75,13 +74,6 @@ * * \param data The continuation data send by the server * \return The appropriate response if the data was a challenge, nil otherwise */ - (OFDataArray*)continueWithData: (OFDataArray*)data; - -- (void)setAuthzid: (OFString*)authzid; -- (OFString*)authzid; -- (void)setAuthcid: (OFString*)authcid; -- (OFString*)authcid; -- (void)setPassword: (OFString*)password; -- (OFString*)password; @end Index: src/XMPPAuthenticator.m ================================================================== --- src/XMPPAuthenticator.m +++ src/XMPPAuthenticator.m @@ -1,9 +1,10 @@ /* * Copyright (c) 2011, Florian Zeitz + * Copyright (c) 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -25,10 +26,12 @@ #endif #import "XMPPAuthenticator.h" @implementation XMPPAuthenticator +@synthesize authzid = _authzid, authcid = _authcid, password = _password; + - initWithAuthcid: (OFString*)authcid password: (OFString*)password { return [self initWithAuthzid: nil authcid: authcid @@ -60,40 +63,10 @@ [_password release]; [super dealloc]; } -- (void)setAuthzid: (OFString*)authzid -{ - OF_SETTER(_authzid, authzid, true, 1) -} - -- (OFString*)authzid -{ - OF_GETTER(_authzid, true) -} - -- (void)setAuthcid: (OFString*)authcid -{ - OF_SETTER(_authcid, authcid, true, 1) -} - -- (OFString*)authcid -{ - OF_GETTER(_authcid, true) -} - -- (void)setPassword: (OFString*)password -{ - OF_SETTER(_password, password, true, 1) -} - -- (OFString*)password -{ - OF_GETTER(_password, true) -} - - (OFDataArray*)initialMessage { return nil; } Index: src/XMPPConnection.h ================================================================== --- src/XMPPConnection.h +++ src/XMPPConnection.h @@ -1,10 +1,11 @@ /* - * Copyright (c) 2010, 2011, 2012, Jonathan Schleifer + * Copyright (c) 2010, 2011, 2012, 2013, 2016 + * Jonathan Schleifer * Copyright (c) 2011, 2012, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -41,14 +42,11 @@ */ @protocol XMPPConnectionDelegate #ifndef XMPP_CONNECTION_M #endif -#ifdef OF_HAVE_OPTIONAL_PROTOCOLS @optional -#endif - /** * \brief This callback is called when the connection received an element. * * \param connection The connection that received the element * \param element The element that was received @@ -145,14 +143,12 @@ @end /** * \brief A class which abstracts a connection to an XMPP service. */ -@interface XMPPConnection: OFObject -#ifdef OF_HAVE_OPTONAL_PROTOCOLS - -#endif +@interface XMPPConnection: OFObject { id _socket; OFXMLParser *_parser, *_oldParser; OFXMLElementBuilder *_elementBuilder, *_oldElementBuilder; OFString *_username, *_password, *_server, *_resource; @@ -172,11 +168,10 @@ bool _supportsRosterVersioning; bool _supportsStreamManagement; unsigned int _lastID; } -#ifdef OF_HAVE_PROPERTIES /// \brief The username to use for authentication @property (copy) OFString *username; /// \brief The password to use for authentication @property (copy) OFString *password; /** @@ -209,11 +204,10 @@ @property (readonly) bool encrypted; /// \brief Whether roster versioning is supported @property (readonly) bool supportsRosterVersioning; /// \brief Whether stream management is supported @property (readonly) bool supportsStreamManagement; -#endif /** * \brief Creates a new autoreleased XMPPConnection. * * \return A new autoreleased XMPPConnection Index: src/XMPPConnection.m ================================================================== --- src/XMPPConnection.m +++ src/XMPPConnection.m @@ -1,10 +1,11 @@ /* - * Copyright (c) 2010, 2011, 2012, Jonathan Schleifer + * Copyright (c) 2010, 2011, 2012, 2013, 2015, 2016 + * Jonathan Schleifer * Copyright (c) 2011, 2012, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -115,10 +116,16 @@ return nil; } @end @implementation XMPPConnection +@synthesize language = _language, privateKeyFile = _privateKeyFile; +@synthesize certificateFile = _certificateFile, socket = _socket; +@synthesize encryptionRequired = _encryptionRequired, encrypted = _encrypted; +@synthesize supportsRosterVersioning = _supportsRosterVersioning; +@synthesize supportsStreamManagement = _supportsStreamManagement; + + (instancetype)connection { return [[[self alloc] init] autorelease]; } @@ -303,30 +310,10 @@ - (OFString*)password { return [[_password copy] autorelease]; } -- (void)setPrivateKeyFile: (OFString*)privateKeyFile -{ - OF_SETTER(_privateKeyFile, privateKeyFile, true, 1) -} - -- (OFString*)privateKeyFile -{ - OF_GETTER(_privateKeyFile, true) -} - -- (void)setCertificateFile: (OFString*)certificateFile -{ - OF_SETTER(_certificateFile, certificateFile, true, 1) -} - -- (OFString*)certificateFile -{ - OF_GETTER(_certificateFile, true) -} - - (void)connect { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; XMPPSRVEntry *candidate = nil; XMPPSRVLookup *SRVLookup = nil; @@ -475,45 +462,15 @@ } return true; } -- (OFTCPSocket*)socket -{ - return [[_socket retain] autorelease]; -} - -- (bool)encryptionRequired -{ - return _encryptionRequired; -} - -- (void)setEncryptionRequired: (bool)encryptionRequired -{ - _encryptionRequired = encryptionRequired; -} - -- (bool)encrypted -{ - return _encrypted; -} - - (bool)streamOpen { return _streamOpen; } -- (bool)supportsRosterVersioning -{ - return _supportsRosterVersioning; -} - -- (bool)supportsStreamManagement -{ - return _supportsStreamManagement; -} - - (bool)checkCertificateAndGetReason: (OFString**)reason { X509Certificate *cert; OFDictionary *SANs; bool serviceSpecific = false; @@ -1253,25 +1210,10 @@ } return ret; } -- (XMPPJID*)JID -{ - return [[_JID copy] autorelease]; -} - -- (void)setPort: (uint16_t)port -{ - _port = port; -} - -- (uint16_t)port -{ - return _port; -} - - (void)setDataStorage: (id )dataStorage { if (_streamOpen) /* FIXME: Find a better exception! */ @throw [OFInvalidArgumentException exception]; @@ -1282,20 +1224,10 @@ - (id )dataStorage { return _dataStorage; } -- (void)setLanguage: (OFString*)language -{ - OF_SETTER(_language, language, true, 1) -} - -- (OFString*)language -{ - OF_GETTER(_language, true) -} - - (void)addDelegate: (id )delegate { [_delegates addDelegate: delegate]; } Index: src/XMPPContact.h ================================================================== --- src/XMPPContact.h +++ src/XMPPContact.h @@ -1,9 +1,10 @@ /* * Copyright (c) 2013, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -36,16 +37,14 @@ XMPPRosterItem *_rosterItem; OFMutableDictionary *_presences; XMPPJID *_lockedOnJID; } -#ifdef OF_HAVE_PROPERTIES /// \brief The XMPPRosterItem corresponding to this contact @property (readonly) XMPPRosterItem *rosterItem; /// \brief The XMPPPresences of this contact with the resources as keys @property (readonly) OFDictionary *presences; -#endif /** * \brief Sends a message to the contact honoring resource locking * * \param message The message to send Index: src/XMPPContact.m ================================================================== --- src/XMPPContact.m +++ src/XMPPContact.m @@ -1,9 +1,10 @@ /* * Copyright (c) 2013, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -23,10 +24,13 @@ #import "XMPPContact.h" #import "XMPPMessage.h" #import "XMPPConnection.h" @implementation XMPPContact +@synthesize rosterItem = _rosterItem; +@synthesize presences = _presences; + - init { self = [super init]; @try { @@ -44,20 +48,10 @@ [_presences release]; [super dealloc]; } -- (XMPPRosterItem*)rosterItem -{ - OF_GETTER(_rosterItem, true) -} - -- (OFDictionary*)presences -{ - OF_GETTER(_presences, true) -} - - (void)sendMessage: (XMPPMessage*)message connection: (XMPPConnection*)connection { if (_lockedOnJID == nil) [message setTo: [_rosterItem JID]]; @@ -67,11 +61,13 @@ [connection sendStanza: message]; } - (void)XMPP_setRosterItem: (XMPPRosterItem*)rosterItem { - OF_SETTER(_rosterItem, rosterItem, true, 0); + XMPPRosterItem *old = _rosterItem; + _rosterItem = [rosterItem retain]; + [old release]; } - (void)XMPP_setPresence: (XMPPPresence*)presence resource: (OFString*)resource { @@ -97,8 +93,10 @@ [self XMPP_setLockedOnJID: nil]; } - (void)XMPP_setLockedOnJID: (XMPPJID*)JID; { - OF_SETTER(_lockedOnJID, JID, true, 0); + XMPPJID *old = _lockedOnJID; + _lockedOnJID = [JID retain]; + [old release]; } @end Index: src/XMPPContactManager.h ================================================================== --- src/XMPPContactManager.h +++ src/XMPPContactManager.h @@ -1,9 +1,10 @@ /* * Copyright (c) 2013, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -33,13 +34,11 @@ /** * \brief A protocol that should be (partially) implemented by delegates * of a XMPPContactManager */ @protocol XMPPContactManagerDelegate -#ifdef OF_HAVE_OPTIONAL_PROTOCOLS @optional -#endif /** * \brief This callback is called whenever a new contact enters the users roster * * \param manager The contact manager that added the contact * \param contact The contact that was added @@ -99,25 +98,21 @@ * \brief A class tracking a XMPPContact instance for each contact in the roster * * This class delegates to a XMPPConnection and a XMPPRoster, thereby tracking * each contacts presences and the current XMPPRosterItem. */ -@interface XMPPContactManager: OFObject -#ifdef OF_HAVE_OPTIONAL_PROTOCOLS - -#endif +@interface XMPPContactManager: OFObject { OFMutableDictionary *_contacts; XMPPConnection *_connection; XMPPRoster *_roster; XMPPMulticastDelegate *_delegates; } -#ifdef OF_HAVE_PROPERTIES /// \brief The tracked contacts, with their bare JID as key @property (readonly) OFDictionary *contacts; -#endif /*! * @brief Initializes an already allocated XMPPContactManager. * * @param connection The connection to be used to track contacts Index: src/XMPPContactManager.m ================================================================== --- src/XMPPContactManager.m +++ src/XMPPContactManager.m @@ -1,9 +1,10 @@ /* * Copyright (c) 2013, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -26,10 +27,12 @@ #import "XMPPMulticastDelegate.h" #import "XMPPPresence.h" #import "XMPPRosterItem.h" @implementation XMPPContactManager +@synthesize contacts = _contacts; + - initWithConnection: (XMPPConnection*)connection roster: (XMPPRoster*)roster { self = [super init]; @@ -82,15 +85,10 @@ - (void)removeDelegate: (id )delegate { [_delegates removeDelegate: delegate]; } -- (OFDictionary*)contacts -{ - OF_GETTER(_contacts, true) -} - - (void)rosterWasReceived: (XMPPRoster*)roster { OFEnumerator *contactEnumerator; XMPPContact *contact; OFDictionary *rosterItems; Index: src/XMPPDiscoEntity.h ================================================================== --- src/XMPPDiscoEntity.h +++ src/XMPPDiscoEntity.h @@ -1,9 +1,10 @@ /* * Copyright (c) 2013, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -36,22 +37,23 @@ OFMutableDictionary *_discoNodes; XMPPConnection *_connection; OFString *_capsNode; } -#ifdef OF_HAVE_PROPERTIES /** * \brief The XMPPDiscoNodes this entity provides Services Discovery * responses for * * This usually contains at least all immediate child nodes, but may contain * any number of nodes nested more deeply. */ @property (readonly) OFDictionary *discoNodes; -/// \brief The node advertised for the entity's capabilites + +/** + * The node advertised for the entity's capabilites. + */ @property (readonly) OFString *capsNode; -#endif /** * \brief Creates a new autoreleased XMPPDiscoEntity with the specified * connection. * @@ -104,9 +106,6 @@ * \brief Calculates the Entity Capabilities Hash of the entity * * \return A OFString containing the capabilities hash */ - (OFString*)capsHash; - -- (OFDictionary*)discoNodes; -- (OFString*)capsNode; @end Index: src/XMPPDiscoEntity.m ================================================================== --- src/XMPPDiscoEntity.m +++ src/XMPPDiscoEntity.m @@ -1,9 +1,10 @@ /* * Copyright (c) 2013, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -24,10 +25,12 @@ #import "XMPPDiscoIdentity.h" #import "XMPPIQ.h" #import "namespaces.h" @implementation XMPPDiscoEntity +@synthesize discoNodes = _discoNodes, capsNode = _capsNode; + + (instancetype)discoEntityWithConnection: (XMPPConnection*)connection { return [[[self alloc] initWithConnection: connection] autorelease]; } @@ -70,26 +73,16 @@ [_discoNodes release]; [super dealloc]; } -- (OFDictionary*)discoNodes; -{ - OF_GETTER(_discoNodes, true) -} - - (void)addDiscoNode: (XMPPDiscoNode*)node { [_discoNodes setObject: node forKey: [node node]]; } -- (OFString*)capsNode -{ - OF_GETTER(_capsNode, true) -} - - (OFString*)capsHash { OFEnumerator *enumerator; XMPPDiscoIdentity *identity; OFString *feature; Index: src/XMPPDiscoIdentity.h ================================================================== --- src/XMPPDiscoIdentity.h +++ src/XMPPDiscoIdentity.h @@ -1,9 +1,10 @@ /* * Copyright (c) 2013, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -27,18 +28,17 @@ */ @interface XMPPDiscoIdentity: OFObject { OFString *_category, *_name, *_type; } -#ifdef OF_HAVE_PROPERTIES + /// \brief The category of the identity @property (readonly) OFString *category; /// \brief The name of the identity, might be unset @property (readonly) OFString *name; /// \brief The type of the identity @property (readonly) OFString *type; -#endif /** * \brief Creates a new autoreleased XMPPDiscoIdentity with the specified * category, type and name. * @@ -83,10 +83,6 @@ * \param type The type of the identity * \return An initialized XMPPDiscoIdentity */ - initWithCategory: (OFString*)category type: (OFString*)type; - -- (OFString*)category; -- (OFString*)name; -- (OFString*)type; @end Index: src/XMPPDiscoIdentity.m ================================================================== --- src/XMPPDiscoIdentity.m +++ src/XMPPDiscoIdentity.m @@ -1,9 +1,10 @@ /* * Copyright (c) 2013, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -21,10 +22,12 @@ */ #import "XMPPDiscoIdentity.h" @implementation XMPPDiscoIdentity +@synthesize category = _category, name = _name, type = _type; + + (instancetype)identityWithCategory: (OFString*)category type: (OFString*)type name: (OFString*)name { return [[[self alloc] initWithCategory: category @@ -87,25 +90,10 @@ [_type release]; [super dealloc]; } -- (OFString*)category -{ - OF_GETTER(_category, true) -} - -- (OFString*)name -{ - OF_GETTER(_name, true) -} - -- (OFString*)type -{ - OF_GETTER(_type, true) -} - - (bool)isEqual: (id)object { XMPPDiscoIdentity *identity; if (object == self) Index: src/XMPPDiscoNode.h ================================================================== --- src/XMPPDiscoNode.h +++ src/XMPPDiscoNode.h @@ -1,9 +1,10 @@ /* * Copyright (c) 2013, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -36,11 +37,10 @@ OFSortedList *_identities; OFSortedList *_features; OFMutableDictionary *_childNodes; } -#ifdef OF_HAVE_PROPERTIES /// \brief The JID this node lives on @property (readonly) XMPPJID *JID; /// \brief The node's opaque name of the node @property (readonly) OFString *node; /// \brief The node's human friendly name (may be unspecified) @@ -49,11 +49,10 @@ @property (readonly) OFSortedList *identities; /// \brief The node's list of features @property (readonly) OFSortedList *features; /// \brief The node's children @property (readonly) OFDictionary *childNodes; -#endif /** * \brief Creates a new autoreleased XMPPDiscoNode with the specified * JID and node * @@ -120,16 +119,10 @@ * * \param node The XMPPDiscoNode to add as child */ - (void)addChildNode: (XMPPDiscoNode*)node; -- (XMPPJID*)JID; -- (OFString*)node; -- (OFSortedList*)identities; -- (OFSortedList*)features; -- (OFDictionary*)childNodes; - - (bool)XMPP_handleItemsIQ: (XMPPIQ*)IQ connection: (XMPPConnection*)connection; - (bool)XMPP_handleInfoIQ: (XMPPIQ*)IQ connection: (XMPPConnection*)connection; @end Index: src/XMPPDiscoNode.m ================================================================== --- src/XMPPDiscoNode.m +++ src/XMPPDiscoNode.m @@ -1,9 +1,10 @@ /* * Copyright (c) 2013, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -27,17 +28,20 @@ #import "XMPPDiscoNode.h" #import "XMPPDiscoIdentity.h" #import "namespaces.h" @implementation XMPPDiscoNode + +@synthesize JID = _JID, node = _node, name = _name, identities = _identities; +@synthesize features = _features, childNodes = _childNodes; + + (instancetype)discoNodeWithJID: (XMPPJID*)JID node: (OFString*)node; { return [[[self alloc] initWithJID: JID node: node] autorelease]; } - + (instancetype)discoNodeWithJID: (XMPPJID*)JID node: (OFString*)node name: (OFString*)name { @@ -92,40 +96,10 @@ [_childNodes release]; [super dealloc]; } -- (XMPPJID*)JID -{ - OF_GETTER(_JID, true) -} - -- (OFString*)node -{ - OF_GETTER(_node, true) -} - -- (OFString*)name -{ - OF_GETTER(_name, true) -} - -- (OFSortedList*)identities -{ - OF_GETTER(_identities, true) -} - -- (OFSortedList*)features -{ - OF_GETTER(_features, true) -} - -- (OFDictionary*)childNodes -{ - OF_GETTER(_childNodes, true) -} - - (void)addIdentity: (XMPPDiscoIdentity*)identity { [_identities insertObject: identity]; } Index: src/XMPPExceptions.h ================================================================== --- src/XMPPExceptions.h +++ src/XMPPExceptions.h @@ -1,9 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer + * Copyright (c) 2011, 2012, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -31,14 +32,12 @@ @interface XMPPException: OFException { XMPPConnection *_connection; } -#ifdef OF_HAVE_PROPERTIES /// \brief The connection the exception relates to @property (readonly, retain) XMPPConnection *connection; -#endif /** * \brief Creates a new XMPPException. * * \param connection The connection that received the data responsible @@ -53,12 +52,10 @@ * \param connection The connection that received the data responsible * for this exception * \return An initialized XMPPException */ - initWithConnection: (XMPPConnection*)connection; - -- (XMPPConnection*)connection; @end /** * \brief An exception indicating a stream error was received */ @@ -65,16 +62,14 @@ @interface XMPPStreamErrorException: XMPPException { OFString *_condition, *_reason; } -#ifdef OF_HAVE_PROPERTIES /// \brief The defined error condition specified by the stream error @property (readonly, copy) OFString *condition; /// \brief The descriptive free-form text specified by the stream error @property (readonly, copy) OFString *reason; -#endif /** * \brief Creates a new XMPPStreamErrorException. * * \param connection The connection that received the stream error @@ -95,13 +90,10 @@ * \return An initialized XMPPStreamErrorException */ - initWithConnection: (XMPPConnection*)connection condition: (OFString*)condition reason: (OFString*)reason; - -- (OFString*)condition; -- (OFString*)reason; @end /** * \brief An exception indicating a stringprep profile * did not apply to a string @@ -109,16 +101,14 @@ @interface XMPPStringPrepFailedException: XMPPException { OFString *_profile, *_string; } -#ifdef OF_HAVE_PROPERTIES /// \brief The name of the stringprep profile that did not apply @property (readonly, copy) OFString *profile; /// \brief The string that failed the stringprep profile @property (readonly, copy) OFString *string; -#endif /** * \brief Creates a new XMPPStringPrepFailedException. * * \param connection The connection the string relates to @@ -139,13 +129,10 @@ * \return An initialized XMPPStringPrepFailedException */ - initWithConnection: (XMPPConnection*)connection profile: (OFString*)profile string: (OFString*)string; - -- (OFString*)profile; -- (OFString*)string; @end /** * \brief An exception indicating IDNA translation of a string failed */ @@ -152,16 +139,14 @@ @interface XMPPIDNATranslationFailedException: XMPPException { OFString *_operation, *_string; } -#ifdef OF_HAVE_PROPERTIES /// \brief The IDNA translation operation which failed @property (readonly, copy) OFString *operation; /// \brief The string that could not be translated @property (readonly, copy) OFString *string; -#endif /** * \brief Creates a new XMPPIDNATranslationFailedException. * * \param connection The connection the string relates to @@ -182,13 +167,10 @@ * \return An initialized XMPPIDNATranslationFailedException */ - initWithConnection: (XMPPConnection*)connection operation: (OFString*)operation string: (OFString*)string; - -- (OFString*)operation; -- (OFString*)string; @end /** * \brief An exception indicating authentication failed */ @@ -195,14 +177,12 @@ @interface XMPPAuthFailedException: XMPPException { OFString *_reason; } -#ifdef OF_HAVE_PROPERTIES /// \brief The reason the authentication failed @property (readonly, copy) OFString *reason; -#endif /** * \brief Creates a new XMPPAuthFailedException. * * \param connection The connection that could not be authenticated @@ -219,8 +199,6 @@ * \param reason The reason the authentication failed * \return An initialized XMPPAuthFailedException */ - initWithConnection: (XMPPConnection*)connection reason: (OFString*)reason; - -- (OFString*)reason; @end Index: src/XMPPExceptions.m ================================================================== --- src/XMPPExceptions.m +++ src/XMPPExceptions.m @@ -1,9 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer + * Copyright (c) 2012, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -28,25 +29,20 @@ #import "XMPPExceptions.h" #import "XMPPConnection.h" @implementation XMPPException +@synthesize connection = _connection; + + (instancetype)exceptionWithConnection: (XMPPConnection*)connection { return [[[self alloc] initWithConnection: connection] autorelease]; } - init { - @try { - [self doesNotRecognizeSelector: _cmd]; - } @catch (id e) { - [self release]; - @throw e; - } - - abort(); + OF_INVALID_INIT_METHOD } - initWithConnection: (XMPPConnection*)connection { self = [super init]; @@ -65,18 +61,15 @@ { [_connection release]; [super dealloc]; } - -- (XMPPConnection*)connection -{ - OF_GETTER(_connection, true) -} @end @implementation XMPPStreamErrorException +@synthesize condition = _condition, reason = _reason; + + (instancetype)exceptionWithConnection: (XMPPConnection*)connection condition: (OFString*)condition reason: (OFString*)reason; { return [[[self alloc] initWithConnection: connection @@ -84,18 +77,11 @@ reason: reason] autorelease]; } - initWithConnection: (XMPPConnection*)connection { - @try { - [self doesNotRecognizeSelector: _cmd]; - } @catch (id e) { - [self release]; - @throw e; - } - - abort(); + OF_INVALID_INIT_METHOD } - initWithConnection: (XMPPConnection*)connection condition: (OFString*)condition reason: (OFString*)reason @@ -124,23 +110,15 @@ - (OFString*)description { return [OFString stringWithFormat: @"Got stream error: %@. Reason: %@!", _condition, _reason]; } - -- (OFString*)condition -{ - OF_GETTER(_condition, true) -} - -- (OFString*)reason -{ - OF_GETTER(_reason, true) -} @end @implementation XMPPStringPrepFailedException +@synthesize profile = _profile, string = _string; + + (instancetype)exceptionWithConnection: (XMPPConnection*)connection profile: (OFString*)profile string: (OFString*)string { return [[[self alloc] initWithConnection: connection @@ -148,18 +126,11 @@ string: string] autorelease]; } - initWithConnection: (XMPPConnection*)connection { - @try { - [self doesNotRecognizeSelector: _cmd]; - } @catch (id e) { - [self release]; - @throw e; - } - - abort(); + OF_INVALID_INIT_METHOD } - initWithConnection: (XMPPConnection*)connection profile: (OFString*)profile string: (OFString*)string @@ -189,23 +160,15 @@ { return [OFString stringWithFormat: @"Stringprep with profile %@ failed on string '%@'!", _profile, _string]; } - -- (OFString*)profile -{ - OF_GETTER(_profile, true) -} - -- (OFString*)string -{ - OF_GETTER(_string, true) -} @end @implementation XMPPIDNATranslationFailedException +@synthesize operation = _operation, string = _string; + + (instancetype)exceptionWithConnection: (XMPPConnection*)connection operation: (OFString*)operation string: (OFString*)string { return [[[self alloc] initWithConnection: connection @@ -213,18 +176,11 @@ string: string] autorelease]; } - initWithConnection: (XMPPConnection*)connection { - @try { - [self doesNotRecognizeSelector: _cmd]; - } @catch (id e) { - [self release]; - @throw e; - } - - abort(); + OF_INVALID_INIT_METHOD } - initWithConnection: (XMPPConnection*)connection operation: (OFString*)operation string: (OFString*)string @@ -253,40 +209,25 @@ - (OFString*)description { return [OFString stringWithFormat: @"IDNA operation %@ failed on string '%@'!", _operation, _string]; } - -- (OFString*)operation -{ - OF_GETTER(_operation, true) -} - -- (OFString*)string -{ - OF_GETTER(_string, true) -} @end @implementation XMPPAuthFailedException +@synthesize reason = _reason; + + (instancetype)exceptionWithConnection: (XMPPConnection*)connection reason: (OFString*)reason; { return [[[self alloc] initWithConnection: connection reason: reason] autorelease]; } - initWithConnection: (XMPPConnection*)connection { - @try { - [self doesNotRecognizeSelector: _cmd]; - } @catch (id e) { - [self release]; - @throw e; - } - - abort(); + OF_INVALID_INIT_METHOD } - initWithConnection: (XMPPConnection*)connection reason: (OFString*)reason { @@ -312,11 +253,6 @@ - (OFString*)description { return [OFString stringWithFormat: @"Authentication failed. Reason: %@!", _reason]; } - -- (OFString*)reason -{ - OF_GETTER(_reason, true) -} @end Index: src/XMPPJID.h ================================================================== --- src/XMPPJID.h +++ src/XMPPJID.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer * Copyright (c) 2011, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -29,18 +29,16 @@ @interface XMPPJID: OFObject { OFString *_node, *_domain, *_resource; } -#ifdef OF_HAVE_PROPERTIES /// \brief The JID's localpart @property (copy) OFString *node; /// \brief The JID's domainpart @property (copy) OFString *domain; /// \brief The JID's resourcepart @property (copy) OFString *resource; -#endif /** * \brief Creates a new autoreleased XMPPJID. * * \return A new autoreleased XMPPJID @@ -74,13 +72,6 @@ * \brief Returns the full JID. * * \return An OFString containing the full JID */ - (OFString*)fullJID; - -- (void)setNode: (OFString*)node; -- (OFString*)node; -- (void)setDomain: (OFString*)domain; -- (OFString*)domain; -- (void)setResource: (OFString*)resource; -- (OFString*)resource; @end Index: src/XMPPJID.m ================================================================== --- src/XMPPJID.m +++ src/XMPPJID.m @@ -1,10 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer - * Copyright (c) 2011, Florian Zeitz + * Copyright (c) 2011, 2012, 2013, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * Index: src/XMPPMessage.h ================================================================== --- src/XMPPMessage.h +++ src/XMPPMessage.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer * Copyright (c) 2011, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -25,14 +25,12 @@ /** * \brief A class describing a message stanza. */ @interface XMPPMessage: XMPPStanza -#ifdef OF_HAVE_PROPERTIES -/// \brief The text content of the body of the message +/** The text content of the body of the message. */ @property (copy) OFString *body; -#endif /** * \brief Creates a new autoreleased XMPPMessage. * * \return A new autoreleased XMPPMessage @@ -89,20 +87,6 @@ * \param ID The value for the stanza's id attribute * \return A initialized XMPPMessage */ - initWithType: (OFString*)type ID: (OFString*)ID; - -/** - * \brief Sets the text content of the body of the XMPPMessage. - * - * \param body The text content of the body element or nil to remove the body - */ -- (void)setBody: (OFString*)body; - -/** - * \brief Returns the text content of the body element of the XMPPMessage. - * - * \return The text content of the body element of the XMPPMessage. - */ -- (OFString*)body; @end Index: src/XMPPMessage.m ================================================================== --- src/XMPPMessage.m +++ src/XMPPMessage.m @@ -1,10 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, Jonathan Schleifer * Copyright (c) 2011, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * Index: src/XMPPPresence.h ================================================================== --- src/XMPPPresence.h +++ src/XMPPPresence.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer - * Copyright (c) 2011, Florian Zeitz + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer + * Copyright (c) 2011, 2013, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -26,18 +26,28 @@ /** * \brief A class describing a presence stanza. */ @interface XMPPPresence: XMPPStanza { - OFString *_status, *_show, *_priority; + OFString *_status, *_show; + OFNumber *_priority; } -#ifdef OF_HAVE_PROPERTIES +/** + * The text content of the status element. + */ @property (copy) OFString *status; + +/** + * The text content of the show element of the presence stanza. + */ @property (copy) OFString *show; + +/** + * The numeric content of the priority element. + */ @property (copy) OFNumber *priority; -#endif /** * \brief Creates a new autoreleased XMPPPresence. * * \return A new autoreleased XMPPPresence @@ -95,49 +105,6 @@ * \param ID The value for the stanza's id attribute * \return A initialized XMPPPresence */ - initWithType: (OFString*)type ID: (OFString*)ID; - -/** - * \brief Sets/Adds the show element of the presence stanza. - * - * \param show The text content of the show element - */ -- (void)setShow: (OFString*)show; - -/** - * \brief Returns the text content of the show element of the presence stanza. - * - * \return The text content of the show element of the presence stanza. - */ -- (OFString*)show; - -/** - * \brief Sets/Adds the status element of the presence stanza. - * - * \param status The text content of the status element - */ -- (void)setStatus: (OFString*)status; - -/** - * \brief Returns the text content of the status element of the presence stanza. - * - * \return The text content of the status element of the presence stanza. - */ -- (OFString*)status; - -/** - * \brief Sets/Adds the priority element of the presence stanza. - * - * \param priority The numeric content of the priority element - */ -- (void)setPriority: (OFNumber*)priority; - -/** - * \brief Returns the numeric content of the priority element of the presence - * stanza. - * - * \return The numeric content of the priority element of the presence stanza. - */ -- (OFNumber*)priority; @end Index: src/XMPPPresence.m ================================================================== --- src/XMPPPresence.m +++ src/XMPPPresence.m @@ -1,10 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer - * Copyright (c) 2011, Florian Zeitz + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -23,25 +23,29 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include - #import "XMPPPresence.h" #import "namespaces.h" -// This provides us with sortable values for show values -static int show_to_int(OFString *show) -{ - if ([show isEqual: @"chat"]) return 0; - if (show == nil) return 1; // available - if ([show isEqual: @"away"]) return 2; - if ([show isEqual: @"dnd"]) return 3; - if ([show isEqual: @"xa"]) return 4; - - assert(0); +/* This provides us with sortable values for show values */ +static int +show_to_int(OFString *show) +{ + if ([show isEqual: @"chat"]) + return 0; + if (show == nil) + return 1; /* available */ + if ([show isEqual: @"away"]) + return 2; + if ([show isEqual: @"dnd"]) + return 3; + if ([show isEqual: @"xa"]) + return 4; + + OF_ENSURE(0); } @implementation XMPPPresence + (instancetype)presence { @@ -139,20 +143,23 @@ - (void)setShow: (OFString*)show { OFXMLElement *oldShow = [self elementForName: @"show" namespace: XMPP_NS_CLIENT]; + OFString *old; if (oldShow != nil) [self removeChild: oldShow]; if (show != nil) [self addChild: [OFXMLElement elementWithName: @"show" namespace: XMPP_NS_CLIENT stringValue: show]]; - OF_SETTER(_show, show, true, 1) + old = _show; + _show = [show copy]; + [old release]; } - (OFString*)show { return [[_show copy] autorelease]; @@ -160,20 +167,23 @@ - (void)setStatus: (OFString*)status { OFXMLElement *oldStatus = [self elementForName: @"status" namespace: XMPP_NS_CLIENT]; + OFString *old; if (oldStatus != nil) [self removeChild: oldStatus]; if (status != nil) [self addChild: [OFXMLElement elementWithName: @"status" namespace: XMPP_NS_CLIENT stringValue: status]]; - OF_SETTER(_status, status, true, 1) + old = _status; + _status = [status copy]; + [old release]; } - (OFString*)status { return [[_status copy] autorelease]; @@ -180,10 +190,11 @@ } - (void)setPriority: (OFNumber*)priority { intmax_t prio = [priority intMaxValue]; + OFNumber *old; if ((prio < -128) || (prio > 127)) @throw [OFInvalidArgumentException exception]; OFXMLElement *oldPriority = [self elementForName: @"priority" @@ -196,11 +207,13 @@ [OFString stringWithFormat: @"%" @PRId8, [priority int8Value]]; [self addChild: [OFXMLElement elementWithName: @"priority" namespace: XMPP_NS_CLIENT stringValue: priority_s]]; - OF_SETTER(_priority, priority, true, 1) + old = _priority; + _priority = [priority copy]; + [old release]; } - (OFNumber*)priority { return [[_priority copy] autorelease]; Index: src/XMPPRoster.h ================================================================== --- src/XMPPRoster.h +++ src/XMPPRoster.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer * Copyright (c) 2012, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -37,13 +37,11 @@ */ @protocol XMPPRosterDelegate #ifndef XMPP_ROSTER_M #endif -#ifdef OF_HAVE_OPTIONAL_PROTOCOLS @optional -#endif /** * \brief This callback is called after the roster was received (as a result of * calling -requestRoster). * * \param roster The roster that was received @@ -61,23 +59,19 @@ @end /** * \brief A class implementing roster related functionality. */ -@interface XMPPRoster: OFObject -#ifdef OF_HAVE_OPTIONAL_PROTOCOLS - -#endif +@interface XMPPRoster: OFObject { XMPPConnection *_connection; OFMutableDictionary *_rosterItems; XMPPMulticastDelegate *_delegates; id _dataStorage; bool _rosterRequested; } -#ifdef OF_HAVE_PROPERTIES /** * \brief The connection to which the roster belongs */ @property (readonly, assign) XMPPConnection *connection; @@ -91,11 +85,10 @@ /** * \brief The list of contacts as an OFDictionary with the bare JID as a string * as key. */ @property (readonly, copy) OFDictionary *rosterItems; -#endif /** * \brief Initializes an already allocated XMPPRoster. * * \param connection The connection roster related stanzas @@ -102,12 +95,10 @@ * are send and received over * \return An initialized XMPPRoster */ - initWithConnection: (XMPPConnection*)connection; -- (OFDictionary*)rosterItems; - /** * \brief Requests the roster from the server. */ - (void)requestRoster; @@ -144,18 +135,13 @@ * * \param delegate The delegate to remove */ - (void)removeDelegate: (id )delegate; -- (XMPPConnection*)connection; - -- (void)setDataStorage: (id )dataStorage; -- (id )dataStorage; - - (void)XMPP_updateRosterItem: (XMPPRosterItem*)rosterItem; - (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection IQ: (XMPPIQ*)iq; - (XMPPRosterItem*)XMPP_rosterItemWithXMLElement: (OFXMLElement*)element; @end @interface OFObject (XMPPRosterDelegate) @end Index: src/XMPPRoster.m ================================================================== --- src/XMPPRoster.m +++ src/XMPPRoster.m @@ -1,10 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer * Copyright (c) 2012, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -38,10 +38,13 @@ #import "XMPPJID.h" #import "XMPPMulticastDelegate.h" #import "namespaces.h" @implementation XMPPRoster +@synthesize connection = _connection, dataStorage = _dataStorage; +@synthesize rosterItems = _rosterItems; + - initWithConnection: (XMPPConnection*)connection { self = [super init]; @try { @@ -65,15 +68,10 @@ [_rosterItems release]; [super dealloc]; } -- (OFDictionary*)rosterItems -{ - return [[_rosterItems copy] autorelease]; -} - - (void)requestRoster { XMPPIQ *iq; OFXMLElement *query; Index: src/XMPPRosterItem.h ================================================================== --- src/XMPPRosterItem.h +++ src/XMPPRosterItem.h @@ -1,9 +1,10 @@ /* - * Copyright (c) 2011, 2012, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer + * Copyright (c) 2012, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -33,32 +34,21 @@ OFString *_name; OFString *_subscription; OFArray *_groups; } -#ifdef OF_HAVE_PROPERTIES /// \brief The JID of the roster item @property (copy) XMPPJID *JID; /// \brief The name of the roster item to show to the user @property (copy) OFString *name; /// \brief The subscription for the roster item @property (copy) OFString *subscription; /// \brief An array of groups in which the roster item is @property (copy) OFArray *groups; -#endif /** * \brief Creates a new autoreleased roster item. * * \return A new autoreleased roster item. */ + (instancetype)rosterItem; - -- (void)setJID: (XMPPJID*)JID; -- (XMPPJID*)JID; -- (void)setName: (OFString*)name; -- (OFString*)name; -- (void)setSubscription: (OFString*)subscription; -- (OFString*)subscription; -- (void)setGroups: (OFArray*)groups; -- (OFArray*)groups; @end Index: src/XMPPRosterItem.m ================================================================== --- src/XMPPRosterItem.m +++ src/XMPPRosterItem.m @@ -1,9 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer + * Copyright (c) 2012, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -28,10 +29,13 @@ #import "XMPPJID.h" #import @implementation XMPPRosterItem +@synthesize JID = _JID, name = _name, subscription = _subscription; +@synthesize groups = _groups; + + (instancetype)rosterItem { return [[[self alloc] init] autorelease]; } @@ -66,46 +70,6 @@ { return [OFString stringWithFormat: @"", _JID, _name, _subscription, _groups]; } - -- (void)setJID: (XMPPJID*)JID -{ - OF_SETTER(_JID, JID, true, 1) -} - -- (XMPPJID*)JID -{ - OF_GETTER(_JID, true) -} - -- (void)setName: (OFString*)name -{ - OF_SETTER(_name, name, true, 1) -} - -- (OFString*)name -{ - OF_GETTER(_name, true) -} - -- (void)setSubscription: (OFString*)subscription -{ - OF_SETTER(_subscription, subscription, true, 1) -} - -- (OFString*)subscription -{ - OF_GETTER(_subscription, true) -} - -- (void)setGroups: (OFArray*)groups -{ - OF_SETTER(_groups, groups, true, 1) -} - -- (OFArray*)groups -{ - OF_GETTER(_groups, true) -} @end Index: src/XMPPSRVLookup.h ================================================================== --- src/XMPPSRVLookup.h +++ src/XMPPSRVLookup.h @@ -1,9 +1,10 @@ /* - * Copyright (c) 2011, Florian Zeitz + * Copyright (c) 2011, 2012, Florian Zeitz + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -33,17 +34,15 @@ uint32_t _accumulatedWeight; uint16_t _port; OFString *_target; } -#ifdef OF_HAVE_PROPERTIES @property (readonly) uint16_t priority; @property (readonly) uint16_t weight; @property uint32_t accumulatedWeight; @property (readonly) uint16_t port; @property (readonly, copy) OFString *target; -#endif + (instancetype)entryWithPriority: (uint16_t)priority weight: (uint16_t)weight port: (uint16_t)port target: (OFString*)target; @@ -53,28 +52,20 @@ weight: (uint16_t)weight port: (uint16_t)port target: (OFString*)target; - initWithResourceRecord: (ns_rr)resourceRecord handle: (ns_msg)handle; -- (uint16_t)priority; -- (uint16_t)weight; -- (uint32_t)accumulatedWeight; -- (void)setAccumulatedWeight: (uint32_t)accumulatedWeight; -- (uint16_t)port; -- (OFString*)target; @end @interface XMPPSRVLookup: OFObject { OFString *_domain; struct __res_state _resState; OFList *_list; } -#ifdef OF_HAVE_PROPERTIES @property (readonly, copy) OFString *domain; -#endif + (instancetype)lookupWithDomain: (OFString*)domain; - initWithDomain: (OFString*)domain; - (void)XMPP_lookup; Index: src/XMPPSRVLookup.m ================================================================== --- src/XMPPSRVLookup.m +++ src/XMPPSRVLookup.m @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011, 2012, 2013, 2014, 2015 - * Jonathan Schleifer - * Copyright (c) 2011, Florian Zeitz + * Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 + * Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2014, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -38,10 +38,14 @@ #import "XMPPSRVLookup.h" #import @implementation XMPPSRVEntry +@synthesize priority = _priority, weight = _weight; +@synthesize accumulatedWeight = _accumulatedWeight, port = _port; +@synthesize target = _target; + + (instancetype)entryWithPriority: (uint16_t)priority weight: (uint16_t)weight port: (uint16_t)port target: (OFString*)target { @@ -131,43 +135,15 @@ { return [OFString stringWithFormat: @"<%@ priority: %" PRIu16 @", weight: %" PRIu16 @", target: %@:%" PRIu16 @">", [self class], _priority, _weight, _target, _port]; } - -- (uint16_t)priority -{ - return _priority; -} - -- (uint16_t)weight -{ - return _weight; -} - -- (void)setAccumulatedWeight: (uint32_t)accumulatedWeight -{ - _accumulatedWeight = accumulatedWeight; -} - -- (uint32_t)accumulatedWeight -{ - return _accumulatedWeight; -} - -- (uint16_t)port -{ - return _port; -} - -- (OFString*)target -{ - OF_GETTER(_target, true) -} @end @implementation XMPPSRVLookup +@synthesize domain = _domain; + + (instancetype)lookupWithDomain: (OFString*)domain { return [[[self alloc] initWithDomain: domain] autorelease]; } @@ -194,15 +170,10 @@ [_domain release]; [super dealloc]; } -- (OFString*)domain; -{ - OF_GETTER(_domain, true) -} - - (void)XMPP_lookup { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; unsigned char *answer = NULL; size_t pageSize = [OFSystemInfo pageSize]; Index: src/XMPPStanza.h ================================================================== --- src/XMPPStanza.h +++ src/XMPPStanza.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer * Copyright (c) 2011, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -32,21 +32,20 @@ { XMPPJID *_from, *_to; OFString *_type, *_ID, *_language; } -#ifdef OF_HAVE_PROPERTIES /// \brief The value of the stanza's from attribute @property (copy) XMPPJID *from; /// \brief The value of the stanza's to attribute @property (copy) XMPPJID *to; /// \brief The value of the stanza's type attribute @property (copy) OFString *type; /// \brief The value of the stanza's id attribute @property (copy) OFString *ID; /// \brief The stanza's xml:lang -#endif +@property (copy) OFString *language; /** * \brief Creates a new autoreleased XMPPStanza with the specified name. * * \param name The stanza's name (one of iq, message or presence) @@ -144,17 +143,6 @@ * * \param element The element to base the XMPPStanza on * \return A initialized XMPPStanza */ - initWithElement: (OFXMLElement*)element; - -- (void)setFrom: (XMPPJID*)from; -- (XMPPJID*)from; -- (void)setTo: (XMPPJID*)to; -- (XMPPJID*)to; -- (void)setType: (OFString*)type; -- (OFString*)type; -- (void)setID: (OFString*)ID; -- (OFString*)ID; -- (void)setLanguage: (OFString*)language; -- (OFString*)language; @end Index: src/XMPPStanza.m ================================================================== --- src/XMPPStanza.m +++ src/XMPPStanza.m @@ -1,10 +1,10 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, Jonathan Schleifer * Copyright (c) 2011, Florian Zeitz * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * Index: src/XMPPStreamManagement.h ================================================================== --- src/XMPPStreamManagement.h +++ src/XMPPStreamManagement.h @@ -1,9 +1,10 @@ /* * Copyright (c) 2012, Florian Zeitz + * Copyright (c) 2013, 2016, Jonathan Schleifer * - * https://webkeks.org/git/?p=objxmpp.git + * https://heap.zone/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * @@ -20,16 +21,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ #import "XMPPConnection.h" -@interface XMPPStreamManagement: OFObject -#ifdef OF_HAVE_OPTIONAL_PROTOCOLS - -#endif +@interface XMPPStreamManagement: OFObject { XMPPConnection *_connection; uint32_t _receivedCount; } - initWithConnection: (XMPPConnection*)connection; @end