Java 类org.jivesoftware.smackx.pubsub.ItemsExtension 实例源码

项目:xmppsupport_v2    文件:ItemsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement,
        String currentNamespace, Map<String, String> attributeMap,
        List<? extends PacketExtension> content) {
    return new ItemsExtension(ItemsExtension.ItemsElementType.items,
            attributeMap.get("node"), content);
}
项目:desktopclient-java    文件:AvatarSendReceiver.java   
void processMetadataEvent(JID jid, ItemsExtension itemsExt) {
    List<? extends ExtensionElement> items = itemsExt.getItems();
    if (items.isEmpty()) {
        LOGGER.warning("no items in items event");
        return;
    }

    // there should be only one item
    ExtensionElement e = items.get(0);
    if (!(e instanceof PayloadItem)) {
        LOGGER.warning("element not a payloaditem");
        return;
    }

    PayloadItem item = (PayloadItem) e;
    ExtensionElement metadataExt = item.getPayload();
    if (!(metadataExt instanceof AvatarMetadataExtension)) {
        LOGGER.warning("payload not avatar metadata");
        return;
    }
    AvatarMetadataExtension metadata = (AvatarMetadataExtension) metadataExt;
    List<AvatarMetadataExtension.Info> infos = metadata.getInfos();
    if (infos.isEmpty()) {
        // this means the contact disabled avatar publishing
        mHandler.onNotify(jid, "");
        return;
    }
    // assuming infos are always in the same order
    for (AvatarMetadataExtension.Info info : infos) {
        if (AvatarHandler.SUPPORTED_TYPES.contains(info.getType())) {
            mHandler.onNotify(jid, info.getId());
            break;
        } else {
            LOGGER.info("image type not supported: "+info.getType());
        }
    }
}
项目:mangosta-android    文件:XMPPSession.java   
private void receiveBlogPosts() {
    PEPManager pepManager = PEPManager.getInstanceFor(mXMPPConnection);
    pepManager.addPEPListener(new PEPListener() {
        @Override
        public void eventReceived(EntityBareJid entityBareJid, EventElement eventElement, Message message) {
            if (EventElementType.items == eventElement.getEventType()) {
                ItemsExtension itemsExtension = (ItemsExtension) eventElement.getExtensions().get(0);
                PayloadItem payloadItem = (PayloadItem) itemsExtension.getItems().get(0);
                PostEntryExtension postEntryExtension = (PostEntryExtension) payloadItem.getPayload();

                String id = postEntryExtension.getId();
                String jid = entityBareJid.toString();
                String title = postEntryExtension.getTitle();
                Date published = postEntryExtension.getPublished();
                Date updated = postEntryExtension.getUpdated();

                BlogPost blogPost = new BlogPost(id, jid, null, title, published, updated);
                RealmManager.getInstance().saveBlogPost(blogPost);

                String commentsNode = PublishCommentExtension.NODE + "/" + id;
                ServiceDiscoveryManager.getInstanceFor(mXMPPConnection).addFeature(commentsNode + "+notify");

                notifyNewBlogPost();
            }
        }

        private void notifyNewBlogPost() {
            MangostaApplication mangostaApplication = MangostaApplication.getInstance();
            if (mangostaApplication.isClosed()) {
                BlogPostNotifications.newBlogPostNotification();
            } else {
                mangostaApplication.getCurrentActivity().runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        new Event(Event.Type.BLOG_POST_CREATED).post();
                    }
                });
            }
        }
    });
}
项目:Smack    文件:ItemsProvider.java   
@Override
protected ItemsExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
{
       return new ItemsExtension(ItemsExtension.ItemsElementType.items, attributeMap.get("node"), content);
}
项目:EIM    文件:ItemsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
       return new ItemsExtension(ItemsExtension.ItemsElementType.items, attributeMap.get("node"), content);
}
项目:androidPN-client.    文件:ItemsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
       return new ItemsExtension(ItemsExtension.ItemsElementType.items, attributeMap.get("node"), content);
}
项目:java-bells    文件:ItemsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
       return new ItemsExtension(ItemsExtension.ItemsElementType.items, attributeMap.get("node"), content);
}
项目:telegraph    文件:ItemsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
       return new ItemsExtension(ItemsExtension.ItemsElementType.items, attributeMap.get("node"), content);
}
项目:NewCommunication-Android    文件:ItemsProvider.java   
@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
       return new ItemsExtension(ItemsExtension.ItemsElementType.items, attributeMap.get("node"), content);
}