1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

Provide a MUC method to create *or* join a room

MulitUserChat.create() will throw an SmackException if the MUC service
does not return a 201 status when entering a room. Some MUC
implementations don't return the 201 status but instead behave like
the room already existed.

If the user doesn't care about the room beeing locked until the
initial configuration has been send, he can now use the new
MutliUserChat.createOrJoin(String) method.

Also remove some duplicate code by creating the private enter() method.

Fixes SMACK-557
This commit is contained in:
Florian Schmaus 2014-04-15 23:33:42 +02:00
parent 8ba0715cc3
commit bd5ceded37
2 changed files with 116 additions and 99 deletions

View file

@ -513,17 +513,27 @@ public class StringUtils {
}
/**
* Returns true if string is not null and is not empty, false otherwise
* Returns true if CharSequence is not null and is not empty, false otherwise
* Examples:
* isNotEmpty(null) - false
* isNotEmpty("") - false
* isNotEmpty(" ") - true
* isNotEmpty("empty") - true
*
* @param string checked String
* @param cs checked CharSequence
* @return true if string is not null and is not empty, false otherwise
*/
public static boolean isNotEmpty(CharSequence string) {
return string != null && string.length() != 0;
public static boolean isNotEmpty(CharSequence cs) {
return !isNullOrEmpty(cs);
}
/**
* Returns true if the given CharSequence is not null or empty.
*
* @param cs
* @return true if the given CharSequence is not null or empty
*/
public static boolean isNullOrEmpty(CharSequence cs) {
return cs == null || cs.length() == 0;
}
}