aboutsummaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2011-12-20 14:49:47 +0000
committerDamian Minkov <damencho@jitsi.org>2011-12-20 14:49:47 +0000
commit2ec466b61f66fa48c018edc87752fa86005e341e (patch)
tree1241e1495d4cbc7c7fe47c9224fb8df0b552c244 /src/net
parent63ecfb3cfcb1977fb63ff0d30a8f2fe51d6e8a36 (diff)
downloadjitsi-2ec466b61f66fa48c018edc87752fa86005e341e.zip
jitsi-2ec466b61f66fa48c018edc87752fa86005e341e.tar.gz
jitsi-2ec466b61f66fa48c018edc87752fa86005e341e.tar.bz2
Removes awaiting authorization group for icq as contacts are currently marked as waiting for authorization.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java6
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java138
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java129
3 files changed, 44 insertions, 229 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java
index 0483927..b428763 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java
@@ -484,12 +484,6 @@ public class ContactGroupIcqImpl
for (Buddy buddy : serverBuddies)
{
- if(buddy.isAwaitingAuthorization())
- {
- ssclCallback.addAwaitingAuthorizationContact(buddy);
- continue;
- }
-
ContactIcqImpl contact
= findContact(buddy.getScreenname().getFormatted());
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
index 146dc2b..a5bd743 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
@@ -778,25 +778,6 @@ public class OperationSetPersistentPresenceIcqImpl
"The specified group is not an icq contact group."
+ newParent);
- ContactGroupIcqImpl theAwaitingAuthorizationGroup =
- ssContactList.findContactGroup(
- ServerStoredContactListIcqImpl.awaitingAuthorizationGroupName);
-
- if(newParent.equals(theAwaitingAuthorizationGroup))
- throw new IllegalArgumentException(
- "Cannot move contacts to this group : " +
- theAwaitingAuthorizationGroup);
-
- if(((ContactIcqImpl)contactToMove).isPersistent()
- && !contactToMove.getParentContactGroup().isPersistent())
- {
- if(contactToMove.getParentContactGroup().equals(
- theAwaitingAuthorizationGroup))
- throw new IllegalArgumentException(
- "Cannot move contacts from this group : " +
- theAwaitingAuthorizationGroup);
- }
-
ssContactList.moveContact((ContactIcqImpl)contactToMove,
(ContactGroupIcqImpl)newParent);
}
@@ -1432,8 +1413,6 @@ public class OperationSetPersistentPresenceIcqImpl
if (logger.isTraceEnabled())
logger.trace("authorizationAccepted from " + screenname);
Contact srcContact = findContactByID(screenname.getFormatted());
- ssContactList.moveAwaitingAuthorizationContact(
- (ContactIcqImpl)srcContact);
authorizationHandler.processAuthorizationResponse(
new AuthorizationResponse(AuthorizationResponse.ACCEPT, reason)
@@ -1489,48 +1468,6 @@ public class OperationSetPersistentPresenceIcqImpl
if(buddy instanceof VolatileBuddy)
((VolatileBuddy)buddy).setAwaitingAuthorization(true);
-
- ContactGroupIcqImpl theAwaitingAuthorizationGroup =
- ssContactList.findContactGroup(
- ServerStoredContactListIcqImpl.awaitingAuthorizationGroupName);
-
-
- if(theAwaitingAuthorizationGroup == null)
- {
- theAwaitingAuthorizationGroup
- = new ContactGroupIcqImpl(
- new VolatileGroup(
- ServerStoredContactListIcqImpl
- .awaitingAuthorizationGroupName),
- null,
- ssContactList,
- false);
-
- ((RootContactGroupIcqImpl)ssContactList.getRootGroup()).
- addSubGroup(theAwaitingAuthorizationGroup);
-
- ssContactList.fireGroupEvent(theAwaitingAuthorizationGroup
- , ServerStoredGroupEvent.GROUP_CREATED_EVENT);
- }
-
-
- parent.removeContact(srcContact);
- theAwaitingAuthorizationGroup.addContact(srcContact);
-
- try
- {
- Thread.sleep(500);
- }
- catch (InterruptedException ex)
- {
- /*
- * I don't know why the exception is ignored, I just fixed
- * an incorrect use of Object.wait(long).
- */
- }
-
- fireSubscriptionMovedEvent(srcContact,
- parent, theAwaitingAuthorizationGroup);
}
AuthorizationRequest authRequest =
@@ -1620,47 +1557,56 @@ public class OperationSetPersistentPresenceIcqImpl
if (logger.isTraceEnabled())
logger.trace("Running status retreiver for AwaitingAuthorizationContacts");
- ContactGroupIcqImpl theAwaitingAuthorizationGroup =
- ssContactList.findContactGroup(
- ServerStoredContactListIcqImpl.awaitingAuthorizationGroupName);
-
- if(theAwaitingAuthorizationGroup == null)
- return;
+ Iterator<ContactGroup> groupsIter
+ = getServerStoredContactListRoot().subgroups();
- Iterator<Contact> iter = theAwaitingAuthorizationGroup.contacts();
- while (iter.hasNext())
+ while(groupsIter.hasNext())
{
- ContactIcqImpl sourceContact = (ContactIcqImpl)iter.next();
- String sourceContactAddress = sourceContact.getAddress();
- PresenceStatus newStatus
- = queryContactStatus(sourceContactAddress);
- PresenceStatus oldStatus = sourceContact.getPresenceStatus();
+ ContactGroup group = groupsIter.next();
+ Iterator<Contact> contactsIter = group.contacts();
- if(newStatus.equals(oldStatus))
- continue;
+ while(contactsIter.hasNext())
+ {
+ ContactIcqImpl sourceContact
+ = (ContactIcqImpl)contactsIter.next();
- sourceContact.updatePresenceStatus(newStatus);
+ if(!sourceContact.getJoustSimBuddy()
+ .isAwaitingAuthorization())
+ continue;
- fireContactPresenceStatusChangeEvent(
- sourceContact,
- theAwaitingAuthorizationGroup,
- oldStatus,
- newStatus);
+ String sourceContactAddress = sourceContact.getAddress();
+ PresenceStatus newStatus
+ = queryContactStatus(sourceContactAddress);
+ PresenceStatus oldStatus = sourceContact.getPresenceStatus();
- if (!newStatus.equals(IcqStatusEnum.OFFLINE)
- && !buddiesSeenAvailable.contains(sourceContactAddress))
- {
- buddiesSeenAvailable.add(sourceContactAddress);
- try
- {
- AuthorizationRequest req = new AuthorizationRequest();
- req.setReason("I'm resending my request. Please authorize me!");
+ if(newStatus.equals(oldStatus))
+ continue;
- opSetExtendedAuthorizations
- .reRequestAuthorization(req, sourceContact);
- } catch (OperationFailedException ex)
+ sourceContact.updatePresenceStatus(newStatus);
+
+ fireContactPresenceStatusChangeEvent(
+ sourceContact,
+ sourceContact.getParentContactGroup(),
+ oldStatus,
+ newStatus);
+
+ if (!newStatus.equals(IcqStatusEnum.OFFLINE)
+ && !buddiesSeenAvailable.contains(sourceContactAddress))
{
- logger.error("failed to reRequestAuthorization", ex);
+ buddiesSeenAvailable.add(sourceContactAddress);
+ try
+ {
+ AuthorizationRequest req =
+ new AuthorizationRequest();
+ req.setReason("I'm resending my request. " +
+ "Please authorize me!");
+
+ opSetExtendedAuthorizations
+ .reRequestAuthorization(req, sourceContact);
+ } catch (OperationFailedException ex)
+ {
+ logger.error("failed to reRequestAuthorization", ex);
+ }
}
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java
index d6b2048..2d63c21 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java
@@ -98,12 +98,6 @@ public class ServerStoredContactListIcqImpl
private NickRetriever nickRetriever = null;
/**
- * Used for retrieving missing nicks on specified contacts
- */
- static final String awaitingAuthorizationGroupName
- = "Awaiting authorization";
-
- /**
* Creates a ServerStoredContactList wrapper for the specified BuddyList.
*
* @param parentOperationSet the operation set that created us and that
@@ -747,8 +741,7 @@ public class ServerStoredContactListIcqImpl
ContactGroupIcqImpl gr =
(ContactGroupIcqImpl)getRootGroup().getGroup(i);
- if(!gr.isPersistent() &&
- !gr.getGroupName().equals(awaitingAuthorizationGroupName))
+ if(!gr.isPersistent())
return gr;
}
@@ -769,94 +762,6 @@ public class ServerStoredContactListIcqImpl
nickRetriever.addContact(c);
}
- protected void addAwaitingAuthorizationContact(Buddy buddy)
- {
- //Check whether a Awaiting authorization group already exists and if
- //not create one
- ContactGroupIcqImpl theAwaitingAuthorizationGroup =
- findContactGroup(awaitingAuthorizationGroupName);
-
- if(theAwaitingAuthorizationGroup == null)
- {
- List<Buddy> emptyBuddies = new LinkedList<Buddy>();
- theAwaitingAuthorizationGroup = new ContactGroupIcqImpl(
- new VolatileGroup(awaitingAuthorizationGroupName),
- emptyBuddies,
- this,
- false);
-
- this.rootGroup.addSubGroup(theAwaitingAuthorizationGroup);
-
- fireGroupEvent(theAwaitingAuthorizationGroup
- , ServerStoredGroupEvent.GROUP_CREATED_EVENT);
- }
-
- ContactGroupIcqImpl oldParentGroup = null;
- ContactIcqImpl newContact = findContactByJoustSimBuddy(buddy);
-
- if(newContact != null)
- oldParentGroup = (ContactGroupIcqImpl)newContact
- .getParentContactGroup();
-
- boolean fireResolvedEvent = false;
-
- if(newContact == null)
- {
- newContact = new ContactIcqImpl(
- buddy, ServerStoredContactListIcqImpl.this, true, true);
- }
- else
- {
- oldParentGroup.removeContact(newContact);
-
- newContact.setJoustSimBuddy(buddy);
- newContact.setPersistent(true);
- if(!newContact.isResolved())
- {
- newContact.setResolved(true);
- fireResolvedEvent = true;
- }
- }
-
- theAwaitingAuthorizationGroup.addContact(newContact);
-
- int index = theAwaitingAuthorizationGroup.findContactIndex(newContact);
-
- //register a listener for name changes of this buddy
- buddy.addBuddyListener(jsimBuddyListener);
-
- //tell listeners about the added group
- if(oldParentGroup == null)
- {
- fireContactAdded(theAwaitingAuthorizationGroup, newContact);
- }
- else if(oldParentGroup != theAwaitingAuthorizationGroup)
- {
- fireContactMoved(oldParentGroup, theAwaitingAuthorizationGroup
- , newContact, index);
- }
-
- //fire an event in case the contact has just been resolved.
- if(fireResolvedEvent)
- {
- fireContactResolved(theAwaitingAuthorizationGroup, newContact);
- }
- }
-
- protected void moveAwaitingAuthorizationContact(ContactIcqImpl contact)
- {
- ContactGroupIcqImpl parentGroup = findGroup(contact.getJoustSimBuddy());
-
- if(parentGroup == null)
- return;
-
- findContactGroup(awaitingAuthorizationGroupName).removeContact(contact);
- parentGroup.addContact(contact);
-
- fireContactMoved(findContactGroup(awaitingAuthorizationGroupName),
- parentGroup, contact, parentGroup.findContactIndex(contact));
- }
-
ContactGroupIcqImpl findGroup(Buddy buddy)
{
Iterator<ContactGroup> iter = rootGroup.subgroups();
@@ -1033,12 +938,6 @@ public class ServerStoredContactListIcqImpl
return;
}
- if(buddy.isAwaitingAuthorization())
- {
- addAwaitingAuthorizationContact(buddy);
- return;
- }
-
if(newContact == null)
{
newContact = new ContactIcqImpl(
@@ -1102,31 +1001,7 @@ public class ServerStoredContactListIcqImpl
ContactGroupIcqImpl parentGroup = findContactGroup(group);
ContactIcqImpl contactToRemove = parentGroup.findContact(buddy);
- if(contactToRemove == null)
- {
- // this buddy is not in this group
- // it can be in awaiting authorization group
- // will search it there
-
- ContactGroupIcqImpl theAwaitingAuthorizationGroup =
- findContactGroup(awaitingAuthorizationGroupName);
- if(theAwaitingAuthorizationGroup != null)
- {
- contactToRemove =
- theAwaitingAuthorizationGroup.
- findContact(buddy.getScreenname().getFormatted());
-
- if(contactToRemove == null)
- return;
-
- theAwaitingAuthorizationGroup.removeContact(contactToRemove);
-
- buddy.removeBuddyListener(jsimBuddyListener);
-
- fireContactRemoved(theAwaitingAuthorizationGroup, contactToRemove);
- }
- }
- else
+ if(contactToRemove != null)
{
parentGroup.removeContact(contactToRemove);