diff options
author | Damian Minkov <damencho@jitsi.org> | 2008-04-23 14:36:18 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2008-04-23 14:36:18 +0000 |
commit | d19ad54151bbd00c001494c045baea3df5743a9f (patch) | |
tree | c003a4459c921466e291393bcd8118d09e591492 /src/net/java/sip | |
parent | 935e212b1900b2b59003aff23cd4d9a03f201838 (diff) | |
download | jitsi-d19ad54151bbd00c001494c045baea3df5743a9f.zip jitsi-d19ad54151bbd00c001494c045baea3df5743a9f.tar.gz jitsi-d19ad54151bbd00c001494c045baea3df5743a9f.tar.bz2 |
Fix when changing rss contact address from feed:// to http://
the metacontact list service to see the same address as the one used when start creating it. Otherwise contact is created ok but error dialog is show with error creating contact.
Diffstat (limited to 'src/net/java/sip')
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/rss/ContactRssImpl.java | 19 | ||||
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/rss/OperationSetPersistentPresenceRssImpl.java | 24 |
2 files changed, 33 insertions, 10 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ContactRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ContactRssImpl.java index 3f2fe17..be6cbb5 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ContactRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ContactRssImpl.java @@ -54,7 +54,12 @@ public class ContactRssImpl /** * This contact's URL (URL of the RSS feed). */ - private URL contactID = null; + private URL rssURL = null; + + /** + * This contact id (http://... or feed://...) + */ + private String contactID = null; /** * The provider that created us. @@ -98,11 +103,13 @@ public class ContactRssImpl * the rss flow associated with this contact. * @param parentProvider the provider that created us. */ - public ContactRssImpl(URL rssURL, + public ContactRssImpl(String contactID, + URL rssURL, RssFeedReader rssFeedReader, ProtocolProviderServiceRssImpl parentProvider) { - this.contactID = rssURL; + this.contactID = contactID; + this.rssURL = rssURL; this.parentProvider = parentProvider; this.rssFeedReader = rssFeedReader; } @@ -127,7 +134,7 @@ public class ContactRssImpl */ public String getAddress() { - return contactID.toString(); + return contactID; } /** @@ -137,7 +144,7 @@ public class ContactRssImpl */ public URL getRssURL() { - return contactID; + return rssURL; } /** @@ -151,7 +158,7 @@ public class ContactRssImpl { if(nickName == null) { - return contactID.toExternalForm(); + return contactID; } else { diff --git a/src/net/java/sip/communicator/impl/protocol/rss/OperationSetPersistentPresenceRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/OperationSetPersistentPresenceRssImpl.java index 0d36968..8a285cd 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/OperationSetPersistentPresenceRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/OperationSetPersistentPresenceRssImpl.java @@ -844,13 +844,21 @@ public class OperationSetPersistentPresenceRssImpl { URL rssURL = null; + String contactIdentifierURL = contactIdentifier; // in order to allow adding of URIs like feed://a.host.com/feed.xml - if (contactIdentifier.startsWith("feed")) - contactIdentifier = contactIdentifier.replaceFirst("feed", "http"); + if (contactIdentifierURL.startsWith("feed")) + contactIdentifierURL = contactIdentifierURL.replaceFirst("feed", "http"); + + if(findContactByID(contactIdentifier) != null) + { + logger.debug( + "contact with same id already exists - " + contactIdentifier); + return; + } try { - rssURL = new URL(contactIdentifier); + rssURL = new URL(contactIdentifierURL); } catch (MalformedURLException ex) { @@ -871,6 +879,7 @@ public class OperationSetPersistentPresenceRssImpl rssFeedReader.retrieveFlow(); ContactRssImpl contact = new ContactRssImpl( + contactIdentifier, rssURL , rssFeedReader , parentProvider); @@ -990,9 +999,15 @@ public class OperationSetPersistentPresenceRssImpl throws IllegalArgumentException { URL rssURL = null; + + String contactIdentifierURL = address; + // in order to allow adding of URIs like feed://a.host.com/feed.xml + if (contactIdentifierURL.startsWith("feed")) + contactIdentifierURL = contactIdentifierURL.replaceFirst("feed", "http"); + try { - rssURL = new URL(address); + rssURL = new URL(contactIdentifierURL); } catch (MalformedURLException ex) { @@ -1004,6 +1019,7 @@ public class OperationSetPersistentPresenceRssImpl } ContactRssImpl contact = new ContactRssImpl( + address, rssURL , new RssFeedReader(rssURL) , parentProvider); |