Browse files

Added "Call Ended" Growl notification. It is shown only if applicatio…

…n is not active.
  • Loading branch information...
1 parent 1430c76 commit 4c7430f3f651a7689ecccc90e10720fd216b73ea eofster committed Jan 14, 2009
Showing with 32 additions and 3 deletions.
  1. +2 −2 AKAccountController.m
  2. +18 −0 AKCallController.m
  3. +5 −1 AppController.h
  4. +5 −0 AppController.m
  5. +2 −0 Growl Registration Ticket.growlRegDict
View
4 AKAccountController.m
@@ -643,15 +643,15 @@ - (void)telephoneAccountDidReceiveCall:(AKTelephoneCall *)aCall
description:[NSString stringWithFormat:[NSLocalizedString(@"Calling from %@", @"Incoming call from ... received.")
lowercaseString],
[[aCall remoteURI] SIPAddress]]
- notificationName:@"Incoming Call"
+ notificationName:AKGrowlNotificationIncomingCall
iconData:nil
priority:0
isSticky:NO
clickContext:nil];
} else {
[GrowlApplicationBridge notifyWithTitle:[[aCall remoteURI] SIPAddress]
description:[NSLocalizedString(@"Calling", @"Incoming call received.") lowercaseString]
- notificationName:@"Incoming Call"
+ notificationName:AKGrowlNotificationIncomingCall
iconData:nil
priority:0
isSticky:NO
View
18 AKCallController.m
@@ -26,8 +26,11 @@
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
+#import <Growl/Growl.h>
+
#import "AKActiveCallView.h"
#import "AKCallController.h"
+#import "AKSIPURI.h"
#import "AKTelephone.h"
#import "AKTelephoneCall.h"
#import "AppController.h"
@@ -302,6 +305,21 @@ - (void)telephoneCallDidDisconnect:(NSNotification *)notification
[hangUpButton setEnabled:NO];
[acceptCallButton setEnabled:NO];
[declineCallButton setEnabled:NO];
+
+ // Show Growl notification.
+ NSString *notificationTitle;
+ if ([[[[self call] remoteURI] displayName] length] > 0)
+ notificationTitle = [[[self call] remoteURI] displayName];
+ else
+ notificationTitle = [[[self call] remoteURI] SIPAddress];
+ if (![NSApp isActive])
+ [GrowlApplicationBridge notifyWithTitle:notificationTitle
+ description:[self status]
+ notificationName:AKGrowlNotificationCallEnded
+ iconData:nil
+ priority:0
+ isSticky:NO
+ clickContext:nil];
}
- (void)telephoneCallMediaActive:(NSNotification *)notification
View
6 AppController.h
@@ -80,4 +80,8 @@
extern NSString * const AKAudioDeviceIdentifier;
extern NSString * const AKAudioDeviceName;
extern NSString * const AKAudioDeviceInputsCount;
-extern NSString * const AKAudioDeviceOutputsCount;
+extern NSString * const AKAudioDeviceOutputsCount;
+
+// Growl notification names.
+extern NSString * const AKGrowlNotificationIncomingCall;
+extern NSString * const AKGrowlNotificationCallEnded;
View
5 AppController.m
@@ -1044,3 +1044,8 @@ static OSStatus AKGetAudioDevices(Ptr *devices, UInt16 *devicesCount)
return err;
}
+
+
+// Growl notification names.
+NSString * const AKGrowlNotificationIncomingCall = @"Incoming Call";
+NSString * const AKGrowlNotificationCallEnded = @"Call Ended";
View
2 Growl Registration Ticket.growlRegDict
@@ -5,10 +5,12 @@
<key>AllNotifications</key>
<array>
<string>Incoming Call</string>
+ <string>Call Ended</string>
</array>
<key>DefaultNotifications</key>
<array>
<string>Incoming Call</string>
+ <string>Call Ended</string>
</array>
<key>TicketVersion</key>
<integer>1</integer>

0 comments on commit 4c7430f

Please sign in to comment.