ObjIRC  Check-in [58b8dc229f]

Overview
Comment:More consistent naming
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 58b8dc229fd4e0d8b3038b5a2d8c575783b107664f76aaf6db219b20e3f8d06d
User & Date: js on 2024-08-17 00:20:17
Other Links: manifest | tags
Context
2024-08-17
00:27
Migrate build system to Meson check-in: f2b266d4a6 user: js tags: trunk
00:20
More consistent naming check-in: 58b8dc229f user: js tags: trunk
00:19
Don't use private ObjFW functions check-in: 3e008e2964 user: js tags: trunk
Changes

Modified src/IRCConnection.m from [b90da3a057] to [d47e3390d9].

292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
	if ([action isEqual: @"JOIN"] && components.count == 3) {
		OFString *who = [components objectAtIndex: 0];
		OFString *where = [components objectAtIndex: 2];
		IRCUser *user;
		OFMutableSet *channel;

		who = [who substringFromIndex: 1];
		user = [IRCUser IRCUserWithString: who];

		if ([who hasPrefix:
		    [_nickname stringByAppendingString: @"!"]]) {
			channel = [OFMutableSet set];
			[_channels setObject: channel forKey: where];
		} else
			channel = [_channels objectForKey: where];







|







292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
	if ([action isEqual: @"JOIN"] && components.count == 3) {
		OFString *who = [components objectAtIndex: 0];
		OFString *where = [components objectAtIndex: 2];
		IRCUser *user;
		OFMutableSet *channel;

		who = [who substringFromIndex: 1];
		user = [IRCUser userWithString: who];

		if ([who hasPrefix:
		    [_nickname stringByAppendingString: @"!"]]) {
			channel = [OFMutableSet set];
			[_channels setObject: channel forKey: where];
		} else
			channel = [_channels objectForKey: where];
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
		IRCUser *user;
		OFMutableSet *channel;
		OFString *reason = nil;
		size_t pos = who.length + 1 +
		    [[components objectAtIndex: 1] length] + 1 + where.length;

		who = [who substringFromIndex: 1];
		user = [IRCUser IRCUserWithString: who];
		channel = [_channels objectForKey: where];

		if (components.count > 3)
			reason = [line substringFromIndex: pos + 2];

		[channel removeObject: user.nickname];








|







363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
		IRCUser *user;
		OFMutableSet *channel;
		OFString *reason = nil;
		size_t pos = who.length + 1 +
		    [[components objectAtIndex: 1] length] + 1 + where.length;

		who = [who substringFromIndex: 1];
		user = [IRCUser userWithString: who];
		channel = [_channels objectForKey: where];

		if (components.count > 3)
			reason = [line substringFromIndex: pos + 2];

		[channel removeObject: user.nickname];

394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
		OFMutableSet *channel;
		OFString *reason = nil;
		size_t pos = who.length + 1 +
		    [[components objectAtIndex: 1] length] + 1 +
		    where.length + 1 + whom.length;

		who = [who substringFromIndex: 1];
		user = [IRCUser IRCUserWithString: who];
		channel = [_channels objectForKey: where];

		if (components.count > 4)
			reason = [line substringFromIndex: pos + 2];

		[channel removeObject: user.nickname];








|







394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
		OFMutableSet *channel;
		OFString *reason = nil;
		size_t pos = who.length + 1 +
		    [[components objectAtIndex: 1] length] + 1 +
		    where.length + 1 + whom.length;

		who = [who substringFromIndex: 1];
		user = [IRCUser userWithString: who];
		channel = [_channels objectForKey: where];

		if (components.count > 4)
			reason = [line substringFromIndex: pos + 2];

		[channel removeObject: user.nickname];

422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
		OFString *who = [components objectAtIndex: 0];
		IRCUser *user;
		OFString *reason = nil;
		size_t pos = who.length + 1 +
		    [[components objectAtIndex: 1] length];

		who = [who substringFromIndex: 1];
		user = [IRCUser IRCUserWithString: who];

		if ([components count] > 2)
			reason = [line substringFromIndex: pos + 2];

		for (OFString *channel in _channels)
			[[_channels objectForKey: channel]
			    removeObject: user.nickname];







|







422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
		OFString *who = [components objectAtIndex: 0];
		IRCUser *user;
		OFString *reason = nil;
		size_t pos = who.length + 1 +
		    [[components objectAtIndex: 1] length];

		who = [who substringFromIndex: 1];
		user = [IRCUser userWithString: who];

		if ([components count] > 2)
			reason = [line substringFromIndex: pos + 2];

		for (OFString *channel in _channels)
			[[_channels objectForKey: channel]
			    removeObject: user.nickname];
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
		OFString *who = [components objectAtIndex: 0];
		OFString *nickname = [components objectAtIndex: 2];
		IRCUser *user;

		who = [who substringFromIndex: 1];
		nickname = [nickname substringFromIndex: 1];

		user = [IRCUser IRCUserWithString: who];

		if ([user.nickname isEqual: _nickname]) {
			[_nickname release];
			_nickname = [nickname copy];
		}

		for (OFMutableSet *channel in _channels) {







|







449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
		OFString *who = [components objectAtIndex: 0];
		OFString *nickname = [components objectAtIndex: 2];
		IRCUser *user;

		who = [who substringFromIndex: 1];
		nickname = [nickname substringFromIndex: 1];

		user = [IRCUser userWithString: who];

		if ([user.nickname isEqual: _nickname]) {
			[_nickname release];
			_nickname = [nickname copy];
		}

		for (OFMutableSet *channel in _channels) {
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
		IRCUser *user;
		OFString *message;
		size_t pos = from.length + 1 +
		    [[components objectAtIndex: 1] length] + 1 + to.length;

		from = [from substringFromIndex: 1];
		message = [line substringFromIndex: pos + 2];
		user = [IRCUser IRCUserWithString: from];

		if (![to isEqual: _nickname]) {
			if ([_delegate respondsToSelector: @selector(connection:
			    didReceiveMessage:channel:user:)])
				[_delegate connection: self
				    didReceiveMessage: message
					      channel: to







|







483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
		IRCUser *user;
		OFString *message;
		size_t pos = from.length + 1 +
		    [[components objectAtIndex: 1] length] + 1 + to.length;

		from = [from substringFromIndex: 1];
		message = [line substringFromIndex: pos + 2];
		user = [IRCUser userWithString: from];

		if (![to isEqual: _nickname]) {
			if ([_delegate respondsToSelector: @selector(connection:
			    didReceiveMessage:channel:user:)])
				[_delegate connection: self
				    didReceiveMessage: message
					      channel: to
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
		notice = [line substringFromIndex: pos + 2];

		if (![from containsString: @"!"] || [to isEqual: @"*"]) {
			/* System message - ignore for now */
			return;
		}

		user = [IRCUser IRCUserWithString: from];

		if (![to isEqual: _nickname]) {
			if ([_delegate respondsToSelector: @selector(connection:
			    didReceiveNotice:channel:user:)])
				[_delegate connection: self
				     didReceiveNotice: notice
					      channel: to







|







520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
		notice = [line substringFromIndex: pos + 2];

		if (![from containsString: @"!"] || [to isEqual: @"*"]) {
			/* System message - ignore for now */
			return;
		}

		user = [IRCUser userWithString: from];

		if (![to isEqual: _nickname]) {
			if ([_delegate respondsToSelector: @selector(connection:
			    didReceiveNotice:channel:user:)])
				[_delegate connection: self
				     didReceiveNotice: notice
					      channel: to

Modified src/IRCUser.h from [213f1c82e3] to [63e91b24a8].

28
29
30
31
32
33
34
35
36
37
38
39
@interface IRCUser: OFObject <OFCopying>
{
	OFString *_nickname, *_username, *_hostname;
}

@property (readonly, nonatomic) OFString *nickname, *username, *hostname;

+ (instancetype)IRCUserWithString: (OFString *)string;
- (instancetype)initWithString: (OFString *)string OF_DESIGNATED_INITIALIZER;
@end

OF_ASSUME_NONNULL_END







|




28
29
30
31
32
33
34
35
36
37
38
39
@interface IRCUser: OFObject <OFCopying>
{
	OFString *_nickname, *_username, *_hostname;
}

@property (readonly, nonatomic) OFString *nickname, *username, *hostname;

+ (instancetype)userWithString: (OFString *)string;
- (instancetype)initWithString: (OFString *)string OF_DESIGNATED_INITIALIZER;
@end

OF_ASSUME_NONNULL_END

Modified src/IRCUser.m from [9f27229e45] to [4d18aa68b9].

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#import <ObjFW/macros.h>

#import "IRCUser.h"

@implementation IRCUser
@synthesize username = _username, nickname = _nickname, hostname = _hostname;

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

- (instancetype)initWithString: (OFString *)string
{
	self = [super init];







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#import <ObjFW/macros.h>

#import "IRCUser.h"

@implementation IRCUser
@synthesize username = _username, nickname = _nickname, hostname = _hostname;

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

- (instancetype)initWithString: (OFString *)string
{
	self = [super init];