1. activate update checker

2. fix java docs in metacontact list service and some spellcheck
3. in sip presence impl subscription created events now fired only on server ok response and also fire a subscription failed if server responds with error
cusax-fix
Damian Minkov 18 years ago
parent a5e055bff2
commit 026730d899

@ -93,6 +93,7 @@ felix.auto.start.60= \
felix.auto.start.66= \
reference:file:sc-bundles/swing-ui.jar \
reference:file:sc-bundles/updatechecker.jar \
reference:file:sc-bundles/systray.jar
felix.auto.start.67= \

@ -337,7 +337,7 @@ public void addNewContactToMetaContact( ProtocolProviderService provider,
* @param contactID
* the identifier of the contact that the specified provider
* @param fireEvent
* specifies whether or not an even is to be faire at
* specifies whether or not an even is to be fired at
* the end of the method.Used when this method is called upon creation of a
* new meta contact and not only a new contact.
* @throws MetaContactListException
@ -575,7 +575,7 @@ private ContactGroup resolveProtoPath(ProtocolProviderService protoProvider,
/**
* Returns the meta contact group that is a direct parent of the specified
* <tt>child</tt>. If no parent is found <tt>null</tt> is returned.
* @param child the <tt>MetaContactGroup</tt> whose paret group we're
* @param child the <tt>MetaContactGroup</tt> whose parent group we're
* looking for. If no parent is found <tt>null</tt> is returned.
*
* @return the <tt>MetaContactGroup</tt> that contains <tt>child</tt> or
@ -590,7 +590,7 @@ public MetaContactGroup findParentMetaContactGroup(MetaContactGroup child)
* Returns the meta contact group that is a direct parent of the specified
* <tt>child</tt>, beginning the search at the specified root. If
* no parent is found <tt>null</tt> is returned.
* @param child the <tt>MetaContactGroup</tt> whose paret group we're
* @param child the <tt>MetaContactGroup</tt> whose parent group we're
* looking for.
* @param root the parent where the search should start.
* @return the <tt>MetaContactGroup</tt> that contains <tt>child</tt> or
@ -605,11 +605,11 @@ private MetaContactGroup findParentMetaContactGroup(
/**
* Returns the meta contact group that is a direct parent of the specified
* <tt>child</tt>.
* @param child the <tt>MetaContact</tt> whose paret group we're looking
* @param child the <tt>MetaContact</tt> whose parent group we're looking
* for.
*
* @return the <tt>MetaContactGroup</tt>
* @throws IllegalArgumentException if <tt>child</tt> is not an instnace of
* @throws IllegalArgumentException if <tt>child</tt> is not an instance of
* MetaContactImpl
*/
public MetaContactGroup findParentMetaContactGroup(MetaContact child)
@ -626,7 +626,7 @@ public MetaContactGroup findParentMetaContactGroup(MetaContact child)
* Returns the meta contact group that is a direct parent of the specified
* <tt>child</tt>, beginning the search at the specified root. If
* no parent is found <tt>null</tt> is returned.
* @param child the <tt>MetaContact</tt> whose paret group we're
* @param child the <tt>MetaContact</tt> whose parent group we're
* looking for.
* @param root the parent where the search should start.
* @return the <tt>MetaContactGroup</tt> that contains <tt>child</tt> or
@ -660,7 +660,7 @@ private MetaContactGroup findParentMetaContactGroup(
/**
* First makes the specified protocol provider create a contact
* corresponding to the specified <tt>contactID</tt>, then creates a new
* MetaContact which will encapsulate the newly crated protocol specific
* MetaContact which will encapsulate the newly created protocol specific
* contact.
*
* @param provider
@ -671,7 +671,7 @@ private MetaContactGroup findParentMetaContactGroup(
* should be stored.
* @param contactID
* a protocol specific string identifier indicating the contact
* the prtocol provider should create.
* the protocol provider should create.
* @throws MetaContactListException
* with an appropriate code if the operation fails for some
* reason.
@ -1330,7 +1330,7 @@ private void locallyRemoveAllContactsForProvider(
* @param contact the protocol specific <tt>contact</tt> that we're looking
* for.
*
* @return the MetaContact containing the speicified contact or null if no
* @return the MetaContact containing the specified contact or null if no
* such contact is present in this contact list.
*/
public MetaContact findMetaContactByContact(Contact contact)
@ -1339,7 +1339,7 @@ public MetaContact findMetaContactByContact(Contact contact)
}
/**
* Returns the MetaContact containing a contact with an address equald to
* Returns the MetaContact containing a contact with an address equal to
* <tt>contactAddress</tt> and with a source provider matching
* <tt>accountID</tt>, or null if no such MetaContact was found. The method
* can be used when for example we
@ -1352,7 +1352,7 @@ public MetaContact findMetaContactByContact(Contact contact)
* @param accountID the ID of the account that the contact we're looking for
* must belong to.
*
* @return the MetaContact containing the speicified contact or null if no
* @return the MetaContact containing the specified contact or null if no
* such contact is present in this contact list.
*/
public MetaContact findMetaContactByContact(String contactAddress,
@ -1367,7 +1367,7 @@ public MetaContact findMetaContactByContact(String contactAddress,
*
* @param metaContactID
* a String identifier of a meta contact.
* @return the MetaContact with the speicified string identifier or null if
* @return the MetaContact with the specified string identifier or null if
* no such meta contact was found.
*/
public MetaContact findMetaContactByMetaUID(String metaContactID)
@ -1410,7 +1410,7 @@ private void synchronizeOpSetWithLocalContactList(
}
/**
* Creates meta contacts and meta contact groups for all childredn of the
* Creates meta contacts and meta contact groups for all children of the
* specified <tt>contactGroup</tt> and adds them to <tt>metaGroup</tt>
* @param protoGroup the <tt>ContactGroup</tt> to add.
* <p>
@ -2033,7 +2033,7 @@ public void subscriptionResolved(SubscriptionEvent evt)
* In the case where the event refers to a change in the display name
* we compare the old value with the display name of the corresponding
* meta contact. If they are equal this means that the user has not
* speciified their own display name for the meta contact and that the
* specified their own display name for the meta contact and that the
* display name was using this contact's display name for its own
* display name. In this case we change the display name of the meta
* contact to match the new display name of the proto contact.
@ -2232,7 +2232,7 @@ public void groupResolved(ServerStoredGroupEvent evt)
/**
* Updates the local contact list by removing the meta contact group
* corresponding to the group indicated by the delivered <tt>evt</tt>
* @param evt the ServerStoredGroupEvent contining the group that has
* @param evt the ServerStoredGroupEvent confining the group that has
* been removed.
*/
public void groupRemoved(ServerStoredGroupEvent evt)
@ -2571,7 +2571,7 @@ ContactGroup loadStoredContactGroup(MetaContactGroupImpl containingMetaGroup,
* to load.
* @param metaUID the unique identifier of the meta contact.
* @param displayName the display name of the meta contact.
* @param protoContacts a list containing descirptors of proto contacts
* @param protoContacts a list containing descriptors of proto contacts
* encapsulated by the meta contact that we're about to create.
* @param accountID the identifier of the account that the contacts
* originate from.
@ -2743,7 +2743,7 @@ private class BlockingGroupEventRetriever
}
/**
* Called whnever an indication is received that a new server stored
* Called whoever an indication is received that a new server stored
* group is created.
* @param evt a ServerStoredGroupChangeEvent containing a reference to
* the newly created group.
@ -2855,7 +2855,7 @@ public void groupNameChanged(ServerStoredGroupEvent evt)
}
/**
* Called whnever an indication is received that a new server stored group
* Called whenever an indication is received that a new server stored group
* is created.
* @param evt a ServerStoredGroupEvent containing a reference to the
* newly created group.
@ -2877,7 +2877,7 @@ public void groupCreated(ServerStoredGroupEvent evt)
}
/**
* Called whnever an indication is received that a subscription is
* Called whenever an indication is received that a subscription is
* created.
* @param evt a <tt>SubscriptionEvent</tt> containing a reference to
* the newly created contact.
@ -2904,8 +2904,10 @@ public void subscriptionRemoved(SubscriptionEvent evt)
{}
/**
* Events delivered through this method are ignored
* @param evt param ignored
* Called whenever an indication is received that a subscription
* creation has failed.
* @param evt a <tt>SubscriptionEvent</tt> containing a reference to
* the contact we are trying to subscribe.
*/
public void subscriptionFailed(SubscriptionEvent evt)
{

@ -1099,7 +1099,7 @@ public void subscribe(ContactGroup parentGroup, String contactIdentifier)
//if the contact is already in the contact list
ContactSipImpl contact = (ContactSipImpl)
resolveContactID(contactIdentifier);
if (contact != null) {
logger.debug("Contact " + contactIdentifier
+ " already exists.");
@ -1132,7 +1132,7 @@ public void subscribe(ContactGroup parentGroup, String contactIdentifier)
// create the contact
contact = new ContactSipImpl(contactIdentifier, this.parentProvider);
contact.setParentGroup((ContactGroupSipImpl)parentGroup);
//create the subscription
Request subscription;
try
@ -1195,13 +1195,6 @@ public void subscribe(ContactGroup parentGroup, String contactIdentifier)
"Failed to send the subscription",
OperationFailedException.NETWORK_FAILURE);
}
((ContactGroupSipImpl) parentGroup).addContact(contact);
// pretend that the contact is created
fireSubscriptionEvent(contact,
parentGroup,
SubscriptionEvent.SUBSCRIPTION_CREATED);
}
/**
@ -1732,49 +1725,6 @@ public void processResponse(ResponseEvent responseEvent)
ContactSipImpl contact = (ContactSipImpl) this.subscribedContacts
.get(idheader.getCallId());
// if the response is a 423 response, just re-send the request
// with a valid expires value
if (response.getStatusCode() == Response.INTERVAL_TOO_BRIEF) {
MinExpiresHeader min = (MinExpiresHeader)
response.getHeader(MinExpiresHeader.NAME);
if (min == null) {
logger.error("no minimal expires value in this 423 " +
"response");
return;
}
Request request = responseEvent.getClientTransaction()
.getRequest();
ExpiresHeader exp = request.getExpires();
try {
exp.setExpires(min.getExpires());
} catch (InvalidArgumentException e) {
logger.error("can't set the new expires value", e);
return;
}
ClientTransaction transac = null;
try {
transac = this.parentProvider.getDefaultJainSipProvider()
.getNewClientTransaction(request);
} catch (TransactionUnavailableException e) {
logger.error("can't create the client transaction", e);
return;
}
try {
transac.sendRequest();
} catch (SipException e) {
logger.error("can't send the new request", e);
return;
}
return;
}
// if it's the response to an unsubscribe message, we just ignore it
// whatever the response is however if we need to handle a
// challenge, we do it
@ -1807,108 +1757,187 @@ public void processResponse(ResponseEvent responseEvent)
return;
}
try {
if (!contact.isResolved()
&& response.getStatusCode() != Response.UNAUTHORIZED
&& response.getStatusCode() !=
Response.PROXY_AUTHENTICATION_REQUIRED)
if(response.getStatusCode() >= Response.OK &&
response.getStatusCode() < Response.MULTIPLE_CHOICES)
{
// OK (200/202)
if (response.getStatusCode() == Response.OK
|| response.getStatusCode() == Response.ACCEPTED)
{
finalizeSubscription(contact,
clientTransaction.getDialog());
}
} catch (NullPointerException e) {
// should not happen
logger.debug("failed to finalize the subscription of the" +
"contact", e);
if (expHeader == null) {
// not conform to rfc3265
logger.error("no Expires header in this response");
return;
}
return;
}
if (contact.getResfreshTask() != null) {
contact.getResfreshTask().cancel();
}
// OK (200/202)
if (response.getStatusCode() == Response.OK
|| response.getStatusCode() == Response.ACCEPTED)
{
if (expHeader == null) {
// not conform to rfc3265
logger.error("no Expires header in this response");
return;
}
RefreshSubscriptionTask refresh =
new RefreshSubscriptionTask(contact);
contact.setResfreshTask(refresh);
if (contact.getResfreshTask() != null) {
contact.getResfreshTask().cancel();
}
try {
// try to keep a margin
this.timer.schedule(refresh,
(expHeader.getExpires() - REFRESH_MARGIN) * 1000);
} catch (IllegalArgumentException e) {
logger.debug("the expires value seems to be less than a " +
"minute, let's assume it");
this.timer.schedule(refresh, expHeader.getExpires() * 1000);
}
RefreshSubscriptionTask refresh =
new RefreshSubscriptionTask(contact);
contact.setResfreshTask(refresh);
// do it to remember the dialog in case of a polling
// subscription (which means no call to finalizeSubscription)
contact.setClientDialog(clientTransaction.getDialog());
try {
// try to keep a margin
this.timer.schedule(refresh,
(expHeader.getExpires() - REFRESH_MARGIN) * 1000);
} catch (IllegalArgumentException e) {
logger.debug("the expires value seems to be less than a " +
"minute, let's assume it");
try
{
if (!contact.isResolved())
{
// if contact is not in the contact list
// create it, and add to parent, later will be resolved
if(resolveContactID(contact.getAddress()) == null)
{
ContactGroup parentGroup =
contact.getParentContactGroup();
((ContactGroupSipImpl) parentGroup).
addContact(contact);
// pretend that the contact is created
fireSubscriptionEvent(contact,
parentGroup,
SubscriptionEvent.SUBSCRIPTION_CREATED);
}
finalizeSubscription(contact,
clientTransaction.getDialog());
}
} catch (NullPointerException e)
{
// should not happen
logger.debug("failed to finalize the subscription of the" +
"contact", e);
this.timer.schedule(refresh, expHeader.getExpires() * 1000);
return;
}
}
}
else if(response.getStatusCode() >= Response.MULTIPLE_CHOICES &&
response.getStatusCode() < Response.BAD_REQUEST)
{
logger.info("Response to Subscribe of contact: " + contact +
" - " + response.getReasonPhrase());
}
else if(response.getStatusCode() >= Response.BAD_REQUEST)
{
// if the response is a 423 response, just re-send the request
// with a valid expires value
if (response.getStatusCode() == Response.INTERVAL_TOO_BRIEF) {
MinExpiresHeader min = (MinExpiresHeader)
response.getHeader(MinExpiresHeader.NAME);
if (min == null) {
logger.error("no minimal expires value in this 423 " +
"response");
return;
}
// do it to remember the dialog in case of a polling
// subscription (which means no call to finalizeSubscription)
contact.setClientDialog(clientTransaction.getDialog());
// UNAUTHORIZED (401/407)
} else if (response.getStatusCode() == Response.UNAUTHORIZED
Request request = responseEvent.getClientTransaction()
.getRequest();
ExpiresHeader exp = request.getExpires();
try {
exp.setExpires(min.getExpires());
} catch (InvalidArgumentException e) {
logger.error("can't set the new expires value", e);
return;
}
ClientTransaction transac = null;
try {
transac = this.parentProvider.getDefaultJainSipProvider()
.getNewClientTransaction(request);
} catch (TransactionUnavailableException e) {
logger.error("can't create the client transaction", e);
return;
}
try {
transac.sendRequest();
} catch (SipException e) {
logger.error("can't send the new request", e);
return;
}
return;
// UNAUTHORIZED (401/407)
} else if (response.getStatusCode() == Response.UNAUTHORIZED
|| response.getStatusCode() == Response
.PROXY_AUTHENTICATION_REQUIRED)
{
try {
processAuthenticationChallenge(clientTransaction,
response, sourceProvider);
} catch (OperationFailedException e) {
logger.error("can't handle the challenge", e);
{
try {
processAuthenticationChallenge(clientTransaction,
response, sourceProvider);
} catch (OperationFailedException e) {
logger.error("can't handle the challenge", e);
// we probably won't be able to communicate with the contact
changePresenceStatusForContact(contact,
sipStatusEnum.getStatus(SipStatusEnum.UNKNOWN));
this.subscribedContacts.remove(idheader.getCallId());
contact.setClientDialog(null);
}
// 408 480 486 600 603 : non definitive reject
} else if (response.getStatusCode() == Response.REQUEST_TIMEOUT
// we probably won't be able to communicate with the contact
changePresenceStatusForContact(contact,
sipStatusEnum.getStatus(SipStatusEnum.UNKNOWN));
this.subscribedContacts.remove(idheader.getCallId());
contact.setClientDialog(null);
}
// 408 480 486 600 603 : non definitive reject
} else if (response.getStatusCode() == Response.REQUEST_TIMEOUT
|| response.getStatusCode() == Response
.TEMPORARILY_UNAVAILABLE
|| response.getStatusCode() == Response.BUSY_HERE
|| response.getStatusCode() == Response.BUSY_EVERYWHERE
|| response.getStatusCode() == Response.DECLINE)
{
logger.debug("error received from the network" + response);
if (response.getStatusCode() == Response
.TEMPORARILY_UNAVAILABLE)
{
changePresenceStatusForContact(contact,
sipStatusEnum.getStatus(SipStatusEnum.OFFLINE));
logger.debug("error received from the network" + response);
if (response.getStatusCode() == Response
.TEMPORARILY_UNAVAILABLE)
{
changePresenceStatusForContact(contact,
sipStatusEnum.getStatus(SipStatusEnum.OFFLINE));
} else {
changePresenceStatusForContact(contact,
sipStatusEnum.getStatus(SipStatusEnum.UNKNOWN));
}
this.subscribedContacts.remove(idheader.getCallId());
contact.setClientDialog(null);
fireSubscriptionEvent(contact, contact.getParentContactGroup(),
SubscriptionEvent.SUBSCRIPTION_FAILED,
response.getStatusCode(),
response.getReasonPhrase());
// definitive reject (or not implemented)
} else {
logger.debug("error received from the network" + response);
// we'll never be able to resolve this contact
contact.setResolvable(false);
changePresenceStatusForContact(contact,
sipStatusEnum.getStatus(SipStatusEnum.UNKNOWN));
this.subscribedContacts.remove(idheader.getCallId());
contact.setClientDialog(null);
fireSubscriptionEvent(contact, contact.getParentContactGroup(),
SubscriptionEvent.SUBSCRIPTION_FAILED,
response.getStatusCode(),
response.getReasonPhrase());
}
this.subscribedContacts.remove(idheader.getCallId());
contact.setClientDialog(null);
// definitive reject (or not implemented)
} else {
logger.debug("error received from the network" + response);
// we'll never be able to resolve this contact
contact.setResolvable(false);
changePresenceStatusForContact(contact,
sipStatusEnum.getStatus(SipStatusEnum.UNKNOWN));
this.subscribedContacts.remove(idheader.getCallId());
contact.setClientDialog(null);
}
// NOTIFY
// NOTIFY
} else if (method.equals(Request.NOTIFY)) {
// if it's a final response to a NOTIFY, we try to remove it from
// the list of waited NOTIFY end
@ -3265,11 +3294,30 @@ public String getCurrentStatusMessage() {
public void fireSubscriptionEvent(ContactSipImpl source,
ContactGroup parentGroup,
int eventID)
{
fireSubscriptionEvent(source, parentGroup, eventID,
SubscriptionEvent.ERROR_UNSPECIFIED, null);
}
/**
* Notifies all registered listeners of the new event.
*
* @param source the contact that has caused the event.
* @param parentGroup the group that contains the source contact.
* @param eventID an identifier of the event to dispatch.
*/
public void fireSubscriptionEvent(ContactSipImpl source,
ContactGroup parentGroup,
int eventID,
int errorCode,
String errorReason)
{
SubscriptionEvent evt = new SubscriptionEvent(source
, this.parentProvider
, parentGroup
, eventID);
, eventID
, errorCode
, errorReason);
Iterator listeners = null;
synchronized (this.subscriptionListeners)

Loading…
Cancel
Save