aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java
diff options
context:
space:
mode:
authorSymphorien Wanko <wsympho@gmail.com>2009-03-16 21:40:56 +0000
committerSymphorien Wanko <wsympho@gmail.com>2009-03-16 21:40:56 +0000
commit3039065a1623299b48069d4e6ae95774206b1adc (patch)
tree2f030f74dfff641aff5344527682f6c05781670a /src/net/java
parentcce2f8e825d76e00d13a49eba44c3d87a04e7ea4 (diff)
downloadjitsi-3039065a1623299b48069d4e6ae95774206b1adc.zip
jitsi-3039065a1623299b48069d4e6ae95774206b1adc.tar.gz
jitsi-3039065a1623299b48069d4e6ae95774206b1adc.tar.bz2
fix bug introduced by previous commit
make sure a closed chat window will open if the user try to join again in the same session
Diffstat (limited to 'src/net/java')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java4
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java88
2 files changed, 55 insertions, 37 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java
index 6b7f61b..a17a516 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java
@@ -597,6 +597,10 @@ public class ConferenceChatManager
}
this.joinChatRoom(chatRoomWrapper);
+ ChatWindowManager chatWindowManager
+ = GuiActivator.getUIService().getChatWindowManager();
+ chatWindowManager.openChat(
+ chatWindowManager.getMultiChat(chatRoomWrapper), true);
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java
index 6a5c594..0286875 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java
@@ -274,50 +274,64 @@ public class OperationSetMultiUserChatJabberImpl
ChatRoom room = chatRoomCache.get(canonicalRoomName);
- if (room == null)
+ if (room != null)
+ return room;
+
+ try
{
- try
+ RoomInfo infos = MultiUserChat.getRoomInfo(
+ getXmppConnection(), canonicalRoomName);
+ if (infos.getRoom().equals(canonicalRoomName))
{
- Collection<HostedRoom> co =
- MultiUserChat.getHostedRooms(
- getXmppConnection(), canonicalRoomName);
- for (HostedRoom ho : co)
- {
- if (ho.getJid().equals(canonicalRoomName))
- {
- MultiUserChat muc =
- new MultiUserChat(
- getXmppConnection(), canonicalRoomName);
-
- room = new ChatRoomJabberImpl(muc,
- jabberProvider);
-
- chatRoomCache.put(canonicalRoomName, room);
- break;
- }
- }
- } catch (XMPPException ex)
+ MultiUserChat muc =
+ new MultiUserChat(getXmppConnection(), canonicalRoomName);
+ room = new ChatRoomJabberImpl(muc, jabberProvider);
+ chatRoomCache.put(canonicalRoomName, room);
+ return room;
+ }
+ }
+ catch (XMPPException xe)
+ {
+ return null;
+ }
+ catch (NullPointerException ne)
+ {
+ // caused by some bug in smack, we will try another method
+ }
+
+ try
+ {
+ // getHostedRooms will let us if the room doesnt exists
+ // by raising an XMPPException with
+ // XMPPError.Condition.item_not_found as error condition.
+ // if we get anything else, we can conclude so we create
+ // the MultiUserChat instance and the failure point will be
+ // join method
+ Collection<HostedRoom> co =
+ MultiUserChat.getHostedRooms(
+ getXmppConnection(), canonicalRoomName);
+ }
+ catch (XMPPException xe)
+ {
+ if (xe.getXMPPError().getCondition().equals(
+ XMPPError.Condition.item_not_found.toString()))
{
- // if we get any error other than not found, it is not guaranted
- // the room doesnt exists. we will know it only when we will
- // try to join the room
- if (!ex.getXMPPError().getCondition().equals(
- XMPPError.Condition.item_not_found.toString()))
- {
- MultiUserChat muc =
- new MultiUserChat(
- getXmppConnection(), canonicalRoomName);
+ return null;
+ }
+ else
+ {
+ MultiUserChat muc =
+ new MultiUserChat(
+ getXmppConnection(), canonicalRoomName);
- room = new ChatRoomJabberImpl(muc,
- jabberProvider);
+ room = new ChatRoomJabberImpl(muc,
+ jabberProvider);
- chatRoomCache.put(canonicalRoomName, room);
- }
- logger.debug(
- "failed to find room " + canonicalRoomName + "\n", ex);
+ chatRoomCache.put(canonicalRoomName, room);
+ return room;
}
}
- return room;
+ return null;
}
/**