mod_ctlextra not working with mod_roster_odbc?

I am running the ejabberd 2.0.2 distribution put together by the Ubuntu folks under Kubuntu 8.10. Everything works as expected.

I am using Mysql.

By default they have mod_ctlextra enabled and I've tested added roster items using it and it seems to work.

However, if I switch to using mod_roster_odbc, ejabberd add-rosteritem ceases to work. Fails silently. However, I can add roster items through the webadmin and they show up correctly in the Mysql database.

Is this a known problem? Or if not, any thoughts of what I should look at in trying to track it down?

Not implemented

The roster management part of Web Admin is implemented in mod_roster and mod_roster_odbc.

However, mod_ctlextra (and the successor mod_admin_extra) implements only support for internal Mnesia storage (used by mod_roster).

I don't have any short term plan to implement that.

How to add items to mod_roster_odbc

Is there a mechanism for adding roster items from an external source? (i.e. PHP script?) I'm assuming modifying the database directly is A Very Bad Thing(tm).

I was looking at mod_xmlrpc but it seems that's currently a hack.

Can I add items to a roster using a stanza from an external module? (I'm going to be writing one to intercept mod_service_log messages anyways)

Basically I want to be able to add roster items from a webpage.

Example stanza

Yermo wrote:

Can I add items to a roster using a stanza from an external module? (I'm going to be writing one to intercept mod_service_log messages anyways)

Maybe.

2.3. Adding a Roster Item

In the account user@localhost add the contact tom@localhost. The client sends:

<iq from='user@localhost/Tka' type='set'>
     <query xmlns='jabber:iq:roster'>
       <item jid='tom@localhost' name='Tom'>
         <group>Friends</group>
       </item>
     </query>
   </iq>

Or, sending the stanza directly inside ejabberd:

ejabberd_router:route(
  {jid,"user","localhost","","user","localhost",""},
  {jid,"user","localhost","","user","localhost",""},
  {xmlelement,"iq",
    [{"type","set"}],
    [{xmlelement,"query",
         [{"xmlns","jabber:iq:roster"}],
         [{xmlelement,"item",
              [{"jid","tom@localhost"},{"name","Tom"}],
              [{xmlelement,"group",[],[{xmlcdata,"Friends"}]}]}]}]}).

If you send the stanza from an external component, you may be interested in the option service_check_from:
Component should be allowed to send packets on behalf of users

thanks!

Cool, that's exactly what I needed to know.

I'll use that from my external component and see how it goes.

thanks!

error code 400

I've got the external module going and I've set service_check_from in ejabberd.cfg.

I'm sending:

<iq type='set' id='add_f34827f1739e4af9580e5a209796b0da' from='yml@host'>
        <query xmlns='jabber:iq:roster'>
                <item jid='yermo@host'><group>Friends</group>
</item>

        </query>
</iq>

I'm getting an error:

<iq type='error' to='yml@host' id='add_f34827f1739e4af9580e5a209796b0da'>
        <query xmlns='jabber:iq:roster'>
                <item jid='yermo@host'><group>Friends</group>
</item>

        </query>
<error code='400' type='modify'><bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>

I'm sorry if this is a faq, but is there a list of error codes and their meanings somewhere I can refer to?

thanks,

-- Yermo

Was this ever solved? Sending

Was this ever solved? Sending an IQ from a component without a "to" address errors out. Putting the user as the "to" address does create a item in the roster, but with N set for all fields (ignores the ask and subscription fields). Basically I want to put two users on eachothers rosters, with an xmpp component (without them even having to be online)? Any hint to wether this is actually possible would be great!

Some ideas

crash2burn wrote:

Sending an IQ from a component without a "to" address errors out.

IIRC, when a component sends an IQ without TO, ejabberd assumes the TO is the component himself.

crash2burn wrote:

Putting the user as the "to" address does create a item in the roster, but with N set for all fields (ignores the ask and subscription fields).

I don't see where that N comes from.

crash2burn wrote:

Basically I want to put two users on eachothers rosters, with an xmpp component (without them even having to be online)? Any hint to wether this is actually possible would be great!

[/quote]

Some components (like transports) add contacts. You could install one of those, sniff the traffic they send to ejabberd, and reproduce it with your component.

There is an option that may be useful, look in the ejabberd Guide: service_check_from

Syndicate content