diff options
author | hristoterezov <hristo@jitsi.org> | 2014-05-15 18:56:28 +0300 |
---|---|---|
committer | hristoterezov <hristo@jitsi.org> | 2014-05-15 18:56:28 +0300 |
commit | 7ecbe5cacdb4bca32ae36926eb2120456922fd71 (patch) | |
tree | 179824ac784094ba23f0d6eb7b2468964e401b5d /src/net/java/sip/communicator/impl | |
parent | b0c1c997c9eefaabe646d332d23c195b040547ef (diff) | |
download | jitsi-7ecbe5cacdb4bca32ae36926eb2120456922fd71.zip jitsi-7ecbe5cacdb4bca32ae36926eb2120456922fd71.tar.gz jitsi-7ecbe5cacdb4bca32ae36926eb2120456922fd71.tar.bz2 |
Fixes an issue with inviting contacts to one-to-one chat that creates chat room and then renames the creator automatically. With the fix inviting someone will only create the chat room without renaming the creator.
Diffstat (limited to 'src/net/java/sip/communicator/impl')
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java | 38 | ||||
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java | 22 |
2 files changed, 16 insertions, 44 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java index 38418a6..ad895e7 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java @@ -548,7 +548,8 @@ public class ChatRoomJabberImpl public void join(byte[] password) throws OperationFailedException { - joinAs(getOurDisplayName(), password); + joinAs(JabberActivator.getGlobalDisplayDetailsService() + .getDisplayName(getParentProvider()), password); } /** @@ -561,7 +562,8 @@ public class ChatRoomJabberImpl public void join() throws OperationFailedException { - joinAs(getOurDisplayName()); + joinAs(JabberActivator.getGlobalDisplayDetailsService() + .getDisplayName(getParentProvider())); } /** @@ -717,38 +719,6 @@ public class ChatRoomJabberImpl } /** - * Returns the display name of our account - * - * @return the display name of our account. - */ - private String getOurDisplayName() - { - OperationSetServerStoredAccountInfo accountInfoOpSet - = provider.getOperationSet( - OperationSetServerStoredAccountInfo.class); - - if(accountInfoOpSet == null) - return provider.getAccountID().getUserID(); - - ServerStoredDetails.DisplayNameDetail displayName = null; - Iterator<ServerStoredDetails.GenericDetail> displayNameDetails - = accountInfoOpSet.getDetails(ServerStoredDetails.DisplayNameDetail.class); - - if (displayNameDetails.hasNext()) - displayName = (ServerStoredDetails.DisplayNameDetail) displayNameDetails.next(); - - if(displayName == null) - return provider.getAccountID().getUserID(); - - String result = displayName.getString(); - - if(result == null || result.length() == 0) - return provider.getAccountID().getUserID(); - else - return result; - } - - /** * Returns that <tt>ChatRoomJabberRole</tt> instance corresponding to the * <tt>smackRole</tt> string. * 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 b02eac1..c6bff2c 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java @@ -59,7 +59,7 @@ public class OperationSetMultiUserChatJabberImpl * to match incoming messages to <tt>Contact</tt>s and vice versa. */ private OperationSetPersistentPresenceJabberImpl opSetPersPresence = null; - + /** * Instantiates the user operation set with a currently valid instance of * the Jabber protocol provider. @@ -88,7 +88,7 @@ public class OperationSetMultiUserChatJabberImpl * chat room around. * @param chatRoom the associated chat room instance */ - public void addSmackInvitationRejectionListener(MultiUserChat muc, + public void addSmackInvitationRejectionListener(MultiUserChat muc, ChatRoom chatRoom) { muc.addInvitationRejectionListener( @@ -145,7 +145,9 @@ public class OperationSetMultiUserChatJabberImpl { muc = new MultiUserChat( getXmppConnection(), getCanonicalRoomName(roomName)); - muc.create(StringUtils.parseName(getXmppConnection().getUser())); + + muc.create(JabberActivator.getGlobalDisplayDetailsService() + .getDisplayName(jabberProvider)); } catch (XMPPException ex) { @@ -154,7 +156,7 @@ public class OperationSetMultiUserChatJabberImpl , ex.getXMPPError().getCode() , ex.getCause()); } - + boolean isPrivate = false; if(roomProperties != null) { @@ -164,7 +166,7 @@ public class OperationSetMultiUserChatJabberImpl isPrivate = isPrivateObject.equals(true); } } - + try { Form form; @@ -181,9 +183,9 @@ public class OperationSetMultiUserChatJabberImpl initField.getType() == FormField.TYPE_FIXED || initField.getType() == FormField.TYPE_HIDDEN) continue; - FormField submitField + FormField submitField = form.getField(initField.getVariable()); - if(submitField == null) + if(submitField == null) continue; Iterator<String> value = initField.getValues(); while(value.hasNext()) @@ -246,7 +248,7 @@ public class OperationSetMultiUserChatJabberImpl } /** - * Returns a reference to a chatRoom named <tt>roomName</tt>. If the room + * Returns a reference to a chatRoom named <tt>roomName</tt>. If the room * doesn't exists in the cache it creates it. * * @param roomName the name of the <tt>ChatRoom</tt> that we're looking @@ -428,9 +430,9 @@ public class OperationSetMultiUserChatJabberImpl } /** - * Checks if the contact address is associated with private messaging + * Checks if the contact address is associated with private messaging * contact or not. - * + * * @return <tt>true</tt> if the contact address is associated with private * messaging contact and <tt>false</tt> if not. */ |