table equals ``principals/users/`` + ``$useremailaddress``.
If you do not see all contacts: Only contacts with an e-mail address are shown.
+
+
+Links
+=====
+- Git repository: https://git.cweiske.de/roundcube-nextcloud_sql_addressbook.git
+- Git mirror: https://github.com/cweiske/roundcube-nextcloud_sql_addressbook
+- Roundcube plugin page: https://plugins.roundcube.net/packages/cweiske/nextcloud_sql_addressbook
* @var string
*/
protected $prefix = 'oc_';
-
+
+ /**
+ * Database instance
+ */
+ protected $db;
+
/**
* Initialization method, needs to be implemented by the plugin itself
*
$this->add_hook('addressbook_get', [$this, 'addressbook_get']);
$this->rcube = rcube::get_instance();
-
+
$this->db = rcube_db::factory(
$this->rcube->config->get('nextcloud_sql_addressbook_dsn')
);
$this->db->set_debug((bool) $this->rcube->config->get('sql_debug'));
-
+
$this->prefix = $this->rcube->config->get(
'nextcloud_sql_addressbook_dbtableprefix', 'oc_'
);
*/
protected function listAddressbooks()
{
+ if (!isset($this->rcube->user->data)) {
+ return [];
+ }
+
$principalUri = 'principals/users/'
. $this->rcube->user->data['username'];
*/
public function addressbook_get($arguments)
{
+ if (!isset($arguments['id'])) {
+ return $arguments;
+ }
$parts = explode('_', $arguments['id'], 2);
if (count($parts) != 2 || $parts[0] != 'nextcloud') {
return $arguments;
$arguments['instance'] = new nextcloud_sql_addressbook_backend(
$id, $this->db, $this->prefix
);
-
+
return $arguments;
}
}