1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

Improve MUC code and documentation

- use JID types
- make clases immutable
This commit is contained in:
Florian Schmaus 2016-07-29 16:21:20 +02:00
parent e04697d349
commit d37d26547c
9 changed files with 134 additions and 120 deletions

View file

@ -25,6 +25,7 @@ import java.util.Locale;
import org.jivesoftware.smack.SmackException;
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.Jid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Resourcepart;
@ -85,6 +86,18 @@ public class ParserUtils {
return JidCreate.entityBareFrom(jidString);
}
public static EntityFullJid getFullJidAttribute(XmlPullParser parser) throws XmppStringprepException {
return getFullJidAttribute(parser, JID);
}
public static EntityFullJid getFullJidAttribute(XmlPullParser parser, String name) throws XmppStringprepException {
final String jidString = parser.getAttributeValue("", name);
if (jidString == null) {
return null;
}
return JidCreate.entityFullFrom(jidString);
}
public static Resourcepart getResourcepartAttribute(XmlPullParser parser, String name) throws XmppStringprepException {
final String resourcepartString = parser.getAttributeValue("", name);
if (resourcepartString == null) {