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.

fix-message-formatting
hristoterezov 12 years ago
parent b0c1c997c9
commit 7ecbe5cacd

@ -548,7 +548,8 @@ public boolean isJoined()
public void join(byte[] password)
throws OperationFailedException
{
joinAs(getOurDisplayName(), password);
joinAs(JabberActivator.getGlobalDisplayDetailsService()
.getDisplayName(getParentProvider()), password);
}
/**
@ -561,7 +562,8 @@ public void join(byte[] password)
public void join()
throws OperationFailedException
{
joinAs(getOurDisplayName());
joinAs(JabberActivator.getGlobalDisplayDetailsService()
.getDisplayName(getParentProvider()));
}
/**
@ -716,38 +718,6 @@ public void joinAs(String nickname)
this.joinAs(nickname, null);
}
/**
* 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.

@ -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 ChatRoom createChatRoom(
{
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 ChatRoom createChatRoom(
, ex.getXMPPError().getCode()
, ex.getCause());
}
boolean isPrivate = false;
if(roomProperties != null)
{
@ -164,7 +166,7 @@ public ChatRoom createChatRoom(
isPrivate = isPrivateObject.equals(true);
}
}
try
{
Form form;
@ -181,9 +183,9 @@ public ChatRoom createChatRoom(
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 @@ private ChatRoom createLocalChatRoomInstance(MultiUserChat muc)
}
/**
* 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 boolean isMultiChatSupportedByContact(Contact contact)
}
/**
* 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.
*/

Loading…
Cancel
Save