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