Android Open Source - AsmackChat X M P P Utils






From Project

Back to project page AsmackChat.

License

The source code is released under:

Apache License

If you think the Android project AsmackChat listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Licensed under Apache License, Version 2.0 or LGPL 2.1, at your option.
 * --//from   www . jav  a 2 s  .  c o m
 *
 * Copyright 2010 Rene Treffer
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * --
 *
 * Copyright (C) 2010 Rene Treffer
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 */

package com.googlecode.asmack.chat;

/**
 * XMPP utilities.
 */
public class XMPPUtils {

    /**
     * Get the bare jid from a full jid by cuttting any resource parts.
     * @param resourceJid The resource jid.
     * @return A bare jid.
     */
    public final static String getBareJid(String resourceJid) {
        int index = resourceJid.indexOf('/');
        if (index == -1) {
            return resourceJid;
        }
        return resourceJid.substring(0, index);
    }

    /**
     * Retrieve the user part of a jid.
     * @param jid The bare or full jid.
     * @return The user part of the jid.
     */
    public final static String getUser(String jid) {
        int index = jid.indexOf('@');
        if (index == -1) {
            index = jid.indexOf('.');
            if (index == -1) {
                return jid;
            }
        }
        return jid.substring(0, index);
    }
}




Java Source Code List

com.googlecode.asmack.chat.AutoscrollDataSetObserver.java
com.googlecode.asmack.chat.AutoscrollListView.java
com.googlecode.asmack.chat.BootCompletedReceiver.java
com.googlecode.asmack.chat.ChatNotificationListener.java
com.googlecode.asmack.chat.ChatService.java
com.googlecode.asmack.chat.Chat.java
com.googlecode.asmack.chat.DatabaseOpenHelper.java
com.googlecode.asmack.chat.Database.java
com.googlecode.asmack.chat.HistoryCursorAdapter.java
com.googlecode.asmack.chat.XMPPUtils.java