summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/kolab_addressbook/kolab_addressbook.php6
-rw-r--r--plugins/kolab_addressbook/lib/rcube_kolab_contacts.php4
-rw-r--r--plugins/kolab_addressbook/localization/de_CH.inc3
-rw-r--r--plugins/kolab_addressbook/localization/de_DE.inc3
-rw-r--r--plugins/kolab_addressbook/localization/en_US.inc3
-rw-r--r--plugins/libkolab/lib/kolab_format_contact.php52
6 files changed, 40 insertions, 31 deletions
diff --git a/plugins/kolab_addressbook/kolab_addressbook.php b/plugins/kolab_addressbook/kolab_addressbook.php
index ef6d11a..3e1d200 100644
--- a/plugins/kolab_addressbook/kolab_addressbook.php
+++ b/plugins/kolab_addressbook/kolab_addressbook.php
@@ -292,7 +292,8 @@ class kolab_addressbook extends rcube_plugin
$p['form']['personal']['content']['profession'] = array('size' => 40);
$p['form']['personal']['content']['children'] = array('size' => 40);
$p['form']['personal']['content']['freebusyurl'] = array('size' => 40);
- $p['form']['personal']['content']['pgppublickey'] = array('size' => 40);
+ $p['form']['personal']['content']['pgppublickey'] = array('size' => 70);
+ $p['form']['personal']['content']['pkcs7publickey'] = array('size' => 70);
// re-order fields according to the coltypes list
$p['form']['contact']['content'] = $this->_sort_form_fields($p['form']['contact']['content']);
@@ -302,8 +303,9 @@ class kolab_addressbook extends rcube_plugin
$p['form']['settings'] = array(
'name' => $this->gettext('settings'),
'content' => array(
- 'pgppublickey' => array('size' => 40, 'visible' => true),
'freebusyurl' => array('size' => 40, 'visible' => true),
+ 'pgppublickey' => array('size' => 70, 'visible' => true),
+ 'pkcs7publickey' => array('size' => 70, 'visible' => false),
)
);
*/
diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
index 0c1a821..ebfa29a 100644
--- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
@@ -63,9 +63,11 @@ class rcube_kolab_contacts extends rcube_addressbook
'label' => 'kolab_addressbook.freebusyurl'),
'pgppublickey' => array('type' => 'textarea', 'size' => 70, 'rows' => 10, 'limit' => 1,
'label' => 'kolab_addressbook.pgppublickey'),
+ 'pkcs7publickey' => array('type' => 'textarea', 'size' => 70, 'rows' => 10, 'limit' => 1,
+ 'label' => 'kolab_addressbook.pkcs7publickey'),
'notes' => array(),
'photo' => array(),
- // TODO: define more Kolab-specific fields such as: language, latitude, longitude
+ // TODO: define more Kolab-specific fields such as: language, latitude, longitude, crypto settings
);
/**
diff --git a/plugins/kolab_addressbook/localization/de_CH.inc b/plugins/kolab_addressbook/localization/de_CH.inc
index f91a24b..3439448 100644
--- a/plugins/kolab_addressbook/localization/de_CH.inc
+++ b/plugins/kolab_addressbook/localization/de_CH.inc
@@ -5,7 +5,8 @@ $labels['initials'] = 'Initialen';
$labels['profession'] = 'Berufsbezeichnung';
$labels['officelocation'] = 'Büro Adresse';
$labels['children'] = 'Kinder';
-$labels['pgppublickey'] = 'Öffentlicher PGP-Schlüssel';
+$labels['pgppublickey'] = 'PGP-Schlüssel';
+$labels['pkcs7publickey'] = 'S/MIME-Schlüssel';
$labels['freebusyurl'] = 'Frei/Belegt URL';
$labels['typebusiness'] = 'Dienstlich';
$labels['typebusinessfax'] = 'Dienst';
diff --git a/plugins/kolab_addressbook/localization/de_DE.inc b/plugins/kolab_addressbook/localization/de_DE.inc
index 5fd86b7..2c2a5d2 100644
--- a/plugins/kolab_addressbook/localization/de_DE.inc
+++ b/plugins/kolab_addressbook/localization/de_DE.inc
@@ -5,7 +5,8 @@ $labels['initials'] = 'Initialen';
$labels['profession'] = 'Berufsbezeichnung';
$labels['officelocation'] = 'Büro Adresse';
$labels['children'] = 'Kinder';
-$labels['pgppublickey'] = 'Öffentlicher PGP-Schlüssel';
+$labels['pgppublickey'] = 'PGP-Schlüssel';
+$labels['pkcs7publickey'] = 'S/MIME-Schlüssel';
$labels['freebusyurl'] = 'Frei/Belegt URL';
$labels['typebusiness'] = 'Dienstlich';
$labels['typebusinessfax'] = 'Dienst';
diff --git a/plugins/kolab_addressbook/localization/en_US.inc b/plugins/kolab_addressbook/localization/en_US.inc
index 36f2139..a66426f 100644
--- a/plugins/kolab_addressbook/localization/en_US.inc
+++ b/plugins/kolab_addressbook/localization/en_US.inc
@@ -5,7 +5,8 @@ $labels['initials'] = 'Initials';
$labels['profession'] = 'Profession';
$labels['officelocation'] = 'Office location';
$labels['children'] = 'Children';
-$labels['pgppublickey'] = 'PGP publickey';
+$labels['pgppublickey'] = 'PGP public key';
+$labels['pkcs7publickey'] = 'S/MIME public key';
$labels['freebusyurl'] = 'Free-busy URL';
$labels['typebusiness'] = 'Business';
$labels['typebusinessfax'] = 'Business Fax';
diff --git a/plugins/libkolab/lib/kolab_format_contact.php b/plugins/libkolab/lib/kolab_format_contact.php
index 6df3502..69db2d1 100644
--- a/plugins/libkolab/lib/kolab_format_contact.php
+++ b/plugins/libkolab/lib/kolab_format_contact.php
@@ -270,30 +270,31 @@ class kolab_format_contact extends kolab_format
}
$this->obj->setRelateds($rels);
- if (isset($object['pgppublickey'])) {
- $replace = -1;
- $keys = $this->obj->keys();
- if (!is_object($keys))
- $keys = new vectorkey;
-
- for ($i=0; $i < $keys->size(); $i++) {
- $key = $keys->get($i);
- if ($key->type() == Key::PGP) {
- $replace = $i;
- break;
- }
- }
-
- // insert/replace pgp key entry
- $key = new Key($object['pgppublickey'], Key::PGP);
- if ($replace >= 0)
- $keys->set($replace, $key);
- else
- $keys->push($key);
-
- $this->obj->setKeys($keys);
+ // insert/replace crypto keys
+ $pgp_index = $pkcs7_index = -1;
+ $keys = $this->obj->keys();
+ for ($i=0; $i < $keys->size(); $i++) {
+ $key = $keys->get($i);
+ if ($pgp_index < 0 && $key->type() == Key::PGP)
+ $pgp_index = $i;
+ else if ($pkcs7_index < 0 && $key->type() == Key::PKCS7_MIME)
+ $pkcs7_index = $i;
}
+ $pgpkey = $object['pgppublickey'] ? new Key($object['pgppublickey'], Key::PGP) : new Key();
+ $pkcs7key = $object['pkcs7publickey'] ? new Key($object['pkcs7publickey'], Key::PKCS7_MIME) : new Key();
+
+ if ($pgp_index >= 0)
+ $keys->set($pgp_index, $pgpkey);
+ else if (!empty($object['pgppublickey']))
+ $keys->push($pgpkey);
+ if ($pkcs7_index >= 0)
+ $keys->set($pkcs7_index, $pkcs7key);
+ else if (!empty($object['pkcs7publickey']))
+ $keys->push($pkcs7key);
+
+ $this->obj->setKeys($keys);
+
// TODO: handle language, gpslocation, etc.
@@ -389,13 +390,14 @@ class kolab_format_contact extends kolab_format
// relateds -> spouse, children
$this->read_relateds($this->obj->relateds(), $object);
- // crypto settings: currently only pgpkey is supported
+ // crypto settings: currently only key values are supported
$keys = $this->obj->keys();
for ($i=0; is_object($keys) && $i < $keys->size(); $i++) {
$key = $keys->get($i);
- if ($key->type() == Key::PGP) {
+ if ($key->type() == Key::PGP)
$object['pgppublickey'] = $key->key();
- }
+ else if ($key->type() == Key::PKCS7_MIME)
+ $object['pkcs7publickey'] = $key->key();
}
$this->data = $object;