自定义Roundcube webmail服务器列表

I have -latest version 1.2.0- webmail works with . I host multiple domains on that server and I use IIS as web server for Roundcube. The webmail is accessible by https://mail.xxxx.tld where xxxx is the domain name that I host.

All the domains points to only one website on the IIS using bindings from IIS's webite settings.

In the Roundcube config.inc.php:

$config['default_host'] = array('mail.x1.net', 'mail.x2.net', 'mail.x3.org', 'mail.x4.net');

So, in the login page there is servers list like the following screen shot:

enter image description here

The first server in the server's list is always selected by default. What I need to get is making the selected server or even make a single server available based on the URL from which the login page is accessed.

Now, I don't meant with how to implement it, either client-side using javascript or server-side using PHP, I just meant with where could I able to apply any implementation for that requirement?

I have tried to modify skins/larry/templates/login.html but I could not able to find any details for the login form other than the following:

<roundcube:form name="form" method="post">
<roundcube:object name="loginform" form="form" size="40" submit=true />
</form> 

In other words, all the three form elements, Username, Password and server are generated from <roundcube:object name="loginform" form="form" size="40" submit=true />, so where could I able to modify this object?

I found that there is two ways:

  1. Long way, study Roundcube API and build a plugin.
  2. Short way, adding a little script at the end of skins/larry/templates/login.html

The following is the script that I have added:

<script>
/* By: Said Bakr
 Making only one select list server item equals to the current host.
*/
$(document).ready(function() {
    my_host = $(location).attr('hostname');
    $("#rcmloginhost option").each(function(){
      if ($(this).val().replace(/^(.*)\:\/\//i, "") != my_host){
        $(this).remove();
      } 
    })
});
</script>
</body>