From 815d41050c946ec4cb4eb6f36bf775734b1e8e2b Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Fri, 8 Aug 2008 09:27:34 +0200 Subject: [PATCH] Add actual support for adding emails from gnus --- lisp/eweouz.el | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/lisp/eweouz.el b/lisp/eweouz.el index d2adcf3..6c4a838 100644 --- a/lisp/eweouz.el +++ b/lisp/eweouz.el @@ -25,10 +25,15 @@ (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) @@ -135,6 +140,24 @@ (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." -- 2.39.5