mirror of https://github.com/sipwise/jitsi.git
parent
bbd6748b2c
commit
a43c581d92
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* 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.beans.PropertyChangeEvent;
|
||||
import net.java.sip.communicator.service.protocol.PresenceStatus;
|
||||
import net.java.sip.communicator.service.protocol.ProtocolProviderService;
|
||||
import net.java.sip.communicator.service.protocol.*;
|
||||
|
||||
/**
|
||||
* Instances of this class represent a change in the status of a particular
|
||||
* contact.
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public class ContactPresenceStatusChangeEvent extends PropertyChangeEvent
|
||||
{
|
||||
private ProtocolProviderService sourceProvider = null;
|
||||
private ContactGroup parentGroup = null;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an event instance indicating that the specified source contact
|
||||
* has changed status from <code>oldValue</code> to <code>newValue</code>.
|
||||
* @param source the provider that generated the event
|
||||
* @param sourceProvider the protocol provider that the contact belongs to.
|
||||
* @param parentGroup the group containing the contact that caused this
|
||||
* event (to be set as null in cases where groups are not supported);
|
||||
* @param oldValue the status the source countact was in before enetering
|
||||
* the new state.
|
||||
* @param newValue the status the source contact is currently in.
|
||||
*/
|
||||
public ContactPresenceStatusChangeEvent(
|
||||
Contact source,
|
||||
ProtocolProviderService sourceProvider,
|
||||
ContactGroup parentGroup,
|
||||
PresenceStatus oldValue,
|
||||
PresenceStatus newValue)
|
||||
{
|
||||
super( source,
|
||||
ContactPresenceStatusChangeEvent.class.getName(),
|
||||
oldValue,
|
||||
newValue);
|
||||
this.sourceProvider = sourceProvider;
|
||||
this.parentGroup = parentGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the provider that the source contact belongs to.
|
||||
* @return the provider that the source contact belongs to.
|
||||
*/
|
||||
public ProtocolProviderService getSourceProvider()
|
||||
{
|
||||
return sourceProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the provider that the source contact belongs to.
|
||||
* @return the provider that the source contact belongs to.
|
||||
*/
|
||||
public Contact getSourceContact()
|
||||
{
|
||||
return (Contact)getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status of the provider before this event took place.
|
||||
* @return a PresenceStatus instance indicating the event the source
|
||||
* provider was in before it entered its new state.
|
||||
*/
|
||||
public PresenceStatus getOldStatus()
|
||||
{
|
||||
return (PresenceStatus)super.getOldValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status of the provider after this event took place.
|
||||
* (i.e. at the time the event is being dispatched).
|
||||
* @return a PresenceStatus instance indicating the event the source
|
||||
* provider is in after the status change occurred.
|
||||
*/
|
||||
public PresenceStatus getNewStatus()
|
||||
{
|
||||
return (PresenceStatus)super.getNewValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns (if applicable) the group containing the contact that cause this
|
||||
* event. In the case of a non persistent presence operation set this
|
||||
* field is null.
|
||||
* @return the ContactGroup (if there is one) containing the contact that
|
||||
* caused the event.
|
||||
*/
|
||||
public ContactGroup getParentGroup()
|
||||
{
|
||||
return parentGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of this ContactPresenceStatusChangeEvent
|
||||
*
|
||||
* @return A a String representation of this
|
||||
* ContactPresenceStatusChangeEvent.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer buff
|
||||
= new StringBuffer("ContactPresenceStatusChangeEvent-[ ContactID=");
|
||||
buff.append(getSourceContact().getAddress());
|
||||
if(getParentGroup() != null)
|
||||
buff.append(", ParentGroup").append(getParentGroup().getGroupName());
|
||||
return buff.append(", OldStatus=").append(getOldStatus())
|
||||
.append(", NewStatus=").append(getNewStatus()).append("]").toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.*;
|
||||
|
||||
/**
|
||||
* <code>ContactPresenceStatusListener</code>s listener for events caused by
|
||||
* changes in the status of contacts that we have active subscriptions for.
|
||||
* <p>
|
||||
* Events handled by this listener a most often the direct result of server/
|
||||
* remotely generated notifications.
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public interface ContactPresenceStatusListener
|
||||
extends EventListener
|
||||
{
|
||||
/**
|
||||
* Called whenever a change occurs in the PresenceStatus of one of the
|
||||
* contacts that we have subscribed for.
|
||||
* @param evt the ContactPresenceStatusChangeEvent describing the status
|
||||
* change.
|
||||
*/
|
||||
public void contactPresenceStatusChanged(
|
||||
ContactPresenceStatusChangeEvent evt);
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package net.java.sip.communicator.service.protocol.event;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Represents an event pertaining to message delivery, reception or failure.
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public class MessageEvent
|
||||
extends EventObject
|
||||
{
|
||||
public MessageEvent(Object source)
|
||||
{
|
||||
super(source);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package net.java.sip.communicator.service.protocol.event;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* A listener that would gather events notifying of message delivery status.
|
||||
* Message received
|
||||
*
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public interface MessageListener
|
||||
extends EventListener
|
||||
{
|
||||
public void messageReceived(MessageEvent evt);
|
||||
|
||||
public void messageDelivered(MessageEvent evt);
|
||||
|
||||
public void messageDeliveryFailed(MessageEvent evt);
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.beans.PropertyChangeEvent;
|
||||
import net.java.sip.communicator.service.protocol.PresenceStatus;
|
||||
import net.java.sip.communicator.service.protocol.ProtocolProviderService;
|
||||
|
||||
/**
|
||||
* Instances of this class represent a change in the status of the provider
|
||||
* that triggerred them.
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public class ProviderPresenceStatusChangeEvent extends PropertyChangeEvent
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates an event instance indicating a change of the property
|
||||
* specified by <code>eventType</code> from <code>oldValue</code> to
|
||||
* <code>newValue</code>.
|
||||
* @param source the provider that generated the event
|
||||
* @param oldValue the status the source provider was int before enetering
|
||||
* the new state.
|
||||
* @param newValue the status the source provider is currently in.
|
||||
*/
|
||||
public ProviderPresenceStatusChangeEvent(
|
||||
ProtocolProviderService source,
|
||||
PresenceStatus oldValue,
|
||||
PresenceStatus newValue)
|
||||
{
|
||||
super( source,
|
||||
ProviderPresenceStatusChangeEvent.class.getName(),
|
||||
oldValue,
|
||||
newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the provider that has genereted this event
|
||||
* @return the provider that generated the event.
|
||||
*/
|
||||
public ProtocolProviderService getProvider()
|
||||
{
|
||||
return (ProtocolProviderService)getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status of the provider before this event took place.
|
||||
* @return a PresenceStatus instance indicating the event the source
|
||||
* provider was in before it entered its new state.
|
||||
*/
|
||||
public PresenceStatus getOldStatus()
|
||||
{
|
||||
return (PresenceStatus)super.getOldValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status of the provider after this event took place.
|
||||
* (i.e. at the time the event is being dispatched).
|
||||
* @return a PresenceStatus instance indicating the event the source
|
||||
* provider is in after the status change occurred.
|
||||
*/
|
||||
public PresenceStatus getNewStatus()
|
||||
{
|
||||
return (PresenceStatus)super.getNewValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of this ProviderPresenceStatusChangeEvent
|
||||
*
|
||||
* @return A a String representation of this
|
||||
* ProviderPresenceStatusChangeEvent.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer buff
|
||||
= new StringBuffer("ProviderPresenceStatusChangeEvent-[");
|
||||
return buff.append("OldStatus=").append(getOldStatus())
|
||||
.append(", NewStatus=").append(getNewStatus()).append("]").toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.beans.*;
|
||||
|
||||
/**
|
||||
* An event listener that should be implemented by parties interested in changes
|
||||
* that occur in the state of a ProtocolProvider (e.g. PresenceStatusChanges)
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public interface ProviderPresenceStatusListener extends java.util.EventListener
|
||||
{
|
||||
/**
|
||||
* The property name of PropertyChangeEvents announcing changes in our
|
||||
* status message.
|
||||
*/
|
||||
public static final String STATUS_MESSAGE = "StatusMessage";
|
||||
|
||||
/**
|
||||
* The method is called by a ProtocolProvider implementation whenever
|
||||
* a change in the presence status of the corresponding provider had
|
||||
* occurred.
|
||||
* @param evt ProviderStatusChangeEvent the event describing the status
|
||||
* change.
|
||||
*/
|
||||
public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt);
|
||||
|
||||
/**
|
||||
* The method is called by a ProtocolProvider implementation whenever a
|
||||
* change in the status message of the corresponding provider has occurred
|
||||
* and has been confirmed by the server.
|
||||
*
|
||||
* @param evt a PropertyChangeEvent with a STATUS_MESSAGE property name,
|
||||
* containing the old and new status messages.
|
||||
*/
|
||||
public void providerStatusMessageChanged(PropertyChangeEvent evt);
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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.beans.PropertyChangeEvent;
|
||||
import net.java.sip.communicator.service.protocol.RegistrationState;
|
||||
import net.java.sip.communicator.service.protocol.ProtocolProviderService;
|
||||
|
||||
/**
|
||||
* Instances of this class represent a change in the status of the provider
|
||||
* that triggerred them.
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public class RegistrationStateChangeEvent extends PropertyChangeEvent
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates an event instance indicating a change of the property
|
||||
* specified by <code>eventType</code> from <code>oldValue</code> to
|
||||
* <code>newValue</code>.
|
||||
* @param source the provider that generated the event
|
||||
* @param oldValue the status the source provider was int before enetering
|
||||
* the new state.
|
||||
* @param newValue the status the source provider is currently in.
|
||||
*/
|
||||
public RegistrationStateChangeEvent( ProtocolProviderService source,
|
||||
RegistrationState oldValue,
|
||||
RegistrationState newValue)
|
||||
{
|
||||
super(source,
|
||||
RegistrationStateChangeEvent.class.getName(),
|
||||
oldValue,
|
||||
newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the provider that has genereted this event
|
||||
* @return the provider that generated the event.
|
||||
*/
|
||||
public ProtocolProviderService getProvider()
|
||||
{
|
||||
return (ProtocolProviderService)getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status of the provider before this event took place.
|
||||
* @return a RegistrationState instance indicating the event the source
|
||||
* provider was in before it entered its new state.
|
||||
*/
|
||||
public RegistrationState getOldState()
|
||||
{
|
||||
return (RegistrationState)super.getOldValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status of the provider after this event took place.
|
||||
* (i.e. at the time the event is being dispatched).
|
||||
* @return a RegistrationState instance indicating the event the source
|
||||
* provider is in after the status change occurred.
|
||||
*/
|
||||
public RegistrationState getNewState()
|
||||
{
|
||||
return (RegistrationState)super.getNewValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this event.
|
||||
* @return a String containing the name of the event as well as the names
|
||||
* of the old and new <code>RegistrationState</code>s
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return "RegistrationStateChangeEvent[ oldState="
|
||||
+ getOldState().getStateName()
|
||||
+ "; newState="+ getNewState()+"]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* An event listener that should be implemented by parties interested in changes
|
||||
* that occur in the registration state of a ProtocolProvider.
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public interface RegistrationStateChangeListener extends java.util.EventListener
|
||||
{
|
||||
/**
|
||||
* The method is called by a ProtocolProvider implementation whenver
|
||||
* a change in the registration state of the corresponding provider had
|
||||
* occurred.
|
||||
* @param evt ProviderStatusChangeEvent the event describing the status
|
||||
* change.
|
||||
*/
|
||||
public void registrationStateChanged(RegistrationStateChangeEvent evt);
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* 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.*;
|
||||
import net.java.sip.communicator.service.protocol.*;
|
||||
|
||||
/**
|
||||
* Events of this class indicate a change in one of the properties of a
|
||||
* ServerStoredGroup.
|
||||
*
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public class ServerStoredGroupEvent
|
||||
extends EventObject
|
||||
{
|
||||
public static final int GROUP_CREATED_EVENT = 1;
|
||||
public static final int GROUP_REMOVED_EVENT = 2;
|
||||
public static final int GROUP_RENAMED_EVENT = 3;
|
||||
|
||||
private int eventID = -1;
|
||||
private ProtocolProviderService sourceProvider = null;
|
||||
private OperationSetPersistentPresence parentOperationSet = null;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a ServerStoredGroupChangeEvent instance.
|
||||
* @param sourceGroup the group that this event is pertaining to.
|
||||
* @param eventID an int describing the cause of the event
|
||||
* @param sourceProvider a reference to the protocol provider where this is
|
||||
* happening
|
||||
* @param opSet a reference to the operation set responsible for the event
|
||||
*/
|
||||
public ServerStoredGroupEvent(ContactGroup sourceGroup,
|
||||
int eventID,
|
||||
ProtocolProviderService sourceProvider,
|
||||
OperationSetPersistentPresence opSet)
|
||||
{
|
||||
super(sourceGroup);
|
||||
|
||||
this.eventID = eventID;
|
||||
this.sourceProvider = sourceProvider;
|
||||
this.parentOperationSet = opSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the <code>ContactGroup</code> that this event is
|
||||
* pertaining to.
|
||||
* @return a reference to the ContactGroup that caused the event.
|
||||
*/
|
||||
public ContactGroup getSrouceGroup()
|
||||
{
|
||||
return (ContactGroup)getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an int describing the cause of this event.
|
||||
* @return an int describing the cause of this event.
|
||||
*/
|
||||
public int getEventID()
|
||||
{
|
||||
return eventID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the provider under which the event is being
|
||||
* generated
|
||||
* @return a ProtocolProviderService instance indicating the provider
|
||||
* responsible for the event.
|
||||
*/
|
||||
public ProtocolProviderService getSourceProvider()
|
||||
{
|
||||
return this.sourceProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the operation set that generated the event
|
||||
* @return a reference to an OperationSetPersistentPresence instance,
|
||||
* responsible for generating the event.
|
||||
*/
|
||||
public OperationSetPersistentPresence getSourceOperationSet()
|
||||
{
|
||||
return this.parentOperationSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of this event.
|
||||
* @return a String containing details describin this event.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer buff
|
||||
= new StringBuffer("ServerStoredGroupEvent:[EventID= ");
|
||||
buff.append(getEventID());
|
||||
buff.append(" SourceGroup=");
|
||||
buff.append(getSource());
|
||||
buff.append("]");
|
||||
|
||||
return buff.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.*;
|
||||
|
||||
/**
|
||||
* Used to deliver events concerning contact groups in server stored contact
|
||||
* lists.
|
||||
*
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public interface ServerStoredGroupListener
|
||||
extends EventListener
|
||||
{
|
||||
/**
|
||||
* Called whnever an indication is received that a new server stored group
|
||||
* is created.
|
||||
* @param evt a ServerStoredGroupChangeEvent containing a reference to the
|
||||
* newly created group.
|
||||
*/
|
||||
public void groupCreated(ServerStoredGroupEvent evt);
|
||||
|
||||
/**
|
||||
* Called whnever an indication is received that an existing server stored
|
||||
* group has been removed.
|
||||
* @param evt a ServerStoredGroupChangeEvent containing a reference to the
|
||||
* newly created group.
|
||||
*/
|
||||
public void groupRemoved(ServerStoredGroupEvent evt);
|
||||
|
||||
/**
|
||||
* Called when an indication is received that the name of a server stored
|
||||
* contact group has changed.
|
||||
* @param evt a ServerStoredGroupChangeEvent containing the details of the
|
||||
* name change.
|
||||
*/
|
||||
public void groupNameChanged(ServerStoredGroupEvent evt);
|
||||
}
|
||||
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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.*;
|
||||
import net.java.sip.communicator.service.protocol.*;
|
||||
|
||||
/**
|
||||
* SubscriptionEvents indicate creation removal or failure of a given
|
||||
* Subscription. Note that in SIP Communicator the terms Subscription and
|
||||
* Contact are quite similar: A contact becomes available and it is possible
|
||||
* to query its presence status and user information, once a
|
||||
* subscription for this contact has been created.
|
||||
*
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public class SubscriptionEvent
|
||||
extends EventObject
|
||||
{
|
||||
private int eventID = -1;
|
||||
|
||||
/**
|
||||
* Indicates that the SubscriptionEvent instance was triggered by the
|
||||
* creation of a new subscription
|
||||
*/
|
||||
public static final int SUBSCRIPTION_CREATED = 1;
|
||||
|
||||
/**
|
||||
* Indicates that the SubscriptionEvent instance was triggered by the
|
||||
* removal of an existing subscriptionl'
|
||||
*/
|
||||
public static final int SUBSCRIPTION_REMOVED = 2;
|
||||
|
||||
/**
|
||||
* Indicates that the SubscriptionEvent instance was triggered by the fact
|
||||
* that no confirmation of the successful completion of a new subscription
|
||||
* has been received.
|
||||
*/
|
||||
public static final int SUBSCRIPTION_FAILED = 3;
|
||||
|
||||
private ProtocolProviderService sourceProvider = null;
|
||||
private ContactGroup parentGroup = null;
|
||||
|
||||
/**
|
||||
* Creates a new Subscription event according to the specified parameters.
|
||||
* @param source the Contact instance that this subscription pertains to.
|
||||
* @param provider the ProtocolProviderService instance where this event
|
||||
* occurred
|
||||
* @param parentGroup the ContactGroup underwhich the corresponding Contact
|
||||
* is located
|
||||
* @param eventID one of the SUBSCRIPTION_XXX static fields indicating the
|
||||
* nature of the event.
|
||||
*/
|
||||
public SubscriptionEvent( Contact source,
|
||||
ProtocolProviderService provider,
|
||||
ContactGroup parentGroup,
|
||||
int eventID)
|
||||
{
|
||||
super(source);
|
||||
this.sourceProvider = provider;
|
||||
this.parentGroup = parentGroup;
|
||||
this.eventID = eventID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the provider that the source contact belongs to.
|
||||
* @return the provider that the source contact belongs to.
|
||||
*/
|
||||
public ProtocolProviderService getSourceProvider()
|
||||
{
|
||||
return sourceProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the provider that the source contact belongs to.
|
||||
* @return the provider that the source contact belongs to.
|
||||
*/
|
||||
public Contact getSourceContact()
|
||||
{
|
||||
return (Contact)getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns (if applicable) the group containing the contact that cause this
|
||||
* event. In the case of a non persistent presence operation set this
|
||||
* field is null.
|
||||
* @return the ContactGroup (if there is one) containing the contact that
|
||||
* caused the event.
|
||||
*/
|
||||
public ContactGroup getParentGroup()
|
||||
{
|
||||
return parentGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of this ContactPresenceStatusChangeEvent
|
||||
*
|
||||
* @return A a String representation of this
|
||||
* ContactPresenceStatusChangeEvent.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer buff
|
||||
= new StringBuffer("SubscriptionEvent-[ ContactID=");
|
||||
buff.append(getSourceContact().getAddress());
|
||||
buff.append(", eventID=").append(getEventID());
|
||||
if(getParentGroup() != null)
|
||||
buff.append(", ParentGroup=").append(getParentGroup().getGroupName());
|
||||
return buff.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an event id specifying whether the type of this event (e.g.
|
||||
* SUBSCRIPTION_CREATED, SUBSCRIPTION_FAILED and etc.)
|
||||
* @return one of the SUBSCRIPTION_XXX int fields of this class.
|
||||
*/
|
||||
public int getEventID(){
|
||||
return eventID;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface would listen for events generated as a result
|
||||
* of creating or removing a presence subscription through the subscribe and
|
||||
* unsubscribe methods of the OperationSetPresence and
|
||||
* OperationSetPersistentPresence operation sets.
|
||||
* <p>
|
||||
* Note that these are events that are most often triggered by remote/server
|
||||
* side messages. This means that users of the protocol provider service (such
|
||||
* as the User Interface for example) should wait for one of them before
|
||||
* announcing a subscription as created or deleted (i.e. before showing or
|
||||
* removing a user in/from a displayed contact list).
|
||||
* <p>
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public interface SubscriptionListener
|
||||
extends EventListener
|
||||
{
|
||||
/**
|
||||
* Indicates that a subscription has been successfully created and accepted
|
||||
* by the remote party.
|
||||
* @param evt the SubscriptionEvent containing the corresponding contact
|
||||
*/
|
||||
public void subscriptionCreated(SubscriptionEvent evt);
|
||||
|
||||
/**
|
||||
* Indicates that a subscription has failed and/or was not accepted by the
|
||||
* remote party.
|
||||
* @param evt the SubscriptionEvent containing the corresponding contact
|
||||
*/
|
||||
public void subscriptionFailed(SubscriptionEvent evt);
|
||||
|
||||
/**
|
||||
* Indicates that a subscription has been successfully removed and that
|
||||
* the remote party has acknowledged its removal.
|
||||
* @param evt the SubscriptionEvent containing the corresponding contact
|
||||
*/
|
||||
public void subscriptionRemoved(SubscriptionEvent evt);
|
||||
}
|
||||
Loading…
Reference in new issue