Adium

Changeset 21721

Show
Ignore:
Timestamp:
11/23/2007 12:37:25 PM (1 year ago)
Author:
zacw
Message:

Display a status message in open chats when an account is disconnected or connects. Fixes #8441.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Frameworks/Adium Framework/Source/AIAbstractAccount.m

    r21295 r21721  
    10521052- (void)didConnect 
    10531053{ 
    1054     //We are now online 
     1054        //Display a status message in all open chats for this account. 
     1055        AIChat                  *chat = nil; 
     1056        NSEnumerator    *enumerator = [[[adium interfaceController] openChats] objectEnumerator]; 
     1057         
     1058        while ((chat = [enumerator nextObject])) { 
     1059                if ([chat account] == self && [chat isOpen]) { 
     1060                        [[adium contentController] displayEvent:AILocalizedString(@"You have connected","Displayed in an open chat when its account has been connected") 
     1061                                                                                         ofType:@"connected" 
     1062                                                                                         inChat:chat]; 
     1063                } 
     1064        } 
     1065     
     1066        //We are now online 
    10551067    [self setStatusObject:nil forKey:@"Connecting" notify:NotifyLater]; 
    10561068    [self setStatusObject:[NSNumber numberWithBool:YES] forKey:@"Online" notify:NotifyLater]; 
     
    10641076    //Reset reconnection attempts 
    10651077    reconnectAttemptsPerformed = 0; 
    1066  
     1078         
    10671079        //Update our status and idle status to ensure our newly connected account is in the states we want it to be 
    10681080        if ([[self statusState] statusType] == AIOfflineStatusType) { 
     
    11791191- (void)didDisconnect 
    11801192{ 
     1193        //If we were online, display a status message in all of our open chats noting our disconnection 
     1194        if ([[self statusObjectForKey:@"Online"] boolValue]) { 
     1195                AIChat                  *chat = nil; 
     1196                NSEnumerator    *enumerator = [[[adium interfaceController] openChats] objectEnumerator]; 
     1197                 
     1198                while ((chat = [enumerator nextObject])) { 
     1199                        if ([chat account] == self && [chat isOpen]) { 
     1200                                [[adium contentController] displayEvent:AILocalizedString(@"You have disconnected","Displayed in an open chat when its account has been disconnected.") 
     1201                                                                                                 ofType:@"disconnected" 
     1202                                                                                                 inChat:chat]; 
     1203                        } 
     1204                } 
     1205        } 
     1206         
    11811207        //Remove all contacts 
    11821208        [self removeAllContacts]; 
    1183          
     1209 
    11841210        //We are now offline 
    11851211    [self setStatusObject:nil forKey:@"Disconnecting" notify:NotifyLater]; 
     
    11981224                // Let it try for 2 times and then cancel and wait for the network to return. 
    11991225                [self cancelAutoReconnect]; 
     1226 
     1227                AILog(@"%@: Disconnected (\"%@\"): Waiting until network returns.", self, lastDisconnectionError); 
     1228 
    12001229        } else if ([self shouldBeOnline] && lastDisconnectionError) { 
    12011230                AIReconnectDelayType shouldReconnect = [self shouldAttemptReconnectAfterDisconnectionError:&lastDisconnectionError];