当前位置: 首页>>代码示例>>Java>>正文


Java XmppStringUtils.parseResource方法代码示例

本文整理汇总了Java中org.jxmpp.util.XmppStringUtils.parseResource方法的典型用法代码示例。如果您正苦于以下问题:Java XmppStringUtils.parseResource方法的具体用法?Java XmppStringUtils.parseResource怎么用?Java XmppStringUtils.parseResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jxmpp.util.XmppStringUtils的用法示例。


在下文中一共展示了XmppStringUtils.parseResource方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: userHasLogged

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public void userHasLogged(String user) {
    String localpart = XmppStringUtils.parseLocalpart(user);
    boolean isAnonymous = "".equals(localpart);
    String title =
            "User logged (" + connection.getConnectionCounter() + "): "
            + (isAnonymous ? "" : localpart)
            + "@"
            + connection.getServiceName()
            + ":"
            + connection.getPort();
    title += "/" + XmppStringUtils.parseResource(user);
    log(title);
    // Add the connection listener to the connection so that the debugger can be notified
    // whenever the connection is closed.
    connection.addConnectionListener(connListener);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:17,代码来源:AbstractDebugger.java

示例2: createRxMessage

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public static XmppRxMessage createRxMessage(org.jivesoftware.smack.packet.Message xmppMessage){
    MessageContent content = new DefaultMessageContent(xmppMessage.getBody());
    Resource resource;

    if(xmppMessage.getType().equals(org.jivesoftware.smack.packet.Message.Type.groupchat)){
        resource =
                new DefaultResource(
                        XmppStringUtils.parseBareJid(xmppMessage.getFrom()),
                        XmppStringUtils.parseResource(xmppMessage.getFrom()),
                        Resource.Type.ROOM
                );
    }else{
        resource = new DefaultResource(xmppMessage.getFrom(),xmppMessage.getFrom(), Resource.Type.USER);
    }

    XmppRxMessage msg = new XmppRxMessage(resource,content);
    msg.setId(xmppMessage.getStanzaId());
    msg.setThread(xmppMessage.getThread());
    return msg;
}
 
开发者ID:midoricorp,项目名称:jabbot,代码行数:21,代码来源:MessageHelper.java

示例3: fullFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link FullJid} representing the given String.
 *
 * @param jid the JID's String.
 * @return a full JID representing the input String.
 * @throws XmppStringprepException if an error occurs.
 */
public static FullJid fullFrom(String jid) throws XmppStringprepException {
	FullJid fullJid = FULLJID_CACHE.lookup(jid);
	if (fullJid != null) {
		return fullJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(jid);
	String domainpart = XmppStringUtils.parseDomain(jid);
	String resource = XmppStringUtils.parseResource(jid);
	try {
		fullJid = fullFrom(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	FULLJID_CACHE.put(jid, fullJid);
	return fullJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:25,代码来源:JidCreate.java

示例4: entityFullFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link EntityFullJid} representing the given String.
 *
 * @param jid the JID's String.
 * @return a full JID representing the input String.
 * @throws XmppStringprepException if an error occurs.
 */
public static EntityFullJid entityFullFrom(String jid) throws XmppStringprepException {
	EntityFullJid fullJid = ENTITY_FULLJID_CACHE.lookup(jid);
	if (fullJid != null) {
		return fullJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(jid);
	String domainpart = XmppStringUtils.parseDomain(jid);
	String resource = XmppStringUtils.parseResource(jid);
	try {
		fullJid = entityFullFrom(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	ENTITY_FULLJID_CACHE.put(jid, fullJid);
	return fullJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:25,代码来源:JidCreate.java

示例5: entityFullFromUnescaped

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link EntityFullJid} representing the given unescaped String.
 *
 * @param unescapedJidString the JID's String.
 * @return a full JID representing the input String.
 * @throws XmppStringprepException if an error occurs.
 */
public static EntityFullJid entityFullFromUnescaped(String unescapedJidString) throws XmppStringprepException {
	EntityFullJid fullJid = ENTITY_FULLJID_CACHE.lookup(unescapedJidString);
	if (fullJid != null) {
		return fullJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(unescapedJidString);
	// Some as from(String), but we escape the localpart
	localpart = XmppStringUtils.escapeLocalpart(localpart);

	String domainpart = XmppStringUtils.parseDomain(unescapedJidString);
	String resource = XmppStringUtils.parseResource(unescapedJidString);
	try {
		fullJid = new LocalDomainAndResourcepartJid(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(unescapedJidString, e);
	}

	ENTITY_FULLJID_CACHE.put(unescapedJidString, fullJid);
	return fullJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:29,代码来源:JidCreate.java

示例6: domainFullFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a domain full JID from the given String.
 *
 * @param jid the JID.
 * @return a DomainFullJid.
 * @throws XmppStringprepException if an error happens.
 */
public static DomainFullJid domainFullFrom(String jid) throws XmppStringprepException {
	DomainFullJid domainResourceJid = DOMAINRESOURCEJID_CACHE.lookup(jid);
	if (domainResourceJid != null) {
		return domainResourceJid;
	}

	String domain = XmppStringUtils.parseDomain(jid);
	String resource = XmppStringUtils.parseResource(jid);
	try {
		domainResourceJid = new DomainAndResourcepartJid(domain, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	DOMAINRESOURCEJID_CACHE.put(jid, domainResourceJid);
	return domainResourceJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:24,代码来源:JidCreate.java

示例7: userHasLogged

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public void userHasLogged(String user) {
    boolean isAnonymous = "".equals(XmppStringUtils.parseLocalpart(user));
    String title =
        "Smack Debug Window -- "
            + (isAnonymous ? "" : XmppStringUtils.parseBareJid(user))
            + "@"
            + connection.getServiceName()
            + ":"
            + connection.getPort();
    title += "/" + XmppStringUtils.parseResource(user);
    frame.setTitle(title);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:13,代码来源:LiteDebugger.java

示例8: Occupant

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
Occupant(Presence presence) {
    MUCUser mucUser = (MUCUser) presence.getExtension("x",
            "http://jabber.org/protocol/muc#user");
    MUCItem item = mucUser.getItem();
    this.jid = item.getJid();
    this.affiliation = item.getAffiliation();
    this.role = item.getRole();
    // Get the nickname from the FROM attribute of the presence
    this.nick = XmppStringUtils.parseResource(presence.getFrom());
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:11,代码来源:Occupant.java

示例9: from

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link Jid} from the given String.
 *
 * @param jidString the input String.
 * @return the Jid represented by the input String.
 * @throws XmppStringprepException if an error occurs.
 * @see #from(CharSequence)
 */
public static Jid from(String jidString) throws XmppStringprepException {
	String localpart = XmppStringUtils.parseLocalpart(jidString);
	String domainpart = XmppStringUtils.parseDomain(jidString);
	String resource = XmppStringUtils.parseResource(jidString);
	try {
		return from(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jidString, e);
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:19,代码来源:JidCreate.java

示例10: fromUnescaped

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link Jid} from the given unescaped String.
 *
 * @param unescapedJidString a unescaped String representing a JID.
 * @return a JID.
 * @throws XmppStringprepException if an error occurs.
 */
public static Jid fromUnescaped(String unescapedJidString) throws XmppStringprepException {
	String localpart = XmppStringUtils.parseLocalpart(unescapedJidString);
	// Some as from(String), but we escape the localpart
	localpart = XmppStringUtils.escapeLocalpart(localpart);

	String domainpart = XmppStringUtils.parseDomain(unescapedJidString);
	String resource = XmppStringUtils.parseResource(unescapedJidString);
	try {
		return from(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(unescapedJidString, e);
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:21,代码来源:JidCreate.java


注:本文中的org.jxmpp.util.XmppStringUtils.parseResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。