diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomSubjectPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomSubjectPanel.java index 47b746638..db765c3a2 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomSubjectPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomSubjectPanel.java @@ -19,7 +19,8 @@ import net.java.sip.communicator.util.*; /** - * The panel containing the subject of the chat room. + * The panel containing the subject of the chat room and the configuration + * button. * * @author Yana Stamcheva */ @@ -45,30 +46,39 @@ public class ChatRoomSubjectPanel /** * Creates the panel containing the chat room subject. + * + * @param chatWindow the chat window, where this panel is added + * @param chatRoomWrapper the chat room wrapper, from which we obtain the + * chat room subject and the configuration information. */ - public ChatRoomSubjectPanel(ChatWindow window, - ChatRoomWrapper chatRoomWrap) + public ChatRoomSubjectPanel(ChatWindow chatWindow, + ChatRoomWrapper chatRoomWrapper) { super(new BorderLayout(5, 5)); - this.chatRoomWrapper = chatRoomWrap; - this.chatWindow = window; - + this.chatRoomWrapper = chatRoomWrapper; + this.chatWindow = chatWindow; + 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()); - + + if(chatRoomWrapper.getChatRoom() != null) + { + this.subjectField.setText( + chatRoomWrapper.getChatRoom().getSubject()); + } // The subject is set not editable until we implement this functionality. // TODO: Implement the editing of the chat room subject this.subjectField.setEditable(false); } - + /** * Sets the subject in the corresponding field. * @@ -78,12 +88,16 @@ public void setSubject(String subject) { this.subjectField.setText(subject); } - + /* * Opens the configuration dialog when the configure buttons is pressed. */ private class ConfigButtonActionListener implements ActionListener { + /** + * Obtains and opens the configuration form of the corresponding chat + * room when user clicks on the configuration button. + */ public void actionPerformed(ActionEvent evt) { if(chatRoomWrapper.getChatRoom() == null) @@ -94,11 +108,11 @@ public void actionPerformed(ActionEvent evt) ChatRoomConfigurationForm configForm = chatRoomWrapper.getChatRoom() .getConfigurationForm(); - + ChatRoomConfigurationWindow configWindow = new ChatRoomConfigurationWindow( chatRoomWrapper.getChatRoomName(), configForm); - + configWindow.setVisible(true); } catch (OperationFailedException e) diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatPanel.java index e0ef13480..e8d7efcb2 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatPanel.java @@ -51,13 +51,13 @@ public ConferenceChatPanel(ChatWindow chatWindow, this.chatRoomWrapper = chatRoomWrapper; subjectPanel = new ChatRoomSubjectPanel(chatWindow, chatRoomWrapper); - + // The subject panel is added here, because it's specific for the // multi user chat and is not contained in the single chat chat panel. this.add(subjectPanel, BorderLayout.NORTH); - + ChatRoom chatRoom = chatRoomWrapper.getChatRoom(); - + if(chatRoom != null && chatRoom.isJoined()) { this.loadChatRoom(chatRoom); diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsList.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsList.java index 4850103e6..fb8499fb7 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsList.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsList.java @@ -491,7 +491,7 @@ public void run() }.start(); } } - + /** * Refreshes the chat room's list. Meant to be invoked when a modification * in a chat room is made and the list should be refreshed in order to show diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImpl.java index a1c679de3..86d386a6d 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImpl.java @@ -1031,4 +1031,14 @@ protected void setNickName(String nickName) { this.userNickName = nickName; } + + /** + * Sets the subject obtained from the server once we're connected. + * + * @param subject the subject to set + */ + protected void setSubjectFromServer(String subject) + { + this.chatSubject = subject; + } } \ No newline at end of file diff --git a/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java b/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java index d6aabef81..c5715242f 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java @@ -452,8 +452,7 @@ protected void onJoin( String channel, String login, String hostname) { - if (logger.isDebugEnabled()) - logger.debug("JOIN on " + channel + ": Received from " + sender + logger.trace("JOIN on " + channel + ": Received from " + sender + " " + login + "@" + hostname); ChatRoomIrcImpl chatRoom @@ -1471,9 +1470,13 @@ protected void onTopic( String channel, = new ChatRoomPropertyChangeEvent( chatRoom, ChatRoomPropertyChangeEvent.CHAT_ROOM_SUBJECT, - topic, + chatRoom.getSubject(), topic); + // After creating the event with the old and new value of the subject + // we could change the subject property of the chat room. + chatRoom.setSubjectFromServer(topic); + chatRoom.firePropertyChangeEvent(evt); }