Skip to content

Commit

Permalink
added Preferences for autojoin_on_invite.
Browse files Browse the repository at this point in the history
  • Loading branch information
walf443 authored and psychs committed May 27, 2010
1 parent b0677bc commit 7897871
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Classes/IRC/IRCClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -2971,13 +2971,15 @@ - (void)receiveInvite:(IRCMessage*)m

NSString* text = [NSString stringWithFormat:@"%@ has invited you to %@", nick, chname];
[self printBoth:self type:LINE_TYPE_INVITE text:text];
IRCChannel* c = [self findChannel: chname];
if ( !c ) {
IRCChannelConfig* seed = [[IRCChannelConfig new] autorelease];
seed.name = chname;
c = [world createChannel:seed client:self reload:YES adjust:YES];
[world save];
[self joinChannel: c];
if ( [Preferences autoJoinOnInvited] ) {
IRCChannel* c = [self findChannel: chname];
if ( !c ) {
IRCChannelConfig* seed = [[IRCChannelConfig new] autorelease];
seed.name = chname;
c = [world createChannel:seed client:self reload:YES adjust:YES];
[world save];
[self joinChannel: c];
}
}

[self notifyEvent:GROWL_INVITED target:nil nick:nick text:chname];
Expand Down
1 change: 1 addition & 0 deletions Classes/Preferences/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ typedef enum {
+ (BOOL)showInlineImages;
+ (BOOL)showJoinLeave;
+ (BOOL)stopGrowlOnActive;
+ (BOOL)autoJoinOnInvited;
+ (TabActionType)tabAction;
+ (BOOL)useHotkey;
+ (BOOL)keywordCurrentNick;
Expand Down
7 changes: 7 additions & 0 deletions Classes/Preferences/Preferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ + (BOOL)stopGrowlOnActive
return [ud boolForKey:@"Preferences.General.stop_growl_on_active"];
}

+ (BOOL)autoJoinOnInvited
{
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
return [ud boolForKey:@"Preferences.General.auto_join_on_invited"];
}


+ (TabActionType)tabAction
{
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
Expand Down

0 comments on commit 7897871

Please sign in to comment.