Logging gnus messages

(defun message-to-diary ()
  (make-diary-entry (concat
		     (calendar-date-string (calendar-current-date) t)
		     (if (message-fetch-field "newsgroups")
			 (concat " Sent news To: " (message-fetch-field "newsgroups"))
		       (concat " Sent mail To: " (message-fetch-field "to")))
		     " Subject: \"" (message-fetch-field "subject") "\""
		     " Message-ID: " (message-fetch-field "message-id"))))
(add-hook 'message-sent-hook 'message-to-diary)