package com.sissi.protocol.presence;

/**
 * @author kim 2014年1月16日
 */
public enum PresenceType {

	NONE, PROBE, SUBSCRIBE, SUBSCRIBED, UNSUBSCRIBE, UNSUBSCRIBED, UNAVAILABLE, AVAILABLE;

	public String toString() {
		if (AVAILABLE == this) {
			return null;
		}
		return super.toString().toLowerCase();
	}

	public boolean equals(String type) {
		String value = toString();
		return (value == null) ? false : value.equals(type);
	}

	public boolean in(PresenceType... types) {
		for (PresenceType type : types) {
			if (this == type) {
				return true;
			}
		}
		return false;
	}

	public static PresenceType parse(String type) {
		try {
			return type == null ? AVAILABLE : PresenceType.valueOf(type.toUpperCase());
		} catch (Exception e) {
			return NONE;
		}
	}
}

@@ -346,82 +346,28 @@
 %7B%0A%09%09
-String value = toString();%0A%09%09return (value == null) ? false : value.equals
+return this == parse
 (typ

Fix infinite recursive loop on PresenceType