ObjXMPP  Check-in [049768c6ae]

Overview
Comment:Use instancetype.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 049768c6aec6a6d3a1cdc684493bfe959bd08403d3752679aae06b4d7f514e66
User & Date: js on 2013-06-23 21:41:47
Other Links: manifest | tags
Context
2013-07-01
20:07
Fix argument checking for XMPPDiscoEntity check-in: 4d52c6bfc6 user: florob@babelmonkeys.de tags: trunk
2013-06-23
21:41
Use instancetype. check-in: 049768c6ae user: js tags: trunk
20:13
Prefix *all* IVars with _. check-in: cce64dfcd6 user: js tags: trunk
Changes

Modified src/XMPPCallback.h from [c4e54254ee] to [1125cf7488].

35
36
37
38
39
40
41
42

43
44
45
46
47


48
49
50
51
52
53
35
36
37
38
39
40
41

42
43
44
45


46
47
48
49
50
51
52
53







-
+



-
-
+
+






	SEL _selector;
#ifdef OF_HAVE_BLOCKS
	xmpp_callback_block_t _block;
#endif
}

#ifdef OF_HAVE_BLOCKS
+ callbackWithBlock: (xmpp_callback_block_t)callback;
+ (instancetype)callbackWithBlock: (xmpp_callback_block_t)callback;
- initWithBlock: (xmpp_callback_block_t)callback;
#endif

+ callbackWithTarget: (id)target
	    selector: (SEL)selector;
+ (instancetype)callbackWithTarget: (id)target
			  selector: (SEL)selector;
- initWithTarget: (id)target
	selector: (SEL)selector;

- (void)runWithIQ: (XMPPIQ*)iq
       connection: (XMPPConnection*)connection;
@end

Modified src/XMPPCallback.m from [55260bd7bb] to [629a5d1a6d].

24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52


53
54
55
56
57
58
59
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50


51
52
53
54
55
56
57
58
59







-
+



















-
-
+
+







# include "config.h"
#endif

#import "XMPPCallback.h"

@implementation XMPPCallback
#ifdef OF_HAVE_BLOCKS
+ callbackWithBlock: (xmpp_callback_block_t)block
+ (instancetype)callbackWithBlock: (xmpp_callback_block_t)block
{
	return [[(XMPPCallback*)[self alloc] initWithBlock: block] autorelease];
}

- initWithBlock: (xmpp_callback_block_t)block
{
	self = [super init];

	@try {
		_block = [block copy];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
#endif

+ callbackWithTarget: (id)target
	    selector: (SEL)selector
+ (instancetype)callbackWithTarget: (id)target
			  selector: (SEL)selector
{
	return [[[self alloc] initWithTarget: target
				    selector: selector] autorelease];
}

- initWithTarget: (id)target_
	selector: (SEL)selector_

Modified src/XMPPConnection.h from [0881649e7a] to [bbf937bb03].

214
215
216
217
218
219
220
221

222
223
224
225
226
227
228
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228







-
+







#endif

/**
 * \brief Creates a new autoreleased XMPPConnection.
 *
 * \return A new autoreleased XMPPConnection
 */
+ connection;
+ (instancetype)connection;

/**
 * \brief Adds the specified delegate.
 *
 * \param delegate The delegate to add
 */
- (void)addDelegate: (id <XMPPConnectionDelegate>)delegate;

Modified src/XMPPConnection.m from [0ccfb1340e] to [0f3d82c9ea].

113
114
115
116
117
118
119
120

121
122
123
124
125
126
127
113
114
115
116
117
118
119

120
121
122
123
124
125
126
127







-
+







	[pool release];

	return nil;
}
@end

@implementation XMPPConnection
+ connection
+ (instancetype)connection
{
	return [[[self alloc] init] autorelease];
}

- init
{
	self = [super init];

Modified src/XMPPDiscoEntity.h from [03ee22a189] to [9a1090f9dd].

54
55
56
57
58
59
60
61

62
63
64
65
66
67
68
69
70
71
72


73
74
75
76
77
78
79
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68
69
70


71
72
73
74
75
76
77
78
79







-
+









-
-
+
+







/**
 * \brief Creates a new autoreleased XMPPDiscoEntity with the specified
 *	  connection.
 *
 * \param connection The XMPPConnection to serve responses on.
 * \return A new autoreleased XMPPDiscoEntity
 */
+ discoEntityWithConnection: (XMPPConnection*)connection;
+ (instancetype)discoEntityWithConnection: (XMPPConnection*)connection;

/**
 * \brief Creates a new autoreleased XMPPDiscoEntity with the specified
 *	  connection.
 *
 * \param connection The XMPPConnection to serve responses on.
 * \param capsNode The node advertised for the entity's capabilites
 * \return A new autoreleased XMPPDiscoEntity
 */
+ discoEntityWithConnection: (XMPPConnection*)connection
		   capsNode: (OFString*)capsNode;
+ (instancetype)discoEntityWithConnection: (XMPPConnection*)connection
				 capsNode: (OFString*)capsNode;

/**
 * \brief Initializes an already allocated XMPPDiscoEntity with the specified
 *	  connection.
 *
 * \param connection The XMPPConnection to serve responses on.
 *	  This must already be bound to a resource)

Modified src/XMPPDiscoEntity.m from [f5817847ca] to [0b97adbd3d].

22
23
24
25
26
27
28
29

30
31
32
33
34
35


36
37
38
39
40
41
42
22
23
24
25
26
27
28

29
30
31
32
33


34
35
36
37
38
39
40
41
42







-
+




-
-
+
+








#import "XMPPDiscoEntity.h"
#import "XMPPDiscoIdentity.h"
#import "XMPPIQ.h"
#import "namespaces.h"

@implementation XMPPDiscoEntity
+ discoEntityWithConnection: (XMPPConnection*)connection
+ (instancetype)discoEntityWithConnection: (XMPPConnection*)connection
{
	return [[[self alloc] initWithConnection: connection] autorelease];
}

+ discoEntityWithConnection: (XMPPConnection*)connection
		   capsNode: (OFString*)capsNode
+ (instancetype)discoEntityWithConnection: (XMPPConnection*)connection
				 capsNode: (OFString*)capsNode
{
	return [[[self alloc] initWithConnection: connection
					capsNode: capsNode] autorelease];
}

- initWithConnection: (XMPPConnection*)connection
{

Modified src/XMPPDiscoIdentity.h from [7a8984a7e1] to [a255ebd64e].

43
44
45
46
47
48
49
50
51
52



53
54
55
56
57
58
59
60
61
62
63


64
65
66
67
68
69
70
43
44
45
46
47
48
49



50
51
52
53
54
55
56
57
58
59
60
61


62
63
64
65
66
67
68
69
70







-
-
-
+
+
+









-
-
+
+







 *	  category, type and name.
 *
 * \param category The category of the identity
 * \param type The type of the identity
 * \param name The name of the identity
 * \return A new autoreleased XMPPDiscoIdentity
 */
+ identityWithCategory: (OFString*)category
		  type: (OFString*)type
		  name: (OFString*)name;
+ (instancetype)identityWithCategory: (OFString*)category
				type: (OFString*)type
				name: (OFString*)name;

/**
 * \brief Creates a new autoreleased XMPPDiscoIdentity with the specified
 *	  category and type.
 *
 * \param category The category of the identity
 * \param type The type of the identity
 * \return A new autoreleased XMPPDiscoIdentity
 */
+ identityWithCategory: (OFString*)category
		  type: (OFString*)type;
+ (instancetype)identityWithCategory: (OFString*)category
				type: (OFString*)type;

/**
 * \brief Initializes an already allocated XMPPDiscoIdentity with the specified
 *	  category, type and name.
 *
 * \param category The category of the identity
 * \param type The type of the identity

Modified src/XMPPDiscoIdentity.m from [0b7603d5d7] to [6d865bd091].

19
20
21
22
23
24
25
26
27
28



29
30
31
32
33
34
35
36


37
38
39
40
41
42
43
19
20
21
22
23
24
25



26
27
28
29
30
31
32
33
34


35
36
37
38
39
40
41
42
43







-
-
-
+
+
+






-
-
+
+







 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "XMPPDiscoIdentity.h"

@implementation XMPPDiscoIdentity
+ identityWithCategory: (OFString*)category
		  type: (OFString*)type
		  name: (OFString*)name
+ (instancetype)identityWithCategory: (OFString*)category
				type: (OFString*)type
				name: (OFString*)name
{
	return [[[self alloc] initWithCategory: category
					  type: type
					  name: name] autorelease];
}

+ identityWithCategory: (OFString*)category
		  type: (OFString*)type
+ (instancetype)identityWithCategory: (OFString*)category
				type: (OFString*)type
{
	return [[[self alloc] initWithCategory: category
					  type: type] autorelease];
}

- initWithCategory: (OFString*)category
	      type: (OFString*)type

Modified src/XMPPDiscoNode.h from [0a98f21b19] to [eb39176956].

57
58
59
60
61
62
63
64
65


66
67
68
69
70
71
72
73
74
75
76
77


78
79
80
81
82
83
84
57
58
59
60
61
62
63


64
65
66
67
68
69
70
71
72
73
74
75


76
77
78
79
80
81
82
83
84







-
-
+
+










-
-
+
+







 * \brief Creates a new autoreleased XMPPDiscoNode with the specified
 *	  JID and node
 *
 * \param JID The JID this node lives on
 * \param node The node's opaque name
 * \return A new autoreleased XMPPDiscoNode
 */
+ discoNodeWithJID: (XMPPJID*)JID
	      node: (OFString*)node;
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID
			    node: (OFString*)node;

/**
 * \brief Creates a new autoreleased XMPPDiscoNode with the specified
 *	  JID, node and name
 *
 * \param JID The JID this node lives on
 * \param node The node's opaque name
 * \param name The node's human friendly name
 * \return A new autoreleased XMPPDiscoNode
 */
+ discoNodeWithJID: (XMPPJID*)JID
	      node: (OFString*)node
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID
			    node: (OFString*)node
	      name: (OFString*)name;

/**
 * \brief Initializes an already allocated XMPPDiscoNode with the specified
 *	  JID and node
 *
 * \param JID The JID this node lives on

Modified src/XMPPDiscoNode.m from [443ba32ad2] to [262be970dc].

24
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41



42
43
44
45
46
47
48
24
25
26
27
28
29
30


31
32
33
34
35
36
37
38



39
40
41
42
43
44
45
46
47
48







-
-
+
+






-
-
-
+
+
+







#import "XMPPIQ.h"
#import "XMPPJID.h"
#import "XMPPDiscoNode.h"
#import "XMPPDiscoIdentity.h"
#import "namespaces.h"

@implementation XMPPDiscoNode
+ discoNodeWithJID: (XMPPJID*)JID
	      node: (OFString*)node;
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID
			    node: (OFString*)node;
{
	return [[[self alloc] initWithJID: JID
				     node: node] autorelease];
}


+ discoNodeWithJID: (XMPPJID*)JID
	      node: (OFString*)node
	      name: (OFString*)name
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID
			    node: (OFString*)node
			    name: (OFString*)name
{
	return [[[self alloc] initWithJID: JID
				     node: node
				     name: name] autorelease];
}

- initWithJID: (XMPPJID*)JID

Modified src/XMPPEXTERNALAuth.h from [5dea7059da] to [a16e9590aa].

28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43

44
28
29
30
31
32
33
34

35
36
37
38
39
40
41
42

43
44







-
+







-
+

 */
@interface XMPPEXTERNALAuth: XMPPAuthenticator
/**
 * \brief Creates a new autoreleased XMPPEXTERNALAuth.
 *
 * \return A new autoreleased XMPPEXTERNALAuth
 */
+ EXTERNALAuth;
+ (instancetype)EXTERNALAuth;

/**
 * \brief Creates a new autoreleased XMPPEXTERNALAuth with an authzid.
 *
 * \param authzid The authzid to get authorization for
 * \return A new autoreleased XMPPEXTERNALAuth
 */
+ EXTERNALAuthWithAuthzid: (OFString*)authzid;
+ (instancetype)EXTERNALAuthWithAuthzid: (OFString*)authzid;
@end

Modified src/XMPPEXTERNALAuth.m from [d46bce778e] to [f2a51b3be1].

23
24
25
26
27
28
29
30

31
32
33
34
35
36

37
38
39
40
41
42
43
23
24
25
26
27
28
29

30
31
32
33
34
35

36
37
38
39
40
41
42
43







-
+





-
+







#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#import "XMPPEXTERNALAuth.h"

@implementation XMPPEXTERNALAuth: XMPPAuthenticator
+ EXTERNALAuth
+ (instancetype)EXTERNALAuth
{
	return [[[self alloc] initWithAuthcid: nil
				     password: nil] autorelease];
}

+ EXTERNALAuthWithAuthzid: (OFString*)authzid
+ (instancetype)EXTERNALAuthWithAuthzid: (OFString*)authzid
{
	return [[[self alloc] initWithAuthzid: authzid
				      authcid: nil
				     password: nil] autorelease];
}

- (OFDataArray*)initialMessage

Modified src/XMPPExceptions.h from [532dca8d2a] to [8c68d97891].

41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55







-
+







/**
 * \brief Creates a new XMPPException.
 *
 * \param connection The connection that received the data responsible
 *	  for this exception
 * \return A new XMPPException
 */
+ exceptionWithConnection: (XMPPConnection*)connection;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection;

/**
 * \brief Initializes an already allocated XMPPException.
 *
 * \param connection The connection that received the data responsible
 *	  for this exception
 * \return An initialized XMPPException
78
79
80
81
82
83
84
85
86
87



88
89
90
91
92
93
94
78
79
80
81
82
83
84



85
86
87
88
89
90
91
92
93
94







-
-
-
+
+
+







 * \brief Creates a new XMPPStreamErrorException.
 *
 * \param connection The connection that received the stream error
 * \param condition The defined error condition specified by the stream error
 * \param reason The descriptive free-form text specified by the stream error
 * \return A new XMPPStreamErrorException
 */
+ exceptionWithConnection: (XMPPConnection*)connection
		condition: (OFString*)condition
		   reason: (OFString*)reason;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
			      condition: (OFString*)condition
				 reason: (OFString*)reason;

/**
 * \brief Initializes an already allocated XMPPStreamErrorException.
 *
 * \param connection The connection that received the stream error
 * \param condition The defined error condition specified by the stream error
 * \param reason The descriptive free-form text specified by the stream error
122
123
124
125
126
127
128
129
130
131



132
133
134
135
136
137
138
122
123
124
125
126
127
128



129
130
131
132
133
134
135
136
137
138







-
-
-
+
+
+







 * \brief Creates a new XMPPStringPrepFailedException.
 *
 * \param connection The connection the string relates to
 * \param profile The name of the stringprep profile that did not apply
 * \param string The string that failed the stringprep profile
 * \return A new XMPPStringPrepFailedException
 */
+ exceptionWithConnection: (XMPPConnection*)connection
		  profile: (OFString*)profile
		   string: (OFString*)string;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
				profile: (OFString*)profile
				 string: (OFString*)string;

/**
 * \brief Initializes an already allocated XMPPStringPrepFailedException.
 *
 * \param connection The connection the string relates to
 * \param profile The name of the stringprep profile that did not apply
 * \param string The string that failed the stringprep profile
165
166
167
168
169
170
171
172
173
174



175
176
177
178
179
180
181
165
166
167
168
169
170
171



172
173
174
175
176
177
178
179
180
181







-
-
-
+
+
+







 * \brief Creates a new XMPPIDNATranslationFailedException.
 *
 * \param connection The connection the string relates to
 * \param operation The name of the stringprep profile that did not apply
 * \param string The string that could not be translated
 * \return A new XMPPIDNATranslationFailedException
 */
+ exceptionWithConnection: (XMPPConnection*)connection
		operation: (OFString*)operation
		   string: (OFString*)string;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
			      operation: (OFString*)operation
				 string: (OFString*)string;

/**
 * \brief Initializes an already allocated XMPPIDNATranslationFailedException.
 *
 * \param connection The connection the string relates to
 * \param operation The name of the stringprep profile that did not apply
 * \param string The string that could not be translated
205
206
207
208
209
210
211
212
213


214
215
216
217
218
219
220
221
222
223
224
225
226
205
206
207
208
209
210
211


212
213
214
215
216
217
218
219
220
221
222
223
224
225
226







-
-
+
+













/**
 * \brief Creates a new XMPPAuthFailedException.
 *
 * \param connection The connection that could not be authenticated
 * \param reason The reason the authentication failed
 * \return A new XMPPAuthFailedException
 */
+ exceptionWithConnection: (XMPPConnection*)connection
		   reason: (OFString*)reason;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
				 reason: (OFString*)reason;

/**
 * \brief Initializes an already allocated XMPPAuthFailedException.
 *
 * \param connection The connection that could not be authenticated
 * \param reason The reason the authentication failed
 * \return An initialized XMPPAuthFailedException
 */
- initWithConnection: (XMPPConnection*)connection
	      reason: (OFString*)reason;

- (OFString*)reason;
@end

Modified src/XMPPExceptions.m from [376315cbbf] to [9a8f715d68].

26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40







-
+








#include <stdlib.h>

#import "XMPPExceptions.h"
#import "XMPPConnection.h"

@implementation XMPPException
+ exceptionWithConnection: (XMPPConnection*)connection
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
{
	return [[[self alloc] initWithConnection: connection] autorelease];
}

- init
{
	@try {
71
72
73
74
75
76
77
78
79
80



81
82
83
84
85
86
87
71
72
73
74
75
76
77



78
79
80
81
82
83
84
85
86
87







-
-
-
+
+
+







- (XMPPConnection*)connection
{
	OF_GETTER(_connection, false)
}
@end

@implementation XMPPStreamErrorException
+ exceptionWithConnection: (XMPPConnection*)connection
		condition: (OFString*)condition
		   reason: (OFString*)reason;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
			      condition: (OFString*)condition
				 reason: (OFString*)reason;
{
	return [[[self alloc] initWithConnection: connection
				       condition: condition
					  reason: reason] autorelease];
}

- initWithConnection: (XMPPConnection*)connection
135
136
137
138
139
140
141
142
143
144



145
146
147
148
149
150
151
135
136
137
138
139
140
141



142
143
144
145
146
147
148
149
150
151







-
-
-
+
+
+







- (OFString*)reason
{
	OF_GETTER(_reason, false)
}
@end

@implementation XMPPStringPrepFailedException
+ exceptionWithConnection: (XMPPConnection*)connection
		  profile: (OFString*)profile
		   string: (OFString*)string
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
				profile: (OFString*)profile
				 string: (OFString*)string
{
	return [[[self alloc] initWithConnection: connection
					 profile: profile
					  string: string] autorelease];
}

- initWithConnection: (XMPPConnection*)connection
200
201
202
203
204
205
206
207
208
209



210
211
212
213
214
215
216
200
201
202
203
204
205
206



207
208
209
210
211
212
213
214
215
216







-
-
-
+
+
+







- (OFString*)string
{
	OF_GETTER(_string, false)
}
@end

@implementation XMPPIDNATranslationFailedException
+ exceptionWithConnection: (XMPPConnection*)connection
		operation: (OFString*)operation
		   string: (OFString*)string
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
			      operation: (OFString*)operation
				 string: (OFString*)string
{
	return [[[self alloc] initWithConnection: connection
				       operation: operation
					  string: string] autorelease];
}

- initWithConnection: (XMPPConnection*)connection
264
265
266
267
268
269
270
271
272


273
274
275
276
277
278
279
264
265
266
267
268
269
270


271
272
273
274
275
276
277
278
279







-
-
+
+







- (OFString*)string
{
	OF_GETTER(_string, false)
}
@end

@implementation XMPPAuthFailedException
+ exceptionWithConnection: (XMPPConnection*)connection
		   reason: (OFString*)reason;
+ (instancetype)exceptionWithConnection: (XMPPConnection*)connection
				 reason: (OFString*)reason;
{
	return [[[self alloc] initWithConnection: connection
					  reason: reason] autorelease];
}

- initWithConnection: (XMPPConnection*)connection
{

Modified src/XMPPIQ.h from [15def35d93] to [e581038bc1].

30
31
32
33
34
35
36
37
38


39
40
41
42
43
44
45
30
31
32
33
34
35
36


37
38
39
40
41
42
43
44
45







-
-
+
+







/**
 * \brief Creates a new XMPPIQ with the specified type and ID.
 *
 * \param type The value for the stanza's type attribute
 * \param ID The value for the stanza's id attribute
 * \return A new autoreleased XMPPIQ
 */
+ IQWithType: (OFString*)type
	  ID: (OFString*)ID;
+ (instancetype)IQWithType: (OFString*)type
			ID: (OFString*)ID;

/**
 * \brief Initializes an already allocated XMPPIQ with the specified type and
 *	  ID.
 *
 * \param type The value for the stanza's type attribute
 * \param ID The value for the stanza's id attribute

Modified src/XMPPIQ.m from [08cee60ca1] to [53dae4baf4].

25
26
27
28
29
30
31
32
33


34
35
36
37
38
39
40
25
26
27
28
29
30
31


32
33
34
35
36
37
38
39
40







-
-
+
+







# include "config.h"
#endif

#import "namespaces.h"
#import "XMPPIQ.h"

@implementation XMPPIQ
+ IQWithType: (OFString*)type
	  ID: (OFString*)ID
+ (instancetype)IQWithType: (OFString*)type
			ID: (OFString*)ID
{
	return [[[self alloc] initWithType: type
					ID: ID] autorelease];
}

- initWithType: (OFString*)type
	    ID: (OFString*)ID

Modified src/XMPPJID.h from [bc56489a67] to [a02e2d5381].

41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63







-
+







-
+







#endif

/**
 * \brief Creates a new autoreleased XMPPJID.
 *
 * \return A new autoreleased XMPPJID
 */
+ JID;
+ (instancetype)JID;

/**
 * \brief Creates a new autoreleased XMPPJID from a string.
 *
 * \param string The string to parse into a JID object
 * \return A new autoreleased XMPPJID
 */
+ JIDWithString: (OFString*)string;
+ (instancetype)JIDWithString: (OFString*)string;

/**
 * \brief Initializes an already allocated XMPPJID with a string.
 *
 * \param string The string to parse into a JID object
 * \return A initialized XMPPJID
 */

Modified src/XMPPJID.m from [caa5a8f132] to [dc53237dd0].

29
30
31
32
33
34
35
36

37
38
39
40
41

42
43
44
45
46
47
48
29
30
31
32
33
34
35

36
37
38
39
40

41
42
43
44
45
46
47
48







-
+




-
+








#include <stringprep.h>

#import "XMPPJID.h"
#import "XMPPExceptions.h"

@implementation XMPPJID
+ JID
+ (instancetype)JID
{
	return [[[self alloc] init] autorelease];
}

+ JIDWithString: (OFString*)string
+ (instancetype)JIDWithString: (OFString*)string
{
	return [[[self alloc] initWithString: string] autorelease];
}

- initWithString: (OFString*)string
{
	size_t nodesep, resourcesep;

Modified src/XMPPMessage.h from [9a5fe63a95] to [2b70f07253].

33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65
66


67
68
69
70
71
72
73
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64


65
66
67
68
69
70
71
72
73







-
+







-
+







-
+








-
-
+
+







#endif

/**
 * \brief Creates a new autoreleased XMPPMessage.
 *
 * \return A new autoreleased XMPPMessage
 */
+ message;
+ (instancetype)message;

/**
 * \brief Creates a new autoreleased XMPPMessage with the specified ID.
 *
 * \param ID The value for the stanza's id attribute
 * \return A new autoreleased XMPPMessage
 */
+ messageWithID: (OFString*)ID;
+ (instancetype)messageWithID: (OFString*)ID;

/**
 * \brief Creates a new autoreleased XMPPMessage with the specified type.
 *
 * \param type The value for the stanza's type attribute
 * \return A new autoreleased XMPPMessage
 */
+ messageWithType: (OFString*)type;
+ (instancetype)messageWithType: (OFString*)type;

/**
 * \brief Creates a new autoreleased XMPPMessage with the specified type and ID.
 *
 * \param type The value for the stanza's type attribute
 * \param ID The value for the stanza's id attribute
 * \return A new autoreleased XMPPMessage
 */
+ messageWithType: (OFString*)type
	       ID: (OFString*)ID;
+ (instancetype)messageWithType: (OFString*)type
			     ID: (OFString*)ID;

/**
 * \brief Initializes an already allocated XMPPMessage with the specified ID.
 *
 * \param ID The value for the stanza's id attribute
 * \return A initialized XMPPMessage
 */

Modified src/XMPPMessage.m from [e5cbaf0e95] to [c69cbcf9ac].

25
26
27
28
29
30
31
32

33
34
35
36
37

38
39
40
41
42

43
44
45
46
47

48
49
50
51
52
53
54
25
26
27
28
29
30
31

32
33
34
35
36

37
38
39
40
41

42
43
44
45
46

47
48
49
50
51
52
53
54







-
+




-
+




-
+




-
+







# include "config.h"
#endif

#import "XMPPMessage.h"
#import "namespaces.h"

@implementation XMPPMessage
+ message
+ (instancetype)message
{
	return [[[self alloc] init] autorelease];
}

+ messageWithID: (OFString*)ID
+ (instancetype)messageWithID: (OFString*)ID
{
	return [[[self alloc] initWithID: ID] autorelease];
}

+ messageWithType: (OFString*)type
+ (instancetype)messageWithType: (OFString*)type
{
	return [[[self alloc] initWithType: type] autorelease];
}

+ messageWithType: (OFString*)type
+ (instancetype)messageWithType: (OFString*)type
	       ID: (OFString*)ID
{
	return [[[self alloc] initWithType: type
					ID: ID] autorelease];
}

- init

Modified src/XMPPPLAINAuth.h from [76bca323b5] to [a12ea37ddd].

30
31
32
33
34
35
36
37
38


39
40
41
42
43
44
45
46
47
48
49
50


51
52
30
31
32
33
34
35
36


37
38
39
40
41
42
43
44
45
46
47
48


49
50
51
52







-
-
+
+










-
-
+
+


/**
 * \brief Creates a new autoreleased XMPPPLAINAuth with an authcid and password.
 *
 * \param authcid The authcid to authenticate with
 * \param password The password to authenticate with
 * \return A new autoreleased XMPPPLAINAuth
 */
+ PLAINAuthWithAuthcid: (OFString*)authcid
	      password: (OFString*)password;
+ (instancetype)PLAINAuthWithAuthcid: (OFString*)authcid
			    password: (OFString*)password;

/**
 * \brief Creates a new autoreleased XMPPPLAINAuth with an authzid, authcid and
 *	  password.
 *
 * \param authzid The authzid to get authorization for
 * \param authcid The authcid to authenticate with
 * \param password The password to authenticate with
 * \return A new autoreleased XMPPPLAINAuth
 */
+ PLAINAuthWithAuthzid: (OFString*)authzid
	       authcid: (OFString*)authcid
+ (instancetype)PLAINAuthWithAuthzid: (OFString*)authzid
			     authcid: (OFString*)authcid
	      password: (OFString*)password;
@end

Modified src/XMPPPLAINAuth.m from [9b4707618f] to [40cd53e30c].

24
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40



41
42
43
44
45
46
47
24
25
26
27
28
29
30


31
32
33
34
35
36
37



38
39
40
41
42
43
44
45
46
47







-
-
+
+





-
-
-
+
+
+







# include "config.h"
#endif

#import "XMPPPLAINAuth.h"
#import "XMPPExceptions.h"

@implementation XMPPPLAINAuth
+ PLAINAuthWithAuthcid: (OFString*)authcid
	      password: (OFString*)password
+ (instancetype)PLAINAuthWithAuthcid: (OFString*)authcid
			    password: (OFString*)password
{
	return [[[self alloc] initWithAuthcid: authcid
				     password: password] autorelease];
}

+ PLAINAuthWithAuthzid: (OFString*)authzid
	       authcid: (OFString*)authcid
	      password: (OFString*)password
+ (instancetype)PLAINAuthWithAuthzid: (OFString*)authzid
			     authcid: (OFString*)authcid
			    password: (OFString*)password
{
	return [[[self alloc] initWithAuthzid: authzid
				      authcid: authcid
				     password: password] autorelease];
}

- (OFDataArray*)initialMessage

Modified src/XMPPPresence.h from [7a50bb3ff0] to [7c4674f054].

38
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61

62
63
64
65
66
67
68
69
70
71
72


73
74
75
76
77
78
79
38
39
40
41
42
43
44

45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68
69
70


71
72
73
74
75
76
77
78
79







-
+







-
+







-
+









-
-
+
+







#endif

/**
 * \brief Creates a new autoreleased XMPPPresence.
 *
 * \return A new autoreleased XMPPPresence
 */
+ presence;
+ (instancetype)presence;

/**
 * \brief Creates a new autoreleased XMPPPresence with the specified ID.
 *
 * \param ID The value for the stanza's id attribute
 * \return A new autoreleased XMPPPresence
 */
+ presenceWithID: (OFString*)ID;
+ (instancetype)presenceWithID: (OFString*)ID;

/**
 * \brief Creates a new autoreleased XMPPPresence with the specified type.
 *
 * \param type The value for the stanza's type attribute
 * \return A new autoreleased XMPPPresence
 */
+ presenceWithType: (OFString*)type;
+ (instancetype)presenceWithType: (OFString*)type;

/**
 * \brief Creates a new autoreleased XMPPPresence with the specified type and
 *	  ID.
 *
 * \param type The value for the stanza's type attribute
 * \param ID The value for the stanza's id attribute
 * \return A new autoreleased XMPPPresence
 */
+ presenceWithType: (OFString*)type
		ID: (OFString*)ID;
+ (instancetype)presenceWithType: (OFString*)type
			      ID: (OFString*)ID;

/**
 * \brief Initializes an already allocated XMPPPresence with the specified ID.
 *
 * \param ID The value for the stanza's id attribute
 * \return A initialized XMPPPresence
 */

Modified src/XMPPPresence.m from [84efc4167a] to [75cd9b8e76].

39
40
41
42
43
44
45
46

47
48
49
50
51

52
53
54
55
56

57
58
59
60
61
62


63
64
65
66
67
68
69
39
40
41
42
43
44
45

46
47
48
49
50

51
52
53
54
55

56
57
58
59
60


61
62
63
64
65
66
67
68
69







-
+




-
+




-
+




-
-
+
+







	if ([show isEqual: @"dnd"]) return 3;
	if ([show isEqual: @"xa"]) return 4;

	assert(0);
}

@implementation XMPPPresence
+ presence
+ (instancetype)presence
{
	return [[[self alloc] init] autorelease];
}

+ presenceWithID: (OFString*)ID
+ (instancetype)presenceWithID: (OFString*)ID
{
	return [[[self alloc] initWithID: ID] autorelease];
}

+ presenceWithType: (OFString*)type
+ (instancetype)presenceWithType: (OFString*)type
{
	return [[[self alloc] initWithType: type] autorelease];
}

+ presenceWithType: (OFString*)type
		ID: (OFString*)ID
+ (instancetype)presenceWithType: (OFString*)type
			      ID: (OFString*)ID
{
	return [[[self alloc] initWithType: type
					ID: ID] autorelease];
}

- init
{

Modified src/XMPPRosterItem.h from [4896991386] to [dd977fe5de].

47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61







-
+







#endif

/**
 * \brief Creates a new autoreleased roster item.
 *
 * \return A new autoreleased roster item.
 */
+ rosterItem;
+ (instancetype)rosterItem;

- (void)setJID: (XMPPJID*)JID;
- (XMPPJID*)JID;
- (void)setName: (OFString*)name;
- (OFString*)name;
- (void)setSubscription: (OFString*)subscription;
- (OFString*)subscription;

Modified src/XMPPRosterItem.m from [78eee45854] to [2c3d9410b3].

26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40







-
+








#import "XMPPRosterItem.h"
#import "XMPPJID.h"

#import <ObjFW/macros.h>

@implementation XMPPRosterItem
+ rosterItem
+ (instancetype)rosterItem
{
	return [[[self alloc] init] autorelease];
}

- (void)dealloc
{
	[_JID release];

Modified src/XMPPSCRAMAuth.h from [b0a08a1248] to [5736a7576b].

45
46
47
48
49
50
51
52
53
54
55
56





57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75






76
77
78
79
80
81
82
45
46
47
48
49
50
51





52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69






70
71
72
73
74
75
76
77
78
79
80
81
82







-
-
-
-
-
+
+
+
+
+













-
-
-
-
-
-
+
+
+
+
+
+







 * \param authcid The authcid to authenticate with
 * \param password The password to authenticate with
 * \param connection The connection over which authentication is done
 * \param hash The class to use for calulating hashes
 * \param plusAvailable Whether the PLUS variant was offered
 * \return A new autoreleased XMPPSCRAMAuth
 */
+ SCRAMAuthWithAuthcid: (OFString*)authcid
	      password: (OFString*)password
	    connection: (XMPPConnection*)connection
		  hash: (Class)hash
	 plusAvailable: (bool)plusAvailable;
+ (instancetype)SCRAMAuthWithAuthcid: (OFString*)authcid
			    password: (OFString*)password
			  connection: (XMPPConnection*)connection
				hash: (Class)hash
		       plusAvailable: (bool)plusAvailable;

/**
 * \brief Creates a new autoreleased XMPPSCRAMAuth with an authzid, authcid and
 *	  password.
 *
 * \param authzid The authzid to get authorization for
 * \param authcid The authcid to authenticate with
 * \param password The password to authenticate with
 * \param connection The connection over which authentication is done
 * \param hash The class to use for calulating hashes
 * \param plusAvailable Whether the PLUS variant was offered
 * \return A new autoreleased XMPPSCRAMAuth
 */
+ SCRAMAuthWithAuthzid: (OFString*)authzid
	       authcid: (OFString*)authcid
	      password: (OFString*)password
	    connection: (XMPPConnection*)connection
		  hash: (Class)hash
	 plusAvailable: (bool)plusAvailable;
+ (instancetype)SCRAMAuthWithAuthzid: (OFString*)authzid
			     authcid: (OFString*)authcid
			    password: (OFString*)password
			  connection: (XMPPConnection*)connection
				hash: (Class)hash
		       plusAvailable: (bool)plusAvailable;

/**
 * \brief Initializes an already allocated XMPPSCRAMAuth with an authcid and
 *	  password.
 *
 * \param authcid The authcid to authenticate with
 * \param password The password to authenticate with

Modified src/XMPPSCRAMAuth.m from [5849c66f1f] to [2dea2d70da].

34
35
36
37
38
39
40
41
42
43
44
45





46
47
48
49
50
51
52
53
54
55
56
57
58
59






60
61
62
63
64
65
66
34
35
36
37
38
39
40





41
42
43
44
45
46
47
48
49
50
51
52
53






54
55
56
57
58
59
60
61
62
63
64
65
66







-
-
-
-
-
+
+
+
+
+








-
-
-
-
-
-
+
+
+
+
+
+







#import "XMPPSCRAMAuth.h"
#import "XMPPExceptions.h"

#define HMAC_IPAD 0x36
#define HMAC_OPAD 0x5c

@implementation XMPPSCRAMAuth
+ SCRAMAuthWithAuthcid: (OFString*)authcid
	      password: (OFString*)password
	    connection: (XMPPConnection*)connection
		  hash: (Class)hash
	 plusAvailable: (bool)plusAvailable
+ (instancetype)SCRAMAuthWithAuthcid: (OFString*)authcid
			    password: (OFString*)password
			  connection: (XMPPConnection*)connection
				hash: (Class)hash
		       plusAvailable: (bool)plusAvailable
{
	return [[[self alloc] initWithAuthcid: authcid
				     password: password
				   connection: connection
					 hash: hash
				plusAvailable: plusAvailable] autorelease];
}

+ SCRAMAuthWithAuthzid: (OFString*)authzid
	       authcid: (OFString*)authcid
	      password: (OFString*)password
	    connection: (XMPPConnection*)connection
		  hash: (Class)hash
	 plusAvailable: (bool)plusAvailable
+ (instancetype)SCRAMAuthWithAuthzid: (OFString*)authzid
			     authcid: (OFString*)authcid
			    password: (OFString*)password
			  connection: (XMPPConnection*)connection
				hash: (Class)hash
		       plusAvailable: (bool)plusAvailable
{
	return [[[self alloc] initWithAuthzid: authzid
				      authcid: authcid
				     password: password
				   connection: connection
					 hash: hash
				plusAvailable: plusAvailable] autorelease];

Modified src/XMPPSRVLookup.h from [be89ec074f] to [9725c64004].

39
40
41
42
43
44
45
46
47
48
49
50
51






52
53
54
55
56
57
58
39
40
41
42
43
44
45






46
47
48
49
50
51
52
53
54
55
56
57
58







-
-
-
-
-
-
+
+
+
+
+
+







@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

+ entryWithPriority: (uint16_t)priority
	     weight: (uint16_t)weight
	       port: (uint16_t)port
	     target: (OFString*)target;
+ entryWithResourceRecord: (ns_rr)resourceRecord
		   handle: (ns_msg)handle;
+ (instancetype)entryWithPriority: (uint16_t)priority
			   weight: (uint16_t)weight
			     port: (uint16_t)port
			   target: (OFString*)target;
+ (instancetype)entryWithResourceRecord: (ns_rr)resourceRecord
				 handle: (ns_msg)handle;
- initWithPriority: (uint16_t)priority
	    weight: (uint16_t)weight
	      port: (uint16_t)port
	    target: (OFString*)target;
- initWithResourceRecord: (ns_rr)resourceRecord
		  handle: (ns_msg)handle;
- (uint16_t)priority;
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84







-
+







	OFList *_list;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFString *domain;
#endif

+ lookupWithDomain: (OFString*)domain;
+ (instancetype)lookupWithDomain: (OFString*)domain;
- initWithDomain: (OFString*)domain;

- (void)XMPP_lookup;
- (void)XMPP_addEntry: (XMPPSRVEntry*)item;
@end

@interface XMPPSRVEnumerator: OFEnumerator

Modified src/XMPPSRVLookup.m from [9ac2bb0130] to [ce2e51c85a].

33
34
35
36
37
38
39
40
41
42
43




44
45
46
47
48
49
50
51
52


53
54
55
56
57
58
59
33
34
35
36
37
38
39




40
41
42
43
44
45
46
47
48
49
50


51
52
53
54
55
56
57
58
59







-
-
-
-
+
+
+
+







-
-
+
+







#include <netdb.h>
#include <sys/types.h>
#include <openssl/rand.h>

#import "XMPPSRVLookup.h"

@implementation XMPPSRVEntry
+ entryWithPriority: (uint16_t)priority
	     weight: (uint16_t)weight
	       port: (uint16_t)port
	     target: (OFString*)target
+ (instancetype)entryWithPriority: (uint16_t)priority
			   weight: (uint16_t)weight
			     port: (uint16_t)port
			   target: (OFString*)target
{
	return [[[self alloc] initWithPriority: priority
					weight: weight
					  port: port
					target: target] autorelease];
}

+ entryWithResourceRecord: (ns_rr)resourceRecord
		   handle: (ns_msg)handle
+ (instancetype)entryWithResourceRecord: (ns_rr)resourceRecord
				 handle: (ns_msg)handle
{
	return [[[self alloc] initWithResourceRecord: resourceRecord
					      handle: handle] autorelease];
}

- init
{
159
160
161
162
163
164
165
166

167
168
169
170
171
172
173
159
160
161
162
163
164
165

166
167
168
169
170
171
172
173







-
+







- (OFString*)target
{
	OF_GETTER(_target, true)
}
@end

@implementation XMPPSRVLookup
+ lookupWithDomain: (OFString*)domain
+ (instancetype)lookupWithDomain: (OFString*)domain
{
	return [[[self alloc] initWithDomain: domain] autorelease];
}

- initWithDomain: (OFString*)domain
{
	self = [super init];

Modified src/XMPPStanza.h from [7567c50495] to [f4da51d486].

48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64
65
66


67
68
69
70
71
72
73
74
75
76


77
78
79
80
81
82
83
84
85
86
87
88
89



90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64


65
66
67
68
69
70
71
72
73
74


75
76
77
78
79
80
81
82
83
84
85
86



87
88
89
90
91
92
93
94
95
96

97
98
99
100
101
102
103
104







-
+









-
-
+
+








-
-
+
+










-
-
-
+
+
+







-
+








/**
 * \brief Creates a new autoreleased XMPPStanza with the specified name.
 *
 * \param name The stanza's name (one of iq, message or presence)
 * \return A new autoreleased XMPPStanza
 */
+ stanzaWithName: (OFString*)name;
+ (instancetype)stanzaWithName: (OFString*)name;

/**
 * \brief Creates a new autoreleased XMPPStanza with the specified name and
 *	  type.
 *
 * \param name The stanza's name (one of iq, message or presence)
 * \param type The value for the stanza's type attribute
 * \return A new autoreleased XMPPStanza
 */
+ stanzaWithName: (OFString*)name
	    type: (OFString*)type;
+ (instancetype)stanzaWithName: (OFString*)name
			  type: (OFString*)type;

/**
 * \brief Creates a new autoreleased XMPPStanza with the specified name and ID.
 *
 * \param name The stanza's name (one of iq, message or presence)
 * \param ID The value for the stanza's id attribute
 * \return A new autoreleased XMPPStanza
 */
+ stanzaWithName: (OFString*)name
	      ID: (OFString*)ID;
+ (instancetype)stanzaWithName: (OFString*)name
			    ID: (OFString*)ID;

/**
 * \brief Creates a new autoreleased XMPPStanza with the specified name, type
 *	  and ID.
 *
 * \param name The stanza's name (one of iq, message or presence)
 * \param type The value for the stanza's type attribute
 * \param ID The value for the stanza's id attribute
 * \return A new autoreleased XMPPStanza
 */
+ stanzaWithName: (OFString*)name
	    type: (OFString*)type
	      ID: (OFString*)ID;
+ (instancetype)stanzaWithName: (OFString*)name
			  type: (OFString*)type
			    ID: (OFString*)ID;

/**
 * \brief Creates a new autoreleased XMPPStanza from an OFXMLElement.
 *
 * \param element The element to base the XMPPStanza on
 * \return A new autoreleased XMPPStanza
 */
+ stanzaWithElement: (OFXMLElement*)element;
+ (instancetype)stanzaWithElement: (OFXMLElement*)element;

/**
 * \brief Initializes an already allocated XMPPStanza with the specified name.
 *
 * \param name The stanza's name (one of iq, message or presence)
 * \return A initialized XMPPStanza
 */

Modified src/XMPPStanza.m from [bb69e66d09] to [d2bae5f7fc].

26
27
28
29
30
31
32
33

34
35
36
37
38
39


40
41
42
43
44
45
46


47
48
49
50
51
52
53
54



55
56
57
58
59
60
61

62
63
64
65
66
67
68
26
27
28
29
30
31
32

33
34
35
36
37


38
39
40
41
42
43
44


45
46
47
48
49
50
51



52
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68







-
+




-
-
+
+





-
-
+
+





-
-
-
+
+
+






-
+







#endif

#import "XMPPStanza.h"
#import "XMPPJID.h"
#import "namespaces.h"

@implementation XMPPStanza
+ stanzaWithName: (OFString*)name
+ (instancetype)stanzaWithName: (OFString*)name
{
	return [[[self alloc] initWithName: name] autorelease];
}

+ stanzaWithName: (OFString*)name
	    type: (OFString*)type
+ (instancetype)stanzaWithName: (OFString*)name
			  type: (OFString*)type
{
	return [[[self alloc] initWithName: name
				      type: type] autorelease];
}

+ stanzaWithName: (OFString*)name
	      ID: (OFString*)ID
+ (instancetype)stanzaWithName: (OFString*)name
			    ID: (OFString*)ID
{
	return [[[self alloc] initWithName: name
					ID: ID] autorelease];
}

+ stanzaWithName: (OFString*)name
	    type: (OFString*)type
	      ID: (OFString*)ID
+ (instancetype)stanzaWithName: (OFString*)name
			  type: (OFString*)type
			    ID: (OFString*)ID
{
	return [[[self alloc] initWithName: name
				      type: type
					ID: ID] autorelease];
}

+ stanzaWithElement: (OFXMLElement*)element
+ (instancetype)stanzaWithElement: (OFXMLElement*)element
{
	return [[[self alloc] initWithElement: element] autorelease];
}

- initWithName: (OFString*)name
{
	return [self initWithName: name