| 96 | | [[adium dockController] performBehavior:[[details objectForKey:KEY_DOCK_BEHAVIOR_TYPE] intValue]]; |
|---|
| | 97 | if ([[adium dockController] performBehavior:[[details objectForKey:KEY_DOCK_BEHAVIOR_TYPE] intValue]]) { |
|---|
| | 98 | //The behavior will continue into the future |
|---|
| | 99 | if ([[adium contactAlertsController] isMessageEvent:eventID]) { |
|---|
| | 100 | AIChat *chat = [userInfo objectForKey:@"AIChat"]; |
|---|
| | 101 | |
|---|
| | 102 | if (chat == [[adium interfaceController] activeChat]) { |
|---|
| | 103 | //If this is the active chat, stop the bouncing immediately |
|---|
| | 104 | [self stopBouncing:nil]; |
|---|
| | 105 | |
|---|
| | 106 | } else { |
|---|
| | 107 | [self observeToStopBouncingForChat:chat]; |
|---|
| | 108 | } |
|---|
| | 109 | } |
|---|
| | 110 | } |
|---|
| | 111 | } |
|---|
| | 112 | |
|---|
| | 113 | /* |
|---|
| | 114 | * @brief Begin watching for this chat to close or become active so we'll know to stop bouncing |
|---|
| | 115 | */ |
|---|
| | 116 | - (void)observeToStopBouncingForChat:(AIChat *)chat |
|---|
| | 117 | { |
|---|
| | 118 | [[adium notificationCenter] addObserver:self |
|---|
| | 119 | selector:@selector(stopBouncing:) |
|---|
| | 120 | name:Chat_WillClose |
|---|
| | 121 | object:chat]; |
|---|
| | 122 | |
|---|
| | 123 | [[adium notificationCenter] addObserver:self |
|---|
| | 124 | selector:@selector(stopBouncing:) |
|---|
| | 125 | name:Chat_BecameActive |
|---|
| | 126 | object:chat]; |
|---|
| | 127 | } |
|---|
| | 128 | |
|---|
| | 129 | /* |
|---|
| | 130 | * @brief Remove our observers and stop bouncing |
|---|
| | 131 | * |
|---|
| | 132 | * We remove all observers because no matter how many chats we were watching, we will stop bouncing; subsequently, stopping a bounce |
|---|
| | 133 | * would be inappropriate as it would not be associated with the chat or event which triggered a later bounce. |
|---|
| | 134 | */ |
|---|
| | 135 | - (void)stopBouncing:(NSNotification *)inNotification |
|---|
| | 136 | { |
|---|
| | 137 | [[adium notificationCenter] removeObserver:self |
|---|
| | 138 | name:Chat_WillClose |
|---|
| | 139 | object:nil]; |
|---|
| | 140 | [[adium notificationCenter] removeObserver:self |
|---|
| | 141 | name:Chat_BecameActive |
|---|
| | 142 | object:nil]; |
|---|
| | 143 | |
|---|
| | 144 | [[adium dockController] performBehavior:BOUNCE_NONE]; |
|---|