diff options
author | Ingo Bauersachs <ingo@jitsi.org> | 2012-05-07 16:57:52 +0000 |
---|---|---|
committer | Ingo Bauersachs <ingo@jitsi.org> | 2012-05-07 16:57:52 +0000 |
commit | 1e33a5f4c04034bb25ef6749ebfcd118095e8731 (patch) | |
tree | 636ba6cc6029853ba81a992347f87a45e4646393 /src/net/java/sip/communicator/plugin/notificationwiring | |
parent | fe20f058ff735edf25031444e4ff58f374b4c58f (diff) | |
download | jitsi-1e33a5f4c04034bb25ef6749ebfcd118095e8731.zip jitsi-1e33a5f4c04034bb25ef6749ebfcd118095e8731.tar.gz jitsi-1e33a5f4c04034bb25ef6749ebfcd118095e8731.tar.bz2 |
JITSI-1035 #resolve fixed Allows caller information to be passed to the command action handler on the incoming call event.
Patch by Vieri Di Paola.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/notificationwiring')
-rw-r--r-- | src/net/java/sip/communicator/plugin/notificationwiring/NotificationManager.java | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/net/java/sip/communicator/plugin/notificationwiring/NotificationManager.java b/src/net/java/sip/communicator/plugin/notificationwiring/NotificationManager.java index 837055e..b717013 100644 --- a/src/net/java/sip/communicator/plugin/notificationwiring/NotificationManager.java +++ b/src/net/java/sip/communicator/plugin/notificationwiring/NotificationManager.java @@ -574,6 +574,35 @@ public class NotificationManager } /** + * Fires a message notification for the given event type through the + * <tt>NotificationService</tt>. + * + * @param eventType the event type for which we fire a notification + * @param messageTitle the title of the message + * @param message the content of the message + * @param extra additional event data for external processing + * @return A reference to the fired notification to stop it. + */ + public static NotificationData fireNotification(String eventType, + String messageTitle, + String message, + Map<String,String> extra) + { + NotificationService notificationService + = NotificationWiringActivator.getNotificationService(); + + if(notificationService == null) + return null; + + return notificationService.fireNotification(eventType, + messageTitle, + message, + extra, + null, + null); + } + + /** * Fires a chat message notification for the given event type through the * <tt>NotificationService</tt>. * @@ -641,6 +670,7 @@ public class NotificationManager notificationService.fireNotification( eventType, messageTitle, message, + null, contactIcon, chatContact); @@ -969,7 +999,8 @@ public class NotificationManager /** * Implements CallListener.incomingCallReceived. When a call is received - * plays the ring phone sound to the user. + * plays the ring phone sound to the user and gathers caller information + * that may be used by a user-specified command (incomingCall event trigger). * @param event the <tt>CallEvent</tt> */ public void incomingCallReceived(CallEvent event) @@ -977,8 +1008,14 @@ public class NotificationManager try { Call call = event.getSourceCall(); - String peerName = event.getSourceCall() - .getCallPeers().next().getDisplayName(); + CallPeer firstPeer = call.getCallPeers().next(); + String peerName = firstPeer.getDisplayName(); + + Map<String,String> peerInfo = new HashMap<String, String>(); + peerInfo.put("caller.uri", firstPeer.getURI()); + peerInfo.put("caller.address", firstPeer.getAddress()); + peerInfo.put("caller.name", firstPeer.getDisplayName()); + peerInfo.put("caller.id", firstPeer.getPeerID()); callNotifications.put(event.getSourceCall(), fireNotification( @@ -986,7 +1023,8 @@ public class NotificationManager "", NotificationWiringActivator.getResources() .getI18NString("service.gui.INCOMING_CALL", - new String[]{peerName}))); + new String[]{peerName}), + peerInfo)); call.addCallChangeListener(this); |