Prefix *all* IVars with _.
This commit is contained in:
parent
cd292b53fa
commit
4fead04d9a
12 changed files with 56 additions and 69 deletions
|
@ -27,9 +27,7 @@
|
||||||
*/
|
*/
|
||||||
@interface XMPPAuthenticator: OFObject
|
@interface XMPPAuthenticator: OFObject
|
||||||
{
|
{
|
||||||
OFString *_authzid;
|
OFString *_authzid, *_authcid, *_password;
|
||||||
OFString *_authcid;
|
|
||||||
OFString *_password;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OF_HAVE_PROPERTIES
|
#ifdef OF_HAVE_PROPERTIES
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
@class XMPPIQ;
|
@class XMPPIQ;
|
||||||
|
|
||||||
#ifdef OF_HAVE_BLOCKS
|
#ifdef OF_HAVE_BLOCKS
|
||||||
typedef void(^xmpp_callback_block_t)(XMPPConnection*, XMPPIQ*);
|
typedef void (^xmpp_callback_block_t)(XMPPConnection*, XMPPIQ*);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface XMPPCallback: OFObject
|
@interface XMPPCallback: OFObject
|
||||||
|
@ -34,7 +34,7 @@ typedef void(^xmpp_callback_block_t)(XMPPConnection*, XMPPIQ*);
|
||||||
id _target;
|
id _target;
|
||||||
SEL _selector;
|
SEL _selector;
|
||||||
#ifdef OF_HAVE_BLOCKS
|
#ifdef OF_HAVE_BLOCKS
|
||||||
xmpp_callback_block_t block;
|
xmpp_callback_block_t _block;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,12 @@
|
||||||
return [[(XMPPCallback*)[self alloc] initWithBlock: block] autorelease];
|
return [[(XMPPCallback*)[self alloc] initWithBlock: block] autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
- initWithBlock: (xmpp_callback_block_t)block_
|
- initWithBlock: (xmpp_callback_block_t)block
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
block = [block_ copy];
|
_block = [block copy];
|
||||||
} @catch (id e) {
|
} @catch (id e) {
|
||||||
[self release];
|
[self release];
|
||||||
@throw e;
|
@throw e;
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
{
|
{
|
||||||
[_target release];
|
[_target release];
|
||||||
#ifdef OF_HAVE_BLOCKS
|
#ifdef OF_HAVE_BLOCKS
|
||||||
[block release];
|
[_block release];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
@ -80,8 +80,8 @@
|
||||||
connection: (XMPPConnection*)connection
|
connection: (XMPPConnection*)connection
|
||||||
{
|
{
|
||||||
#ifdef OF_HAVE_BLOCKS
|
#ifdef OF_HAVE_BLOCKS
|
||||||
if (block != NULL)
|
if (_block != NULL)
|
||||||
block(connection, iq);
|
_block(connection, iq);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
[_target performSelector: _selector
|
[_target performSelector: _selector
|
||||||
|
|
|
@ -27,9 +27,7 @@
|
||||||
*/
|
*/
|
||||||
@interface XMPPDiscoIdentity: OFObject <OFComparing>
|
@interface XMPPDiscoIdentity: OFObject <OFComparing>
|
||||||
{
|
{
|
||||||
OFString *_category;
|
OFString *_category, *_name, *_type;
|
||||||
OFString *_name;
|
|
||||||
OFString *_type;
|
|
||||||
}
|
}
|
||||||
#ifdef OF_HAVE_PROPERTIES
|
#ifdef OF_HAVE_PROPERTIES
|
||||||
/// \brief The category of the identity
|
/// \brief The category of the identity
|
||||||
|
|
|
@ -64,8 +64,7 @@
|
||||||
*/
|
*/
|
||||||
@interface XMPPStreamErrorException: XMPPException
|
@interface XMPPStreamErrorException: XMPPException
|
||||||
{
|
{
|
||||||
OFString *_condition;
|
OFString *_condition, *_reason;
|
||||||
OFString *_reason;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OF_HAVE_PROPERTIES
|
#ifdef OF_HAVE_PROPERTIES
|
||||||
|
@ -109,8 +108,7 @@
|
||||||
*/
|
*/
|
||||||
@interface XMPPStringPrepFailedException: XMPPException
|
@interface XMPPStringPrepFailedException: XMPPException
|
||||||
{
|
{
|
||||||
OFString *_profile;
|
OFString *_profile, *_string;
|
||||||
OFString *_string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OF_HAVE_PROPERTIES
|
#ifdef OF_HAVE_PROPERTIES
|
||||||
|
@ -153,8 +151,7 @@
|
||||||
*/
|
*/
|
||||||
@interface XMPPIDNATranslationFailedException: XMPPException
|
@interface XMPPIDNATranslationFailedException: XMPPException
|
||||||
{
|
{
|
||||||
OFString *_operation;
|
OFString *_operation, *_string;
|
||||||
OFString *_string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OF_HAVE_PROPERTIES
|
#ifdef OF_HAVE_PROPERTIES
|
||||||
|
|
|
@ -28,9 +28,7 @@
|
||||||
*/
|
*/
|
||||||
@interface XMPPJID: OFObject <OFCopying>
|
@interface XMPPJID: OFObject <OFCopying>
|
||||||
{
|
{
|
||||||
OFString *_node;
|
OFString *_node, *_domain, *_resource;
|
||||||
OFString *_domain;
|
|
||||||
OFString *_resource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OF_HAVE_PROPERTIES
|
#ifdef OF_HAVE_PROPERTIES
|
||||||
|
|
|
@ -28,10 +28,9 @@
|
||||||
*/
|
*/
|
||||||
@interface XMPPPresence: XMPPStanza <OFComparing>
|
@interface XMPPPresence: XMPPStanza <OFComparing>
|
||||||
{
|
{
|
||||||
OFString *_status;
|
OFString *_status, *_show, *_priority;
|
||||||
OFString *_show;
|
|
||||||
OFNumber *_priority;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OF_HAVE_PROPERTIES
|
#ifdef OF_HAVE_PROPERTIES
|
||||||
@property (copy) OFString *status;
|
@property (copy) OFString *status;
|
||||||
@property (copy) OFString *show;
|
@property (copy) OFString *show;
|
||||||
|
@ -135,7 +134,8 @@
|
||||||
- (void)setPriority: (OFNumber*)priority;
|
- (void)setPriority: (OFNumber*)priority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Returns the numeric content of the priority element of the presence stanza.
|
* \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.
|
* \return The numeric content of the priority element of the presence stanza.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -83,10 +83,10 @@
|
||||||
|
|
||||||
@interface XMPPSRVEnumerator: OFEnumerator
|
@interface XMPPSRVEnumerator: OFEnumerator
|
||||||
{
|
{
|
||||||
OFList *list;
|
OFList *_list;
|
||||||
of_list_object_t *listIter;
|
of_list_object_t *_listIter;
|
||||||
OFList *subListCopy;
|
OFList *_subListCopy;
|
||||||
bool done;
|
bool _done;
|
||||||
}
|
}
|
||||||
|
|
||||||
- initWithList: (OFList*)list;
|
- initWithList: (OFList*)list;
|
||||||
|
|
|
@ -303,12 +303,12 @@
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation XMPPSRVEnumerator
|
@implementation XMPPSRVEnumerator
|
||||||
- initWithList: (OFList*)list_
|
- initWithList: (OFList*)list
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
list = [list_ copy];
|
_list = [list copy];
|
||||||
} @catch (id e) {
|
} @catch (id e) {
|
||||||
[self release];
|
[self release];
|
||||||
@throw e;
|
@throw e;
|
||||||
|
@ -323,50 +323,50 @@
|
||||||
of_list_object_t *iter;
|
of_list_object_t *iter;
|
||||||
uint32_t totalWeight = 0;
|
uint32_t totalWeight = 0;
|
||||||
|
|
||||||
if (done)
|
if (_done)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
if (listIter == NULL)
|
if (_listIter == NULL)
|
||||||
listIter = [list firstListObject];
|
_listIter = [_list firstListObject];
|
||||||
|
|
||||||
if (listIter == NULL)
|
if (_listIter == NULL)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
if (subListCopy == nil)
|
if (_subListCopy == nil)
|
||||||
subListCopy = [listIter->object copy];
|
_subListCopy = [_listIter->object copy];
|
||||||
|
|
||||||
for (iter = [subListCopy firstListObject]; iter != NULL;
|
for (iter = [_subListCopy firstListObject]; iter != NULL;
|
||||||
iter = iter->next) {
|
iter = iter->next) {
|
||||||
totalWeight += [iter->object weight];
|
totalWeight += [iter->object weight];
|
||||||
[iter->object setAccumulatedWeight: totalWeight];
|
[iter->object setAccumulatedWeight: totalWeight];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([subListCopy count] > 0) {
|
if ([_subListCopy count] > 0) {
|
||||||
uint32_t randomWeight;
|
uint32_t randomWeight;
|
||||||
|
|
||||||
RAND_pseudo_bytes((uint8_t*)&randomWeight, sizeof(uint32_t));
|
RAND_pseudo_bytes((uint8_t*)&randomWeight, sizeof(uint32_t));
|
||||||
randomWeight %= (totalWeight + 1);
|
randomWeight %= (totalWeight + 1);
|
||||||
|
|
||||||
for (iter = [subListCopy firstListObject]; iter != NULL;
|
for (iter = [_subListCopy firstListObject]; iter != NULL;
|
||||||
iter = iter->next) {
|
iter = iter->next) {
|
||||||
if ([iter->object accumulatedWeight] >= randomWeight) {
|
if ([iter->object accumulatedWeight] >= randomWeight) {
|
||||||
ret = [[iter->object retain] autorelease];
|
ret = [[iter->object retain] autorelease];
|
||||||
|
|
||||||
[subListCopy removeListObject: iter];
|
[_subListCopy removeListObject: iter];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([subListCopy count] == 0) {
|
if ([_subListCopy count] == 0) {
|
||||||
[subListCopy release];
|
[_subListCopy release];
|
||||||
subListCopy = nil;
|
_subListCopy = nil;
|
||||||
|
|
||||||
listIter = listIter->next;
|
_listIter = _listIter->next;
|
||||||
|
|
||||||
if (listIter == NULL)
|
if (_listIter == NULL)
|
||||||
done = true;
|
_done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -374,9 +374,9 @@
|
||||||
|
|
||||||
- (void)reset
|
- (void)reset
|
||||||
{
|
{
|
||||||
listIter = NULL;
|
_listIter = NULL;
|
||||||
[subListCopy release];
|
[_subListCopy release];
|
||||||
subListCopy = nil;
|
_subListCopy = nil;
|
||||||
done = false;
|
_done = false;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -30,11 +30,8 @@
|
||||||
*/
|
*/
|
||||||
@interface XMPPStanza: OFXMLElement
|
@interface XMPPStanza: OFXMLElement
|
||||||
{
|
{
|
||||||
XMPPJID *_from;
|
XMPPJID *_from, *_to;
|
||||||
XMPPJID *_to;
|
OFString *_type, *_ID, *_language;
|
||||||
OFString *_type;
|
|
||||||
OFString *_ID;
|
|
||||||
OFString *_language;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OF_HAVE_PROPERTIES
|
#ifdef OF_HAVE_PROPERTIES
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
XMPPConnection *_connection;
|
XMPPConnection *_connection;
|
||||||
uint32_t receivedCount;
|
uint32_t _receivedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
- initWithConnection: (XMPPConnection*)connection;
|
- initWithConnection: (XMPPConnection*)connection;
|
||||||
|
|
|
@ -24,14 +24,13 @@
|
||||||
#import "namespaces.h"
|
#import "namespaces.h"
|
||||||
|
|
||||||
@implementation XMPPStreamManagement
|
@implementation XMPPStreamManagement
|
||||||
- initWithConnection: (XMPPConnection*)connection_
|
- initWithConnection: (XMPPConnection*)connection
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
_connection = connection_;
|
_connection = connection;
|
||||||
[_connection addDelegate: self];
|
[_connection addDelegate: self];
|
||||||
receivedCount = 0;
|
|
||||||
} @catch (id e) {
|
} @catch (id e) {
|
||||||
[self release];
|
[self release];
|
||||||
@throw e;
|
@throw e;
|
||||||
|
@ -47,7 +46,7 @@
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)connection: (XMPPConnection*)connection_
|
- (void)connection: (XMPPConnection*)connection
|
||||||
didReceiveElement: (OFXMLElement*)element
|
didReceiveElement: (OFXMLElement*)element
|
||||||
{
|
{
|
||||||
OFString *elementName = [element name];
|
OFString *elementName = [element name];
|
||||||
|
@ -55,7 +54,7 @@
|
||||||
|
|
||||||
if ([elementNS isEqual: XMPP_NS_SM]) {
|
if ([elementNS isEqual: XMPP_NS_SM]) {
|
||||||
if ([elementName isEqual: @"enabled"]) {
|
if ([elementName isEqual: @"enabled"]) {
|
||||||
receivedCount = 0;
|
_receivedCount = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,11 +67,11 @@
|
||||||
OFXMLElement *ack =
|
OFXMLElement *ack =
|
||||||
[OFXMLElement elementWithName: @"a"
|
[OFXMLElement elementWithName: @"a"
|
||||||
namespace: XMPP_NS_SM];
|
namespace: XMPP_NS_SM];
|
||||||
|
OFString *stringValue = [OFString
|
||||||
|
stringWithFormat: @"%" PRIu32, _receivedCount];
|
||||||
[ack addAttributeWithName: @"h"
|
[ack addAttributeWithName: @"h"
|
||||||
stringValue:
|
stringValue: stringValue];
|
||||||
[OFString stringWithFormat: @"%" PRIu32,
|
[connection sendStanza: ack];
|
||||||
receivedCount]];
|
|
||||||
[connection_ sendStanza: ack];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +79,11 @@
|
||||||
([elementName isEqual: @"iq"] ||
|
([elementName isEqual: @"iq"] ||
|
||||||
[elementName isEqual: @"presence"] ||
|
[elementName isEqual: @"presence"] ||
|
||||||
[elementName isEqual: @"message"]))
|
[elementName isEqual: @"message"]))
|
||||||
receivedCount++;
|
_receivedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Count outgoing stanzas here and cache them, send own ACK requests
|
/* TODO: Count outgoing stanzas here and cache them, send own ACK requests
|
||||||
- (void)connection: (XMPPConnection*)connection_
|
- (void)connection: (XMPPConnection*)connection
|
||||||
didSendElement: (OFXMLElement*)element
|
didSendElement: (OFXMLElement*)element
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue