Index: vcard.module
===================================================================
--- vcard.module	(revision 889)
+++ vcard.module	(revision 893)
@@ -102,11 +102,11 @@ function vcard_admin_settings() {
   );
   $options = array('' => 'Select a property');
   $options = $options + _vcard_properties();
-  foreach (_vcard_profile_fields() as $fid => $title) {
-    $form['field_mappings']['vcard_profile_'. $fid] = array(
+  foreach (module_invoke_all('vcard_fields') as $name => $title) {
+    $form['field_mappings']['vcard_'. $name] = array(
       '#type' => 'select',
       '#title' => t('Property for ') . $title,
-      '#default_value' => variable_get('vcard_profile_'. $fid, ''),
+      '#default_value' => variable_get('vcard_'. $name, ''),
       '#options' => $options,
     );
   }
@@ -296,13 +296,13 @@ function _vcard_init() {
 }
 
 /**
- *
+ * Implementation of hook_vcard_fields().
  */
-function _vcard_profile_fields() {
+function vcard_vcard_fields() {
   $output = array();
-  $result = db_query("SELECT fid, title FROM {profile_fields}");
+  $result = db_query("SELECT name, title FROM {profile_fields}");
   while ($row = db_fetch_object($result)) {
-    $output[$row->fid] = $row->title;
+    $output[$row->name] = $row->title;
   }
   return $output;
 }
@@ -331,13 +331,24 @@ function _vcard_properties() {
  */
 function _vcard_get_map($account) {
   $map = array();
-  $result = db_query('SELECT fid, name FROM {profile_fields}');
-  while ($field = db_fetch_object($result)) {
-    $mapped = variable_get('vcard_profile_'. $field->fid, 0);
+  $fields = module_invoke_all('vcard_map', $account);
+  foreach ($fields as $name => $value) {
+    $mapped = variable_get('vcard_'. $name, 0);
     if ($mapped) {
-      $map[$mapped] = $account->{$field->name};
+      $map[$mapped] = $value;
     }
   }
 
   return $map;
 }
+
+/**
+ * Implementation of hook_vcard_map().
+ */
+function vcard_vcard_map($account) {
+  $result = db_query('SELECT name FROM {profile_fields}');
+  while ($field = db_fetch_object($result)) {
+    $fields[$field->name] = $account->{$field->name};
+  }
+  return $fields;
+}
\ No newline at end of file
Index: vcard.install
===================================================================
--- vcard.install	(revision 0)
+++ vcard.install	(revision 893)
@@ -0,0 +1,26 @@
+<?php
+
+function vcard_install() {
+}
+
+function vcard_uninstall() {
+  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'vcard\_%'");
+  while ($variable = db_fetch_object($result)) {
+    variable_del($variable->name);
+  }
+}
+
+function vcard_update_1() {
+  $map = array();
+  $result = db_query("SELECT * FROM {profile_fields}");
+  while ($field = db_fetch_object($result)) {
+    $map[$field->name] = variable_get('vcard_profile_'. $field->fid, 0);
+    variable_del('vcard_profile_'. $field->fid);
+  }
+  foreach ($map as $name => $value) {
+    if (!empty($value)) {
+      variable_set('vcard_'. $name, $value);
+    }
+  }
+  return array(array('success' => TRUE, 'query' => 'Updated variable names'));
+}
\ No newline at end of file
