Roundcube-converse.js-xmmp-plugin in Kolab

Mihai Badici mihai at badici.ro
Mon Oct 19 11:42:52 CEST 2015


On Monday 19 October 2015 11:01:23 Mathias Friman wrote:


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[1] in a way 
that is sufficiently pleasing to the eye: http://imgur.com/fZO8bTj.png[2] 



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.




I have a working configuration, and my config looks like:

$rcmail_config['converse_xmpp_hostname'] = function($args) {
  list($user,$host) = explode('@', $args['user']);
//    return $host;
    return 'domain.ro';
    };

This server use "short usernames" for login ( no domain so i added it 
manually)
IMHO the fact converse is not appearing at login is just because it not 
authenticate but you should dig.
( I think after you change the config you need to logoff and logon again in 
order the plugin read again the user and pass; i think a little logging can 
be helpfull here)
Usually my customers have desktop clients (I tried  pandion or jitsi, 
pandion is not an active project but is easy to configure and it have a user 
friendly interface) but they use the web client when are not at the office.


Any ideas?



Kindest regards,


Mathias 




Mihai Badici[3] 

--------
[1] https://github.com/priyadi/roundcube-converse.js-xmpp-plugin
[2] http://imgur.com/fZO8bTj.png
[3] http://mihai.badici.ro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kolab.org/pipermail/users/attachments/20151019/b7c8e78d/attachment-0001.html>


More information about the users mailing list