+
+;; note. PO Box and Extended Address are added as additional address street lines if they exist.
+;; If you don't like this, just delete them from this fiel.
+;; If you want some other special handling, it will need to be coded.
+(defconst bbdb3-csv-import-gmail
+ '(("firstname" "Given Name")
+ ("lastname" "Family Name")
+ ("name" "Name")
+ ("mail" (repeat "E-mail 1 - Value"))
+ ("phone" (repeat ("Phone 1 - Type" "Phone 1 - Value")))
+ ("address"
+ (repeat (("Address 1 - Type")
+ (("Address 1 - Street" "Address 1 - PO Box" "Address 1 - Extended Address")
+ "Address 1 - City" "Address 1 - Region"
+ "Address 1 - Postal Code" "Address 1 - Country"))))
+ ("organization" (repeat "Organization 1 - Name"))
+ ("xfields"
+ "Additional Name" "Yomi Name" "Given Name Yomi"
+ "Additional Name Yomi" "Family Name Yomi" "Name Prefix"
+ "Name Suffix" "Initials" "Nickname"
+ "Short Name" "Maiden Name" "Birthday"
+ "Gender" "Location" "Billing Information"
+ "Directory Server" "Mileage" "Occupation"
+ "Hobby" "Sensitivity" "Priority"
+ "Subject" "Notes" "Group Membership"
+ ;; Gmail wouldn't let me add more than 1 organization, but no harm in
+ ;; looking for multiple since the field name implies the possibility.
+ (repeat
+ "Organization 1 - Type" "Organization 1 - Yomi Name"
+ "Organization 1 - Title" "Organization 1 - Department"
+ "Organization 1 - Symbol" "Organization 1 - Location"
+ "Organization 1 - Job Description")
+ (repeat ("Relation 1 - Type" "Relation 1 - Value"))
+ (repeat ("Website 1 - Type" "Website 1 - Value"))
+ (repeat ("Event 1 - Type" "Event 1 - Value"))
+ (repeat ("Custom Field 1 - Type" "Custom Field 1 - Value"))))
+ "Gmail csv export format")
+
+
+(defconst bbdb3-csv-import-gmail-typed-email
+ (append (car (last bbdb3-csv-import-gmail)) '((repeat "E-mail 1 - Type")))
+ "Like the first Gmail mapping, but use custom fields to store
+ Gmail's email labels. This is separate because I assume most
+ people don't use those labels and using the default labels
+ would create useless custom fields.")
+
+(defconst bbdb3-csv-import-outlook-typed-email
+ (append (car (last bbdb3-csv-import-outlook-web)) '((repeat "E-mail 1 - Type")))
+ "Like the previous var, but for outlook-web.
+Adds email labels as custom fields.")
+
+
+(defconst bbdb3-csv-import-outlook-web
+ '(("firstname" "First Name")
+ ("lastname" "Last Name")
+ ("middlename" "Middle Name")
+ ("mail" "E-mail Address" "E-mail 2 Address" "E-mail 3 Address")
+ ("phone"
+ "Assistant's Phone" "Business Fax" "Business Phone"
+ "Business Phone 2" "Callback" "Car Phone"
+ "Company Main Phone" "Home Fax" "Home Phone"
+ "Home Phone 2" "ISDN" "Mobile Phone"
+ "Other Fax" "Other Phone" "Pager"
+ "Primary Phone" "Radio Phone" "TTY/TDD Phone" "Telex")
+ ("address"
+ (("business address"
+ (("Business Street")
+ "Business City" "Business State"
+ "Business Postal Code" "Business Country"))
+ ("home address"
+ (("Home Street")
+ "Home City" "Home State"
+ "Home Postal Code" "Home Country"))
+ ("other address"
+ (("Other Street")
+ "Other City" "Other State"
+ "Other Postal Code" "Other Country"))))
+ ("organization" "Company")
+ ("xfields"
+ "Anniversary" "Family Name Yomi" "Given Name Yomi"
+ "Suffix" "Department" "Job Title" "Birthday" "Manager's Name" "Notes"
+ "Spouse" "Web Page"))
+ "Hotmail.com, outlook.com, live.com, etc.
+Based on 'Export for outlook.com and other services',
+not the export for Outlook 2010 and 2013.")
+
+(defconst bbdb3-csv-import-combined
+ (list
+ (bbdb3-csv-import-merge-map "firstname")
+ (bbdb3-csv-import-merge-map "middlename")
+ (bbdb3-csv-import-merge-map "lastname")
+ (bbdb3-csv-import-merge-map "name")
+ (bbdb3-csv-import-merge-map "aka")
+ (bbdb3-csv-import-merge-map "mail")
+ (bbdb3-csv-import-merge-map "phone")
+ ;; manually combined the addresses. Because it was easier.
+ '("address"
+ (repeat (("Address 1 - Type")
+ (("Address 1 - Street" "Address 1 - PO Box" "Address 1 - Extended Address")
+ "Address 1 - City" "Address 1 - Region"
+ "Address 1 - Postal Code" "Address 1 - Country")))
+ (("business address"
+ (("Business Street" "Business Street 2" "Business Street 3")
+ "Business City" "Business State"
+ "Business Postal Code" "Business Country"))
+ ("home address"
+ (("Home Street" "Home Street 2" "Home Street 3"
+ "Home Address" "Home Address 2")
+ "Home City" "Home State"
+ "Home Postal Code" "Home ZipCode" "Home Country"))
+ ("work address"
+ (("Work Address" "Work Address 2")
+ "Work City" "Work State"
+ "Work ZipCode" "Work Country"))
+ ("other address"
+ (("Other Street" "Other Street 2" "Other Street 3")
+ "Other City" "Other State"
+ "Other Postal Code" "Other Country"))))
+ (bbdb3-csv-import-merge-map "organization")
+ (bbdb3-csv-import-merge-map "xfields")))
+
+(defun bbdb3-csv-import-merge-map (root)
+ (bbdb3-csv-import-flatten1
+ (list root
+ (-distinct
+ (append
+ (cdr (assoc root bbdb3-csv-import-thunderbird))
+ (cdr (assoc root bbdb3-csv-import-linkedin))
+ (cdr (assoc root bbdb3-csv-import-gmail))
+ (cdr (assoc root bbdb3-csv-import-outlook-web)))))))
+
+