Skip to content

Commit f50ad4b

Browse files
committed
A little bit of code modernization: converting enums to NS_ENUM.
1 parent f8be98f commit f50ad4b

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

Authentication/XMPPSASLAuthentication.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@
66
@class XMPPStream;
77

88

9-
enum XMPPHandleAuthResponse
10-
{
9+
typedef NS_ENUM(NSInteger, XMPPHandleAuthResponse) {
10+
1111
XMPP_AUTH_FAIL, // Authentication failed.
1212
// The delegate will be informed via xmppStream:didNotAuthenticate:
1313

1414
XMPP_AUTH_SUCCESS, // Authentication succeeded.
1515
// The delegate will be informed via xmppStreamDidAuthenticate:
1616

1717
XMPP_AUTH_CONTINUE, // The authentication process is still ongoing.
18-
1918
};
20-
typedef enum XMPPHandleAuthResponse XMPPHandleAuthResponse;
2119

2220

2321
@protocol XMPPSASLAuthentication <NSObject>
@@ -80,7 +78,7 @@ typedef enum XMPPHandleAuthResponse XMPPHandleAuthResponse;
8078
* If the authentication is not yet complete, it should return XMPP_AUTH_CONTINUE,
8179
* meaning the xmpp stream will continue to forward all incoming xmpp stanzas to this method.
8280
*
83-
* This method is called by automatically XMPPStream (via the authenticate: method).
81+
* This method is called automatically by XMPPStream (via the authenticate: method).
8482
* You should NOT invoke this method manually.
8583
**/
8684
- (XMPPHandleAuthResponse)handleAuth:(NSXMLElement *)auth;

Core/XMPPInternal.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
#import "XMPPModule.h"
77

88
// Define the various states we'll use to track our progress
9-
enum XMPPStreamState
10-
{
9+
typedef NS_ENUM(NSInteger, XMPPStreamState) {
1110
STATE_XMPP_DISCONNECTED,
1211
STATE_XMPP_RESOLVING_SRV,
1312
STATE_XMPP_CONNECTING,
@@ -22,7 +21,6 @@ enum XMPPStreamState
2221
STATE_XMPP_START_SESSION,
2322
STATE_XMPP_CONNECTED,
2423
};
25-
typedef enum XMPPStreamState XMPPStreamState;
2624

2725
/**
2826
* It is recommended that storage classes cache a stream's myJID.

Core/XMPPStream.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ @interface XMPPStream ()
9393

9494
GCDMulticastDelegate <XMPPStreamDelegate> *multicastDelegate;
9595

96-
int state;
96+
XMPPStreamState state;
9797

9898
GCDAsyncSocket *asyncSocket;
9999

@@ -287,7 +287,7 @@ - (XMPPStreamState)state
287287
__block XMPPStreamState result = STATE_XMPP_DISCONNECTED;
288288

289289
dispatch_block_t block = ^{
290-
result = (XMPPStreamState)state;
290+
result = state;
291291
};
292292

293293
if (dispatch_get_specific(xmppQueueTag))

0 commit comments

Comments
 (0)