From 3891c738ad7386117d41f2f6f22d9825476c4404 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 22 Mar 2013 18:14:58 +0000 Subject: [PATCH] Added isFullJID() helper in StringUtils git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13579 b35dd754-fafc-0310-a699-88a17e54d16e --- .../org/jivesoftware/smack/util/StringUtils.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/org/jivesoftware/smack/util/StringUtils.java b/source/org/jivesoftware/smack/util/StringUtils.java index 39bc54945..7e3cfdc73 100644 --- a/source/org/jivesoftware/smack/util/StringUtils.java +++ b/source/org/jivesoftware/smack/util/StringUtils.java @@ -362,6 +362,20 @@ public class StringUtils { } } + /** + * Returns true if jid is a full JID (i.e. a JID with resource part). + * + * @param jid + * @return true if full JID, false otherwise + */ + public static boolean isFullJID(String jid) { + if (parseName(jid).length() <= 0 || parseServer(jid).length() <= 0 + || parseResource(jid).length() <= 0) { + return false; + } + return true; + } + /** * Escapes the node portion of a JID according to "JID Escaping" (JEP-0106). * Escaping replaces characters prohibited by node-prep with escape sequences,