- Fixes the message upon joining a chat room stating that the chat room has had its subject changed to null. The fix rather stops the message unless the subject value has really changed.

- Fixes the sorting of the chat room members (which first sorts by role and then by name).
cusax-fix
Lyubomir Marinov 16 years ago
parent 4ea47d57cf
commit 5c1c9ac641

@ -279,7 +279,6 @@ else if (chatSession instanceof ConferenceChatSession)
if (chatContactListPanel != null)
{
// Initialize chat participants' panel.
Iterator<ChatContact> chatParticipants
= chatSession.getParticipants();
@ -1774,6 +1773,17 @@ public void setChatSubject(String subject)
{
if (subjectPanel != null)
{
// Don't do anything if the subject doesn't really change.
String oldSubject = subjectPanel.getSubject();
if ((subject == null ) || (subject.length() == 0))
{
if ((oldSubject == null) || (oldSubject.length() == 0))
return;
}
else if (subject.equals(oldSubject))
return;
subjectPanel.setSubject(subject);
this.addMessage(

@ -86,8 +86,8 @@ public void addElement(ChatContact chatContact)
if (chatContact == null)
throw new IllegalArgumentException("chatContact");
int index = -1;
int chatContactCount = chatContacts.size();
int index = -1;
for (int i = 0; i < chatContactCount; i++)
{
@ -104,7 +104,7 @@ public void addElement(ChatContact chatContact)
}
}
if (index == -1)
index = 0;
index = chatContactCount;
chatContacts.add(index, chatContact);
fireIntervalAdded(this, index, index);

@ -43,17 +43,20 @@ public class ChatRoomMemberListPanel
private final ChatContactListModel memberListModel
= new ChatContactListModel();
private final ChatPanel chatPanel;
private final ChatPanel chatPanel;
/**
* Creates an instance of <tt>ChatContactListPanel</tt>.
* @param chat Currently not used
* Initializes a new <tt>ChatRoomMemberListPanel</tt> instance which is to
* depict the members of a chat specified by its <tt>ChatPanel</tt>.
*
* @param chatPanel the <tt>ChatPanel</tt> which specifies the chat the new
* instance is to depict the members of
*/
public ChatRoomMemberListPanel(final ChatPanel chat)
public ChatRoomMemberListPanel(ChatPanel chatPanel)
{
super(new BorderLayout());
this.chatPanel = chat;
this.chatPanel = chatPanel;
this.memberList.setModel(memberListModel);
this.memberList.addKeyListener(new CListKeySearchListener(memberList));
@ -77,7 +80,7 @@ public void mouseClicked(MouseEvent e)
if (chatContact != null)
new ChatContactRightButtonMenu(
chat,
ChatRoomMemberListPanel.this.chatPanel,
chatContact)
.show(memberList, e.getX(), e.getY());
}

@ -16,6 +16,7 @@
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
@ -24,41 +25,32 @@
* button.
*
* @author Yana Stamcheva
* @author Lubomir Marinov
*/
public class ChatRoomSubjectPanel
extends TransparentPanel
{
/**
* The object used for logging.
* The <tt>Logger</tt> used by the <tt>ChatRoomSubjectPanel</tt> class and
* its instances for logging output.
*/
private Logger logger = Logger.getLogger(ChatRoomSubjectPanel.class);
private static final Logger logger
= Logger.getLogger(ChatRoomSubjectPanel.class);
/**
* The panel containing the subject of the chat room.
*/
private JLabel subjectLabel = new JLabel(
GuiActivator.getResources().getI18NString("service.gui.SUBJECT") + ": ");
/**
* The field containing the subject of the chat room.
*/
private JTextField subjectField = new JTextField();
/**
* The button that opens the configuration form of the chat room.
* The corresponding chat session.
*/
private JButton configButton = new JButton(new ImageIcon(
ImageLoader.getImage(ImageLoader.CHAT_ROOM_CONFIG)));
private final ConferenceChatSession chatSession;
/**
* The corresponding chat session.
* The parent window.
*/
private ConferenceChatSession chatSession;
private final ChatWindow chatWindow;
/**
* The parent window.
* The field containing the subject of the chat room.
*/
private ChatWindow chatWindow;
private final JTextField subjectField = new JTextField();
/**
* Creates the panel containing the chat room subject.
@ -72,34 +64,54 @@ public ChatRoomSubjectPanel(ChatWindow chatWindow,
{
super(new BorderLayout(5, 5));
this.chatSession = chatSession;
this.chatWindow = chatWindow;
this.chatSession = chatSession;
this.add(subjectLabel, BorderLayout.WEST);
this.add(subjectField, BorderLayout.CENTER);
this.add(configButton, BorderLayout.EAST);
this.configButton.setPreferredSize(new Dimension(26, 26));
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
this.configButton.addActionListener(new ConfigButtonActionListener());
this.subjectField.setText(chatSession.getChatSubject());
JLabel subjectLabel
= new JLabel(
GuiActivator.getResources().getI18NString(
"service.gui.SUBJECT") + ": ");
subjectField.setText(chatSession.getChatSubject());
// TODO Implement the editing of the chat room subject.
subjectField.setEditable(false);
JButton configButton
= new JButton(
new ImageIcon(
ImageLoader.getImage(
ImageLoader.CHAT_ROOM_CONFIG)));
configButton.setPreferredSize(new Dimension(26, 26));
configButton.addActionListener(new ConfigButtonActionListener());
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
add(subjectLabel, BorderLayout.WEST);
add(subjectField, BorderLayout.CENTER);
add(configButton, BorderLayout.EAST);
}
// The subject is set not editable until we implement this functionality.
// TODO: Implement the editing of the chat room subject
this.subjectField.setEditable(false);
/**
* Gets the (chat room) subject displayed in this
* <tt>ChatRoomSubjectPanel</tt>.
*
* @return the (chat room) subject displayed in this
* <tt>ChatRoomSubjectPanel</tt>
*/
public String getSubject()
{
return subjectField.getText();
}
/**
* Sets the subject in the corresponding field.
* Sets the (chat room) subject to be displayed in this
* <tt>ChatRoomSubjectPanel</tt>.
*
* @param subject the subject of the chat room
* @param subject the (chat room) subject to be displayed in this
* <tt>ChatRoomSubjectPanel</tt>
*/
public void setSubject(String subject)
{
this.subjectField.setText(subject);
subjectField.setText(subject);
}
/**
@ -119,7 +131,6 @@ public void actionPerformed(ActionEvent evt)
{
ChatRoomConfigurationForm configForm
= chatSession.getChatConfigurationForm();
ChatRoomConfigurationWindow configWindow
= new ChatRoomConfigurationWindow(
chatSession.getChatName(), configForm);
@ -132,30 +143,31 @@ public void actionPerformed(ActionEvent evt)
logger.error(
"Failed to obtain the chat room configuration form.", e);
ResourceManagementService resources
= GuiActivator.getResources();
if(e.getErrorCode()
== OperationFailedException.NOT_ENOUGH_PRIVILEGES)
{
new ErrorDialog(
chatWindow,
GuiActivator.getResources()
.getI18NString("service.gui.WARNING"),
GuiActivator.getResources().getI18NString(
"service.gui.CHAT_ROOM_CONFIGURATION_FORBIDDEN",
new String[]{chatSession.getChatName()}),
ErrorDialog.WARNING)
.showDialog();
chatWindow,
resources.getI18NString("service.gui.WARNING"),
resources.getI18NString(
"service.gui.CHAT_ROOM_CONFIGURATION_FORBIDDEN",
new String[]{chatSession.getChatName()}),
ErrorDialog.WARNING)
.showDialog();
}
else
{
new ErrorDialog(
chatWindow,
GuiActivator.getResources()
.getI18NString("service.gui.ERROR"),
GuiActivator.getResources().getI18NString(
"service.gui.CHAT_ROOM_CONFIGURATION_FAILED",
new String[]{
chatSession.getChatName()}),
e).showDialog();
chatWindow,
resources.getI18NString("service.gui.ERROR"),
resources.getI18NString(
"service.gui.CHAT_ROOM_CONFIGURATION_FAILED",
new String[]{chatSession.getChatName()}),
e)
.showDialog();
}
}
}

@ -22,7 +22,7 @@
* @author Yana Stamcheva
*/
public class ChatRoomIrcImpl
implements ChatRoom
implements ChatRoom
{
/**
* The object used for logging.
@ -49,7 +49,7 @@ public class ChatRoomIrcImpl
/**
* The parent protocol service provider
*/
private ProtocolProviderServiceIrcImpl parentProvider;
private final ProtocolProviderServiceIrcImpl parentProvider;
/**
* Listeners that will be notified of changes in member status in the
@ -106,7 +106,7 @@ public class ChatRoomIrcImpl
* Indicates if this chat room is a private one (i.e. created with the
* query command ).
*/
private boolean isPrivate = false;
private final boolean isPrivate;
/**
* Indicates if this chat room is a system one (i.e. corresponding to the

@ -12,6 +12,7 @@
* Represents a chat room member.
*
* @author Stephane Remy
* @author Lubomir Marinov
*/
public class ChatRoomMemberIrcImpl
implements ChatRoomMember
@ -29,12 +30,12 @@ public class ChatRoomMemberIrcImpl
/**
* The provider that created us.
*/
private ProtocolProviderServiceIrcImpl parentProvider = null;
private final ProtocolProviderServiceIrcImpl parentProvider;
/**
* The role of this member.
*/
private ChatRoomMemberRole chatRoomMemberRole = null;
private ChatRoomMemberRole chatRoomMemberRole;
/**
* Creates an instance of <tt>ChatRoomMemberIrcImpl</tt>, by specifying the
@ -50,9 +51,9 @@ public class ChatRoomMemberIrcImpl
* corresponding chat room
*/
public ChatRoomMemberIrcImpl(ProtocolProviderServiceIrcImpl parentProvider,
ChatRoom chatRoom,
String contactID,
ChatRoomMemberRole chatRoomMemberRole)
ChatRoom chatRoom,
String contactID,
ChatRoomMemberRole chatRoomMemberRole)
{
this.parentProvider = parentProvider;
this.chatRoom = chatRoom;
@ -150,4 +151,4 @@ public Contact getContact()
{
return null;
}
}
}

@ -373,11 +373,11 @@ protected void onChannelInfo(String channel, int userCount, String topic)
* change.
* @param recipient The nick of the user that got 'de-opp-ed'.
*/
protected void onDeop( String channel,
String sourceNick,
String sourceLogin,
String sourceHostname,
String recipient)
protected void onDeop(String channel,
String sourceNick,
String sourceLogin,
String sourceHostname,
String recipient)
{
logger.trace("DEOP on " + channel + ": Received from " + sourceNick
+ " " + sourceLogin + "@" + sourceHostname + "on " + recipient);

Loading…
Cancel
Save