(eventFilters).iterator();
+ }
+ // return if a filter has filtered this event out
+ boolean filtered = false;
+ while (filters.hasNext())
+ {
+ try
+ {
+ if (filters.next().filterEvent(evt))
+ {
+ filtered = true;
+ }
+ }
+ catch(Exception exc)
+ {
+ logger.error("An exception occurred while filtering an event.",
+ exc);
+ }
+ }
+
+ if (filtered)
+ {
+ logger.trace("Message event filtered.");
+ return;
+ }
+
Iterator listeners = null;
synchronized (messageListeners)
{
@@ -627,4 +665,35 @@ private String formatLinksToHTML(String text)
return linkBuffer.toString();
}
+
+ /**
+ * Registers an EventFilter with this operation set so that
+ * events, that do not need processing, are filtered out.
+ *
+ * @param filter the EventFilter to register.
+ */
+ public void addEventFilter(EventFilter filter)
+ {
+ synchronized(eventFilters)
+ {
+ if(!eventFilters.contains(filter))
+ {
+ eventFilters.add(filter);
+ }
+ }
+ }
+
+ /**
+ * Unregisteres an EventFilter so that it won't check any more
+ * if an event should be filtered out.
+ *
+ * @param filter the EventFilter to unregister.
+ */
+ public void removeEventFilter(EventFilter filter)
+ {
+ synchronized(eventFilters)
+ {
+ eventFilters.remove(filter);
+ }
+ }
}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java
index 004752cb8..a8e5fdca9 100644
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java
@@ -265,16 +265,6 @@ void unregister(boolean fireEvent)
}
}
- /**
- * Indicates whether or not this provider is signed on the service
- * @return true if the provider is currently signed on (and hence online)
- * and false otherwise.
- */
- public boolean isRegistered()
- {
- return getRegistrationState().equals(RegistrationState.REGISTERED);
- }
-
/**
* Returns the short name of the protocol that the implementation of this
* provider is based upon (like SIP, Msn, ICQ/AIM, or others for
diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java
index 78af46e7d..9b479aaa0 100644
--- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java
@@ -206,17 +206,6 @@ public Map getSupportedOperationSets()
//Copy the map so that the caller is not able to modify it.
return (Map)supportedOperationSets.clone();
}
-
- /**
- * Indicates whether or not this provider is registered
- *
- * @return true if the provider is currently registered and false
- * otherwise.
- */
- public boolean isRegistered()
- {
- return currentRegistrationState.equals(RegistrationState.REGISTERED);
- }
/**
* Starts the registration process.
diff --git a/src/net/java/sip/communicator/service/media/CallSession.java b/src/net/java/sip/communicator/service/media/CallSession.java
index 84baf4637..de7cac57b 100644
--- a/src/net/java/sip/communicator/service/media/CallSession.java
+++ b/src/net/java/sip/communicator/service/media/CallSession.java
@@ -109,4 +109,14 @@ public void processSdpAnswer(CallParticipant responder, String sdpAnswer)
* CallSession.
*/
public int getAudioPort();
+
+ /**
+ * Returns a URL pointing ta a location with call control information for
+ * this call or null if no such URL is available.
+ *
+ * @return a URL link to a location with call information or a call control
+ * web interface for the specified participant or null if no such
+ * URL is available.
+ */
+ public URL getCallInfoURL();
}
diff --git a/src/net/java/sip/communicator/service/media/event/MediaEvent.java b/src/net/java/sip/communicator/service/media/event/MediaEvent.java
index b84bbccbd..6192832b8 100644
--- a/src/net/java/sip/communicator/service/media/event/MediaEvent.java
+++ b/src/net/java/sip/communicator/service/media/event/MediaEvent.java
@@ -11,7 +11,7 @@
/**
*
- * @author Martin Andre
+ * @author Symphorien Wanko
*/
public class MediaEvent
extends java.util.EventObject
diff --git a/src/net/java/sip/communicator/service/protocol/AbstractCallParticipant.java b/src/net/java/sip/communicator/service/protocol/AbstractCallParticipant.java
index 656652f52..d38ab5cbc 100644
--- a/src/net/java/sip/communicator/service/protocol/AbstractCallParticipant.java
+++ b/src/net/java/sip/communicator/service/protocol/AbstractCallParticipant.java
@@ -7,6 +7,7 @@
package net.java.sip.communicator.service.protocol;
import java.util.*;
+import java.net.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@@ -143,4 +144,20 @@ public String toString()
return getDisplayName() + " <" + getAddress()
+ ">;status=" + getState().getStateString();
}
+
+ /**
+ * Returns a URL pointing ta a location with call control information for
+ * this participant or null if no such URL is available for this
+ * call participant.
+ *
+ * @return a URL link to a location with call information or a call control
+ * web interface related to this participant or null if no such URL
+ * is available.
+ */
+ public URL getCallInfoURL()
+ {
+ //if signaling protocols (such as SIP) know where to get this URL from
+ //they should override this method
+ return null;
+ }
}
diff --git a/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java b/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java
index 800b537a7..2a7334e60 100644
--- a/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java
+++ b/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java
@@ -12,7 +12,7 @@
import net.java.sip.communicator.util.*;
/**
- * Implements "standard" functionality of ProtocolProviderService in
+ * Implements "standard" functionality of ProtocolProviderService in
* order to make it easier for implementers to provide complete solutions while
* focusing on protocol-specific details.
*/
@@ -104,6 +104,17 @@ public String getProtocolDisplayName()
return (displayName == null) ? getProtocolName() : displayName;
}
+ /**
+ * Indicates whether or not this provider is registered
+ *
+ * @return true if the provider is currently registered and false
+ * otherwise.
+ */
+ public boolean isRegistered()
+ {
+ return getRegistrationState().equals(RegistrationState.REGISTERED);
+ }
+
/**
* Removes the specified registration state change listener so that it does
* not receive any further notifications upon changes of the
diff --git a/src/net/java/sip/communicator/service/protocol/CallParticipant.java b/src/net/java/sip/communicator/service/protocol/CallParticipant.java
index 1fd94c54f..0c18065cd 100644
--- a/src/net/java/sip/communicator/service/protocol/CallParticipant.java
+++ b/src/net/java/sip/communicator/service/protocol/CallParticipant.java
@@ -122,4 +122,14 @@ public interface CallParticipant
* if no particular contact has been associated.
*/
public Contact getContact();
+
+ /**
+ * Returns a URL pointing ta a location with call control information or
+ * null if such an URL is not available for the current call participant.
+ *
+ * @return a URL link to a location with call information or a call control
+ * web interface related to this participant or null if no such URL
+ * is available.
+ */
+ public URL getCallInfoURL();
}
diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetInstantMessageFiltering.java b/src/net/java/sip/communicator/service/protocol/OperationSetInstantMessageFiltering.java
new file mode 100644
index 000000000..de2b6d097
--- /dev/null
+++ b/src/net/java/sip/communicator/service/protocol/OperationSetInstantMessageFiltering.java
@@ -0,0 +1,36 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package net.java.sip.communicator.service.protocol;
+
+/**
+ * An operation set that allows plugins to register filters which could
+ * intercept instant messages and determine whether or not they should be
+ * dispatched to regular listeners. EventFilter-s allow implementating
+ * features that use standard instant messaging channels to exchange
+ *
+ * @author Keio Kraaner
+ */
+
+import net.java.sip.communicator.service.protocol.event.*;
+
+public interface OperationSetInstantMessageFiltering
+ extends OperationSet
+{
+ /**
+ * Registeres an EventFilter with this operation set so that
+ * events, that do not need processing, are filtered out.
+ *
+ * @param filter the EventFilter to register.
+ */
+ public void addEventFilter(EventFilter filter);
+
+ /**
+ * Unregisteres an EventFilter so that it won't check any more
+ * if an event should be filtered out.
+ *
+ * @param filter the EventFilter to unregister.
+ */
+ public void removeEventFilter(EventFilter filter);
+}
diff --git a/src/net/java/sip/communicator/service/protocol/event/EventFilter.java b/src/net/java/sip/communicator/service/protocol/event/EventFilter.java
new file mode 100644
index 000000000..8ea7ad9d9
--- /dev/null
+++ b/src/net/java/sip/communicator/service/protocol/event/EventFilter.java
@@ -0,0 +1,32 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.protocol.event;
+
+import java.util.*;
+
+/**
+ * An event filter that decides whether an instant message event should be
+ * filtered or not. For instance, maybe some type of received messages should not be
+ * shown in the chat windows. In such cases implementations of this filter would block
+ * this message before it is delivered to other IM listeners.
+ *
+ * Note that in order to be able to use this Filter, protocols should implement
+ * OperationSetMessageFiltering.
+ *
+ * @author Keio Kraaner
+ */
+public interface EventFilter
+{
+ /**
+ * Checks if an event should be filtered out or processed.
+ *
+ * @param msg The event that should be checked
+ * @return true if the event was filtered out, otherwise
+ * false.
+ */
+ public boolean filterEvent(EventObject msg);
+}