From: Tollef Fog Heen Date: Fri, 8 Aug 2008 07:27:34 +0000 (+0200) Subject: Add actual support for adding emails from gnus X-Git-Tag: 0.1~4 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=815d41050c946ec4cb4eb6f36bf775734b1e8e2b;p=eweouz Add actual support for adding emails from gnus --- 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."