SIMPLE alpha 1

currently working until a refresh is needed, PIDF presence only, still bugged with iptel.org server.
under _heavy_ development
cusax-fix
Benoit Pradelle 19 years ago
parent 720133df02
commit 906bb771d5

@ -9,6 +9,8 @@
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import javax.sip.*;
/**
* A simple, straightforward implementation of a SIP Contact. Since
* the SIP protocol is not a real one, we simply store all contact details
@ -18,6 +20,7 @@
* consulting the encapsulated object.
*
* @author Emil Ivov
* @author Benoit Pradelle
*/
public class ContactSipImpl
implements Contact
@ -55,8 +58,24 @@ public class ContactSipImpl
* Determines whether the contact has been resolved (i.e. we have a
* confirmation that it is still on the server contact list).
*/
private boolean isResolved = true;
private boolean isResolved = false;
/**
* Determines whether this contact can be resolved or if he will be
* never resolved (for example if he doesn't support SIMPLE)
*/
private boolean isResolvable = true;
/**
* Stores the dialog used for receiving the contact status
*/
private Dialog clientDialog = null;
/**
* Stores the dialog used for communicate our status to this contact
*/
private Dialog serverDialog = null;
/**
* Creates an instance of a meta contact with the specified string used
* as a name and identifier.
@ -231,6 +250,50 @@ public String getPersistentData()
{
return null;
}
/**
* Sets the client dialog associated with this contact.
* The client dialog is the dialog we use to retrieve the presence
* state of this contact.
*
* @param clientDialog the new clientDialog to use
*/
public void setClientDialog(Dialog clientDialog) {
this.clientDialog = clientDialog;
}
/**
* Returns the client dialog associated with this contact.
* The client dialog is the dialog we use to retrieve the presence
* state of this contact.
*
* @return the clientDialog associated with the contact
*/
public Dialog getClientDialog() {
return this.clientDialog;
}
/**
* Sets the server dialog associated with this contact.
* The server dialog is the dialog we use to send our presence status
* to this contact.
*
* @param serverDialog the new clientDialog to use
*/
public void setServerDialog(Dialog serverDialog) {
this.serverDialog = serverDialog;
}
/**
* Returns the server dialog associated with this contact.
* The server dialog is the dialog we use to send our presence status
* to this contact.
*
* @return the clientDialog associated with the contact
*/
public Dialog getServerDialog() {
return this.serverDialog;
}
/**
* Determines whether or not this contact has been resolved against the
@ -244,7 +307,7 @@ public String getPersistentData()
*/
public boolean isResolved()
{
return isResolved;
return this.isResolved;
}
/**
@ -257,6 +320,29 @@ public void setResolved(boolean resolved)
{
this.isResolved = resolved;
}
/**
* Determines whether or not this contact can be resolved against the
* server.
*
* @return true if the contact can be resolved (mapped against a buddy)
* and false otherwise.
*/
public boolean isResolvable()
{
return this.isResolvable;
}
/**
* Makes the contact resolvable or unresolvable.
*
* @param resolvable true to make the contact resolvable; false to
* make it unresolvable
*/
public void setResolvable(boolean resolvable)
{
this.isResolvable = resolvable;
}
/**
* Indicates whether some other object is "equal to" this one which in terms

@ -46,7 +46,7 @@ public class OperationSetBasicInstantMessagingSipImpl
* A reference to the persistent presence operation set that we use
* to match incoming messages to <tt>Contact</tt>s and vice versa.
*/
private OperationSetPersistentPresenceSipImpl opSetPersPresence = null;
private OperationSetPresenceSipImpl opSetPersPresence = null;
/**
* Hashtable containing the CSeq of each discussion
@ -576,7 +576,7 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence = (OperationSetPersistentPresenceSipImpl)
opSetPersPresence = (OperationSetPresenceSipImpl)
sipProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
}

@ -162,6 +162,19 @@ public class ProtocolProviderServiceSipImpl
* The default name of a server log file for the jain-sip RI.
*/
private static String NSPVALUE_SERVER_LOG = "log/sc-jainsipserver.log";
/**
* The name of the property under which jain-sip will know if it must
* deliver some unsolicited notify.
*/
private static final String NSPNAME_DELIVER_UNSOLICITED_NOTIFY =
"gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY";
/**
* The value of the property under which jain-sip will know if it must
* deliver some unsolicited notify.
*/
private static final String NSPVALUE_DELIVER_UNSOLICITED_NOTIFY = "true";
/**
* A random generator we use to generate tags.
@ -545,6 +558,10 @@ protected void initialize(String sipAddress,
// Log level
properties.setProperty(NSPNAME_TRACE_LEVEL, NSPVALUE_TRACE_LEVEL);
// deliver unsolicited NOTIFY
properties.setProperty(NSPNAME_DELIVER_UNSOLICITED_NOTIFY,
NSPVALUE_DELIVER_UNSOLICITED_NOTIFY);
try
{
@ -610,7 +627,7 @@ protected void initialize(String sipAddress,
//init presence op set.
OperationSetPersistentPresence opSetPersPresence
= new OperationSetPersistentPresenceSipImpl(this);
= new OperationSetPresenceSipImpl(this);
this.supportedOperationSets.put(
OperationSetPersistentPresence.class.getName()
, opSetPersPresence);

@ -476,6 +476,9 @@ public void unregister() throws OperationFailedException
"Could not find the initial register request."
, OperationFailedException.INTERNAL_ERROR);
}
setRegistrationState(RegistrationState.UNREGISTERING,
RegistrationStateChangeEvent.REASON_USER_REQUEST, "");
//We are apparently registered so send a un-Register request.
Request unregisterRequest = (Request) registerRequest.clone();

@ -42,6 +42,16 @@ public class SipStatusEnum
30
, "Do Not Disturb",
loadIcon("resources/images/sip/sip16x16-dnd.png"));
/**
* The Away status. Indicates that the user has connectivity but might
* not be able to immediately act upon initiation of communication.
*/
public static final SipStatusEnum AWAY
= new SipStatusEnum(
40,
"Away",
loadIcon("resources/images/sip/sip16x16-dnd.png"));
/**
* The Online status. Indicate that the user is able and willing to
@ -52,6 +62,15 @@ public class SipStatusEnum
65
, "Online"
, loadIcon("resources/images/sip/sip16x16-online.png"));
/**
* The Unknown status. Indicate that we don't know if the user is present
* or not.
*/
public static final SipStatusEnum UNKNOWN = new SipStatusEnum(
1,
"Unknown",
loadIcon("resources/images/sip/sip16x16-offline.png"));
/**
* Initialize the list of supported status states.
@ -60,6 +79,7 @@ public class SipStatusEnum
static
{
supportedStatusSet.add(OFFLINE);
supportedStatusSet.add(AWAY);
supportedStatusSet.add(DO_NOT_DISTURB);
supportedStatusSet.add(ONLINE);
}

@ -4,6 +4,7 @@ Bundle-Description: A bundle that implements the Protocol Provider package over
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
Import-Package: org.osgi.framework,
org.w3c.dom,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.util,
net.java.sip.communicator.service.configuration.event,
@ -12,4 +13,8 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.netaddr,
net.java.sip.communicator.service.media,
net.java.sip.communicator.service.media.event,
javax.net.ssl
javax.net.ssl,
javax.xml.parsers,
javax.xml.transform,
javax.xml.transform.dom,
javax.xml.transform.stream

@ -112,10 +112,10 @@ public void testProviderUnregister()
collector2.waitForEvent(10000);
assertEquals("Provider did not distribute unregister events"
, 1
, 2
, collector1.collectedNewStates.size());
assertEquals("Provider did not distribute unregister events"
, 1
, 2
, collector1.collectedNewStates.size());
//make sure both providers are now unregistered.

Loading…
Cancel
Save