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,6 +78,7 @@ 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');
foreach(explode(',', $abook_uris) as $abook_uri){
if(substr($abook_uri, 0,4) == 'http'){ if(substr($abook_uri, 0,4) == 'http'){
$r=$abook->add_backend('carddav',array( $r=$abook->add_backend('carddav',array(
'name'=>_("CardDAV Address Book"), 'name'=>_("CardDAV Address Book"),
@ -89,6 +90,7 @@ function abook_carddav_init(&$argv) {
'listing'=>$abook_listing, 'listing'=>$abook_listing,
)); ));
} }
}
bindtextdomain ('squirrelmail', SM_PATH . 'locale'); bindtextdomain ('squirrelmail', SM_PATH . 'locale');
textdomain ('squirrelmail'); textdomain ('squirrelmail');