Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure the plugin? #55

Open
tristan-k opened this issue Oct 28, 2016 · 3 comments
Open

How to configure the plugin? #55

tristan-k opened this issue Oct 28, 2016 · 3 comments

Comments

@tristan-k
Copy link

tristan-k commented Oct 28, 2016

Can someone explain how to configure the plugin properly? As soon as I enable the plugin via main.inc.php and log in, Rouncube only display a blank page. I'm using the up-to-date fork from @devurandom at https://github.com/devurandom/roundcube-converse.js-xmpp-plugin/.

$ cat config.inc.php
<?php
// important variables in the following anonymous functions:
// $args['host'] : IMAP hostname
// $args['user'] : IMAP username
// $args['pass'] : IMAP password

// Hostname of BOSH endpoint, used for prebinding only (called by PHP),
// this must be an absolute URL
$rcmail_config['converse_xmpp_bosh_prebind_url']= function($args) {
    return 'http://tristank.de:61219/http-bind';
    # return sprintf('http://%s/http-bind', $_SERVER['HTTP_HOST']);
    # return sprintf('http://%s/http-bind', $args['host']);
};

// Hostname of BOSH endpoint, used by web browsers (called by Javascript code),
// this can be a relative URL
$rcmail_config['converse_xmpp_bosh_url']= function($args) {
    return '/http-bind';
};

// Hostname portion of XMPP username (bare JID), example: "example.net"
$rcmail_config['converse_xmpp_hostname']= function($args) {
    return 'tristank.de';
    # return preg_replace('/^.*@/', '', $args['user']);
    # return $args['host'];
};

// Username portion of XMPP username (bare JID), example: "user"
// if this contains @, this will only take the part before @,
// and the part after @ will replace the hostname definition above.
$rcmail_config['converse_xmpp_username']= function($args) {
    return $args['user'];
    # return preg_replace('/@.*$/', '', $args['user']);
};

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

// converse.js file to use, defaults to converse.nojquery.min.js
// If you want to disable OTR and/or locales, use one of the alternatives
$rcmail_config['converse_jsfile'] = 'converse.nojquery.min.js';

// Additional converse.js option to use
// refer to https://conversejs.org/docs/html/index.html#configuration-variables
// some options are overriden: expose_rid_and_sid, bosh_service_url, debug,
// prebind, jid, sid, rid
$rcmail_config['converse_config'] = array(
    #'animate' => false
);

// Always embed chat even if prebinding is not configured or failed
$rcmail_config['converse_xmpp_enable_always'] = false;

// Enable debug mode
$rcmail_config['converse_xmpp_debug'] = false;

// Enable development mode
$rcmail_config['converse_xmpp_devel_mode'] = false;

// Use older XMPP bind code (in case someone is having problem with
// newer code using Candy Chat's prebind library)
$rcmail_config['converse_xmpp_old_style_prebind'] = false;

// Configure XMPP resource prefix. XMPP resource is set to this variable
// appended with a unique id. Defaults to 'Roundcube-'.
$rcmail_config['converse_xmpp_resource_prefix'] = 'Roundcube-';
@devurandom
Copy link

devurandom commented Oct 28, 2016

I use this configuration:

$rcmail_config['converse_xmpp_bosh_prebind_url']= function($args) {
        return 'https://xmpp.domain.tld:5280/http-bind';
};
$rcmail_config['converse_xmpp_bosh_url']= function($args) {
        return 'https://xmpp.domain.tld:5280/http-bind';
};
$rcmail_config['converse_xmpp_hostname']= function($args) {
        return 'domain.tld';
};
$rcmail_config['converse_xmpp_username']= function($args) {
        return $args['user'];
};
$rcmail_config['converse_xmpp_password']= function($args) {
        return $args['pass'];
};
$rcmail_config['converse_jsfile'] = 'converse.nojquery.min.js';
$rcmail_config['converse_config'] = array(
        'message_archiving' => 'roster',
        'message_carbons' => true,
        'csi_waiting_time' => 60
);

Please note that I had to hardcode converse_xmpp_hostname in the config, as my XMPP server resides on a different host.

For the same reason, and because I also don't use a proxy, both instances of converse_xmpp_bosh*_url have to be absolute URLs on my system. If it is located on the same host, or the roundcube webserver provides a proxy, it might not be necessary to use an absolute URL for converse_xmpp_bosh_url and converse_xmpp_bosh_prebind_url can point to localhost.

Generally your browser's JavaScript console can be helpful in debugging configuration issues, if the PHP server logs do not already contain clues.

@tristan-k
Copy link
Author

tristan-k commented Oct 28, 2016

Thanks for answering. Still no luck. My Prosody server is on the same host so I guess

$rcmail_config['converse_xmpp_bosh_prebind_url']= function($args) {
        return 'http://localhost:61219/http-bind';
};
$rcmail_config['converse_xmpp_bosh_url']= function($args) {
        return 'http://localhost:61219/http-bind';

should be fine. How would I have to configure converse_xmpp_hostname then?

Do I have to copy the necesarry files to the root folder of converse? Because converse.nojquery.min.js is located at js/converse.nojquery.min.js. Are the steps in the tutorial at https://github.com/devurandom/roundcube-converse.js-xmpp-plugin/blob/master/build/HOWTO.md just for customizing conversejs or is it obligatory for using the roundcube plugin?

The JavaScript console shows nothing, please have a look at https://mail.tristank.de/.

@devurandom
Copy link

The build/HOWTO.md is just for customising or updating converse.js.

The converse_xmpp_hostname is the domain part of your JID. E.g. if the JID is [email protected], you set converse_xmpp_hostname to tristank.de. Using the $args['host'] variant works only if your IMAP server is also located at tristank.de (i.e. it will not work if the IMAP server is named imap.tristank.de or similar).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants