org.jivesoftware.smackx.pubsub.EventElement Java Examples
The following examples show how to use
org.jivesoftware.smackx.pubsub.EventElement.
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 |
private EventItemsExtensionFilter() { super(EventElement.class); }
Example #4
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; }
Example #5
Source File: EventExtensionFilter.java From Smack with Apache License 2.0 | 4 votes |
private EventExtensionFilter() { super(EventElement.ELEMENT, EventElement.NAMESPACE); }
Example #6
Source File: PepListener.java From Smack with Apache License 2.0 | 2 votes |
/** * Called when PEP events are received as part of a presence subscribe or message filter. * * @param from the user that sent the entries. * @param event the event contained in the message. * @param message the message stanza containing the PEP event. */ void eventReceived(EntityBareJid from, EventElement event, Message message);