Adjust to ObjFW changes

This commit is contained in:
Jonathan Schleifer 2016-07-10 00:39:19 +02:00
parent 4b6e5e25ed
commit 1cf318f91e
No known key found for this signature in database
GPG key ID: 338C3541DB54E169
31 changed files with 180 additions and 601 deletions

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -30,14 +31,12 @@
OFString *_authzid, *_authcid, *_password; OFString *_authzid, *_authcid, *_password;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The authzid to get authorization for /// \brief The authzid to get authorization for
@property (copy) OFString *authzid; @property (copy) OFString *authzid;
/// \brief The authcid to authenticate with /// \brief The authcid to authenticate with
@property (copy) OFString *authcid; @property (copy) OFString *authcid;
/// \brief The password to authenticate with /// \brief The password to authenticate with
@property (copy) OFString *password; @property (copy) OFString *password;
#endif
/** /**
* \brief Initializes an already allocated XMPPAuthenticator with an authcid * \brief Initializes an already allocated XMPPAuthenticator with an authcid
@ -77,11 +76,4 @@
* \return The appropriate response if the data was a challenge, nil otherwise * \return The appropriate response if the data was a challenge, nil otherwise
*/ */
- (OFDataArray*)continueWithData: (OFDataArray*)data; - (OFDataArray*)continueWithData: (OFDataArray*)data;
- (void)setAuthzid: (OFString*)authzid;
- (OFString*)authzid;
- (void)setAuthcid: (OFString*)authcid;
- (OFString*)authcid;
- (void)setPassword: (OFString*)password;
- (OFString*)password;
@end @end

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -27,6 +28,8 @@
#import "XMPPAuthenticator.h" #import "XMPPAuthenticator.h"
@implementation XMPPAuthenticator @implementation XMPPAuthenticator
@synthesize authzid = _authzid, authcid = _authcid, password = _password;
- initWithAuthcid: (OFString*)authcid - initWithAuthcid: (OFString*)authcid
password: (OFString*)password password: (OFString*)password
{ {
@ -62,36 +65,6 @@
[super dealloc]; [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 - (OFDataArray*)initialMessage
{ {
return nil; return nil;

View file

@ -1,8 +1,9 @@
/* /*
* Copyright (c) 2010, 2011, 2012, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2010, 2011, 2012, 2013, 2016
* Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, 2012, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, 2012, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -43,10 +44,7 @@
#ifndef XMPP_CONNECTION_M #ifndef XMPP_CONNECTION_M
<OFObject> <OFObject>
#endif #endif
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional @optional
#endif
/** /**
* \brief This callback is called when the connection received an element. * \brief This callback is called when the connection received an element.
* *
@ -147,10 +145,8 @@
/** /**
* \brief A class which abstracts a connection to an XMPP service. * \brief A class which abstracts a connection to an XMPP service.
*/ */
@interface XMPPConnection: OFObject @interface XMPPConnection: OFObject <OFXMLParserDelegate,
#ifdef OF_HAVE_OPTONAL_PROTOCOLS OFXMLElementBuilderDelegate>
<OFXMLParserDelegate, OFXMLElementBuilderDelegate>
#endif
{ {
id _socket; id _socket;
OFXMLParser *_parser, *_oldParser; OFXMLParser *_parser, *_oldParser;
@ -174,7 +170,6 @@
unsigned int _lastID; unsigned int _lastID;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The username to use for authentication /// \brief The username to use for authentication
@property (copy) OFString *username; @property (copy) OFString *username;
/// \brief The password to use for authentication /// \brief The password to use for authentication
@ -211,7 +206,6 @@
@property (readonly) bool supportsRosterVersioning; @property (readonly) bool supportsRosterVersioning;
/// \brief Whether stream management is supported /// \brief Whether stream management is supported
@property (readonly) bool supportsStreamManagement; @property (readonly) bool supportsStreamManagement;
#endif
/** /**
* \brief Creates a new autoreleased XMPPConnection. * \brief Creates a new autoreleased XMPPConnection.

View file

@ -1,8 +1,9 @@
/* /*
* Copyright (c) 2010, 2011, 2012, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2010, 2011, 2012, 2013, 2015, 2016
* Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, 2012, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, 2012, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -117,6 +118,12 @@
@end @end
@implementation XMPPConnection @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 + (instancetype)connection
{ {
return [[[self alloc] init] autorelease]; return [[[self alloc] init] autorelease];
@ -305,26 +312,6 @@
return [[_password copy] autorelease]; 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 - (void)connect
{ {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
@ -477,41 +464,11 @@
return true; return true;
} }
- (OFTCPSocket*)socket
{
return [[_socket retain] autorelease];
}
- (bool)encryptionRequired
{
return _encryptionRequired;
}
- (void)setEncryptionRequired: (bool)encryptionRequired
{
_encryptionRequired = encryptionRequired;
}
- (bool)encrypted
{
return _encrypted;
}
- (bool)streamOpen - (bool)streamOpen
{ {
return _streamOpen; return _streamOpen;
} }
- (bool)supportsRosterVersioning
{
return _supportsRosterVersioning;
}
- (bool)supportsStreamManagement
{
return _supportsStreamManagement;
}
- (bool)checkCertificateAndGetReason: (OFString**)reason - (bool)checkCertificateAndGetReason: (OFString**)reason
{ {
X509Certificate *cert; X509Certificate *cert;
@ -1255,21 +1212,6 @@
return ret; return ret;
} }
- (XMPPJID*)JID
{
return [[_JID copy] autorelease];
}
- (void)setPort: (uint16_t)port
{
_port = port;
}
- (uint16_t)port
{
return _port;
}
- (void)setDataStorage: (id <XMPPStorage>)dataStorage - (void)setDataStorage: (id <XMPPStorage>)dataStorage
{ {
if (_streamOpen) if (_streamOpen)
@ -1284,16 +1226,6 @@
return _dataStorage; return _dataStorage;
} }
- (void)setLanguage: (OFString*)language
{
OF_SETTER(_language, language, true, 1)
}
- (OFString*)language
{
OF_GETTER(_language, true)
}
- (void)addDelegate: (id <XMPPConnectionDelegate>)delegate - (void)addDelegate: (id <XMPPConnectionDelegate>)delegate
{ {
[_delegates addDelegate: delegate]; [_delegates addDelegate: delegate];

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -38,12 +39,10 @@
XMPPJID *_lockedOnJID; XMPPJID *_lockedOnJID;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The XMPPRosterItem corresponding to this contact /// \brief The XMPPRosterItem corresponding to this contact
@property (readonly) XMPPRosterItem *rosterItem; @property (readonly) XMPPRosterItem *rosterItem;
/// \brief The XMPPPresences of this contact with the resources as keys /// \brief The XMPPPresences of this contact with the resources as keys
@property (readonly) OFDictionary *presences; @property (readonly) OFDictionary *presences;
#endif
/** /**
* \brief Sends a message to the contact honoring resource locking * \brief Sends a message to the contact honoring resource locking

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -25,6 +26,9 @@
#import "XMPPConnection.h" #import "XMPPConnection.h"
@implementation XMPPContact @implementation XMPPContact
@synthesize rosterItem = _rosterItem;
@synthesize presences = _presences;
- init - init
{ {
self = [super init]; self = [super init];
@ -46,16 +50,6 @@
[super dealloc]; [super dealloc];
} }
- (XMPPRosterItem*)rosterItem
{
OF_GETTER(_rosterItem, true)
}
- (OFDictionary*)presences
{
OF_GETTER(_presences, true)
}
- (void)sendMessage: (XMPPMessage*)message - (void)sendMessage: (XMPPMessage*)message
connection: (XMPPConnection*)connection connection: (XMPPConnection*)connection
{ {
@ -69,7 +63,9 @@
- (void)XMPP_setRosterItem: (XMPPRosterItem*)rosterItem - (void)XMPP_setRosterItem: (XMPPRosterItem*)rosterItem
{ {
OF_SETTER(_rosterItem, rosterItem, true, 0); XMPPRosterItem *old = _rosterItem;
_rosterItem = [rosterItem retain];
[old release];
} }
- (void)XMPP_setPresence: (XMPPPresence*)presence - (void)XMPP_setPresence: (XMPPPresence*)presence
@ -99,6 +95,8 @@
- (void)XMPP_setLockedOnJID: (XMPPJID*)JID; - (void)XMPP_setLockedOnJID: (XMPPJID*)JID;
{ {
OF_SETTER(_lockedOnJID, JID, true, 0); XMPPJID *old = _lockedOnJID;
_lockedOnJID = [JID retain];
[old release];
} }
@end @end

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -35,9 +36,7 @@
* of a XMPPContactManager * of a XMPPContactManager
*/ */
@protocol XMPPContactManagerDelegate <OFObject> @protocol XMPPContactManagerDelegate <OFObject>
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional @optional
#endif
/** /**
* \brief This callback is called whenever a new contact enters the users roster * \brief This callback is called whenever a new contact enters the users roster
* *
@ -101,10 +100,8 @@
* This class delegates to a XMPPConnection and a XMPPRoster, thereby tracking * This class delegates to a XMPPConnection and a XMPPRoster, thereby tracking
* each contacts presences and the current XMPPRosterItem. * each contacts presences and the current XMPPRosterItem.
*/ */
@interface XMPPContactManager: OFObject @interface XMPPContactManager: OFObject <XMPPConnectionDelegate,
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS XMPPRosterDelegate>
<XMPPConnectionDelegate, XMPPRosterDelegate>
#endif
{ {
OFMutableDictionary *_contacts; OFMutableDictionary *_contacts;
XMPPConnection *_connection; XMPPConnection *_connection;
@ -112,10 +109,8 @@
XMPPMulticastDelegate *_delegates; XMPPMulticastDelegate *_delegates;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The tracked contacts, with their bare JID as key /// \brief The tracked contacts, with their bare JID as key
@property (readonly) OFDictionary *contacts; @property (readonly) OFDictionary *contacts;
#endif
/*! /*!
* @brief Initializes an already allocated XMPPContactManager. * @brief Initializes an already allocated XMPPContactManager.

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -28,6 +29,8 @@
#import "XMPPRosterItem.h" #import "XMPPRosterItem.h"
@implementation XMPPContactManager @implementation XMPPContactManager
@synthesize contacts = _contacts;
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
roster: (XMPPRoster*)roster roster: (XMPPRoster*)roster
{ {
@ -84,11 +87,6 @@
[_delegates removeDelegate: delegate]; [_delegates removeDelegate: delegate];
} }
- (OFDictionary*)contacts
{
OF_GETTER(_contacts, true)
}
- (void)rosterWasReceived: (XMPPRoster*)roster - (void)rosterWasReceived: (XMPPRoster*)roster
{ {
OFEnumerator *contactEnumerator; OFEnumerator *contactEnumerator;

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -38,7 +39,6 @@
OFString *_capsNode; OFString *_capsNode;
} }
#ifdef OF_HAVE_PROPERTIES
/** /**
* \brief The XMPPDiscoNodes this entity provides Services Discovery * \brief The XMPPDiscoNodes this entity provides Services Discovery
* responses for * responses for
@ -47,9 +47,11 @@
* any number of nodes nested more deeply. * any number of nodes nested more deeply.
*/ */
@property (readonly) OFDictionary *discoNodes; @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; @property (readonly) OFString *capsNode;
#endif
/** /**
* \brief Creates a new autoreleased XMPPDiscoEntity with the specified * \brief Creates a new autoreleased XMPPDiscoEntity with the specified
@ -106,7 +108,4 @@
* \return A OFString containing the capabilities hash * \return A OFString containing the capabilities hash
*/ */
- (OFString*)capsHash; - (OFString*)capsHash;
- (OFDictionary*)discoNodes;
- (OFString*)capsNode;
@end @end

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -26,6 +27,8 @@
#import "namespaces.h" #import "namespaces.h"
@implementation XMPPDiscoEntity @implementation XMPPDiscoEntity
@synthesize discoNodes = _discoNodes, capsNode = _capsNode;
+ (instancetype)discoEntityWithConnection: (XMPPConnection*)connection + (instancetype)discoEntityWithConnection: (XMPPConnection*)connection
{ {
return [[[self alloc] initWithConnection: connection] autorelease]; return [[[self alloc] initWithConnection: connection] autorelease];
@ -72,22 +75,12 @@
[super dealloc]; [super dealloc];
} }
- (OFDictionary*)discoNodes;
{
OF_GETTER(_discoNodes, true)
}
- (void)addDiscoNode: (XMPPDiscoNode*)node - (void)addDiscoNode: (XMPPDiscoNode*)node
{ {
[_discoNodes setObject: node [_discoNodes setObject: node
forKey: [node node]]; forKey: [node node]];
} }
- (OFString*)capsNode
{
OF_GETTER(_capsNode, true)
}
- (OFString*)capsHash - (OFString*)capsHash
{ {
OFEnumerator *enumerator; OFEnumerator *enumerator;

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -29,14 +30,13 @@
{ {
OFString *_category, *_name, *_type; OFString *_category, *_name, *_type;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The category of the identity /// \brief The category of the identity
@property (readonly) OFString *category; @property (readonly) OFString *category;
/// \brief The name of the identity, might be unset /// \brief The name of the identity, might be unset
@property (readonly) OFString *name; @property (readonly) OFString *name;
/// \brief The type of the identity /// \brief The type of the identity
@property (readonly) OFString *type; @property (readonly) OFString *type;
#endif
/** /**
* \brief Creates a new autoreleased XMPPDiscoIdentity with the specified * \brief Creates a new autoreleased XMPPDiscoIdentity with the specified
@ -85,8 +85,4 @@
*/ */
- initWithCategory: (OFString*)category - initWithCategory: (OFString*)category
type: (OFString*)type; type: (OFString*)type;
- (OFString*)category;
- (OFString*)name;
- (OFString*)type;
@end @end

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -23,6 +24,8 @@
#import "XMPPDiscoIdentity.h" #import "XMPPDiscoIdentity.h"
@implementation XMPPDiscoIdentity @implementation XMPPDiscoIdentity
@synthesize category = _category, name = _name, type = _type;
+ (instancetype)identityWithCategory: (OFString*)category + (instancetype)identityWithCategory: (OFString*)category
type: (OFString*)type type: (OFString*)type
name: (OFString*)name name: (OFString*)name
@ -89,21 +92,6 @@
[super dealloc]; [super dealloc];
} }
- (OFString*)category
{
OF_GETTER(_category, true)
}
- (OFString*)name
{
OF_GETTER(_name, true)
}
- (OFString*)type
{
OF_GETTER(_type, true)
}
- (bool)isEqual: (id)object - (bool)isEqual: (id)object
{ {
XMPPDiscoIdentity *identity; XMPPDiscoIdentity *identity;

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -38,7 +39,6 @@
OFMutableDictionary *_childNodes; OFMutableDictionary *_childNodes;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The JID this node lives on /// \brief The JID this node lives on
@property (readonly) XMPPJID *JID; @property (readonly) XMPPJID *JID;
/// \brief The node's opaque name of the node /// \brief The node's opaque name of the node
@ -51,7 +51,6 @@
@property (readonly) OFSortedList *features; @property (readonly) OFSortedList *features;
/// \brief The node's children /// \brief The node's children
@property (readonly) OFDictionary *childNodes; @property (readonly) OFDictionary *childNodes;
#endif
/** /**
* \brief Creates a new autoreleased XMPPDiscoNode with the specified * \brief Creates a new autoreleased XMPPDiscoNode with the specified
@ -122,12 +121,6 @@
*/ */
- (void)addChildNode: (XMPPDiscoNode*)node; - (void)addChildNode: (XMPPDiscoNode*)node;
- (XMPPJID*)JID;
- (OFString*)node;
- (OFSortedList*)identities;
- (OFSortedList*)features;
- (OFDictionary*)childNodes;
- (bool)XMPP_handleItemsIQ: (XMPPIQ*)IQ - (bool)XMPP_handleItemsIQ: (XMPPIQ*)IQ
connection: (XMPPConnection*)connection; connection: (XMPPConnection*)connection;
- (bool)XMPP_handleInfoIQ: (XMPPIQ*)IQ - (bool)XMPP_handleInfoIQ: (XMPPIQ*)IQ

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2013, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -29,6 +30,10 @@
#import "namespaces.h" #import "namespaces.h"
@implementation XMPPDiscoNode @implementation XMPPDiscoNode
@synthesize JID = _JID, node = _node, name = _name, identities = _identities;
@synthesize features = _features, childNodes = _childNodes;
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID + (instancetype)discoNodeWithJID: (XMPPJID*)JID
node: (OFString*)node; node: (OFString*)node;
{ {
@ -36,7 +41,6 @@
node: node] autorelease]; node: node] autorelease];
} }
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID + (instancetype)discoNodeWithJID: (XMPPJID*)JID
node: (OFString*)node node: (OFString*)node
name: (OFString*)name name: (OFString*)name
@ -94,36 +98,6 @@
[super dealloc]; [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 - (void)addIdentity: (XMPPDiscoIdentity*)identity
{ {
[_identities insertObject: identity]; [_identities insertObject: identity];

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, 2012, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -33,10 +34,8 @@
XMPPConnection *_connection; XMPPConnection *_connection;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The connection the exception relates to /// \brief The connection the exception relates to
@property (readonly, retain) XMPPConnection *connection; @property (readonly, retain) XMPPConnection *connection;
#endif
/** /**
* \brief Creates a new XMPPException. * \brief Creates a new XMPPException.
@ -55,8 +54,6 @@
* \return An initialized XMPPException * \return An initialized XMPPException
*/ */
- initWithConnection: (XMPPConnection*)connection; - initWithConnection: (XMPPConnection*)connection;
- (XMPPConnection*)connection;
@end @end
/** /**
@ -67,12 +64,10 @@
OFString *_condition, *_reason; OFString *_condition, *_reason;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The defined error condition specified by the stream error /// \brief The defined error condition specified by the stream error
@property (readonly, copy) OFString *condition; @property (readonly, copy) OFString *condition;
/// \brief The descriptive free-form text specified by the stream error /// \brief The descriptive free-form text specified by the stream error
@property (readonly, copy) OFString *reason; @property (readonly, copy) OFString *reason;
#endif
/** /**
* \brief Creates a new XMPPStreamErrorException. * \brief Creates a new XMPPStreamErrorException.
@ -97,9 +92,6 @@
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
condition: (OFString*)condition condition: (OFString*)condition
reason: (OFString*)reason; reason: (OFString*)reason;
- (OFString*)condition;
- (OFString*)reason;
@end @end
/** /**
@ -111,12 +103,10 @@
OFString *_profile, *_string; OFString *_profile, *_string;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The name of the stringprep profile that did not apply /// \brief The name of the stringprep profile that did not apply
@property (readonly, copy) OFString *profile; @property (readonly, copy) OFString *profile;
/// \brief The string that failed the stringprep profile /// \brief The string that failed the stringprep profile
@property (readonly, copy) OFString *string; @property (readonly, copy) OFString *string;
#endif
/** /**
* \brief Creates a new XMPPStringPrepFailedException. * \brief Creates a new XMPPStringPrepFailedException.
@ -141,9 +131,6 @@
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
profile: (OFString*)profile profile: (OFString*)profile
string: (OFString*)string; string: (OFString*)string;
- (OFString*)profile;
- (OFString*)string;
@end @end
/** /**
@ -154,12 +141,10 @@
OFString *_operation, *_string; OFString *_operation, *_string;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The IDNA translation operation which failed /// \brief The IDNA translation operation which failed
@property (readonly, copy) OFString *operation; @property (readonly, copy) OFString *operation;
/// \brief The string that could not be translated /// \brief The string that could not be translated
@property (readonly, copy) OFString *string; @property (readonly, copy) OFString *string;
#endif
/** /**
* \brief Creates a new XMPPIDNATranslationFailedException. * \brief Creates a new XMPPIDNATranslationFailedException.
@ -184,9 +169,6 @@
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
operation: (OFString*)operation operation: (OFString*)operation
string: (OFString*)string; string: (OFString*)string;
- (OFString*)operation;
- (OFString*)string;
@end @end
/** /**
@ -197,10 +179,8 @@
OFString *_reason; OFString *_reason;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The reason the authentication failed /// \brief The reason the authentication failed
@property (readonly, copy) OFString *reason; @property (readonly, copy) OFString *reason;
#endif
/** /**
* \brief Creates a new XMPPAuthFailedException. * \brief Creates a new XMPPAuthFailedException.
@ -221,6 +201,4 @@
*/ */
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
reason: (OFString*)reason; reason: (OFString*)reason;
- (OFString*)reason;
@end @end

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2012, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -30,6 +31,8 @@
#import "XMPPConnection.h" #import "XMPPConnection.h"
@implementation XMPPException @implementation XMPPException
@synthesize connection = _connection;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection + (instancetype)exceptionWithConnection: (XMPPConnection*)connection
{ {
return [[[self alloc] initWithConnection: connection] autorelease]; return [[[self alloc] initWithConnection: connection] autorelease];
@ -37,14 +40,7 @@
- init - init
{ {
@try { OF_INVALID_INIT_METHOD
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
} }
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
@ -67,14 +63,11 @@
[super dealloc]; [super dealloc];
} }
- (XMPPConnection*)connection
{
OF_GETTER(_connection, true)
}
@end @end
@implementation XMPPStreamErrorException @implementation XMPPStreamErrorException
@synthesize condition = _condition, reason = _reason;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection + (instancetype)exceptionWithConnection: (XMPPConnection*)connection
condition: (OFString*)condition condition: (OFString*)condition
reason: (OFString*)reason; reason: (OFString*)reason;
@ -86,14 +79,7 @@
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
{ {
@try { OF_INVALID_INIT_METHOD
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
} }
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
@ -126,19 +112,11 @@
return [OFString stringWithFormat: return [OFString stringWithFormat:
@"Got stream error: %@. Reason: %@!", _condition, _reason]; @"Got stream error: %@. Reason: %@!", _condition, _reason];
} }
- (OFString*)condition
{
OF_GETTER(_condition, true)
}
- (OFString*)reason
{
OF_GETTER(_reason, true)
}
@end @end
@implementation XMPPStringPrepFailedException @implementation XMPPStringPrepFailedException
@synthesize profile = _profile, string = _string;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection + (instancetype)exceptionWithConnection: (XMPPConnection*)connection
profile: (OFString*)profile profile: (OFString*)profile
string: (OFString*)string string: (OFString*)string
@ -150,14 +128,7 @@
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
{ {
@try { OF_INVALID_INIT_METHOD
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
} }
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
@ -191,19 +162,11 @@
@"Stringprep with profile %@ failed on string '%@'!", @"Stringprep with profile %@ failed on string '%@'!",
_profile, _string]; _profile, _string];
} }
- (OFString*)profile
{
OF_GETTER(_profile, true)
}
- (OFString*)string
{
OF_GETTER(_string, true)
}
@end @end
@implementation XMPPIDNATranslationFailedException @implementation XMPPIDNATranslationFailedException
@synthesize operation = _operation, string = _string;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection + (instancetype)exceptionWithConnection: (XMPPConnection*)connection
operation: (OFString*)operation operation: (OFString*)operation
string: (OFString*)string string: (OFString*)string
@ -215,14 +178,7 @@
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
{ {
@try { OF_INVALID_INIT_METHOD
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
} }
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
@ -255,19 +211,11 @@
return [OFString stringWithFormat: return [OFString stringWithFormat:
@"IDNA operation %@ failed on string '%@'!", _operation, _string]; @"IDNA operation %@ failed on string '%@'!", _operation, _string];
} }
- (OFString*)operation
{
OF_GETTER(_operation, true)
}
- (OFString*)string
{
OF_GETTER(_string, true)
}
@end @end
@implementation XMPPAuthFailedException @implementation XMPPAuthFailedException
@synthesize reason = _reason;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection + (instancetype)exceptionWithConnection: (XMPPConnection*)connection
reason: (OFString*)reason; reason: (OFString*)reason;
{ {
@ -277,14 +225,7 @@
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
{ {
@try { OF_INVALID_INIT_METHOD
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
abort();
} }
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
@ -314,9 +255,4 @@
return [OFString stringWithFormat: return [OFString stringWithFormat:
@"Authentication failed. Reason: %@!", _reason]; @"Authentication failed. Reason: %@!", _reason];
} }
- (OFString*)reason
{
OF_GETTER(_reason, true)
}
@end @end

View file

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -31,14 +31,12 @@
OFString *_node, *_domain, *_resource; OFString *_node, *_domain, *_resource;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The JID's localpart /// \brief The JID's localpart
@property (copy) OFString *node; @property (copy) OFString *node;
/// \brief The JID's domainpart /// \brief The JID's domainpart
@property (copy) OFString *domain; @property (copy) OFString *domain;
/// \brief The JID's resourcepart /// \brief The JID's resourcepart
@property (copy) OFString *resource; @property (copy) OFString *resource;
#endif
/** /**
* \brief Creates a new autoreleased XMPPJID. * \brief Creates a new autoreleased XMPPJID.
@ -76,11 +74,4 @@
* \return An OFString containing the full JID * \return An OFString containing the full JID
*/ */
- (OFString*)fullJID; - (OFString*)fullJID;
- (void)setNode: (OFString*)node;
- (OFString*)node;
- (void)setDomain: (OFString*)domain;
- (OFString*)domain;
- (void)setResource: (OFString*)resource;
- (OFString*)resource;
@end @end

View file

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, 2012, 2013, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -27,10 +27,8 @@
* \brief A class describing a message stanza. * \brief A class describing a message stanza.
*/ */
@interface XMPPMessage: XMPPStanza @interface XMPPMessage: XMPPStanza
#ifdef OF_HAVE_PROPERTIES /** The text content of the body of the message. */
/// \brief The text content of the body of the message
@property (copy) OFString *body; @property (copy) OFString *body;
#endif
/** /**
* \brief Creates a new autoreleased XMPPMessage. * \brief Creates a new autoreleased XMPPMessage.
@ -91,18 +89,4 @@
*/ */
- initWithType: (OFString*)type - initWithType: (OFString*)type
ID: (OFString*)ID; 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 @end

View file

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, 2013, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -28,14 +28,24 @@
*/ */
@interface XMPPPresence: XMPPStanza <OFComparing> @interface XMPPPresence: XMPPStanza <OFComparing>
{ {
OFString *_status, *_show, *_priority; OFString *_status, *_show;
OFNumber *_priority;
} }
#ifdef OF_HAVE_PROPERTIES /**
* The text content of the status element.
*/
@property (copy) OFString *status; @property (copy) OFString *status;
/**
* The text content of the show element of the presence stanza.
*/
@property (copy) OFString *show; @property (copy) OFString *show;
/**
* The numeric content of the priority element.
*/
@property (copy) OFNumber *priority; @property (copy) OFNumber *priority;
#endif
/** /**
* \brief Creates a new autoreleased XMPPPresence. * \brief Creates a new autoreleased XMPPPresence.
@ -97,47 +107,4 @@
*/ */
- initWithType: (OFString*)type - initWithType: (OFString*)type
ID: (OFString*)ID; 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 @end

View file

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, 2012, 2013, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -25,21 +25,25 @@
# include "config.h" # include "config.h"
#endif #endif
#include <assert.h>
#import "XMPPPresence.h" #import "XMPPPresence.h"
#import "namespaces.h" #import "namespaces.h"
// This provides us with sortable values for show values /* This provides us with sortable values for show values */
static int show_to_int(OFString *show) static int
show_to_int(OFString *show)
{ {
if ([show isEqual: @"chat"]) return 0; if ([show isEqual: @"chat"])
if (show == nil) return 1; // available return 0;
if ([show isEqual: @"away"]) return 2; if (show == nil)
if ([show isEqual: @"dnd"]) return 3; return 1; /* available */
if ([show isEqual: @"xa"]) return 4; if ([show isEqual: @"away"])
return 2;
if ([show isEqual: @"dnd"])
return 3;
if ([show isEqual: @"xa"])
return 4;
assert(0); OF_ENSURE(0);
} }
@implementation XMPPPresence @implementation XMPPPresence
@ -141,6 +145,7 @@ static int show_to_int(OFString *show)
{ {
OFXMLElement *oldShow = [self elementForName: @"show" OFXMLElement *oldShow = [self elementForName: @"show"
namespace: XMPP_NS_CLIENT]; namespace: XMPP_NS_CLIENT];
OFString *old;
if (oldShow != nil) if (oldShow != nil)
[self removeChild: oldShow]; [self removeChild: oldShow];
@ -150,7 +155,9 @@ static int show_to_int(OFString *show)
namespace: XMPP_NS_CLIENT namespace: XMPP_NS_CLIENT
stringValue: show]]; stringValue: show]];
OF_SETTER(_show, show, true, 1) old = _show;
_show = [show copy];
[old release];
} }
- (OFString*)show - (OFString*)show
@ -162,6 +169,7 @@ static int show_to_int(OFString *show)
{ {
OFXMLElement *oldStatus = [self elementForName: @"status" OFXMLElement *oldStatus = [self elementForName: @"status"
namespace: XMPP_NS_CLIENT]; namespace: XMPP_NS_CLIENT];
OFString *old;
if (oldStatus != nil) if (oldStatus != nil)
[self removeChild: oldStatus]; [self removeChild: oldStatus];
@ -171,7 +179,9 @@ static int show_to_int(OFString *show)
namespace: XMPP_NS_CLIENT namespace: XMPP_NS_CLIENT
stringValue: status]]; stringValue: status]];
OF_SETTER(_status, status, true, 1) old = _status;
_status = [status copy];
[old release];
} }
- (OFString*)status - (OFString*)status
@ -182,6 +192,7 @@ static int show_to_int(OFString *show)
- (void)setPriority: (OFNumber*)priority - (void)setPriority: (OFNumber*)priority
{ {
intmax_t prio = [priority intMaxValue]; intmax_t prio = [priority intMaxValue];
OFNumber *old;
if ((prio < -128) || (prio > 127)) if ((prio < -128) || (prio > 127))
@throw [OFInvalidArgumentException exception]; @throw [OFInvalidArgumentException exception];
@ -198,7 +209,9 @@ static int show_to_int(OFString *show)
namespace: XMPP_NS_CLIENT namespace: XMPP_NS_CLIENT
stringValue: priority_s]]; stringValue: priority_s]];
OF_SETTER(_priority, priority, true, 1) old = _priority;
_priority = [priority copy];
[old release];
} }
- (OFNumber*)priority - (OFNumber*)priority

View file

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2012, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2012, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -39,9 +39,7 @@
#ifndef XMPP_ROSTER_M #ifndef XMPP_ROSTER_M
<OFObject> <OFObject>
#endif #endif
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional @optional
#endif
/** /**
* \brief This callback is called after the roster was received (as a result of * \brief This callback is called after the roster was received (as a result of
* calling -requestRoster). * calling -requestRoster).
@ -63,10 +61,7 @@
/** /**
* \brief A class implementing roster related functionality. * \brief A class implementing roster related functionality.
*/ */
@interface XMPPRoster: OFObject @interface XMPPRoster: OFObject <XMPPConnectionDelegate>
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
<XMPPConnectionDelegate>
#endif
{ {
XMPPConnection *_connection; XMPPConnection *_connection;
OFMutableDictionary *_rosterItems; OFMutableDictionary *_rosterItems;
@ -75,7 +70,6 @@
bool _rosterRequested; bool _rosterRequested;
} }
#ifdef OF_HAVE_PROPERTIES
/** /**
* \brief The connection to which the roster belongs * \brief The connection to which the roster belongs
*/ */
@ -93,7 +87,6 @@
* as key. * as key.
*/ */
@property (readonly, copy) OFDictionary *rosterItems; @property (readonly, copy) OFDictionary *rosterItems;
#endif
/** /**
* \brief Initializes an already allocated XMPPRoster. * \brief Initializes an already allocated XMPPRoster.
@ -104,8 +97,6 @@
*/ */
- initWithConnection: (XMPPConnection*)connection; - initWithConnection: (XMPPConnection*)connection;
- (OFDictionary*)rosterItems;
/** /**
* \brief Requests the roster from the server. * \brief Requests the roster from the server.
*/ */
@ -146,11 +137,6 @@
*/ */
- (void)removeDelegate: (id <XMPPRosterDelegate>)delegate; - (void)removeDelegate: (id <XMPPRosterDelegate>)delegate;
- (XMPPConnection*)connection;
- (void)setDataStorage: (id <XMPPStorage>)dataStorage;
- (id <XMPPStorage>)dataStorage;
- (void)XMPP_updateRosterItem: (XMPPRosterItem*)rosterItem; - (void)XMPP_updateRosterItem: (XMPPRosterItem*)rosterItem;
- (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection - (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection
IQ: (XMPPIQ*)iq; IQ: (XMPPIQ*)iq;

View file

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2012, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2012, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -40,6 +40,9 @@
#import "namespaces.h" #import "namespaces.h"
@implementation XMPPRoster @implementation XMPPRoster
@synthesize connection = _connection, dataStorage = _dataStorage;
@synthesize rosterItems = _rosterItems;
- initWithConnection: (XMPPConnection*)connection - initWithConnection: (XMPPConnection*)connection
{ {
self = [super init]; self = [super init];
@ -67,11 +70,6 @@
[super dealloc]; [super dealloc];
} }
- (OFDictionary*)rosterItems
{
return [[_rosterItems copy] autorelease];
}
- (void)requestRoster - (void)requestRoster
{ {
XMPPIQ *iq; XMPPIQ *iq;

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2011, 2012, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2012, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -35,7 +36,6 @@
OFArray *_groups; OFArray *_groups;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The JID of the roster item /// \brief The JID of the roster item
@property (copy) XMPPJID *JID; @property (copy) XMPPJID *JID;
/// \brief The name of the roster item to show to the user /// \brief The name of the roster item to show to the user
@ -44,7 +44,6 @@
@property (copy) OFString *subscription; @property (copy) OFString *subscription;
/// \brief An array of groups in which the roster item is /// \brief An array of groups in which the roster item is
@property (copy) OFArray *groups; @property (copy) OFArray *groups;
#endif
/** /**
* \brief Creates a new autoreleased roster item. * \brief Creates a new autoreleased roster item.
@ -52,13 +51,4 @@
* \return A new autoreleased roster item. * \return A new autoreleased roster item.
*/ */
+ (instancetype)rosterItem; + (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 @end

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2012, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -30,6 +31,9 @@
#import <ObjFW/macros.h> #import <ObjFW/macros.h>
@implementation XMPPRosterItem @implementation XMPPRosterItem
@synthesize JID = _JID, name = _name, subscription = _subscription;
@synthesize groups = _groups;
+ (instancetype)rosterItem + (instancetype)rosterItem
{ {
return [[[self alloc] init] autorelease]; return [[[self alloc] init] autorelease];
@ -68,44 +72,4 @@
@"subscription=%@, groups=%@>", @"subscription=%@, groups=%@>",
_JID, _name, _subscription, _groups]; _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 @end

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, 2012, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -35,13 +36,11 @@
OFString *_target; OFString *_target;
} }
#ifdef OF_HAVE_PROPERTIES
@property (readonly) uint16_t priority; @property (readonly) uint16_t priority;
@property (readonly) uint16_t weight; @property (readonly) uint16_t weight;
@property uint32_t accumulatedWeight; @property uint32_t accumulatedWeight;
@property (readonly) uint16_t port; @property (readonly) uint16_t port;
@property (readonly, copy) OFString *target; @property (readonly, copy) OFString *target;
#endif
+ (instancetype)entryWithPriority: (uint16_t)priority + (instancetype)entryWithPriority: (uint16_t)priority
weight: (uint16_t)weight weight: (uint16_t)weight
@ -55,12 +54,6 @@
target: (OFString*)target; target: (OFString*)target;
- initWithResourceRecord: (ns_rr)resourceRecord - initWithResourceRecord: (ns_rr)resourceRecord
handle: (ns_msg)handle; handle: (ns_msg)handle;
- (uint16_t)priority;
- (uint16_t)weight;
- (uint32_t)accumulatedWeight;
- (void)setAccumulatedWeight: (uint32_t)accumulatedWeight;
- (uint16_t)port;
- (OFString*)target;
@end @end
@interface XMPPSRVLookup: OFObject <OFEnumerating> @interface XMPPSRVLookup: OFObject <OFEnumerating>
@ -70,9 +63,7 @@
OFList *_list; OFList *_list;
} }
#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFString *domain; @property (readonly, copy) OFString *domain;
#endif
+ (instancetype)lookupWithDomain: (OFString*)domain; + (instancetype)lookupWithDomain: (OFString*)domain;
- initWithDomain: (OFString*)domain; - initWithDomain: (OFString*)domain;

View file

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2011, 2012, 2013, 2014, 2015 * Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016
* Jonathan Schleifer <js@webkeks.org> * Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, 2012, 2013, 2014, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -40,6 +40,10 @@
#import <ObjFW/OFSystemInfo.h> #import <ObjFW/OFSystemInfo.h>
@implementation XMPPSRVEntry @implementation XMPPSRVEntry
@synthesize priority = _priority, weight = _weight;
@synthesize accumulatedWeight = _accumulatedWeight, port = _port;
@synthesize target = _target;
+ (instancetype)entryWithPriority: (uint16_t)priority + (instancetype)entryWithPriority: (uint16_t)priority
weight: (uint16_t)weight weight: (uint16_t)weight
port: (uint16_t)port port: (uint16_t)port
@ -133,39 +137,11 @@
@"<%@ priority: %" PRIu16 @", weight: %" PRIu16 @", target: %@:%" @"<%@ priority: %" PRIu16 @", weight: %" PRIu16 @", target: %@:%"
PRIu16 @">", [self class], _priority, _weight, _target, _port]; PRIu16 @">", [self class], _priority, _weight, _target, _port];
} }
- (uint16_t)priority
{
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 @end
@implementation XMPPSRVLookup @implementation XMPPSRVLookup
@synthesize domain = _domain;
+ (instancetype)lookupWithDomain: (OFString*)domain + (instancetype)lookupWithDomain: (OFString*)domain
{ {
return [[[self alloc] initWithDomain: domain] autorelease]; return [[[self alloc] initWithDomain: domain] autorelease];
@ -196,11 +172,6 @@
[super dealloc]; [super dealloc];
} }
- (OFString*)domain;
{
OF_GETTER(_domain, true)
}
- (void)XMPP_lookup - (void)XMPP_lookup
{ {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];

View file

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -34,7 +34,6 @@
OFString *_type, *_ID, *_language; OFString *_type, *_ID, *_language;
} }
#ifdef OF_HAVE_PROPERTIES
/// \brief The value of the stanza's from attribute /// \brief The value of the stanza's from attribute
@property (copy) XMPPJID *from; @property (copy) XMPPJID *from;
/// \brief The value of the stanza's to attribute /// \brief The value of the stanza's to attribute
@ -44,7 +43,7 @@
/// \brief The value of the stanza's id attribute /// \brief The value of the stanza's id attribute
@property (copy) OFString *ID; @property (copy) OFString *ID;
/// \brief The stanza's xml:lang /// \brief The stanza's xml:lang
#endif @property (copy) OFString *language;
/** /**
* \brief Creates a new autoreleased XMPPStanza with the specified name. * \brief Creates a new autoreleased XMPPStanza with the specified name.
@ -146,15 +145,4 @@
* \return A initialized XMPPStanza * \return A initialized XMPPStanza
*/ */
- initWithElement: (OFXMLElement*)element; - 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 @end

View file

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org> * Copyright (c) 2011, 2012, 2013, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,8 @@
/* /*
* Copyright (c) 2012, Florian Zeitz <florob@babelmonkeys.de> * Copyright (c) 2012, Florian Zeitz <florob@babelmonkeys.de>
* Copyright (c) 2013, 2016, Jonathan Schleifer <js@heap.zone>
* *
* 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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -22,10 +23,7 @@
#import "XMPPConnection.h" #import "XMPPConnection.h"
@interface XMPPStreamManagement: OFObject @interface XMPPStreamManagement: OFObject <XMPPConnectionDelegate>
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
<XMPPConnectionDelegate>
#endif
{ {
XMPPConnection *_connection; XMPPConnection *_connection;
uint32_t _receivedCount; uint32_t _receivedCount;