Changeset 21721
- Timestamp:
- 11/23/2007 12:37:25 PM (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Frameworks/Adium Framework/Source/AIAbstractAccount.m
r21295 r21721 1052 1052 - (void)didConnect 1053 1053 { 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 1055 1067 [self setStatusObject:nil forKey:@"Connecting" notify:NotifyLater]; 1056 1068 [self setStatusObject:[NSNumber numberWithBool:YES] forKey:@"Online" notify:NotifyLater]; … … 1064 1076 //Reset reconnection attempts 1065 1077 reconnectAttemptsPerformed = 0; 1066 1078 1067 1079 //Update our status and idle status to ensure our newly connected account is in the states we want it to be 1068 1080 if ([[self statusState] statusType] == AIOfflineStatusType) { … … 1179 1191 - (void)didDisconnect 1180 1192 { 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 1181 1207 //Remove all contacts 1182 1208 [self removeAllContacts]; 1183 1209 1184 1210 //We are now offline 1185 1211 [self setStatusObject:nil forKey:@"Disconnecting" notify:NotifyLater]; … … 1198 1224 // Let it try for 2 times and then cancel and wait for the network to return. 1199 1225 [self cancelAutoReconnect]; 1226 1227 AILog(@"%@: Disconnected (\"%@\"): Waiting until network returns.", self, lastDisconnectionError); 1228 1200 1229 } else if ([self shouldBeOnline] && lastDisconnectionError) { 1201 1230 AIReconnectDelayType shouldReconnect = [self shouldAttemptReconnectAfterDisconnectionError:&lastDisconnectionError];