Roundcube-converse.js-xmmp-plugin in Kolab

Mathias Friman mathias at workplays.se
Mon Oct 19 11:01:23 CEST 2015


Hi list!

No progress in my migration so I'll try another issue instead. I've managed
to do a ugly hack with the converse.js-xmpp-plugin that has not seen any
action in a while. You see, my municipality administration is considering a
switch from FirstClass to Office365, but I would think that Kolab could
make an excellent alternative, combined with some other software.

One of the key functions though, is the chat presence which is a must. So
I've setup a Prosody XMPP server and ugly hacked together
https://github.com/priyadi/roundcube-converse.js-xmpp-plugin in a way that
is sufficiently pleasing to the eye: http://imgur.com/fZO8bTj.png

Now to the problem(s).

1. This plugin only works if i set the user and password manually in
config.inc.php like so:

$rcmail_config['converse_xmpp_username']= function($args) {
        return 'osdmatfri';
        //return $args['user'];
        //return preg_replace('/@.*$/', '', $args['user']);
};

// XMPP password
$rcmail_config['converse_xmpp_password']= function($args) {
        return 'OpenSourceRules!';
        //return $args['pass'];
};

When I try with "return $args['pass'];" etc, which seems to be the default
behaviour, it doesn't work. Having a username and password value hard coded
in the config is, as you understand, suboptimal.

As I understand this plugin, you connect to the XMPP server at login, and
Roundcube/Kolab handles the login/logout procedure. Which leads me to the
second problem.

2. When I have the chat in Kolab like on the screenshot, the whole system
becomes unresponsive to clicks. onMouseOver-effects work when i steer the
mouse pointer, but I cannot click anywhere. The javascript errors out with
"TypeError: converse.on is not a function" in js/converse-rcmail.js :

    // hook into login event and keep XMPP session in Roundcube's session
    converse.on('onReady', function(e){
        if (!args.sid && e.target.bare_jid)
            rcmail.http_post('plugin.converse_bind', {
jid:e.target.bare_jid, sid:converse.getSID() });
    });

I guess this is because I've changed the JavaScript-code in converse.php
like so:

        //define("jquery", [], function() { return jQuery; });
        //require.config({ baseUrl: "'.$this->urlbase.'devel/converse.js"
});
        //require(["converse"], function (converse) {
                var args =
'.$rcmail->output->json_serialize($converse_prop).';
                args.i18n = locales["'.$locale.'"];
                rcmail_converse_init(converse, args);
        //});

I understand that commenting out the define and require statements is
probably a bad idea, but otherwise the converse.js chat will not start at
all and gives a whole other lot of errors. I guess the converse.js has
changed a bit in a year or two.

I'm no JavaScript programmer and rather terrible at PHP too, so I would
like some help with this in some way.

When inserting the converse.js chat "as is" in Kolab it works splendidly,
however the user is required to login one extra time and that does not give
the impression of very great integration.

Any ideas?

Kindest regards,
Mathias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kolab.org/pipermail/users/attachments/20151019/269b66de/attachment.html>


More information about the users mailing list