001/** 002 * 003 * Copyright © 2014-2015 Florian Schmaus 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.muc; 018 019import org.jivesoftware.smack.SmackException; 020import org.jxmpp.jid.DomainBareJid; 021 022public abstract class MultiUserChatException extends SmackException { 023 024 protected MultiUserChatException() { 025 } 026 027 protected MultiUserChatException(String message) { 028 super(message); 029 } 030 031 /** 032 * 033 */ 034 private static final long serialVersionUID = 1L; 035 036 // This could eventually become an unchecked exception. But be aware that it's required in the 037 // control flow of MultiUserChat.createOrJoinIfNecessary 038 public static class MucAlreadyJoinedException extends MultiUserChatException { 039 040 /** 041 * 042 */ 043 private static final long serialVersionUID = 1L; 044 045 } 046 047 /** 048 * Thrown if the requested operation required the MUC to be joined by the 049 * client, while the client is currently joined. 050 * 051 */ 052 public static class MucNotJoinedException extends MultiUserChatException { 053 054 /** 055 * 056 */ 057 private static final long serialVersionUID = 1L; 058 059 public MucNotJoinedException(MultiUserChat multiUserChat) { 060 super("Client not currently joined " + multiUserChat.getRoom()); 061 } 062 } 063 064 public static class MissingMucCreationAcknowledgeException extends MultiUserChatException { 065 066 /** 067 * 068 */ 069 private static final long serialVersionUID = 1L; 070 071 } 072 073 /** 074 * Thrown if the MUC room does not support the requested configuration option. 075 */ 076 public static class MucConfigurationNotSupportedException extends MultiUserChatException { 077 078 /** 079 * 080 */ 081 private static final long serialVersionUID = 1L; 082 083 public MucConfigurationNotSupportedException(String configString) { 084 super("The MUC configuration '" + configString + "' is not supported by the MUC service"); 085 } 086 } 087 088 /** 089 * Thrown when trying to enter a MUC room that is not hosted a domain providing a MUC service. 090 * Try {@link MultiUserChatManager#getXMPPServiceDomains()} for a list of client-local domains 091 * providing a MUC service. 092 */ 093 public static class NotAMucServiceException extends MultiUserChatException { 094 095 /** 096 * 097 */ 098 private static final long serialVersionUID = 1L; 099 100 NotAMucServiceException(DomainBareJid service) { 101 super("Can't perform operation because " + service 102 + " does not provide a MUC (XEP-45) service."); 103 } 104 105 NotAMucServiceException(MultiUserChat multiUserChat) { 106 super("Can not join '" + multiUserChat.getRoom() + "', because '" 107 + multiUserChat.getRoom().asDomainBareJid() 108 + "' does not provide a MUC (XEP-45) service."); 109 } 110 } 111}