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


Java PubSub.createPubsubPacket方法代码示例

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


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

示例1: sendBlogPostComment

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
public BlogPostComment sendBlogPostComment(String content, BlogPost blogPost)
        throws SmackException.NotConnectedException, InterruptedException,
        XMPPException.XMPPErrorException, SmackException.NoResponseException {
    Jid jid = XMPPSession.getInstance().getUser().asEntityBareJid();
    String userName = XMPPUtils.fromJIDToUserName(jid.toString());
    Jid pubSubServiceJid = XMPPSession.getInstance().getPubSubService();

    // create stanza
    PublishCommentExtension publishCommentExtension = new PublishCommentExtension(blogPost.getId(), userName, jid, content, new Date());
    PubSub publishCommentPubSub = PubSub.createPubsubPacket(pubSubServiceJid, IQ.Type.set, publishCommentExtension, null);

    // send stanza
    XMPPSession.getInstance().sendStanza(publishCommentPubSub);

    return new BlogPostComment(publishCommentExtension.getId(),
            blogPost.getId(),
            content,
            userName,
            jid.toString(),
            publishCommentExtension.getPublished());
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:22,代码来源:BlogPostDetailsActivity.java

示例2: createNode

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Creates a node with specified configuration.
 * 
 * Note: This is the only way to create a collection node.
 * 
 * @param name The name of the node, which must be unique within the 
 * pubsub service
 * @param config The configuration for the node
 * @return The node that was created
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public Node createNode(String name, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException
{
    PubSub request = PubSub.createPubsubPacket(to, Type.set, new NodeExtension(PubSubElementType.CREATE, name), null);
    boolean isLeafNode = true;
    
    if (config != null)
    {
        request.addExtension(new FormNode(FormNodeType.CONFIGURE, config));
        FormField nodeTypeField = config.getField(ConfigureNodeFields.node_type.getFieldName());
        
        if (nodeTypeField != null)
            isLeafNode = nodeTypeField.getValues().get(0).equals(NodeType.leaf.toString());
    }

    // Errors will cause exceptions in getReply, so it only returns
    // on success.
    sendPubsubPacket(con, request);
    Node newNode = isLeafNode ? new LeafNode(con, name) : new CollectionNode(con, name);
    newNode.setTo(to);
    nodeMap.put(newNode.getId(), newNode);
    
    return newNode;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:37,代码来源:PubSubManager.java

示例3: createPubsubPacket

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
protected PubSub createPubsubPacket(Type type, ExtensionElement ext, PubSubNamespace ns)
{
    return PubSub.createPubsubPacket(to, type, ext, ns);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:5,代码来源:Node.java


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