diff options
author | Damian Minkov <damencho@jitsi.org> | 2007-01-13 10:47:34 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2007-01-13 10:47:34 +0000 |
commit | 8ac3b03cc18a5b519b6cd564c1b03e29bd888cc8 (patch) | |
tree | 5675f930141564daa5642d15f0316ab63a813fc1 /src/net/java/sip/communicator/impl/protocol | |
parent | 72686db9291753b65c896eede9a45e9aac435ad9 (diff) | |
download | jitsi-8ac3b03cc18a5b519b6cd564c1b03e29bd888cc8.zip jitsi-8ac3b03cc18a5b519b6cd564c1b03e29bd888cc8.tar.gz jitsi-8ac3b03cc18a5b519b6cd564c1b03e29bd888cc8.tar.bz2 |
Fix adding friends with @yahoo.com suffix.
Diffstat (limited to 'src/net/java/sip/communicator/impl/protocol')
7 files changed, 31 insertions, 37 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ContactGroupYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ContactGroupYahooImpl.java index 6c55018..ab51530 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ContactGroupYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ContactGroupYahooImpl.java @@ -356,7 +356,9 @@ public class ContactGroupYahooImpl while (contacts.hasNext()) { ContactYahooImpl item = (ContactYahooImpl) contacts.next(); - if(item.getAddress().equals(id)) + + if(YahooSession.getYahooUserID(item.getAddress()) + .equals(YahooSession.getYahooUserID(id))) return item; } return null; diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java index cef5594..12ceaa3 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java @@ -112,7 +112,8 @@ public class ContactYahooImpl { if (obj == null || !(obj instanceof ContactYahooImpl) - || !(((ContactYahooImpl)obj).getAddress().equals(getAddress()) + || !(YahooSession.getYahooUserID(((ContactYahooImpl)obj).getAddress()) + .equals(YahooSession.getYahooUserID(getAddress())) && ((ContactYahooImpl)obj).getProtocolProvider() == getProtocolProvider())) return false; diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java index 5343a5f..48acfc8 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java @@ -615,10 +615,6 @@ public class OperationSetPersistentPresenceYahooImpl if(! (parent instanceof ContactGroupYahooImpl) ) throw new IllegalArgumentException( "Argument is not an yahoo contact group (group=" + parent + ")"); - - if(contactIdentifier.indexOf("@") > -1 ) - contactIdentifier = - contactIdentifier.substring(0, contactIdentifier.indexOf("@")); ssContactList.addContact((ContactGroupYahooImpl)parent, contactIdentifier); } @@ -1089,7 +1085,7 @@ public class OperationSetPersistentPresenceYahooImpl ContactYahooImpl contact = (ContactYahooImpl)evt.getSourceContact(); - if(!contact.isPersistent()) + if(!contact.isPersistent() || !contact.isResolved()) return; handleContactStatusChange(contact, diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java index eb08dc6..46e6c7e 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java @@ -213,14 +213,16 @@ public class ProtocolProviderServiceYahooImpl try { - yahooSession.logout(); + if(yahooSession != null && + yahooSession.getSessionStatus() == StatusConstants.MESSAGING) + yahooSession.logout(); } catch(Exception ex) { - logger.error("Cannot logout!"); + logger.error("Cannot logout! ", ex); } - yahooSession.reset(); + yahooSession = null; if(fireEvent) { @@ -473,7 +475,7 @@ public class ProtocolProviderServiceYahooImpl **/ public void connectionClosed(SessionEvent ev) { - unregister(false); + unregister(true); if(isRegistered()) fireRegistrationStateChanged( getRegistrationState(), diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java index 936d405..f24dfcb 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java @@ -306,16 +306,6 @@ public class ServerStoredContactListYahooImpl if (result != null) return result; - - } - - Iterator rootContacts = rootGroup.contacts(); - while (rootContacts.hasNext()) - { - ContactYahooImpl item = (ContactYahooImpl) rootContacts.next(); - - if(item.getAddress().equals(id)) - return item; } return null; @@ -343,16 +333,6 @@ public class ServerStoredContactListYahooImpl return contactGroup; } - Iterator contacts = rootGroup.contacts(); - - while(contacts.hasNext()) - { - ContactYahooImpl contact = (ContactYahooImpl) contacts.next(); - - if( contact.equals(child)) - return rootGroup; - } - return null; } @@ -383,7 +363,7 @@ public class ServerStoredContactListYahooImpl * @param parent the group under which we want the new contact placed. * @throws OperationFailedException if the contact already exist */ - public void addContact(final ContactGroupYahooImpl parent, final String id) + public void addContact(final ContactGroupYahooImpl parent, String id) throws OperationFailedException { logger.trace("Adding contact " + id + " to parent=" + parent); @@ -401,9 +381,11 @@ public class ServerStoredContactListYahooImpl OperationFailedException.SUBSCRIPTION_ALREADY_EXISTS); } + createUnresolvedContact(parent, id); + try { - yahooSession.addFriend(id, parent.getGroupName()); + yahooSession.addFriend(YahooSession.getYahooUserID(id), parent.getGroupName()); } catch(IOException ex) { @@ -470,7 +452,7 @@ public class ServerStoredContactListYahooImpl ContactYahooImpl createUnresolvedContact(ContactGroup parentGroup, String id) { ContactYahooImpl newUnresolvedContact - = new ContactYahooImpl(id, this, false); + = new ContactYahooImpl(id, this, true); if(parentGroup instanceof ContactGroupYahooImpl) ((ContactGroupYahooImpl)parentGroup). @@ -898,6 +880,12 @@ public class ServerStoredContactListYahooImpl return; } + else if(!contactToAdd.isResolved()) + { + // the contact is already created just resole it + contactToAdd.setResolved(ev.getFriend()); + return; + } Object isWaitingForMove = waitMove.get(contactID); diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java index 0ddddc1..bc524f3 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java @@ -25,9 +25,7 @@ public class YahooAccountID */ YahooAccountID(String id, Map accountProperties ) { - super((id.indexOf("@") > -1 ) - ? id.substring(0, id.indexOf("@")) - : id, + super(YahooSession.getYahooUserID(id), accountProperties, ProtocolNames.YAHOO, "yahoo.com"); } } diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooSession.java b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooSession.java index be04d71..92a0030 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooSession.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooSession.java @@ -25,4 +25,11 @@ public class YahooSession { transmitGroupRename(oldName, newName); } + + public static String getYahooUserID(String id) + { + return (id.indexOf("@") > -1 ) + ? id.substring(0, id.indexOf("@")) + : id; + } } |