From ff64c57b4dfa6d2ac81376ed03ef0635f088217d Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 22 Mar 2013 18:13:53 +0000 Subject: [PATCH] Added isFullJID() helper in StringUtils git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13575 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,