From: nega <neg...@ya...> - 2003-09-08 03:02:39
|
Guess I should read all of my email first. :) Kevin, I havent exactly stressedit but it works fine for me. --- Kevin Bube <kb...@gm...> wrote: > Hi folks, > > the attached patch replaces the dummy function (mc-gpg-fetch-key) by > a > real one. This makes it possible for Gnupg users to fetch keys from > external servers. > > Please have a look, test this and send me comments before I start > integrating the function into the menu and the other framework. > > The error handling is a bit, uh, binary. Do you think it needs to be > more verbose (e.a. report the reason for failures)? I left this > because > if one has really trouble there exists the possibility to have a look > at > the gpg error buffer. > > Kevin > > > diff -Naur mailcrypt/mc-gpg.el mailcrypt.fetchonly/mc-gpg.el > --- mailcrypt/mc-gpg.el Thu Aug 14 12:41:31 2003 > +++ mailcrypt.fetchonly/mc-gpg.el Thu Sep 4 16:56:26 2003 > @@ -1283,14 +1283,46 @@ > "*If t, always attempt to fetch missing keys, or never fetch if > 'never.") > > -(defun mc-gpg-fetch-key (&optional id) > +(defvar mc-gpg-keyserver 'nil > + "*Keyserver to query for missing keys. If nil let GPG use its > default.") > + > + > +(defun mc-gpg-fetch-key-parser (stdoutbuf stderrbuf statusbuf rc > parserdata) > + (let (result) > + (save-excursion > + (set-buffer stderrbuf) > + (goto-char (point-min)) > + > + (mc-gpg-debug-print > + (format "(mc-gpg-fetch-key-parser (stdoutbuf=%s stderrbuf=%s > statusbuf=%s rc=%s" stdoutbuf stderrbuf statusbuf rc)) > + > + > + (if (search-forward "Total number processed: " nil t) > + ;; success > + (progn > + (re-search-backward "\".*\"") > + (setq result (list nil t (match-string 0)))) > + ;; failure > + (setq result (list nil nil nil)))) > + )) > + > +(defun mc-gpg-fetch-key (id) > "Attempt to fetch a key for addition to GPG keyring. > Interactively, > -prompt for string matching key to fetch. > +prompt for string matching key to fetch." > + (interactive "sKey-ID: ") > + > + (let ((buffer (get-buffer-create mc-buffer-name)) > + args result) > + (setq args (list "--recv-keys" id)) > + (if mc-gpg-keyserver > + (setq args (append (list "--keyserver" mc-gpg-keyserver args)))) > > -This function is not yet implemented. The GPG documentation suggests > a simple > -keyserver protocol, but as far as I know it has not yet been > implemented > -anywhere." > + (setq result (mc-gpg-process-region 1 1 nil mc-gpg-path args > + 'mc-gpg-fetch-key-parser buffer)) > > - (error "Key fetching not yet implemented")) > + (if (car result) > + (message "Imported key %s: %s" id (cdr result)) > + (error "Couldn't fetch key %s" id)) > + )) > > ;;}}} > > > > -- > publickey: http://www.icbm.de/~bube/publickey.txt > fingerprint: 607B 39BC C9E9 0F5E EF7F 4557 31D4 A73C 215F 9C87 > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com |