From 3fca394c5bfccdecf60cf65515430218df4a471d Mon Sep 17 00:00:00 2001 From: Sebastien Vincent Date: Tue, 22 Nov 2011 10:27:46 +0000 Subject: [PATCH] Attempts to fix slowly loaded contact list. --- .../jabber/ProtocolProviderServiceJabberImpl.java | 14 ++++++++------ .../jabber/ServerStoredContactListJabberImpl.java | 10 ++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index e3337a1f4..d01ef51d9 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -179,6 +179,11 @@ public class ProtocolProviderServiceJabberImpl private static final String IS_CALLING_DISABLED = "net.java.sip.communicator.impl.protocol.jabber.CALLING_DISABLED"; + /** + * Smack packet reply timeout. + */ + public static final int SMACK_PACKET_REPLY_TIMEOUT = 45000; + /** * Used to connect to a XMPP server. */ @@ -656,7 +661,7 @@ private ConnectState connectUsingSRVRecords( * protocol is Google Talk, the user ID including the service name is used. * For other protocols, if the login with the user ID without the service * name fails, a second attempt including the service name is made. - * + * * @param currentAddress the IP address to connect to * @param password the password of the user * @param serviceName the domain name of the user's login @@ -755,7 +760,7 @@ private void loadResource() /** * Load the password from the account configuration or ask the user. - * + * * @param authority SecurityAuthority * @param reasonCode the authentication reason code. Indicates the reason of * this authentication. @@ -820,7 +825,7 @@ private String loadPassword(SecurityAuthority authority, int reasonCode) /** * Sets the global proxy information based on the configuration - * + * * @throws OperationFailedException */ private void loadProxy() throws OperationFailedException @@ -1473,9 +1478,6 @@ protected void initialize(String screenname, OperationSetGenericNotifications.class, new OperationSetGenericNotificationsJabberImpl(this)); - // let sufficient time for packet reply - SmackConfiguration.setPacketReplyTimeout(45000); - isInitialized = true; } } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java index 5a0bf74e1..fbf158ad3 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java @@ -449,7 +449,12 @@ public void addContact(ContactGroup parent, String id) if(parent != null) parentNames = new String[]{parent.getGroupName()}; + // modify our reply timeout because some XMPP may send "result" IQ + // late (> 5 secondes). + SmackConfiguration.setPacketReplyTimeout( + ProtocolProviderServiceJabberImpl.SMACK_PACKET_REPLY_TIMEOUT); this.roster.createEntry(completeID, completeID, parentNames); + SmackConfiguration.setPacketReplyTimeout(5000); } catch (XMPPException ex) { @@ -720,9 +725,14 @@ public void moveContact(ContactJabberImpl contact, { // will create the entry with the new group so it can be removed // from other groups if any + // modify our reply timeout because some XMPP may send "result" IQ + // late (> 5 secondes). + SmackConfiguration.setPacketReplyTimeout( + ProtocolProviderServiceJabberImpl.SMACK_PACKET_REPLY_TIMEOUT); roster.createEntry(contact.getSourceEntry().getUser(), contact.getDisplayName(), new String[]{newParent.getGroupName()}); + SmackConfiguration.setPacketReplyTimeout(5000); } catch (XMPPException ex) {