branch: externals/gnorb
commit c3279d2b945edb11ac291db6cec5e3c09346b1d0
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Fix tracking messages from virtual groups
* gnorb-utils.el (gnorb-get-real-group-name): New function for finding
the original group name of messages in nnvirtual or nnir groups.
* gnorb-gnus.el (gnorb-gnus-incoming-do-todo): Use new function.
* gnorb-bbdb.el (gnorb-bbdb-store-message-link): Use new function.
Previously, triggering headings from messages in nnvirtual/nnir groups
would create registry entries with 'group keys pointing to the ephemeral
group name. Now we find the real group name before creating the entry.
---
gnorb-bbdb.el | 12 +++---------
gnorb-gnus.el | 10 ++++++----
gnorb-utils.el | 10 ++++++++++
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/gnorb-bbdb.el b/gnorb-bbdb.el
index 08f24eb..f774a5f 100644
--- a/gnorb-bbdb.el
+++ b/gnorb-bbdb.el
@@ -591,16 +591,10 @@ to a message into the record's
`gnorb-bbdb-messages-field'."
(parse-time-string (mail-header-date heads))))
(subject (mail-header-subject heads))
(id (mail-header-id heads))
- (group gnus-newsgroup-name)
+ (group (gnorb-get-real-group-name
+ gnus-newsgroup-name
+ art-no))
link)
- ;; check for both nnvirtual and nnir, and link to the real
- ;; group in those cases
- (when (eq (car (gnus-find-method-for-group group))
- 'nnvirtual)
- (setq group (car (nnvirtual-map-article art-no))))
- (when (eq (car (gnus-find-method-for-group group))
- 'nnir)
- (setq group (nnir-article-group art-no)))
(if (not (and date subject id group))
(message "Could not save a link to this message")
(setq link (make-gnorb-bbdb-link :subject subject :date date
diff --git a/gnorb-gnus.el b/gnorb-gnus.el
index a0a91f3..63c2c34 100644
--- a/gnorb-gnus.el
+++ b/gnorb-gnus.el
@@ -501,15 +501,17 @@ headings."
(setq gnorb-window-conf (current-window-configuration))
(move-marker gnorb-return-marker (point))
(setq gnorb-gnus-message-info nil)
- (let* ((headers (gnus-data-header
- (gnus-data-find
- (gnus-summary-article-number))))
+ (let* ((art-no (gnus-summary-article-number))
+ (headers (gnus-data-header
+ (gnus-data-find art-no)))
(msg-id (mail-header-id headers))
(from (mail-header-from headers))
(subject (mail-header-subject headers))
(date (mail-header-date headers))
(to (cdr (assoc 'To (mail-header-extra headers))))
- (group gnus-newsgroup-name)
+ (group (gnorb-get-real-group-name
+ gnus-newsgroup-name
+ art-no))
(link (call-interactively 'org-store-link))
(org-refile-targets gnorb-gnus-trigger-refile-targets)
(ref-msg-ids (concat (mail-header-references headers) " "
diff --git a/gnorb-utils.el b/gnorb-utils.el
index 59794ac..ceeb695 100644
--- a/gnorb-utils.el
+++ b/gnorb-utils.el
@@ -385,6 +385,16 @@ child headings."
;; Common functions for extracting references and relevant headings
;; from the message under point. For use in gnorb-gnus.el functions.
+(defun gnorb-get-real-group-name (group art-no)
+ "Find the original group name of a message in a virtual or nnir
+group."
+ (cl-case (car (gnus-find-method-for-group group))
+ (nnvirtual
+ (setq group (car (nnvirtual-map-article art-no))))
+ (nnir
+ (setq group (nnir-article-group art-no))))
+ group)
+
(defun gnorb-find-tracked-headings (headers &optional include-zombies)
"Check HEADERS for message references and return relevant heading IDs.