ObjXMPP  Check-in [7ce8dba65c]

Overview
Comment:Make various XMPPConnection setter accept nil
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7ce8dba65cb57fa9a03b6e88175c07da11c409f83f4c71ff24560ea5e5624411
User & Date: florob@babelmonkeys.de on 2013-01-03 22:02:57
Other Links: manifest | tags
Context
2013-01-04
19:19
Import XMPPStreamManagement in ObjXMPP.h check-in: 3c9335ff3e user: florob@babelmonkeys.de tags: trunk
2013-01-03
22:02
Make various XMPPConnection setter accept nil check-in: 7ce8dba65c user: florob@babelmonkeys.de tags: trunk
21:27
Adjust to recent ObjFW changes. check-in: 21295ecf12 user: florob@babelmonkeys.de tags: trunk
Changes

Modified src/XMPPConnection.m from [8a86240b1e] to [d405ad4653].

159
160
161
162
163
164
165


166
167


168
169
170
171
172
173
174
175







176
177
178
179
180
181







182
183
184
185
186
187
188
189
190
191
192
193


194
195


196
197
198
199
200
201
202
203







204
205
206
207
208
209







210
211
212
213
214
215
216
217
218
219
220
221


222




223
224
225
226
227
228
229
230
231
232
233
234


235
236


237
238
239
240
241
242
243
244







245
246
247
248
249
250





251
252
253







254
255
256
257
258
259
260
261
262
263
264


265
266


267
268
269
270
271
272
273
274







275
276
277
278
279
280







281
282
283
284
285
286
287
159
160
161
162
163
164
165
166
167


168
169
170







171
172
173
174
175
176
177
178





179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199


200
201
202







203
204
205
206
207
208
209
210





211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231

232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249


250
251
252







253
254
255
256
257
258
259
260





261
262
263
264
265

266

267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286


287
288
289







290
291
292
293
294
295
296
297





298
299
300
301
302
303
304
305
306
307
308
309
310
311







+
+
-
-
+
+

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

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












+
+
-
-
+
+

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

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












+
+
-
+
+
+
+












+
+
-
-
+
+

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

-
-
-
-
-
+
+
+
+
+
-

-
+
+
+
+
+
+
+











+
+
-
-
+
+

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

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








	[super dealloc];
}

- (void)setUsername: (OFString*)username_
{
	OFString *old = username;

	if (username_ != nil) {
	char *node;
	Stringprep_rc rc;
		char *node;
		Stringprep_rc rc;

	if ((rc = stringprep_profile([username_ UTF8String], &node,
	    "SASLprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException
		    exceptionWithClass: [self class]
			    connection: self
			       profile: @"SASLprep"
				string: username_];
		if ((rc = stringprep_profile([username_ UTF8String], &node,
		    "SASLprep", 0)) != STRINGPREP_OK)
			@throw [XMPPStringPrepFailedException
			    exceptionWithClass: [self class]
				    connection: self
				       profile: @"SASLprep"
					string: username_];

	@try {
		username = [[OFString alloc] initWithUTF8String: node];
	} @finally {
		free(node);
	}
		@try {
			username = [[OFString alloc] initWithUTF8String: node];
		} @finally {
			free(node);
		}
	} else
		username = nil;

	[old release];
}

- (OFString*)username
{
	return [[username copy] autorelease];
}

- (void)setResource: (OFString*)resource_
{
	OFString *old = resource;

	if (resource_ != nil) {
	char *res;
	Stringprep_rc rc;
		char *res;
		Stringprep_rc rc;

	if ((rc = stringprep_profile([resource_ UTF8String], &res,
	    "Resourceprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException
		    exceptionWithClass: [self class]
			    connection: self
			       profile: @"Resourceprep"
				string: resource_];
		if ((rc = stringprep_profile([resource_ UTF8String], &res,
		    "Resourceprep", 0)) != STRINGPREP_OK)
			@throw [XMPPStringPrepFailedException
			    exceptionWithClass: [self class]
				    connection: self
				       profile: @"Resourceprep"
					string: resource_];

	@try {
		resource = [[OFString alloc] initWithUTF8String: res];
	} @finally {
		free(res);
	}
		@try {
			resource = [[OFString alloc] initWithUTF8String: res];
		} @finally {
			free(res);
		}
	} else
		resource = nil;

	[old release];
}

- (OFString*)resource
{
	return [[resource copy] autorelease];
}

- (void)setServer: (OFString*)server_
{
	OFString *old = server;

	if (server_ != nil)
	server = [self XMPP_IDNAToASCII: server_];
		server = [self XMPP_IDNAToASCII: server_];
	else
		server = nil;

	[old release];
}

- (OFString*)server
{
	return [[server copy] autorelease];
}

- (void)setDomain: (OFString*)domain_
{
	OFString *oldDomain = domain;
	OFString *oldDomainToASCII = domainToASCII;

	if (domain_ != nil) {
	char *srv;
	Stringprep_rc rc;
		char *srv;
		Stringprep_rc rc;

	if ((rc = stringprep_profile([domain_ UTF8String], &srv,
	    "Nameprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException
		    exceptionWithClass: [self class]
			    connection: self
			       profile: @"Nameprep"
				string: domain_];
		if ((rc = stringprep_profile([domain_ UTF8String], &srv,
		    "Nameprep", 0)) != STRINGPREP_OK)
			@throw [XMPPStringPrepFailedException
			    exceptionWithClass: [self class]
				    connection: self
				       profile: @"Nameprep"
					string: domain_];

	@try {
		domain = [[OFString alloc] initWithUTF8String: srv];
	} @finally {
		free(srv);
	}
		@try {
			domain = [[OFString alloc] initWithUTF8String: srv];
		} @finally {
			free(srv);
		}
	[oldDomain release];

	domainToASCII = [self XMPP_IDNAToASCII: domain];
		domainToASCII = [self XMPP_IDNAToASCII: domain];
	} else {
		domain = nil;
		domainToASCII = nil;
	}

	[oldDomain release];
	[oldDomainToASCII release];
}

- (OFString*)domain
{
	return [[domain copy] autorelease];
}

- (void)setPassword: (OFString*)password_
{
	OFString *old = password;

	if (password_ != nil) {
	char *pass;
	Stringprep_rc rc;
		char *pass;
		Stringprep_rc rc;

	if ((rc = stringprep_profile([password_ UTF8String], &pass,
	    "SASLprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException
		    exceptionWithClass: [self class]
			    connection: self
			       profile: @"SASLprep"
				string: password_];
		if ((rc = stringprep_profile([password_ UTF8String], &pass,
		    "SASLprep", 0)) != STRINGPREP_OK)
			@throw [XMPPStringPrepFailedException
			    exceptionWithClass: [self class]
				    connection: self
				       profile: @"SASLprep"
					string: password_];

	@try {
		password = [[OFString alloc] initWithUTF8String: pass];
	} @finally {
		free(pass);
	}
		@try {
			password = [[OFString alloc] initWithUTF8String: pass];
		} @finally {
			free(pass);
		}
	} else
		password = nil;

	[old release];
}

- (OFString*)password
{
	return [[password copy] autorelease];