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


Java XmppStringUtils.completeJidFrom方法代码示例

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


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

示例1: openStream

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Resets the parser using the latest connection's reader. Reseting the parser is necessary
 * when the plain connection has been secured or when a new opening stream element is going
 * to be sent by the server.
 *
 * @throws SmackException if the parser could not be reset.
 */
void openStream() throws SmackException {
    // If possible, provide the receiving entity of the stream open tag, i.e. the server, as much information as
    // possible. The 'to' attribute is *always* available. The 'from' attribute if set by the user and no external
    // mechanism is used to determine the local entity (user). And the 'id' attribute is available after the first
    // response from the server (see e.g. RFC 6120 § 9.1.1 Step 2.)
    CharSequence to = getServiceName();
    CharSequence from = null;
    CharSequence localpart = config.getUsername();
    if (localpart != null) {
        from = XmppStringUtils.completeJidFrom(localpart, to);
    }
    String id = getStreamId();
    // 发送一个SteamOpen
    send(new StreamOpen(to, from, id));
    try {
        packetReader.parser = PacketParserUtils.newXmppParser(reader);
    }
    catch (XmlPullParserException e) {
        throw new SmackException(e);
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:29,代码来源:XMPPTCPConnection.java

示例2: openStream

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Resets the parser using the latest connection's reader. Reseting the parser is necessary
 * when the plain connection has been secured or when a new opening stream element is going
 * to be sent by the server.
 *
 * @throws SmackException if the parser could not be reset.
 * @throws InterruptedException
 */
void openStream() throws SmackException, InterruptedException {
    // If possible, provide the receiving entity of the stream open tag, i.e. the server, as much information as
    // possible. The 'to' attribute is *always* available. The 'from' attribute if set by the user and no external
    // mechanism is used to determine the local entity (user). And the 'id' attribute is available after the first
    // response from the server (see e.g. RFC 6120 § 9.1.1 Step 2.)
    CharSequence to = getXMPPServiceDomain();
    CharSequence from = null;
    CharSequence localpart = config.getUsername();
    if (localpart != null) {
        from = XmppStringUtils.completeJidFrom(localpart, to);
    }
    String id = getStreamId();
    sendNonza(new StreamOpen(to, from, id));
    try {
        packetReader.parser = PacketParserUtils.newXmppParser(reader);
    }
    catch (XmlPullParserException e) {
        throw new SmackException(e);
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:29,代码来源:XMPPTCPConnection.java

示例3: from

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Get a {@link Jid} from the given parts.
 * <p>
 * Only the domainpart is required.
 * </p>
 *
 * @param localpart a optional localpart.
 * @param domainpart a required domainpart.
 * @param resource a optional resourcepart.
 * @return a JID which consists of the given parts.
 * @throws XmppStringprepException if an error occurs.
 */
public static Jid from(String localpart, String domainpart, String resource) throws XmppStringprepException {
	String jidString = XmppStringUtils.completeJidFrom(localpart, domainpart, resource);
	Jid jid = JID_CACHE.lookup(jidString);
	if (jid != null) {
		return jid;
	}
	if (localpart.length() > 0 && domainpart.length() > 0 && resource.length() > 0) {
		jid = new LocalDomainAndResourcepartJid(localpart, domainpart, resource);
	} else if (localpart.length() > 0 && domainpart.length() > 0 && resource.length() == 0) {
		jid = new LocalAndDomainpartJid(localpart, domainpart);
	} else if (localpart.length() == 0 && domainpart.length() > 0 && resource.length() == 0) {
		jid = new DomainpartJid(domainpart);
	} else if (localpart.length() == 0 && domainpart.length() > 0 && resource.length() > 0) {
		jid = new DomainAndResourcepartJid(domainpart, resource);
	} else {
		throw new IllegalArgumentException("Not a valid combination of localpart, domainpart and resource");
	}
	JID_CACHE.put(jidString, jid);
	return jid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:33,代码来源:JidCreate.java

示例4: createGroupJid

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public static String createGroupJid(String groupId, String groupOwner) {
    return XmppStringUtils.completeJidFrom(groupId, groupOwner);
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:4,代码来源:KontalkGroupCommands.java

示例5: createLocalJID

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public static String createLocalJID(Context context, String name) {
    EndpointServer server = Preferences.getEndpointServer(context);
    if (server == null)
        throw new IllegalArgumentException("server is null");
    return XmppStringUtils.completeJidFrom(name, server.getNetwork());
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:7,代码来源:XMPPUtils.java

示例6: string

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/** Return JID as escaped string. */
public String string() {
    return XmppStringUtils.completeJidFrom(mLocal, mDomain, mResource);
}
 
开发者ID:kontalk,项目名称:desktopclient-java,代码行数:5,代码来源:JID.java

示例7: asUnescapedString

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public String asUnescapedString() {
    return XmppStringUtils.completeJidFrom(this.local(), mDomain, mResource);
}
 
开发者ID:kontalk,项目名称:desktopclient-java,代码行数:4,代码来源:JID.java


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