Differences From Artifact [6579a2f540]:
- File
src/IRCConnection.m
— part of check-in
[38de3de8ed]
at
2017-01-22 17:24:18
on branch trunk
— IRCConnection: Make the socket class configurable
This makes using TLS possible. (user: js, size: 15205) [annotate] [blame] [check-ins using]
To Artifact [475d90a93d]:
- File src/IRCConnection.m — part of check-in [0ca6e4f04d] at 2017-01-22 20:49:44 on branch trunk — IRCConnection: Make fallback encoding configurable (user: js, size: 15310) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
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 | void *pool = objc_autoreleasePoolPush(); [self IRC_processLine: line]; objc_autoreleasePoolPop(pool); } | | | | | 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 | { if (line != nil) { [self IRC_processLine: line]; return true; } if ([exception isKindOfClass: [OFInvalidEncodingException class]]) { | > | | | | | | 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; |
︙ | ︙ |