ObjIRC  Diff

Differences From Artifact [6579a2f540]:

To Artifact [475d90a93d]:


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
#import "IRCUser.h"

@implementation IRCConnection
@synthesize socketClass = _socketClass;
@synthesize server = _server, port = _port;
@synthesize nickname = _nickname, username = _username, realname = _realname;
@synthesize delegate = _delegate, socket = _socket;


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

- init
{
	self = [super init];

	@try {
		_socketClass = [OFTCPSocket class];
		_channels = [[OFMutableDictionary alloc] init];
		_port = 6667;

	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}







>














>







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
#import "IRCUser.h"

@implementation IRCConnection
@synthesize socketClass = _socketClass;
@synthesize server = _server, port = _port;
@synthesize nickname = _nickname, username = _username, realname = _realname;
@synthesize delegate = _delegate, socket = _socket;
@synthesize fallbackEncoding = _fallbackEncoding;

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

- init
{
	self = [super init];

	@try {
		_socketClass = [OFTCPSocket class];
		_channels = [[OFMutableDictionary alloc] init];
		_port = 6667;
		_fallbackEncoding = OF_STRING_ENCODING_ISO_8859_1;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
	void *pool = objc_autoreleasePoolPush();

	[self IRC_processLine: line];

	objc_autoreleasePoolPop(pool);
}

-	    (bool)socket: (OFTCPSocket*)socket
  didReceiveISO88591Line: (OFString*)line
	       exception: (OFException*)exception
{
	if (line != nil) {
		[self IRC_processLine: line];
		[socket asyncReadLineWithTarget: self
				       selector: @selector(socket:
						     didReceiveLine:
						     exception:)];







|
|
|







532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
	void *pool = objc_autoreleasePoolPush();

	[self IRC_processLine: line];

	objc_autoreleasePoolPop(pool);
}

-		  (bool)socket: (OFTCPSocket*)socket
  didReceiveWronglyEncodedLine: (OFString*)line
		     exception: (OFException*)exception
{
	if (line != nil) {
		[self IRC_processLine: line];
		[socket asyncReadLineWithTarget: self
				       selector: @selector(socket:
						     didReceiveLine:
						     exception:)];
555
556
557
558
559
560
561

562
563
564
565
566
567
568
569
570
571
572
573
{
	if (line != nil) {
		[self IRC_processLine: line];
		return true;
	}

	if ([exception isKindOfClass: [OFInvalidEncodingException class]]) {

		[socket asyncReadLineWithEncoding: OF_STRING_ENCODING_ISO_8859_1
					   target: self
					 selector: @selector(socket:
						       didReceiveISO88591Line:
						       exception:)];
		return false;
	}

	if ([_delegate respondsToSelector: @selector(connectionWasClosed:)]) {
		[_delegate connectionWasClosed: self];
		[_socket release];
		_socket = nil;







>
|
|
|
|
|







557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
{
	if (line != nil) {
		[self IRC_processLine: line];
		return true;
	}

	if ([exception isKindOfClass: [OFInvalidEncodingException class]]) {
		[socket
		    asyncReadLineWithEncoding: _fallbackEncoding
				       target: self
				     selector: @selector(socket:
						   didReceiveWronglyEncodedLine:
						   exception:)];
		return false;
	}

	if ([_delegate respondsToSelector: @selector(connectionWasClosed:)]) {
		[_delegate connectionWasClosed: self];
		[_socket release];
		_socket = nil;