2012-12-07 51 views
0

我已经实施XEP-0060使用openfire的pubsub,我可以在现有节点上发布消息,并且我有其他订阅者可以获取这些发布的消息。获得发布商的离线消息

现在的问题是,我无法接收旧消息,我的意思是,如果订户脱机,当他们回来在线,那么我怎么才能得到由出版商长期发布的旧消息。

哪个出版商出版配置为

我的节点如下

<iq from="pubsub.example.com" type="result" id="meta1" to="[email protected]/localhost"> 
<query xmlns="http://jabber.org/protocol/disco#info" node="mynode/loc"> 
<identity category="pubsub" type="leaf"/> 
<feature var="http://jabber.org/protocol/pubsub"/> 
<feature var="http://jabber.org/protocol/disco#info"/> 
<x xmlns="jabber:x:data" type="result"> 
<field type="hidden" var="FORM_TYPE"> 
<value>http://jabber.org/protocol/pubsub#meta-data</value> 
</field> 
<field type="text-single" label="Short name for the node" var="pubsub#title"> 
<value/> 
</field> 
<field type="text-single" label="Description of the node" var="pubsub#description"> 
<value/> 
</field> 
<field type="boolean" label="Allow subscriptions to node" var="pubsub#subscribe"> 
<value>1</value> 
</field> 
<field type="boolean" label="New subscriptions require configuration" var="pubsub#subscription_required"> 
<value>0</value> 
</field> 
<field type="boolean" label="Deliver payloads with event notifications" var="pubsub#deliver_payloads"> 
<value>1</value> 
</field> 
<field type="boolean" label="Notify subscribers when the node configuration changes" var="pubsub#notify_config"> 
<value>1</value> 
</field> 
<field type="boolean" label="Notify subscribers when the node is deleted" var="pubsub#notify_delete"> 
<value>1</value> 
</field> 
<field type="boolean" label="Notify subscribers when items are removed from the node" var="pubsub#notify_retract"> 
<value>1</value> 
</field> 
<field type="boolean" label="Only deliver notifications to available users" var="pubsub#presence_based_delivery"> 
<value>0</value> 
</field> 
<field type="text-single" label="Type of payload data to be provided at this node" var="pubsub#type"> 
<value/> 
</field> 
<field type="text-single" label="Message body XSLT" var="pubsub#body_xslt"> 
<value/> 
</field> 
<field type="text-single" label="Payload XSLT" var="pubsub#dataform_xslt"> 
<value/> 
</field> 
<field type="list-single" label="Specify who may subscribe and retrieve items" var="pubsub#access_model"> 
<option> 
<value>authorize</value> 
</option> 
<option> 
<value>open</value> 
</option> 
<option> 
<value>presence</value> 
</option> 
<option> 
<value>roster</value> 
</option> 
<option> 
<value>whitelist</value> 
</option> 
<value>open</value> 
</field> 
<field type="list-single" label="Publisher model" var="pubsub#publish_model"> 
<option> 
<value>publishers</value> 
</option> 
<option> 
<value>subscribers</value> 
</option> 
<option> 
<value>open</value> 
</option> 
<value>open</value> 
</field> 
<field type="list-multi" label="Roster groups allowed to subscribe" var="pubsub#roster_groups_allowed"/> 
<field type="jid-multi" label="People to contact with questions" var="pubsub#contact"/> 
<field type="text-single" label="Default language" var="pubsub#language"> 
<value>English</value> 
</field> 
<field type="jid-multi" label="Node owners" var="pubsub#owner"> 
<value>[email protected]</value> 
</field> 
<field type="jid-multi" label="Node publishers" var="pubsub#publisher"/> 
<field type="list-single" label="Select entity that should receive replies to items" var="pubsub#itemreply"> 
<value>owner</value> 
</field> 
<field type="jid-multi" label="Multi-user chat room to which replies should be sent" var="pubsub#replyroom"/> 
<field type="jid-multi" label="Users to which replies should be sent" var="pubsub#replyto"/> 
<field type="boolean" label="Send items to new subscribers" var="pubsub#send_item_subscribe"> 
<value>1</value> 
</field> 
<field type="boolean" label="Persist items to storage" var="pubsub#persist_items"> 
<value>1</value> 
</field> 
<field type="text-single" label="Max number of items to persist" var="pubsub#max_items"> 
<value>5</value> 
</field> 
<field type="text-single" label="Max payload size in bytes" var="pubsub#max_payload_size"> 
<value>5120</value> 
</field> 
</x> 
</query> 
</iq> 

回答

0

是的,我得到了它,当用户上线使用以下节,他/她可以retrive旧发布的项目

subid是必须在这种情况下

<iq type='get' 
    from='[email protected]' 
    to='pubsub.example.com' 
    id='items1'> 
    <pubsub xmlns='http://jabber.org/protocol/pubsub'> 
    <items node='mynode' 
subid="8839399494949"/> 
    </pubsub> 
</iq> 
+0

嗨,你有没有试过在Android中使用smack获取发送的消息的发送报告。你能分享一些代码吗?我也在做这个问题一样的东西.. PLease参考这个为我的怀疑http://stackoverflow.com/questions/7241444/android-smack-messageeventlistener @Hunt – Roster

+0

你的问题,你在获取旧信息的问题? – Hunt

+0

不,我想知道邮件是否已发送。所以我问你。之后,我从Message Event Listener获得了解决方案。现在工作很好。感谢您回复@Hunt – Roster