allow multiple abook URIs, separated by comma

This commit is contained in:
Alexey Shpakovsky 2023-10-03 00:38:31 +02:00
parent 2eca13d7a2
commit 076cb751d7
No known key found for this signature in database
GPG key ID: 5797A726A2A4230A

View file

@ -70,7 +70,7 @@ function abook_carddav_init(&$argv) {
textdomain ('abook_carddav'); textdomain ('abook_carddav');
// TODO: consider multiple uris // TODO: consider multiple uris
$abook_uri = getPref($data_dir, $username, 'plugin_abook_carddav_abook_uri'); $abook_uris = getPref($data_dir, $username, 'plugin_abook_carddav_abook_uri');
$abook_base_uri = getPref($data_dir, $username, 'plugin_abook_carddav_base_uri'); $abook_base_uri = getPref($data_dir, $username, 'plugin_abook_carddav_base_uri');
$abook_username = getPref($data_dir, $username, 'plugin_abook_carddav_username'); $abook_username = getPref($data_dir, $username, 'plugin_abook_carddav_username');
$abook_password_text = getPref($data_dir, $username, 'plugin_abook_carddav_password'); $abook_password_text = getPref($data_dir, $username, 'plugin_abook_carddav_password');
@ -78,16 +78,18 @@ function abook_carddav_init(&$argv) {
$abook_password = abook_get_password($abook_password_text, $abook_password_opt); $abook_password = abook_get_password($abook_password_text, $abook_password_opt);
$abook_writeable = getPref($data_dir, $username, 'plugin_abook_carddav_writeable'); $abook_writeable = getPref($data_dir, $username, 'plugin_abook_carddav_writeable');
$abook_listing = getPref($data_dir, $username, 'plugin_abook_carddav_listing'); $abook_listing = getPref($data_dir, $username, 'plugin_abook_carddav_listing');
if(substr($abook_uri, 0,4) == 'http'){ foreach(explode(',', $abook_uris) as $abook_uri){
$r=$abook->add_backend('carddav',array( if(substr($abook_uri, 0,4) == 'http'){
'name'=>_("CardDAV Address Book"), $r=$abook->add_backend('carddav',array(
'abook_uri'=>$abook_uri, 'name'=>_("CardDAV Address Book"),
'base_uri'=>$abook_base_uri, 'abook_uri'=>$abook_uri,
'username'=>$abook_username, 'base_uri'=>$abook_base_uri,
'password'=>$abook_password, 'username'=>$abook_username,
'writeable'=>$abook_writeable, 'password'=>$abook_password,
'listing'=>$abook_listing, 'writeable'=>$abook_writeable,
)); 'listing'=>$abook_listing,
));
}
} }
bindtextdomain ('squirrelmail', SM_PATH . 'locale'); bindtextdomain ('squirrelmail', SM_PATH . 'locale');