diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomConfigurationFormFieldJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomConfigurationFormFieldJabberImpl.java new file mode 100644 index 000000000..b19a647a4 --- /dev/null +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomConfigurationFormFieldJabberImpl.java @@ -0,0 +1,219 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.protocol.jabber; + +import java.util.*; + +import org.jivesoftware.smackx.*; + +import net.java.sip.communicator.service.protocol.*; + +/** + * The Jabber protocol implementation of the + * ChatRoomConfigurationFormField. This implementation is based on the + * smack Form and FormField types. + * + * @author Yana Stamcheva + */ +public class ChatRoomConfigurationFormFieldJabberImpl + implements ChatRoomConfigurationFormField +{ + /** + * The smack library for field. + */ + private FormField smackFormField; + + /** + * The smack library submit form field. It's the one that will care all + * values set by user, before submitting the form. + */ + private FormField smackSubmitFormField; + + /** + * Creates an instance of ChatRoomConfigurationFormFieldJabberImpl + * by passing to it the smack form field and the smack submit form, which + * are the base of this implementation. + * + * @param formField the smack form field + * @param submitForm the smack submit form + */ + public ChatRoomConfigurationFormFieldJabberImpl( + FormField formField, + Form submitForm) + { + this.smackFormField = formField; + + if(!formField.getType().equals(FormField.TYPE_FIXED)) + this.smackSubmitFormField + = submitForm.getField(formField.getVariable()); + } + + /** + * Returns the variable name of the corresponding smack property. + * + * @return the variable name of the corresponding smack property + */ + public String getName() + { + return smackFormField.getVariable(); + } + + /** + * Returns the description of the corresponding smack property. + * + * @return the description of the corresponding smack property + */ + public String getDescription() + { + return smackFormField.getDescription(); + } + + /** + * Returns the label of the corresponding smack property. + * + * @return the label of the corresponding smack property + */ + public String getLabel() + { + return smackFormField.getLabel(); + } + + /** + * Returns the options of the corresponding smack property. + * + * @return the options of the corresponding smack property + */ + public Iterator getOptions() + { + List options = new ArrayList(); + Iterator smackOptions = smackFormField.getOptions(); + + while(smackOptions.hasNext()) + { + FormField.Option smackOption + = (FormField.Option) smackOptions.next(); + + options.add(smackOption.getValue()); + } + + return Collections.unmodifiableList(options).iterator(); + } + + /** + * Returns the isRequired property of the corresponding smack property. + * + * @return the isRequired property of the corresponding smack property + */ + public boolean isRequired() + { + return smackFormField.isRequired(); + } + + /** + * For each of the smack form field types returns the corresponding + * ChatRoomConfigurationFormField type. + * + * @return the type of the property + */ + public String getType() + { + String smackType = smackFormField.getType(); + + if(smackType.equals(FormField.TYPE_BOOLEAN)) + return TYPE_BOOLEAN; + if(smackType.equals(FormField.TYPE_FIXED)) + return TYPE_TEXT_FIXED; + else if(smackType.equals(FormField.TYPE_TEXT_PRIVATE)) + return TYPE_TEXT_PRIVATE; + else if(smackType.equals(FormField.TYPE_TEXT_SINGLE)) + return TYPE_TEXT_SINGLE; + else if(smackType.equals(FormField.TYPE_TEXT_MULTI)) + return TYPE_TEXT_MULTI; + else if(smackType.equals(FormField.TYPE_LIST_SINGLE)) + return TYPE_LIST_SINGLE; + else if(smackType.equals(FormField.TYPE_LIST_MULTI)) + return TYPE_LIST_MULTI; + else + return TYPE_UNDEFINED; + } + + /** + * Returns an Iterator over the list of values of this field. + * + * @return an Iterator over the list of values of this field + */ + public Iterator getValues() + { + Iterator valuesIter = null; + List values = new ArrayList(); + Iterator smackValues = smackFormField.getValues(); + + if(smackFormField.getType().equals(FormField.TYPE_BOOLEAN)) + { + while(smackValues.hasNext()) + { + String smackValue = (String) smackValues.next(); + + if(smackValue.equals("1") || smackValue.equals("true")) + values.add(new Boolean(true)); + else + values.add(new Boolean(false)); + } + + valuesIter = values.iterator(); + } + else + valuesIter = smackValues; + + return valuesIter; + } + + /** + * Adds the given value to the list of values of this field. + * + * @param value the value to add + */ + public void addValue(Object value) + { + if(value instanceof Boolean) + { + if(((Boolean)value).booleanValue()) + value = "1"; + else + value = "0"; + } + + smackSubmitFormField.addValue(value.toString()); + } + + /** + * Sets the given list of values to this field. + * + * @param newValues the list of values to set + */ + public void setValues(Object[] newValues) + { + ArrayList list = new ArrayList(); + + for(int i = 0; i < newValues.length; i ++) + { + Object value = newValues[i]; + + if(value instanceof Boolean) + { + if(((Boolean)value).booleanValue()) + value = "1"; + else + value = "0"; + } + + list.add(value); + } + + smackSubmitFormField.addValues(list); + } +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomConfigurationFormJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomConfigurationFormJabberImpl.java new file mode 100644 index 000000000..878911f46 --- /dev/null +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomConfigurationFormJabberImpl.java @@ -0,0 +1,115 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.protocol.jabber; + +import java.util.*; + +import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.*; + +import org.jivesoftware.smack.*; +import org.jivesoftware.smackx.*; +import org.jivesoftware.smackx.muc.*; + +/** + * The Jabber implementation of the ChatRoomConfigurationForm + * interface. + * + * @author Yana Stamcheva + */ +public class ChatRoomConfigurationFormJabberImpl + implements ChatRoomConfigurationForm +{ + private Logger logger + = Logger.getLogger(ChatRoomConfigurationFormJabberImpl.class); + + /** + * The smack chat room configuration form. + */ + private Form smackConfigForm; + + /** + * The form that will be filled out and submitted by user. + */ + private Form smackSubmitForm; + + /** + * The smack multi user chat is the one to which we'll send the form once + * filled out. + */ + private MultiUserChat smackMultiUserChat; + + /** + * Creates an instance of ChatRoomConfigurationFormJabberImpl by + * specifying the corresponding smack multi user chat and smack + * configuration form. + * + * @param multiUserChat the smack multi user chat, to which we'll send the + * configuration form once filled out + * @param smackConfigForm the smack configuration form + */ + public ChatRoomConfigurationFormJabberImpl( + MultiUserChat multiUserChat, Form smackConfigForm) + { + this.smackMultiUserChat = multiUserChat; + this.smackConfigForm = smackConfigForm; + this.smackSubmitForm = smackConfigForm.createAnswerForm(); + } + + /** + * Returns an Iterator over a list of + * ChatRoomConfigurationFormFields. + * + * @return an Iterator over a list of + * ChatRoomConfigurationFormFields + */ + public Iterator getConfigurationSet() + { + Vector configFormFields = new Vector(); + + Iterator smackFormFields = smackConfigForm.getFields(); + + while(smackFormFields.hasNext()) + { + FormField smackFormField = (FormField) smackFormFields.next(); + + if(smackFormField == null + || smackFormField.getType().equals(FormField.TYPE_HIDDEN)) + continue; + + ChatRoomConfigurationFormFieldJabberImpl jabberConfigField + = new ChatRoomConfigurationFormFieldJabberImpl( + smackFormField, smackSubmitForm); + + configFormFields.add(jabberConfigField); + } + + return Collections.unmodifiableList(configFormFields).iterator(); + } + + /** + * Sends the ready smack configuration form to the multi user chat. + */ + public void submit() + throws OperationFailedException + { + logger.trace("Sends chat room configuration form to the server."); + + try + { + smackMultiUserChat.sendConfigurationForm(smackSubmitForm); + } + catch (XMPPException e) + { + logger.error("Failed to submit the configuration form.", e); + + throw new OperationFailedException( + "Failed to submit the configuration form.", + OperationFailedException.GENERAL_ERROR); + } + } +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomInvitationJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomInvitationJabberImpl.java index 023354f77..d24eba289 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomInvitationJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomInvitationJabberImpl.java @@ -22,7 +22,7 @@ public class ChatRoomInvitationJabberImpl private String reason; - private String password; + private byte[] password; /** * Creates an invitation for the given targetChatRoom, from the @@ -35,7 +35,7 @@ public class ChatRoomInvitationJabberImpl public ChatRoomInvitationJabberImpl(ChatRoom targetChatRoom, String inviter, String reason, - String password) + byte[] password) { this.chatRoom = targetChatRoom; this.inviter = inviter; @@ -58,7 +58,7 @@ public String getReason() return reason; } - public String getChatRoomPassword() + public byte[] getChatRoomPassword() { return password; } 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 3e82c3ae2..b3d6c2221 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java @@ -37,17 +37,7 @@ public class ChatRoomJabberImpl * The multi user chat smack object that we encapsulate in this room. */ private MultiUserChat multiUserChat = null; - - /** - * The configuration form that will be used to change cha room properties. - */ - private Form multiUserChatConfigForm = null; - /** - * The list of listeners registered for chat room property change events. - */ - private Vector chatRoomPropertyChangeListeners = new Vector(); - /** * Listeners that will be notified of changes in member status in the * room such as member joined, left or being kicked or dropped. @@ -99,11 +89,6 @@ public class ChatRoomJabberImpl * The list of members of this chat room. */ private Hashtable banList = new Hashtable(); - - /** - * The list of advanced configurations for this chat room. - */ - private Hashtable advancedConfigurations = new Hashtable(); /** * The nickname of this chat room local user participant. @@ -115,6 +100,11 @@ public class ChatRoomJabberImpl */ private String oldSubject; + /** + * The corresponding configuration form. + */ + private ChatRoomConfigurationFormJabberImpl configForm; + /** * Creates an instance of a chat room that has been. * @@ -150,10 +140,10 @@ public ChatRoomJabberImpl(MultiUserChat multiUserChat, public void addPropertyChangeListener( ChatRoomPropertyChangeListener listener) { - synchronized(chatRoomPropertyChangeListeners) + synchronized(propertyChangeListeners) { - if (!chatRoomPropertyChangeListeners.contains(listener)) - chatRoomPropertyChangeListeners.add(listener); + if (!propertyChangeListeners.contains(listener)) + propertyChangeListeners.add(listener); } } @@ -166,9 +156,9 @@ public void addPropertyChangeListener( public void removePropertyChangeListener( ChatRoomPropertyChangeListener listener) { - synchronized(chatRoomPropertyChangeListeners) + synchronized(propertyChangeListeners) { - chatRoomPropertyChangeListeners.remove(listener); + propertyChangeListeners.remove(listener); } } @@ -329,7 +319,7 @@ public String getIdentifier() */ public String getUserNickname() { - return this.multiUserChat.getNickname(); + return multiUserChat.getNickname(); } /** @@ -410,6 +400,8 @@ public void join() public void joinAs(String nickname, byte[] password) throws OperationFailedException { + this.assertConnected(); + this.nickname = nickname; try @@ -431,11 +423,55 @@ public void joinAs(String nickname, byte[] password) } catch (XMPPException ex) { - logger.error("Failed to join chat room " - + getName() - + " with nickname " - + nickname, - ex ); + String errorMessage; + + if(ex.getXMPPError().getCode() == 401) + { + errorMessage + = "Failed to join chat room " + + getName() + + " with nickname: " + + nickname + + ". The chat room requests a password."; + + logger.error(errorMessage, ex); + + throw new OperationFailedException( + errorMessage, + OperationFailedException.AUTHENTICATION_FAILED, + ex); + } + else if(ex.getXMPPError().getCode() == 407) + { + errorMessage + = "Failed to join chat room " + + getName() + + " with nickname: " + + nickname + + ". The chat room requires registration."; + + logger.error(errorMessage, ex); + + throw new OperationFailedException( + errorMessage, + OperationFailedException.REGISTRATION_REQUIRED, + ex); + } + else + { + errorMessage + = "Failed to join room " + + getName() + + " with nickname: " + + nickname; + + logger.error(errorMessage, ex); + + throw new OperationFailedException( + errorMessage, + OperationFailedException.GENERAL_ERROR, + ex); + } } } @@ -450,21 +486,13 @@ public void joinAs(String nickname, byte[] password) public void joinAs(String nickname) throws OperationFailedException { + this.assertConnected(); + this.nickname = nickname; try { multiUserChat.join(nickname); - - try - { - this.multiUserChatConfigForm - = multiUserChat.getConfigurationForm(); - } - catch (XMPPException e) - { - logger.error("", e); - } ChatRoomMemberJabberImpl member = new ChatRoomMemberJabberImpl( this, @@ -481,18 +509,55 @@ public void joinAs(String nickname) } catch (XMPPException ex) { - logger.error("Failed to join room " - + getName() - + " with nickname: " - + nickname - , ex); - throw new OperationFailedException( - "Failed to join room " - + getName() - + " with nickname: " - + nickname - , OperationFailedException.GENERAL_ERROR - , ex); + String errorMessage; + + if(ex.getXMPPError().getCode() == 401) + { + errorMessage + = "Failed to join chat room " + + getName() + + " with nickname: " + + nickname + + ". The chat room requests a password."; + + logger.error(errorMessage, ex); + + throw new OperationFailedException( + errorMessage, + OperationFailedException.AUTHENTICATION_FAILED, + ex); + } + else if(ex.getXMPPError().getCode() == 407) + { + errorMessage + = "Failed to join chat room " + + getName() + + " with nickname: " + + nickname + + ". The chat room requires registration."; + + logger.error(errorMessage, ex); + + throw new OperationFailedException( + errorMessage, + OperationFailedException.REGISTRATION_REQUIRED, + ex); + } + else + { + errorMessage + = "Failed to join room " + + getName() + + " with nickname: " + + nickname; + + logger.error(errorMessage, ex); + + throw new OperationFailedException( + errorMessage, + OperationFailedException.GENERAL_ERROR, + ex); + } } } @@ -615,31 +680,6 @@ public void sendMessage(Message message) } } - /** - * Changes the the local user's nickname in the context of this chatroom. - * - * @param nickname the new nickname within the room. - * @throws OperationFailedException if the setting the new nickname - * changes for some reason. - */ - public void setNickname(String nickname) - throws OperationFailedException - { - try - { - multiUserChat.changeNickname(nickname); - } - catch (XMPPException ex) - { - logger.error("Failed to changed subject for chat room" + getName() - , ex); - throw new OperationFailedException( - "Failed to changed nickname in chat room" + getName() - , OperationFailedException.FORBIDDEN - , ex); - } - } - /** * Sets the subject of this chat room. * @@ -1073,51 +1113,6 @@ public void removeMemberRoleListener(ChatRoomMemberRoleListener listener) } } - /** - * Sets the password of this chat room. If the user does not have the right - * to change the room password, or the protocol does not support this, or - * the operation fails for some other reason, the method throws an - * OperationFailedException with the corresponding code. - * - * @param password the new password that we'd like this room to have - * @throws OperationFailedException if the user does not have the right to - * change the room password, or the protocol does not support - * this, or the operation fails for some other reason - */ - public void setPassword(String password) - throws OperationFailedException - { - multiUserChatConfigForm.setAnswer("password", password); - - try - { - multiUserChat.sendConfigurationForm(multiUserChatConfigForm); - } - catch (XMPPException e) - { - logger.error( - "Failed to send configuration form for this chat room.", e); - } - } - - public String getPassword() - { - return (String) multiUserChatConfigForm - .getField("password").getValues().next(); - } - - public void addBanMask(String banMask) - throws OperationFailedException - { - /** @todo implement addBanMask */ - } - - public void removeBanMask(String banMask) - throws OperationFailedException - { - /** @todo implement removeBanMask */ - } - /** * Returns the list of banned users. */ @@ -1145,601 +1140,15 @@ public void setUserNickname(String nickname) } catch (XMPPException e) { + logger.error("Failed to change nickname for chat room: " + + getName()); + throw new OperationFailedException("The " + nickname + "already exists in this chat room.", - OperationFailedException.NICKNAME_ALREADY_EXISTS); - } - } - - /** - * Returns true by default. The constant value indicates that the chat room - * visibility could not be changed. - */ - public boolean isVisible() - { - return true; - } - - /** - * Fires the appropriare ChatRoomPropertyChangeFailedEvent to indicate that - * this property is not supproted by this implementation. - * - * @param isVisible indicates if this ChatRoom should be visible or - * not - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setVisible(boolean isVisible) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_VISIBLE, - null, - new Boolean(isVisible), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isVisible property is not supported by the jabber multi" + - " user chat implementation.")); - } - - /** - * Returns false by default. The constant indicates that the chat room - * doesn't require invitation and this property is not supported by this - * implementation. - */ - public boolean isInvitationRequired() - { - return false; - } - - /** - * Fires the appropriare ChatRoomPropertyChangeFailedEvent to indicate that - * this property is not supproted by this implementation. - * - * @param isInvitationRequired indicates if this ChatRoom requires - * invitation to be joined - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setInvitationRequired(boolean isInvitationRequired) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_INVITATION_REQUIRED, - null, - new Boolean(isInvitationRequired), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isInvitationRequired property is not supported by the jabber" - + " multi user chat implementation.")); + OperationFailedException.IDENTIFICATION_CONFLICT); + } } - - /** - * Returns false by default. The constant indicates that this property could - * not be modified in this implementation. - */ - public boolean isMute() - { - return false; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isMute indicates if this ChatRoom should be in a mute - * mode or not - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setMute(boolean isMute) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_MUTE, - null, - new Boolean(isMute), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isMute property is not supported by the jabber" - + " multi user chat implementation.")); - } - - /** - * Returns false, which indicates that this property could not be modified - * in this implementation. - */ - public boolean isAllowExternalMessages() - { - return false; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isAllowExternalMessages indicates if this ChatRoom should - * allow external messages or not - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setAllowExternalMessages(boolean isAllowExternalMessages) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_ALLOW_EXTERNAL_MESSAGES, - null, - new Boolean(isAllowExternalMessages), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isMute property is not supported by the jabber" - + " multi user chat implementation.")); - } - - /** - * Returns false, which indicates that this property could not be modified - * in this implementation. - */ - public boolean isRegistered() - { - return false; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isRegistered indicates if this ChatRoom is registered - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setRegistered(boolean isRegistered) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_REGISTERED, - null, - new Boolean(isRegistered), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isMute property is not supported by the jabber" - + " multi user chat implementation.")); - } - - /** - * Returns false by default. The constant indicates that property is not - * configurable in this jabber ChatRoom implementation. - */ - public boolean isSubjectLocked() - { - return false; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isSubjectLocked indicates if the subject of this chat room could - * be changed - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setSubjectLocked(boolean isSubjectLocked) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_SUBJECT_LOCKED, - null, - new Boolean(isSubjectLocked), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isSubjectLocked property is not supported by the jabber" - + "multi user chat implementation.")); - } - - /** - * Returns true by default. The constant indicates that property is not - * configurable in this jabber ChatRoom implementation. - */ - public boolean isAllowMessageFormatting() - { - return true; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isAllowMessageFormatting indicates if message formattings are - * allowed in this chat room - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setAllowMessageFormatting(boolean isAllowMessageFormatting) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_ALLOW_MESSAGE_FORMATTING, - null, - new Boolean(isAllowMessageFormatting), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isAllowMessageFormatting property is not supported by the jabber" - + "multi user chat implementation.")); - } - - /** - * Returns false by default. The constant indicates that property is not - * configurable in this jabber ChatRoom implementation. - */ - public boolean isFilterMessageFormatting() - { - return false; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isFilterMessageFormatting indicates if message formattings are - * filtered in this chat room - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setFilterMessageFormatting(boolean isFilterMessageFormatting) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_FILTER_MESSAGE_FORMATTING, - null, - new Boolean(isFilterMessageFormatting), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isFilterMessageFormatting property is not supported by the jabber" - + "multi user chat implementation.")); - } - - /** - * Returns true by default. The constant indicates that property is not - * configurable in this jabber ChatRoom implementation. - */ - public boolean isAllowInvitation() - { - return true; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isAllowInvitation indicates if invitations are allowed in this - * chat room - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setAllowInvitation(boolean isAllowInvitation) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_ALLOW_INVITATION, - null, - new Boolean(isAllowInvitation), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isAllowInvitation property is not supported by the jabber" - + "multi user chat implementation.")); - } - - /** - * Returns true by default. The constant indicates that property is not - * configurable in this jabber ChatRoom implementation. - */ - public boolean isAllowInvitationRequest() - { - return true; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isAllowInvitationRequest indicates if invitation request are - * allowed in this chat room - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setAllowInvitationRequest(boolean isAllowInvitationRequest) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_ALLOW_INVITATION_REQUEST, - null, - new Boolean(isAllowInvitationRequest), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isAllowInvitationRequest property is not supported by the jabber" - + "multi user chat implementation.")); - } - - /** - * Returns false by default. The constant indicates that property is not - * configurable in this jabber ChatRoom implementation. - */ - public boolean isMemberNicknameLocked() - { - return false; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isMemberNicknameLocked indicates if a member in this chat room - * could change his/her nickname - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setMemberNicknameLocked(boolean isMemberNicknameLocked) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_MEMBER_NICKNAME_LOCKED, - null, - new Boolean(isMemberNicknameLocked), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isMemberNicknameLocked property is not supported by the jabber" - + "multi user chat implementation.")); - } - - /** - * Returns true by default. The constant indicates that property is not - * configurable in this jabber ChatRoom implementation. - */ - public boolean isAllowKick() - { - return true; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isAllowKick indicates if this chat room allows kicks - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setAllowKick(boolean isAllowKick) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_ALLOW_KICK, - null, - new Boolean(isAllowKick), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isAllowKick property is not supported by the jabber" - + "multi user chat implementation.")); - } - - /** - * Returns false to indicate that isRegisteredUsersOnly property is not - * configurable in this jabber ChatRoom implementation. - */ - public boolean isRegisteredUserOnly() - { - return false; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isRegisteredUserOnly indicates if this chat room is only for - * registered users. - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setRegisteredUserOnly(boolean isRegisteredUserOnly) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_REGISTERED_USERS_ONLY, - null, - new Boolean(isRegisteredUserOnly), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isRegisteredUserOnly property is not supported by the jabber" - + "multi user chat implementation.")); - } - - /** - * Returns false to indicate that isAllowSpecialMessage property is not - * configurable in this jabber ChatRoom implementation. - */ - public boolean isAllowSpecialMessage() - { - return false; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isAllowSpecialMessage indicates if special messages are allowed - * in this chat room. - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setAllowSpecialMessage(boolean isAllowSpecialMessage) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_ALLOW_SPECIAL_MESSAGE, - null, - new Boolean(isAllowSpecialMessage), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isAllowSpecialMessage property is not supported by the jabber" - + "multi user chat implementation.")); - } - - /** - * Returns true to indicate that isNickNameListVisible property is not - * configurable in this jabber ChatRoom implementation. - */ - public boolean isNicknameListVisible() - { - return true; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param isNicknameListVisible indicates if the list of nicknames in this - * chat room should be visible. - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setNicknameListVisible(boolean isNicknameListVisible) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_IS_NICKNAME_LIST_VISIBLE, - null, - new Boolean(isNicknameListVisible), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The isNicknameListVisible property is not supported by the jabber" - + "multi user chat implementation.")); - } - - /** - * Returns the limit of user for this chat room. The user limit is the - * maximum number of users, who could enter this chat room at a time. - * - * @return int the max number of users for this chat room - */ - public int getMemberMaxNumber() - { - return 0; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * - * @param maxNumber the maximum number of users that we'd like this room to - * have - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setMemberMaxNumber(int maxNumber) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_MEMBER_MAX_NUMBER, - null, - new Integer(maxNumber), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The redirectChatRoom property is not supported by the jabber multi" + - " user chat implementation.")); - } - - /** - * Returns null to indicate that no redirection is possible in the jabber - * ChatRoom implementation. - */ - public ChatRoom getRedirectChatRoom() - { - return null; - } - - /** - * Fires a ChatRoomPropertyChangeFailedEvent to indicated that - * the jabber ChatRoom implementation doesn't support this property. - * @param chatRoom the chat room to which the messages are redirected - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setRedirectChatRoom(ChatRoom chatRoom) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_REDIRECT, - null, - chatRoom, - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The redirectChatRoom property is not supported by the jabber multi" + - " user chat implementation.")); - } - - - /** - * For now we just fire a ChatRoomPropertyChangeFailedEvent - * .PROPERTY_NOT_SUPPORTED to indicate that this property is not supported - * by this implementation. - * @param seconds the period that user should wait before re-joining a - * chat room - * @throws OperationFailedException if the user doesn't have the right to - * change this property. - */ - public void setJoinRateLimit(int seconds) - throws OperationFailedException - { - firePropertyChangeEvent(new ChatRoomPropertyChangeFailedEvent( - this, - ChatRoomPropertyChangeEvent.CHAT_ROOM_JOIN_RATE_LIMIT, - null, - new Integer(seconds), - ChatRoomPropertyChangeFailedEvent.PROPERTY_NOT_SUPPORTED, - "The joinRateLimit property is not supported by the jabber multi" + - " user chat implementation.")); - } - - public int getJoinRateLimit() - { - return 0; - } - - /** - * Adds the given property to the list of advanced configuration - * properties. - * - * @param propertyName the name of the property to add - * @param propertyValue the value of the property to add - */ - public void addAdvancedConfigProperty(String propertyName, - String propertyValue) - throws OperationFailedException - { - this.advancedConfigurations.put(propertyName, propertyValue); - } - - /** - * Removes the given property from the list of advanced configuration - * properties. - * - * @param propertyName the property to remove - */ - public void removeAdvancedConfigProperty(String propertyName) - throws OperationFailedException - { - this.advancedConfigurations.remove(propertyName); - } - - /** - * Returns an Iterator over a copy of the table containing all advanced - * configurations for this ChatRoom. - */ - public Iterator getAdvancedConfigurationSet() - { - return new Hashtable(advancedConfigurations).entrySet().iterator(); - } - + /** * Bans a user from the room. An admin or owner of the room can ban users * from a room. @@ -2047,14 +1456,14 @@ public void processPacket(Packet packet) private class SmackSubjectUpdatedListener implements SubjectUpdatedListener { public void subjectUpdated(String subject, String from) - { + { ChatRoomPropertyChangeEvent evt = new ChatRoomPropertyChangeEvent( ChatRoomJabberImpl.this, ChatRoomPropertyChangeEvent.CHAT_ROOM_SUBJECT, oldSubject, subject); - + firePropertyChangeEvent(evt); // Keeps track of the subject. @@ -2111,4 +1520,46 @@ private void assertConnected() throws IllegalStateException "The provider must be signed on the service before " +"being able to communicate."); } + + /** + * Returns the ChatRoomConfigurationForm containing all + * configuration properties for this chat room. If the user doesn't have + * permissions to see and change chat room configuration an + * OperationFailedException is thrown. + * + * @return the ChatRoomConfigurationForm containing all + * configuration properties for this chat room + * @throw OperationFailedException if the user doesn't have + * permissions to see and change chat room configuration + */ + public ChatRoomConfigurationForm getConfigurationForm() + throws OperationFailedException + { + Form smackConfigForm = null; + + try + { + smackConfigForm = multiUserChat.getConfigurationForm(); + + this.configForm + = new ChatRoomConfigurationFormJabberImpl( + multiUserChat, smackConfigForm); + } + catch (XMPPException e) + { + if(e.getXMPPError().getCode() == 403) + throw new OperationFailedException( + "Failed to obtain smack multi user chat config form." + + "User doesn't have enough privileges to see the form.", + OperationFailedException.NOT_ENOUGH_PRIVILEGES, + e); + else + throw new OperationFailedException( + "Failed to obtain smack multi user chat config form.", + OperationFailedException.GENERAL_ERROR, + e); + } + + return configForm; + } } 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 fc2556e5f..cad7cba4e 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java @@ -643,7 +643,7 @@ public void fireInvitationEvent( ChatRoom targetChatRoom, String inviter, String reason, - String password) + byte[] password) { ChatRoomInvitationJabberImpl invitation = new ChatRoomInvitationJabberImpl( targetChatRoom, @@ -733,7 +733,8 @@ public void invitationReceived(XMPPConnection conn, { chatRoom = (ChatRoomJabberImpl) findRoom(room); - fireInvitationEvent(chatRoom, inviter, reason, password); + fireInvitationEvent( + chatRoom, inviter, reason, password.getBytes()); } catch (OperationFailedException e) { diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java b/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java index a42947997..e1ac4709b 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java @@ -26,15 +26,11 @@ public class MockChatRoom private String subject; private String nickname; - - private String roomPassword; private boolean joined = false; private List members = new Vector(); - - private Vector banMasks = new Vector(); - + /** * Currently registered member presence listeners. */ @@ -469,103 +465,6 @@ public ProtocolProviderService getParentProvider() return provider; } - /** - * Sets the password of this chat room. If the user does not have the right - * to change the room password, or the protocol does not support this, or - * the operation fails for some other reason, the method throws an - * OperationFailedException with the corresponding code. - * - * @param password the new password that we'd like this room to have - * @throws OperationFailedException if the user does not have the right to - * change the room password, or the protocol does not support - * this, or the operation fails for some other reason - */ - public void setPassword(String password) - throws OperationFailedException - { - roomPassword = password; - } - - /** - * Returns the password of this chat room or null if the room doesn't have - * password. - * @return the password of this chat room or null if the room doesn't have - * password - */ - public String getPassword() - { - return roomPassword; - } - - /** - * Adds a ban mask to the list of ban masks of this chat room. The ban mask - * defines a group of users that will be banned. This property is meant to - * be used mainly by IRC implementations. If the user does not have the - * right to change the room ban list, or the protocol does not support this, - * or the operation fails for some other reason, the method throws an - * OperationFailedException with the corresponding code. - * - * @param banMask the new ban mask that we'd like to add to the room ban - * list - * @throws OperationFailedException if the user does not have the right to - * change the room ban list, or the protocol does not support this, or the - * operation fails for some other reason - */ - public void addBanMask(String banMask) - throws OperationFailedException - { - if(!banMasks.contains(banMask)) - banMasks.add(banMask); - } - - /** - * Remove a ban mask from the list of ban masks of this chat room. If the - * user does not have the right to change the room ban list, or the protocol - * does not support this, or the operation fails for some other reason, the - * method throws an OperationFailedException with the - * corresponding code. - * - * @param banMask the ban mask that we'd like to remove from this room ban - * list - * @throws OperationFailedException if the user does not have the right to - * change the room ban list, or the protocol does not support this, or the - * operation fails for some other reason - */ - public void removeBanMask(String banMask) - throws OperationFailedException - { - banMasks.remove(banMask); - } - - /** - * Returns an Iterator over a set of ChatRoomConfigParams. Each - * element in the set is one of the ChatRoomConfigParams.CHAT_ROOM_XXX - * configuration params. This method is meant to be used by other bundles, - * before trying to change ChatRoom configurations, in order to - * check which are the supported configurations by the current - * implementation. - * - * @return an Iterator over a set of ChatRoomConfigParams - */ - public Iterator getSupportedConfigParams() - { - return new Vector().iterator(); - } - - /** - * Returns an Iterator over a set of ChatRoomConfigParams, - * containing the current configuration of this chat room. This method is - * meant to be used by bundles interested in what are the specific chat room - * configurations. - * - * @return an Iterator over a set of ChatRoomConfigParams, - * containing the current configuration of this chat room - */ - public Iterator getConfiguration() - { - return new Vector().iterator(); - } - /** * Returns an Iterator over a set of ban masks for this chat room. The ban * mask defines a group of users that will be banned. The ban list is a list @@ -634,438 +533,6 @@ public void setUserNickname(String nickname) throws OperationFailedException this.nickname = nickname; } - /** - * Indicates if this ChatRoom is visible to everyone and everyone - * could join it. If the ChatRoom is NOT visible, it cannot be seen - * without knowing the exact name. - * - * @return true if this ChatRoom is visible to - * everyone, otherwise - false. - */ - public boolean isVisible() - { - return true; - } - - /** - * Sets the property indicating if this ChatRoom is visible to - * everyone and everyone could join it. If the ChatRoom is NOT - * visible, it cannot be seen without knowing the exact name. - * - * @param isVisible indicates if this ChatRoom should be visible or - * not - */ - public void setVisible(boolean isVisible) - { - } - - /** - * Indicates if this ChatRoom requires an invitation. If the - * chat room requires invitation, the user could not join it without being - * invited. - * - * @return true if this ChatRoom requires invitation - * to joined, otherwise - false. - */ - public boolean isInvitationRequired() - { - return false; - } - - /** - * Sets the property indicating if this ChatRoom requires an - * invitation to be joined. If the chat room requires invitation, the user - * could not join it without being invited. - * - * @param isInvitationRequired indicates if this ChatRoom requires - * invitation to be joined - */ - public void setInvitationRequired(boolean isInvitationRequired) - { - } - - /** - * Indicates if this ChatRoom is in a mute mode. If a - * ChatRoom is muted no messages could be obtained from it. - * - * @return true if this ChatRoom is in a mute mode, - * otherwise - false - */ - public boolean isMute() - { - return false; - } - - /** - * Sets the property indicating if this ChatRoom is in a mute mode. - * If a ChatRoom is muted no messages could be obtained from it. - * - * @param isMute indicates if this ChatRoom should be in a mute - * mode or not - */ - public void setMute(boolean isMute) - { - } - - /** - * Indicates if it's possible for someone to send messages to this - * ChatRoom even if they are not present inside the chat room. - * - * @return true if this ChatRoom allows external - * messages, otherwise - false - */ - public boolean isAllowExternalMessages() - { - return false; - } - - /** - * Sets the property indicating if it's possible for someone to send - * messages to this ChatRoom even if they are not present inside - * the chat room. - * - * @param isAllowExternalMessages indicates if this ChatRoom should - * allow external messages or not - */ - public void setAllowExternalMessages(boolean isAllowExternalMessages) - { - } - - /** - * Indicates if this ChatRoom is registered. - * - * @return true if this ChatRoom is registered, - * otherwise - false - */ - public boolean isRegistered() - { - return false; - } - - /** - * Sets the property indicating if this ChatRoom is registered or - * not. - * - * @param isRegistered indicates if this ChatRoom is registered - */ - public void setRegistered(boolean isRegistered) - { - } - - /** - * Indicates if the subject of this ChatRoom could be changed by - * non admin users. If the subject is locked only admin users could change - * it. - * - * @return true if only admin user could change the subject of - * this ChatRoom, otherwise - false - */ - public boolean isSubjectLocked() - { - return true; - } - - /** - * Sets the property indicating if the subject of this ChatRoom - * could be changed only by admin users. - * - * @param isSubjectLocked indicates if the subject of this ChatRoom - * is locked - */ - public void setSubjectLocked(boolean isSubjectLocked) - { - } - - /** - * Indicates if the message format in this ChatRoom could be - * modified. If the message formatting is allowed - we could have colored, - * underlined, etc. messages. - * - * @return true if message formatting in this ChatRoom - * is allowed, otherwise - false - */ - public boolean isAllowMessageFormatting() - { - return false; - } - - /** - * Sets the property indicating if the message format in this - * ChatRoom could be modified. If the message formatting is - * allowed - we could have colored, underlined, etc. messages. - * - * @param isAllowMessageFormatting indicates if the message formatting in - * this ChatRoom is allowed - */ - public void setAllowMessageFormatting(boolean isAllowMessageFormatting) - { - } - - /** - * Indicates is this ChatRoom room is currently in a message - * formatting filtered mode. The message formatting filtered mode means that - * all formatted messages (colored, underlined, etc.) are seen in standard - * format by other users. - * - * @return true if this ChatRoom is in message - * formatting filtered mode, otherwise - false - */ - public boolean isFilterMessageFormatting() - { - return false; - } - - /** - * Sets the property indicating if this ChatRoom room is currently - * in a message formatting filtered mode. The message formatting filtered - * mode means that all formatted messages (colored, underlined, etc.) are - * seen in standard format by other users. - * - * @param isFilterMessageFormatting indicates if this ChatRoom - * is currently is a message formatting filtered mode - */ - public void setFilterMessageFormatting(boolean isFilterMessageFormatting) - { - } - - /** - * Indicates if users can only join this ChatRoom in a specified - * interval of X seconds or the time of join is unlimited. - * - * @return true if this ChatRoom could be joined only - * in a specified interval of X seconds, otherwise - false - */ - public boolean isJoinTimeLimited() - { - return false; - } - - /** - * Sets the property indicating if users can only join this ChatRoom - * in a specified interval of X seconds or the time of join is unlimited. - * - * @param isJoinTimeLimited indicates if users can only join this - * ChatRoom in a specified interval of X seconds or the time of - * join is unlimited. - */ - public void setJoinTimeLimited(boolean isJoinTimeLimited) - { - } - - /** - * Indicates if sending invitation request is allowed in this - * ChatRoom. - * - * @return true if user is allowed to send invitation request - * from this ChatRoom, otherwise - false - */ - public boolean isAllowInvitation() - { - return false; - } - - /** - * Sets the property indicating if sending invitation is allowed in - * this ChatRoom. - * - * @param isAllowInvitation indicates if sending invitation request is - * allowed in this ChatRoom - */ - public void setAllowInvitation(boolean isAllowInvitation) - { - } - - /** - * Indicates if ??????? invitation request is allowed in this - * ChatRoom. - * - * @return true if user is allowed to receive invitation request - * in this ChatRoom, otherwise - false - */ - public boolean isAllowInvitationRequest() - { - return false; - } - - /** - * Sets the property indicating if sending invitation request is allowed - * for this ChatRoom. - * - * @param isAllowInvitationRequest indicates if receiving invitation request - * is allowed in this ChatRoom - */ - public void setAllowInvitationRequest(boolean isAllowInvitationRequest) - { - } - - /** - * Indicates if users in this ChatRoom can or cannot change their - * nickname. - * - * @return true if users in this ChatRoom can NOT - * change their nickname, otherwise - false - */ - public boolean isUserNicknameLocked() - { - return false; - } - - /** - * Sets the property indicating if users in this ChatRoom can or - * cannot change their nickname. - * - * @param isUserNicknameLocked indicates if nicknames in this - * ChatRoom are locked and could not be changed by users or users - * are free to modify their nick as they want - */ - public void setUserNicknameLocked(boolean isUserNicknameLocked) - { - } - - /** - * Indicates if kicks are allowed in this ChatRoom. A kick tells the - * server to force a user to leave the chat room. Kick is a term inspired of - * the IRC protocol. - * - * @return true if kicks are allowed in this ChatRoom, - * otherwise - false - */ - public boolean isAllowKick() - { - return false; - } - - /** - * Sets the property indicating if kicks are allowed in this - * ChatRoom. A kick tells the server to force a user to leave the - * chat room. Kick is a term inspired of the IRC protocol. - * - * @param isAllowKick indicates if kicks are allowed in this - * ChatRoom - */ - public void setAllowKick(boolean isAllowKick) - { - } - - /** - * Indicates if only registered users can join this ChatRoom or - * it's opened for everyone. - * - * @return true if only registered users could join this - * ChatRoom, otherwise - false - */ - public boolean isRegisteredUserOnly() - { - return false; - } - - /** - * Sets the property indicating if only registered users can join this - * ChatRoom or it's opened for everyone. - * - * @param isRegisteredUserOnly indicates if only registered users can join - * this ChatRoom or it's opened for everyone. - */ - public void setRegisteredUserOnly(boolean isRegisteredUserOnly) - { - } - - /** - * Indicates if this ChatRoom allows special messages. - * - * @return true if special messages are allowed in this - * ChatRoom, otherwise - false - */ - public boolean isAllowSpecialMessage() - { - return false; - } - - /** - * Sets the property indicating if this ChatRoom allows special - * messages. - * - * @param isAllowSpecialMessage indicates this ChatRoom should - * allow special messages - */ - public void setAllowSpecialMessage(boolean isAllowSpecialMessage) - { - } - - /** - * Indicates if the list of nicknames in this chat room is currently - * visible. - * - * @return true if the list of nicknames in this - * ChatRoom is visible, otherwise - false - */ - public boolean isNicknameListVisible() - { - return false; - } - - /** - * Sets the property indicating if the list of nicknames in this chat room - * is currently visible. - * - * @param isNicknameListVisible indicates if the list of nicknames in this - * chat room should be visible. - */ - public void setNicknameListVisible(boolean isNicknameListVisible) - { - } - - /** - * Adds a configuration property to the configuration list of this chat - * room. If the user does not have the right to change the room - * configuration, or the protocol does not support this, or the operation - * fails for some other reason, the method throws an - * OperationFailedException with the corresponding code. - * - * @param propertyName the name of the configuration property to set - * @param propertyValue the value to set to the given configuration property - * @throws OperationFailedException if the user does not have the right to - * change the room configuration, or the protocol does not support this, or - * the operation fails for some other reason - */ - public void addAdvancedConfigProperty( - String propertyName, String propertyValue) - throws OperationFailedException - { - } - - /** - * Removes a configuration property from this chat room configuration list. - * If the user does not have the right to change the room state, or the - * protocol does not support this, or the operation fails for some other - * reason, the method throws an OperationFailedException with the - * corresponding code. - * - * @param propertyName the name of the configuration property to be removed - * - * @throws OperationFailedException if the user does not have the right to - * change the room configuration, or the protocol does not support this, or - * the operation fails for some other reason - */ - public void removeAdvancedConfigProperty(String propertyName) - throws OperationFailedException - { - } - - /** - * Returns an Iterator over a set of ChatRoomConfigParams, - * containing the current configuration of this chat room. This method is - * meant to be used by bundles interested in what are the specific chat room - * configurations. - * - * @return a Map of (Property_Name, Property_Value) pairs, containing the - * current configuration of this chat room - */ - public Iterator getAdvancedConfigurationSet() - { - return new HashMap().entrySet().iterator(); - } - /** * Returns the identifier of this ChatRoom. The identifier of the * chat room would have the following syntax: @@ -1079,50 +546,19 @@ public String getIdentifier() throw new UnsupportedOperationException("Not supported yet."); } - public ChatRoom getRedirectChatRoom() - { - return null; - } - - public void setRedirectChatRoom(ChatRoom chatRoom) - { - } - - public void setMemberMaxNumber(int maxNumber) + public void banParticipant(ChatRoomMember chatRoomMember, String reason) throws OperationFailedException - { - } - - public int getMemberMaxNumber() - { - return 0; - } - - public boolean isMemberNicknameLocked() - { - return false; - } - - public void setMemberNicknameLocked(boolean isMemberNicknameLocked) { } - public void setJoinRateLimit(int seconds) - { - } - - public int getJoinRateLimit() - { - return 0; - } - - public void banParticipant(ChatRoomMember chatRoomMember, String reason) + public void kickParticipant(ChatRoomMember chatRoomMember, String reason) throws OperationFailedException { } - public void kickParticipant(ChatRoomMember chatRoomMember, String reason) + public ChatRoomConfigurationForm getConfigurationForm() throws OperationFailedException - { + { + return null; } }