diff options
author | Emil Ivov <emcho@jitsi.org> | 2008-07-01 17:25:21 +0000 |
---|---|---|
committer | Emil Ivov <emcho@jitsi.org> | 2008-07-01 17:25:21 +0000 |
commit | 9b93a50c3e18006203860a4acffc745181f925df (patch) | |
tree | d8a115bf245b58d145756ae18eae885bec5d68a2 /src/net | |
parent | c6be00c8668e7a0f18f47fe09f112b3814c9c8ff (diff) | |
download | jitsi-9b93a50c3e18006203860a4acffc745181f925df.zip jitsi-9b93a50c3e18006203860a4acffc745181f925df.tar.gz jitsi-9b93a50c3e18006203860a4acffc745181f925df.tar.bz2 |
Committing patches from Lubomir Marinov (moving isRegistered() to AbstractProtocolProviderService) and Keio Kraaner (implementation of message filtering).
Diffstat (limited to 'src/net')
21 files changed, 240 insertions, 128 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java index 97dc631..edf97f4 100644 --- a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java @@ -267,17 +267,6 @@ public class ProtocolProviderServiceDictImpl } /** - * 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. * * @param authority the security authority that will be used for diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java index 8b8ccc7..714d5e5 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java @@ -195,17 +195,6 @@ public class ProtocolProviderServiceGibberishImpl } /** - * 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. * * @param authority the security authority that will be used for diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java index df19848..07ad09a 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java @@ -402,16 +402,6 @@ public class ProtocolProviderServiceIcqImpl } /** - * Indicates whether or not this provider is signed on the icq 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, Jabber, ICQ/AIM, or others for * example). diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java index 8b19522..f0a6cf0 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java @@ -174,18 +174,6 @@ public class ProtocolProviderServiceIrcImpl } /** - * 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. * * @param authority the security authority that will be used for diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index 149abe8..289e2d4 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -440,16 +440,6 @@ public class ProtocolProviderServiceJabberImpl } /** - * 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, Jabber, ICQ/AIM, or others for * example). diff --git a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java index 904ffba..e988695 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java @@ -237,16 +237,6 @@ public class ProtocolProviderServiceMsnImpl } /** - * 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 * example). diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java index 5642d07..073a50f 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java @@ -195,17 +195,6 @@ public class ProtocolProviderServiceRssImpl } /** - * 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. * * @param authority the security authority that will be used for diff --git a/src/net/java/sip/communicator/impl/protocol/sip/CallParticipantSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/CallParticipantSipImpl.java index 77197ac..73b08d1 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/CallParticipantSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/CallParticipantSipImpl.java @@ -88,6 +88,12 @@ public class CallParticipantSipImpl * address of our sip registrar). */ private InetSocketAddress transportAddress = null; + + /** + * A URL pointing to a location with call information or a call control + * web interface related to this participant. + */ + private URL callControlURL = null; /** * Creates a new call participant with address <tt>participantAddress</tt>. @@ -457,4 +463,29 @@ public class CallParticipantSipImpl return opSetPresence.findContactByID(getAddress()); } + /** + * Returns a URL pointing ta a location with call control information for + * this participant or <tt>null</tt> 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 <tt>null</tt> if no such URL + * is available. + */ + public URL getCallInfoURL() + { + return this.callControlURL; + } + + /** + * Returns a URL pointing ta a location with call control information for + * this participant. + * + * @param callControlURL a URL link to a location with call information or + * a call control web interface related to this participant. + */ + public void setCallInfoURL(URL callControlURL) + { + this.callControlURL = callControlURL; + } } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java index c2d09a3..3ea5a51 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java @@ -754,6 +754,12 @@ public class OperationSetBasicTelephonySipImpl callParticipant , callParticipant.getSdpDescription()); ack.setContent(sdp, contentTypeHeader); + + //set the call url in case there was one + /** @todo this should be done in CallSession, once we move + * it here.*/ + callParticipant.setCallInfoURL( + callSession.getCallInfoURL()); } } @@ -775,6 +781,10 @@ public class OperationSetBasicTelephonySipImpl callSession.processSdpAnswer(callParticipant , callParticipant.getSdpDescription()); + //set the call url in case there was one + /** @todo this should be done in CallSession, once we move + * it here.*/ + callParticipant.setCallInfoURL(callSession.getCallInfoURL()); } catch (ParseException exc) { @@ -1840,6 +1850,11 @@ public class OperationSetBasicTelephonySipImpl sdp = callSession.processSdpOffer( callParticipant , callParticipant.getSdpDescription()); + + //set the call url in case there was one + /** @todo this should be done in CallSession, once we move + * it here.*/ + callParticipant.setCallInfoURL(callSession.getCallInfoURL()); } //if there was no offer in the invite - create an offer else diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java index d89c511..c379681 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java @@ -197,7 +197,7 @@ public class ProtocolProviderServiceSipImpl * A String indicating the default debug level for the jain-sip-ri (must be * log4j compatible). */ - private static final String NSPVALUE_TRACE_LEVEL = "DEBUG"; + private static final String NSPVALUE_TRACE_LEVEL = "ERROR"; /** * The name of the property under which the jain-sip-ri would expect to find @@ -357,7 +357,8 @@ public class ProtocolProviderServiceSipImpl * * @param event The event to register */ - public void registerEvent(String event) { + public void registerEvent(String event) + { synchronized (this.registeredEvents) { if (!this.registeredEvents.contains(event)) { this.registeredEvents.add(event); @@ -370,25 +371,12 @@ public class ProtocolProviderServiceSipImpl * * @return The list of all the registered events */ - public List getKnownEventsList() { + public List getKnownEventsList() + { return this.registeredEvents; } /** - * Indicates whether or not this provider is registered - * @return true if the provider is currently registered and false otherwise. - */ - public boolean isRegistered() - { - if(this.sipRegistrarConnection == null ) - { - return false; - } - return sipRegistrarConnection.getRegistrationState() - .equals(RegistrationState.REGISTERED); - } - - /** * Returns an array containing all operation sets supported by the current * implementation. When querying this method users must be prepared to * receive any sybset of the OperationSet-s defined by this service. They diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java index e8a17b9..428ffc9 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java @@ -568,17 +568,6 @@ public class ProtocolProviderServiceSSHImpl } /** - * 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. * * @param authority the security authority that will be used for diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java index 1fcd95a..9e54276 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java @@ -21,9 +21,11 @@ import ymsg.support.*; * set. * * @author Damian Minkov + * @author Keio Kraaner */ public class OperationSetBasicInstantMessagingYahooImpl - implements OperationSetBasicInstantMessaging + implements OperationSetBasicInstantMessaging, + OperationSetInstantMessageFiltering { /** * Logger for this class @@ -45,9 +47,15 @@ public class OperationSetBasicInstantMessagingYahooImpl /** * A list of listeneres registered for message events. */ - private Vector messageListeners = new Vector(); + private Vector<MessageListener> messageListeners + = new Vector<MessageListener>(); /** + * A list of filters registered for message events. + */ + private Vector<EventFilter> eventFilters = new Vector<EventFilter>(); + + /** * The provider that created us. */ private ProtocolProviderServiceYahooImpl yahooProvider = null; @@ -310,6 +318,36 @@ public class OperationSetBasicInstantMessagingYahooImpl */ private void fireMessageEvent(EventObject evt) { + // check if this event should be filtered out + Iterator<EventFilter> filters = null; + synchronized (eventFilters) + { + filters = new ArrayList<EventFilter>(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 @@ public class OperationSetBasicInstantMessagingYahooImpl return linkBuffer.toString(); } + + /** + * Registers an <tt>EventFilter</tt> with this operation set so that + * events, that do not need processing, are filtered out. + * + * @param filter the <tt>EventFilter</tt> to register. + */ + public void addEventFilter(EventFilter filter) + { + synchronized(eventFilters) + { + if(!eventFilters.contains(filter)) + { + eventFilters.add(filter); + } + } + } + + /** + * Unregisteres an <tt>EventFilter</tt> so that it won't check any more + * if an event should be filtered out. + * + * @param filter the <tt>EventFilter</tt> 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 004752c..a8e5fdc 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java @@ -266,16 +266,6 @@ public class ProtocolProviderServiceYahooImpl } /** - * 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 * example). 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 78af46e..9b479aa 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 class ProtocolProviderServiceZeroconfImpl //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 84baf46..de7cac5 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 interface CallSession * <tt>CallSession</tt>. */ public int getAudioPort(); + + /** + * Returns a URL pointing ta a location with call control information for + * this call or <tt>null</tt> 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 <tt>null</tt> 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 b84bbcc..6192832 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 @@ import net.java.sip.communicator.service.protocol.*; /** * - * @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 656652f..d38ab5c 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 abstract class AbstractCallParticipant return getDisplayName() + " <" + getAddress() + ">;status=" + getState().getStateString(); } + + /** + * Returns a URL pointing ta a location with call control information for + * this participant or <tt>null</tt> 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 <tt>null</tt> 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 800b537..2a7334e 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.service.protocol.event.*; import net.java.sip.communicator.util.*; /** - * Implements "standard" functionality of <tt>ProtocolProviderService</code> in + * Implements "standard" functionality of <tt>ProtocolProviderService</tt> in * order to make it easier for implementers to provide complete solutions while * focusing on protocol-specific details. */ @@ -105,6 +105,17 @@ public abstract class AbstractProtocolProviderService } /** + * 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 * RegistrationState of this provider. diff --git a/src/net/java/sip/communicator/service/protocol/CallParticipant.java b/src/net/java/sip/communicator/service/protocol/CallParticipant.java index 1fd94c5..0c18065 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 <tt>null</tt> 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 0000000..de2b6d0 --- /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. <tt>EventFilter</tt>-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 <tt>EventFilter</tt> with this operation set so that + * events, that do not need processing, are filtered out. + * + * @param filter the <tt>EventFilter</tt> to register. + */ + public void addEventFilter(EventFilter filter); + + /** + * Unregisteres an <tt>EventFilter</tt> so that it won't check any more + * if an event should be filtered out. + * + * @param filter the <tt>EventFilter</tt> 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 0000000..8ea7ad9 --- /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. + * <p> + * Note that in order to be able to use this Filter, protocols should implement + * <tt>OperationSetMessageFiltering</tt>. + * <p> + * @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 <tt>true</tt> if the event was filtered out, otherwise + * <tt>false</tt>. + */ + public boolean filterEvent(EventObject msg); +} |