From f3845d02cb66580b3a4851c07421bded74dcd3ef Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Thu, 17 Feb 2011 15:38:18 +0000 Subject: When creating new account (simple or advance form) make sure we don't reuse old AccountRegistration instances. --- .../communicator/impl/protocol/zeroconf/BonjourService.java | 6 +++++- .../GoogleTalkAccountRegistrationWizard.java | 12 ++++++++++++ .../jabberaccregwizz/JabberAccountRegistrationWizard.java | 12 ++++++++++++ .../plugin/sipaccregwizz/SIPAccountRegistrationWizard.java | 11 +++++++++++ .../ZeroconfAccountRegistrationWizard.java | 12 ++++++++++++ 5 files changed, 52 insertions(+), 1 deletion(-) (limited to 'src/net') diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java index bd1ed01..b8fe5dc 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java @@ -402,10 +402,14 @@ public class BonjourService extends Thread public void serviceRemoved(ServiceEvent event) { String name = event.getName(); - if (name.equals(id)) return; + if (name.equals(id)) + return; ContactZeroconfImpl contact = getContact(name, null); + if(contact == null) + return; + opSetPersPresence.changePresenceStatusForContact(contact, ZeroconfStatusEnum.OFFLINE); if (logger.isDebugEnabled()) diff --git a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java index 0129b1b..ce8ba2a 100644 --- a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java @@ -108,6 +108,13 @@ public class GoogleTalkAccountRegistrationWizard public Iterator getPages() { java.util.List pages = new ArrayList(); + + // create new registration, our container needs the pages + // this means this is a new wizard and we must reset all data + // it will be invoked and when the wizard cleans and unregister + // our pages, but this fix don't hurt in this situation. + this.registration = new GoogleTalkAccountRegistration(); + firstWizardPage = new FirstWizardPage(this); pages.add(firstWizardPage); @@ -431,6 +438,11 @@ public class GoogleTalkAccountRegistrationWizard public Object getSimpleForm() { + // when creating first wizard page, create and new + // AccountRegistration to avoid reusing old instances and + // data left from old registrations + registration = new GoogleTalkAccountRegistration(); + firstWizardPage = new FirstWizardPage(this); return firstWizardPage.getSimpleForm(); } diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java index c13785a..a0b6c8d 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java @@ -121,6 +121,13 @@ public class JabberAccountRegistrationWizard public Iterator getPages() { java.util.List pages = new ArrayList(); + + // create new registration, our container needs the pages + // this means this is a new wizard and we must reset all data + // it will be invoked and when the wizard cleans and unregister + // our pages, but this fix don't hurt in this situation. + this.registration = new JabberAccountRegistration(); + firstWizardPage = new FirstWizardPage(this); pages.add(firstWizardPage); @@ -555,6 +562,11 @@ public class JabberAccountRegistrationWizard */ public Object getSimpleForm() { + // when creating first wizard page, create and new + // AccountRegistration to avoid reusing old instances and + // data left from old registrations + this.registration = new JabberAccountRegistration(); + firstWizardPage = new FirstWizardPage(this); return firstWizardPage.getSimpleForm(); } diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java index 0846193..aeede85 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java @@ -116,6 +116,12 @@ public class SIPAccountRegistrationWizard public Iterator getPages() { java.util.List pages = new ArrayList(); + // create new registration, our container needs the pages + // this means this is a new wizard and we must reset all data + // it will be invoked and when the wizard cleans and unregister + // our pages, but this fix don't hurt in this situation. + this.registration = new SIPAccountRegistration(); + // If the first wizard page was already created if (firstWizardPage == null) firstWizardPage = new FirstWizardPage(this); @@ -685,6 +691,11 @@ public class SIPAccountRegistrationWizard */ public Object getSimpleForm() { + // when creating first wizard page, create and new + // AccountRegistration to avoid reusing old instances and + // data left from old registrations + this.registration = new SIPAccountRegistration(); + firstWizardPage = new FirstWizardPage(this); return firstWizardPage.getSimpleForm(); } diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java index de0fdc6..a9b069a 100644 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java @@ -108,6 +108,13 @@ public class ZeroconfAccountRegistrationWizard public Iterator getPages() { java.util.List pages = new ArrayList(); + + // create new registration, our container needs the pages + // this means this is a new wizard and we must reset all data + // it will be invoked and when the wizard cleans and unregister + // our pages, but this fix don't hurt in this situation. + this.registration = new ZeroconfAccountRegistration(); + firstWizardPage = new FirstWizardPage(this); pages.add(firstWizardPage); @@ -383,6 +390,11 @@ public class ZeroconfAccountRegistrationWizard public Object getSimpleForm() { + // when creating first wizard page, create and new + // AccountRegistration to avoid reusing old instances and + // data left from old registrations + this.registration = new ZeroconfAccountRegistration(); + firstWizardPage = new FirstWizardPage(this); return firstWizardPage.getSimpleForm(); } -- cgit v1.1