new SIMPLE status (online, away, busy, on the phone and offline) + still trying to reduce the abnormal test failures

cusax-fix
Benoit Pradelle 19 years ago
parent 28633e9767
commit d8c4b9f96a

@ -221,6 +221,8 @@ public class OperationSetPresenceSipImpl
private static final String NS_AWAY_ELT = "rpid:away"; private static final String NS_AWAY_ELT = "rpid:away";
private static final String BUSY_ELEMENT = "busy"; private static final String BUSY_ELEMENT = "busy";
private static final String NS_BUSY_ELT = "rpid:busy"; private static final String NS_BUSY_ELT = "rpid:busy";
private static final String OTP_ELEMENT = "on-the-phone";
private static final String NS_OTP_ELT = "rpid:on-the-phone";
/** /**
* Creates an instance of this operation set keeping a reference to the * Creates an instance of this operation set keeping a reference to the
@ -3513,11 +3515,14 @@ public byte[] getPidfPresenceStatus(ContactSipImpl contact)
if (contact.getPresenceStatus().equals(SipStatusEnum.AWAY)) { if (contact.getPresenceStatus().equals(SipStatusEnum.AWAY)) {
Element away = doc.createElement(NS_AWAY_ELT); Element away = doc.createElement(NS_AWAY_ELT);
activities.appendChild(away); activities.appendChild(away);
} else if (contact.getPresenceStatus() } else if (contact.getPresenceStatus().equals(SipStatusEnum.BUSY)) {
.equals(SipStatusEnum.DO_NOT_DISTURB))
{
Element busy = doc.createElement(NS_BUSY_ELT); Element busy = doc.createElement(NS_BUSY_ELT);
activities.appendChild(busy); activities.appendChild(busy);
} else if (contact.getPresenceStatus()
.equals(SipStatusEnum.ON_THE_PHONE))
{
Element otp = doc.createElement(NS_OTP_ELT);
activities.appendChild(otp);
} }
// <tuple> // <tuple>
@ -3632,20 +3637,18 @@ public void setPidfPresenceStatus(String presenceDoc)
continue; continue;
} }
if (activityNode.getNodeName().equals(AWAY_ELEMENT) activity = (Element) activityNode;
|| activityNode.getNodeName().equals(BUSY_ELEMENT))
{ // convert the activity in a SC status
activity = (Element) activityNode;
break;
}
}
// convert the activity in a SC status
if (activity != null) {
if (activity.getNodeName().equals(AWAY_ELEMENT)) { if (activity.getNodeName().equals(AWAY_ELEMENT)) {
personStatus = SipStatusEnum.AWAY; personStatus = SipStatusEnum.AWAY;
break;
} else if (activity.getNodeName().equals(BUSY_ELEMENT)) { } else if (activity.getNodeName().equals(BUSY_ELEMENT)) {
personStatus = SipStatusEnum.DO_NOT_DISTURB; personStatus = SipStatusEnum.BUSY;
break;
} else if (activity.getNodeName().equals(OTP_ELEMENT)) {
personStatus = SipStatusEnum.ON_THE_PHONE;
break;
} }
} }
} }
@ -3764,22 +3767,17 @@ public void setPidfPresenceStatus(String presenceDoc)
Element note = (Element) noteNode; Element note = (Element) noteNode;
String state = getTextContent(note); String state = getTextContent(note);
// away ? Iterator states = SipStatusEnum.supportedStatusSet();
if (state.equalsIgnoreCase(SipStatusEnum.AWAY while (states.hasNext()) {
.getStatusName())) SipStatusEnum current = (SipStatusEnum) states.next();
{
changed = true; if (current.getStatusName().equalsIgnoreCase(state)) {
changePresenceStatusForContact(sipcontact, changed = true;
SipStatusEnum.AWAY); changePresenceStatusForContact(sipcontact,
} current);
// do not disturb ? break;
else if (state.equalsIgnoreCase( }
SipStatusEnum.DO_NOT_DISTURB.getStatusName()))
{
changed = true;
changePresenceStatusForContact(sipcontact,
SipStatusEnum.DO_NOT_DISTURB);
} }
} }

@ -34,13 +34,22 @@ public class SipStatusEnum
, loadIcon("resources/images/sip/sip16x16-offline.png")); , loadIcon("resources/images/sip/sip16x16-offline.png"));
/** /**
* The DND status. Indicates that the user has connectivity but prefers * The busy status. Indicates that the user has connectivity but is doing
* not to be contacted. * something else.
*/ */
public static final SipStatusEnum DO_NOT_DISTURB public static final SipStatusEnum BUSY
= new SipStatusEnum( = new SipStatusEnum(
30 30,
, "Do Not Disturb", "Busy",
loadIcon("resources/images/sip/sip16x16-dnd.png"));
/**
* The On the phone status. Indicates that the user is talking to the phone.
*/
public static final SipStatusEnum ON_THE_PHONE
= new SipStatusEnum(
37,
"On the phone",
loadIcon("resources/images/sip/sip16x16-dnd.png")); loadIcon("resources/images/sip/sip16x16-dnd.png"));
/** /**
@ -79,8 +88,9 @@ public class SipStatusEnum
static static
{ {
supportedStatusSet.add(ONLINE); supportedStatusSet.add(ONLINE);
supportedStatusSet.add(DO_NOT_DISTURB);
supportedStatusSet.add(AWAY); supportedStatusSet.add(AWAY);
supportedStatusSet.add(ON_THE_PHONE);
supportedStatusSet.add(BUSY);
supportedStatusSet.add(OFFLINE); supportedStatusSet.add(OFFLINE);
} }

@ -275,7 +275,7 @@ private void pauseAfterStateChanges()
{ {
try try
{ {
Thread.currentThread().sleep(1500); Thread.currentThread().sleep(2000);
} }
catch (InterruptedException ex) catch (InterruptedException ex)
{ {

Loading…
Cancel
Save