Unable to retrieve archived messages from new session - xmpp

I am using EjabberD and have enabled MAM using
mod_mam:
default: always
I am able to retrieve only the messages I have sent using the client on the current session. If I logout and login again on the client, all the archived messages are deleted from the DB. (acertained by comparing Mnesia dumps before and after the second login).
I am using Strophe js based client.
The IQ Packet sent for getting the archived messages
<iq type="set" to="user1#x.x.x.x" xmlns="jabber:client" id="c0104a00-253e-4727-9157-a4ea24d9bc86:sendIQ">
<query xmlns="urn:xmpp:mam:2">
<x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE" type="hidden">
<value>urn:xmpp:mam:2</value>
</field>
<field var="with">
<value>user1#x.x.x.x</value>
</field>
</x>
<set xmlns="http://jabber.org/protocol/rsm" />
</query>
</iq>
On strophe i logout from the server using
connection.disconnect();
connection.reset();
EDIT : Authentication mechanism is LDAP and ANON.
host_config:
"x.x.x.x":
auth_method:
- anonymous
- ldap
allow_multiple_connections: false
ldap_servers:
- "x.x.x.x"
ldap_encrypt: none
ldap_port: 389
ldap_base: "cn=Users,dc=x,dc=x,dc=x"
ldap_rootdn: "cn=Administrator,cn=Users,dc=x,dc=x,dc=x"
ldap_password: "xxx"
ldap_uids:
- "sAMAccountName": "%u"
I want the messages to be archived forever. So that the clients can retrieve the history without storing anything locally. What am I missing?

Are those accounts anonymous? If so, they are deleted when they logout, and all their related information is also deleted, like roster and mam messages.

Related

How to enable MUC/Sub model in ejabberd 16.09?

I installed ejabberd 16.09. But, How to enable muc/sub model in ejabberd yml file? Is this feature available in ejabberd community addition?
I am sending stanza like
<iq from='sam#localhost'
to='test#conference.localhost'
type='get'
id='ik3vs715'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
but i am not getting responcse like
<feature var="urn:xmpp:mucsub:0" />
please reply
You should query room configuration and check "enable subscription" option

ejabberd MUC Archive Management Query Response

I'm using ejabberd 15.09 and have enabled archive management for every MUC in the server configuration like below:
mod_mam:
default: always
mod_muc:
## host: "conference.#HOST#"
access: muc
access_create: muc_create
access_persistent: muc_create
access_admin: muc_admin
default_room_options:
mam: true
persistent: true
public: true
Also inspection on the admin panel for Ejabberd shows that messages are getting archived as the number of elements in archive table goes up after each message is sent to the MUC. This is verifying that archiving is enabled for the session.
To query the server for message archive from MUC, I am sending this iq packet:
<iq type='set' id='testid1'>
<query xmlns='urn:xmpp:mam:1'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<value>urn:xmpp:mam:1</value>
</field>
<field var='with'>
<value>testmyroomnow#conference.ip/</value>
</field>
</x>
</query>
</iq>
Response received from the server doesn't contain any messages.
<message from='user#ip' to='user#ip/Gajim'>
<fin xmlns='urn:xmpp:mam:0' complete='true'>
<set xmlns='http://jabber.org/protocol/rsm'>
<count>0</count>
</set>
</fin>
</message>
This MUC already contains some messages but querying like above is not returning any message. It seems that the format of xml stanza is not correct. Either the format for sending JID for conference is not correct or something else.
Not sure what to do as I'm already using the latest version of Ejabberd which is showing to support archive of MUC. Other that what I'm doing here, I have no idea how to query a MUC archive from ejabberd server.
You need to query the MUC service for MUC archive. The user MAM service only stores message for one-to-one conversation.
Please also note that you are not using the latest ejabberd. As of today, latest version is 15.11. I recommend you use the latest one regarding MAM MUC, as several clarifications has been made to XEP-0313 and were added to latest ejabberd.
Here is example query, sending MAM query stanza to MUC room itself:
<iq type='set' id='juliet1' to='tech#conference.process-one.net'>
<query xmlns='urn:xmpp:mam:0' queryid='f27'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>10</max>
</set>
</query>
</iq>

xmpp openfire server offer reject not working

I am working on a chat application and using Fastpath plugin of Openfire Chat server for workgroups and queues.
When a user is sending a chat invitation/offer to workgroup it is going to all the agents available in the workgroup, on round robin fashion. when the one of agents accepts chat invitation/offer I am sending following info query to server which works fine because once the agent accept chat invitation/offer same offer don't goes to other users.
this is the info query string :-
<iq to="test-home#workgroup.domain" id="833-197" type="set" xmlns="jabber:client">
<offer-accept jid="sender#workgroup.domain" id="offerId" xmlns="http://jabber.org/protocol/workgroup">
</offer-accept>
</iq>
but when agent rejects the offer I am sending following info query, which is not working, and the same user is getting invitation/offer again and again
<iq to="test-home#workgroup.domain" id="833-197" type="set" xmlns="jabber:client">
<offer-reject jid="sender#workgroup.domain" id="offerId" xmlns="http://jabber.org/protocol/workgroup">
</offer-reject>
</iq>

PubSub module returning error

I'm working on getting Jappix running. I'm using ejabberd as my XMPP server and I've got everything working except comments and viewing attachments - group chat, single chat, external authentication, private messages, friend lists, presence and other works as intended.
My configuration is the same as the one the Jappix project provides on their jappix/jappix-tools github repository. I have no errors in my ejabberd log, the only thing I got while debugging and digging everything up is that this is an example stanza sent to the server:
<iq xmlns="jabber:client" type="get" id="get_31-30" to="pubsub.mydomain.com" xml:lang="en">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="urn:xmpp:microblog:0:comments/3aca5f972fe7198805bdd1a20f502f35"/>
</pubsub>
</iq>
And this is the response I get from the server:
<iq xmlns="jabber:client" from="pubsub.mydomain.com" to="arqu#mydomain.com/jappix (1378149270017)" type="error" id="get_31-30" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="urn:xmpp:microblog:0:comments/3aca5f972fe7198805bdd1a20f502f35"/>
</pubsub>
<error code="503" type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
And in Jappix I just get the usual "Service Unavailable" error message.
Additional info:
My BOSH is the internal one of ejabberd and works fine as far as i know, I've setup the reverse proxy and everything else to make it work. Still could be something related to this and not reaching the service on some other port maybe?
It looks like you do not have pubsub enabled/installed on your server.
Have you tried any other pubsub request?

Xmpp ejabberd and add-user command

I have two ejabberd servers, one local one distant online on foobar.com.
Using xmpp pidgin console i can send iq stanzas for tests:
Local server hostname is eepc
<iq to='eeepc' from='greg#eeepc' id='get-registred-users-num-1' type='set'>
<command xmlns='http://jabber.org/protocol/commands' action='execute' node='http://jabber.org/protocol/admin#get-registered-users-num'/>
</iq>
<iq from='eeepc' to='greg#eeepc/3493331071251540036345753' id='get-registred-users-num-1' type='result'>
<command xmlns='http://jabber.org/protocol/commands' sessionid='2009-08-29T14:01:55.714639Z' node='http://jabber.org/protocol/admin#get-registered-users-num' status='completed'>
<x xmlns='jabber:x:data'>
<field type='hidden' var='FORM_TYPE'>
<value>http://jabber.org/protocol/admin</value>
</field>
<field type='text-single' label='Number of registered users' var='registeredusersnum'>
<value>7</value>
</field>
</x>
</command>
</iq>
Distant Server
<iq to='foobar.com' from='greg#foobar.com' id='get-registred-users-num-1' type='set'>
<command xmlns='http://jabber.org/protocol/commands' action='execute' node='http://jabber.org/protocol/admin#get-registered-users-num'/>
</iq>
<iq from='foobar.com' to='greg#foobar.com/36523779951251567671615394' id='get-registred-users-num-1' type='error'>
<command xmlns='http://jabber.org/protocol/commands' action='execute' node='http://jabber.org/protocol/admin#get-registered-users-num'/>
<error code='404' type='cancel'>
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
I don't understand why i get a , i could not see any particular options to tell the server to accept commands from remote ?
Maybe mod_configure is simply not loaded on the distant server.
You can check via lists:member(mod_configure, gen_mod:loaded_modules("foobar.com")). in an ejabberd admin shell.
I cannot imagine that this is about being a remote user, because no s2s connection is needed between foobar.com and greg#foobar.com.
Looking in the mod_configure.erl source code there seems to be an ACL check to make sure the configure adhoc commands are only allowed when the requester is on a user account has configure priv on that virtual host. By default I think they don't.
acl:match_rule(LServer, configure, From)
You may need to add something like...
{access, configure, [{allow, greg#foobar.com}]}.
...to your ejabberd.cfg file.