Exemple #1
0
        public static string PrepareUser(string user)
        {
            if (String.IsNullOrEmpty(user))
            {
                return(null);
            }

            // first Encode the user/node
            string tmpUser = EscapeNode(user);

#if !STRINGPREP
            return(tmpUser.ToLower());
#else
            return(StringPrep.NodePrep(tmpUser));
#endif
        }
Exemple #2
0
        /// <summary>
        /// Builds a new Jid object.
        /// StringPrep is applied to the input string.
        /// </summary>
        /// <param name="user">XMPP User part</param>
        /// <param name="server">XMPP Domain part</param>
        /// <param name="resource">XMPP Resource part</param>
        public Jid(string user, string server, string resource)
        {
#if !STRINGPREP
            if (user != null)
            {
                user = EscapeNode(user);

                m_User = user.ToLower();
            }

            if (server != null)
            {
                m_Server = server.ToLower();
            }

            if (resource != null)
            {
                m_Resource = resource;
            }
#else
            if (user != null)
            {
                user = EscapeNode(user);

                m_User = StringPrep.NodePrep(user);
            }

            if (server != null)
            {
                m_Server = StringPrep.NamePrep(server);
            }

            if (resource != null)
            {
                m_Resource = StringPrep.ResourcePrep(resource);
            }
#endif
            BuildJid();
        }