Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #221 - Adding option to override auto-join timeout #222

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Classes/Dialogs/ServerDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
@property (nonatomic) IBOutlet NSTextField* nickPasswordText;
@property (nonatomic) IBOutlet NSButton* saslCheck;
@property (nonatomic) IBOutlet NSTextField* altNicksText;
@property (nonatomic) IBOutlet NSTextField* timeoutText;

@property (nonatomic) IBOutlet NSTextField* leavingCommentText;
@property (nonatomic) IBOutlet NSTextField* userInfoText;
Expand Down
4 changes: 4 additions & 0 deletions Classes/Dialogs/ServerDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ - (void)load
_usernameText.stringValue = _config.username;
_realNameText.stringValue = _config.realName;
_nickPasswordText.stringValue = _config.nickPassword;
_timeoutText.intValue = _config.timeout;
_saslCheck.state = _config.useSASL;

if (_config.altNicks.count) {
_altNicksText.stringValue = [_config.altNicks componentsJoinedByString:@" "];
}
Expand Down Expand Up @@ -130,6 +132,7 @@ - (void)save
_config.username = _usernameText.stringValue;
_config.realName = _realNameText.stringValue;
_config.nickPassword = _nickPasswordText.stringValue;
_config.timeout = _timeoutText.intValue;
_config.useSASL = _saslCheck.state;

NSArray* nicks = [_altNicksText.stringValue componentsSeparatedByString:@" "];
Expand Down Expand Up @@ -170,6 +173,7 @@ - (void)updateConnectionPage
int port = [_portText intValue];
NSString* nick = [_nickText stringValue];
NSString* nickPassword = [_nickPasswordText stringValue];
int timeout = [_timeoutText intValue];

BOOL enabled = name.length && host.length && ![host isEqualToString:@"-"] && port > 0 && nick.length;
[_okButton setEnabled:enabled];
Expand Down
3 changes: 1 addition & 2 deletions Classes/IRC/IRCClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#define QUIT_INTERVAL 5
#define RECONNECT_INTERVAL 20
#define RETRY_INTERVAL 240
#define NICKSERV_INTERVAL 5

#define CTCP_MIN_INTERVAL 5

Expand Down Expand Up @@ -428,7 +427,7 @@ - (void)onRetryTimer:(id)sender
- (void)startAutoJoinTimer
{
[_autoJoinTimer stop];
[_autoJoinTimer start:NICKSERV_INTERVAL];
[_autoJoinTimer start:_config.timeout];
}

- (void)stopAutoJoinTimer
Expand Down
1 change: 1 addition & 0 deletions Classes/IRC/IRCClientConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ typedef enum {
@property (nonatomic) NSString* username;
@property (nonatomic) NSString* realName;
@property (nonatomic) NSString* nickPassword;
@property (nonatomic) int timeout;
@property (nonatomic) BOOL useSASL;
@property (nonatomic, readonly) NSMutableArray* altNicks;

Expand Down
3 changes: 3 additions & 0 deletions Classes/IRC/IRCClientConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ - (id)init
_username = @"";
_realName = @"";
_nickPassword = @"";
_timeout = 15;

_proxyHost = @"";
_proxyPort = 1080;
Expand Down Expand Up @@ -70,6 +71,7 @@ - (id)initWithDictionary:(NSDictionary*)dic
_username = [dic stringForKey:@"username"] ?: @"";
_realName = [dic stringForKey:@"realname"] ?: @"";
_nickPassword = [dic stringForKey:@"nickPassword"] ?: [Keychain genericPasswordWithAccountName:[self nickPassword] serviceName:[self keychainServiceName]] ?: @"";
_timeout = [dic intForKey:@"timeout"] ?: 15;
_useSASL = [dic boolForKey:@"useSASL"];
[_altNicks addObjectsFromArray:[dic arrayForKey:@"alt_nicks"]];

Expand Down Expand Up @@ -132,6 +134,7 @@ - (NSMutableDictionary*)dictionaryValue
} else if (_nickPassword) {
[dic setObject:_nickPassword forKey:@"nickPassword"];
}
[dic setInt:_timeout forKey:@"timeout"];
[dic setBool:_useSASL forKey:@"useSASL"];
if (_altNicks) [dic setObject:_altNicks forKey:@"alt_nicks"];

Expand Down
Loading