org.jivesoftware.smackx.pubsub.EventElementType Java Examples
The following examples show how to use
org.jivesoftware.smackx.pubsub.EventElementType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMPPSession.java From mangosta-android with Apache License 2.0 | 4 votes |
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(); } }); } } }); }
Example #2
Source File: EventProvider.java From Smack with Apache License 2.0 | 4 votes |
@Override protected EventElement createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attMap, List<? extends ExtensionElement> content) { // TODO: Shouldn't be an embedded extension provider. return new EventElement(EventElementType.valueOf(content.get(0).getElementName()), (NodeExtension) content.get(0)); }
Example #3
Source File: EventItemsExtensionFilter.java From Smack with Apache License 2.0 | 4 votes |
@Override public boolean accept(EventElement eventElement) { EventElementType eventElementType = eventElement.getEventType(); return eventElementType == EventElementType.items; }