(setq eweouz-helper-dirs '("/usr/lib/eweouz" "/usr/local/lib/eweouz"))
-(defvar eweouz-path (locate-file "eweouz-dump-addressbook"
- eweouz-helper-dirs
- nil
- 'executable))
+(defvar eweouz-dump-path (locate-file "eweouz-dump-addressbook"
+ eweouz-helper-dirs
+ nil
+ 'executable))
+
+(defvar eweouz-write-path (locate-file "eweouz-write-addressbook"
+ eweouz-helper-dirs
+ nil
+ 'executable))
(defvar eweouz-buffer nil)
(defvar eweouz-pop-up-target-lines 5)
(set-buffer (get-buffer-create eweouz-buffer-name))
(insert (vcard-pretty-print record))))
+(defun eweouz-add-sender ()
+ "Add sender of current message"
+ (interactive)
+
+ (save-excursion
+ (set-buffer gnus-article-buffer)
+ (let* ((from (mail-header-parse-address (gnus-fetch-field "From")))
+ (record '((email . (car from))
+ (name . (cdr from)))))
+ (eweouz-do-add record))))
+
+(defun eweouz-do-add (record)
+ (interactive)
+ (let* ((name (cdr (assoc 'name record)))
+ (email (cdr (assoc 'email record))))
+ (call-process eweouz-write-path nil nil nil "--id" "new" "--full-name" name
+ "--emails" email)))
+
;;;###autoload
(defun eweouz-insinuate-gnus ()
"Call this function to hook EWEOUZ into Gnus."