Mercurial > hg > xemacs-beta
comparison lisp/gnus/gnus-msg.el @ 30:ec9a17fef872 r19-15b98
Import from CVS: tag r19-15b98
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:52:29 +0200 |
parents | 8fc7fe29b841 |
children | e04119814345 |
comparison
equal
deleted
inserted
replaced
29:7976500f47f9 | 30:ec9a17fef872 |
---|---|
46 | 46 |
47 (defvar gnus-outgoing-message-group nil | 47 (defvar gnus-outgoing-message-group nil |
48 "*All outgoing messages will be put in this group. | 48 "*All outgoing messages will be put in this group. |
49 If you want to store all your outgoing mail and articles in the group | 49 If you want to store all your outgoing mail and articles in the group |
50 \"nnml:archive\", you set this variable to that value. This variable | 50 \"nnml:archive\", you set this variable to that value. This variable |
51 can also be a list of group names. | 51 can also be a list of group names. |
52 | 52 |
53 If you want to have greater control over what group to put each | 53 If you want to have greater control over what group to put each |
54 message in, you can set this variable to a function that checks the | 54 message in, you can set this variable to a function that checks the |
55 current newsgroup name and then returns a suitable group name (or list | 55 current newsgroup name and then returns a suitable group name (or list |
56 of names).") | 56 of names).") |
59 "*Regexp matching groups that are really mailing lists. | 59 "*Regexp matching groups that are really mailing lists. |
60 This is useful when you're reading a mailing list that has been | 60 This is useful when you're reading a mailing list that has been |
61 gatewayed to a newsgroup, and you want to followup to an article in | 61 gatewayed to a newsgroup, and you want to followup to an article in |
62 the group.") | 62 the group.") |
63 | 63 |
64 (defvar gnus-sent-message-ids-file | 64 (defvar gnus-sent-message-ids-file |
65 (nnheader-concat gnus-directory "Sent-Message-IDs") | 65 (nnheader-concat gnus-directory "Sent-Message-IDs") |
66 "File where Gnus saves a cache of sent message ids.") | 66 "File where Gnus saves a cache of sent message ids.") |
67 | 67 |
68 (defvar gnus-sent-message-ids-length 1000 | 68 (defvar gnus-sent-message-ids-length 1000 |
69 "The number of sent Message-IDs to save.") | 69 "The number of sent Message-IDs to save.") |
171 (gnus-inews-add-send-actions ,winconf ,buffer ,article) | 171 (gnus-inews-add-send-actions ,winconf ,buffer ,article) |
172 (setq gnus-message-buffer (current-buffer)) | 172 (setq gnus-message-buffer (current-buffer)) |
173 (make-local-variable 'gnus-newsgroup-name) | 173 (make-local-variable 'gnus-newsgroup-name) |
174 (run-hooks 'gnus-message-setup-hook)) | 174 (run-hooks 'gnus-message-setup-hook)) |
175 (gnus-configure-windows ,config t)))) | 175 (gnus-configure-windows ,config t)))) |
176 | 176 |
177 (defun gnus-inews-add-send-actions (winconf buffer article) | 177 (defun gnus-inews-add-send-actions (winconf buffer article) |
178 (make-local-hook 'message-sent-hook) | 178 (make-local-hook 'message-sent-hook) |
179 (gnus-add-hook 'message-sent-hook 'gnus-inews-do-gcc nil t) | 179 (gnus-add-hook 'message-sent-hook 'gnus-inews-do-gcc nil t) |
180 (setq message-post-method | 180 (setq message-post-method |
181 `(lambda (arg) | 181 `(lambda (arg) |
225 (gnus-post-news 'post gnus-newsgroup-name)) | 225 (gnus-post-news 'post gnus-newsgroup-name)) |
226 | 226 |
227 (defun gnus-summary-followup (yank &optional force-news) | 227 (defun gnus-summary-followup (yank &optional force-news) |
228 "Compose a followup to an article. | 228 "Compose a followup to an article. |
229 If prefix argument YANK is non-nil, original article is yanked automatically." | 229 If prefix argument YANK is non-nil, original article is yanked automatically." |
230 (interactive | 230 (interactive |
231 (list (and current-prefix-arg | 231 (list (and current-prefix-arg |
232 (gnus-summary-work-articles 1)))) | 232 (gnus-summary-work-articles 1)))) |
233 (gnus-set-global-variables) | 233 (gnus-set-global-variables) |
234 (when yank | 234 (when yank |
235 (gnus-summary-goto-subject (car yank))) | 235 (gnus-summary-goto-subject (car yank))) |
236 (save-window-excursion | 236 (save-window-excursion |
237 (gnus-summary-select-article)) | 237 (gnus-summary-select-article)) |
238 (let ((headers (gnus-summary-article-header (gnus-summary-article-number))) | 238 (let ((headers (gnus-summary-article-header (gnus-summary-article-number))) |
239 (gnus-newsgroup-name gnus-newsgroup-name)) | 239 (gnus-newsgroup-name gnus-newsgroup-name)) |
240 ;; Send a followup. | 240 ;; Send a followup. |
241 (gnus-post-news nil gnus-newsgroup-name | 241 (gnus-post-news nil gnus-newsgroup-name |
242 headers gnus-article-buffer | 242 headers gnus-article-buffer |
243 yank nil force-news))) | 243 yank nil force-news))) |
244 | 244 |
245 (defun gnus-summary-followup-with-original (n &optional force-news) | 245 (defun gnus-summary-followup-with-original (n &optional force-news) |
246 "Compose a followup to an article and include the original article." | 246 "Compose a followup to an article and include the original article." |
247 (interactive "P") | 247 (interactive "P") |
248 (gnus-summary-followup (gnus-summary-work-articles n) force-news)) | 248 (gnus-summary-followup (gnus-summary-work-articles n) force-news)) |
249 | 249 |
250 (defun gnus-summary-followup-to-mail (&optional arg) | 250 (defun gnus-summary-followup-to-mail (&optional arg) |
251 "Followup to the current mail message via news." | 251 "Followup to the current mail message via news." |
252 (interactive | 252 (interactive |
253 (list (and current-prefix-arg | 253 (list (and current-prefix-arg |
254 (gnus-summary-work-articles 1)))) | 254 (gnus-summary-work-articles 1)))) |
255 (gnus-summary-followup arg t)) | 255 (gnus-summary-followup arg t)) |
256 | 256 |
257 (defun gnus-summary-followup-to-mail-with-original (&optional arg) | 257 (defun gnus-summary-followup-to-mail-with-original (&optional arg) |
258 "Followup to the current mail message via news." | 258 "Followup to the current mail message via news." |
373 (gnus-setup-message (cond (yank 'reply-yank) | 373 (gnus-setup-message (cond (yank 'reply-yank) |
374 (article-buffer 'reply) | 374 (article-buffer 'reply) |
375 (t 'message)) | 375 (t 'message)) |
376 (let* ((group (or group gnus-newsgroup-name)) | 376 (let* ((group (or group gnus-newsgroup-name)) |
377 (pgroup group) | 377 (pgroup group) |
378 to-address to-group mailing-list to-list | 378 to-address to-group mailing-list to-list |
379 newsgroup-p) | 379 newsgroup-p) |
380 (when group | 380 (when group |
381 (setq to-address (gnus-group-find-parameter group 'to-address) | 381 (setq to-address (gnus-group-find-parameter group 'to-address) |
382 to-group (gnus-group-find-parameter group 'to-group) | 382 to-group (gnus-group-find-parameter group 'to-group) |
383 to-list (gnus-group-find-parameter group 'to-list) | 383 to-list (gnus-group-find-parameter group 'to-list) |
387 group (gnus-group-real-name group))) | 387 group (gnus-group-real-name group))) |
388 (if (or (and to-group | 388 (if (or (and to-group |
389 (gnus-news-group-p to-group)) | 389 (gnus-news-group-p to-group)) |
390 newsgroup-p | 390 newsgroup-p |
391 force-news | 391 force-news |
392 (and (gnus-news-group-p | 392 (and (gnus-news-group-p |
393 (or pgroup gnus-newsgroup-name) | 393 (or pgroup gnus-newsgroup-name) |
394 (if header (mail-header-number header) | 394 (if header (mail-header-number header) |
395 gnus-current-article)) | 395 gnus-current-article)) |
396 (not mailing-list) | 396 (not mailing-list) |
397 (not to-list) | 397 (not to-list) |
416 | 416 |
417 (defun gnus-post-method (arg group &optional silent) | 417 (defun gnus-post-method (arg group &optional silent) |
418 "Return the posting method based on GROUP and ARG. | 418 "Return the posting method based on GROUP and ARG. |
419 If SILENT, don't prompt the user." | 419 If SILENT, don't prompt the user." |
420 (let ((group-method (gnus-find-method-for-group group))) | 420 (let ((group-method (gnus-find-method-for-group group))) |
421 (cond | 421 (cond |
422 ;; If the group-method is nil (which shouldn't happen) we use | 422 ;; If the group-method is nil (which shouldn't happen) we use |
423 ;; the default method. | 423 ;; the default method. |
424 ((null group-method) | 424 ((null group-method) |
425 (or gnus-post-method gnus-select-method message-post-method)) | 425 (or gnus-post-method gnus-select-method message-post-method)) |
426 ;; We want this group's method. | 426 ;; We want this group's method. |
427 ((and arg (not (eq arg 0))) | 427 ((and arg (not (eq arg 0))) |
447 (when (or (gnus-method-option-p method 'post) | 447 (when (or (gnus-method-option-p method 'post) |
448 (gnus-method-option-p method 'post-mail)) | 448 (gnus-method-option-p method 'post-mail)) |
449 (push method post-methods))) | 449 (push method post-methods))) |
450 ;; Create a name-method alist. | 450 ;; Create a name-method alist. |
451 (setq method-alist | 451 (setq method-alist |
452 (mapcar | 452 (mapcar |
453 (lambda (m) | 453 (lambda (m) |
454 (list (concat (cadr m) " (" (symbol-name (car m)) ")") m)) | 454 (list (concat (cadr m) " (" (symbol-name (car m)) ")") m)) |
455 post-methods)) | 455 post-methods)) |
456 ;; Query the user. | 456 ;; Query the user. |
457 (cadr | 457 (cadr |
473 | 473 |
474 (defun gnus-inews-narrow-to-headers () | 474 (defun gnus-inews-narrow-to-headers () |
475 (widen) | 475 (widen) |
476 (narrow-to-region | 476 (narrow-to-region |
477 (goto-char (point-min)) | 477 (goto-char (point-min)) |
478 (or (and (re-search-forward | 478 (or (and (re-search-forward |
479 (concat "^" (regexp-quote mail-header-separator) "$") nil t) | 479 (concat "^" (regexp-quote mail-header-separator) "$") nil t) |
480 (match-beginning 0)) | 480 (match-beginning 0)) |
481 (point-max))) | 481 (point-max))) |
482 (goto-char (point-min))) | 482 (goto-char (point-min))) |
483 | 483 |
497 (unless gnus-inews-sent-ids | 497 (unless gnus-inews-sent-ids |
498 (ignore-errors | 498 (ignore-errors |
499 (load t t t))) | 499 (load t t t))) |
500 (if (member message-id gnus-inews-sent-ids) | 500 (if (member message-id gnus-inews-sent-ids) |
501 ;; Reject this message. | 501 ;; Reject this message. |
502 (not (gnus-yes-or-no-p | 502 (not (gnus-yes-or-no-p |
503 (format "Message %s already sent. Send anyway? " | 503 (format "Message %s already sent. Send anyway? " |
504 message-id))) | 504 message-id))) |
505 (push message-id gnus-inews-sent-ids) | 505 (push message-id gnus-inews-sent-ids) |
506 ;; Chop off the last Message-IDs. | 506 ;; Chop off the last Message-IDs. |
507 (when (setq end (nthcdr gnus-sent-message-ids-length | 507 (when (setq end (nthcdr gnus-sent-message-ids-length |
508 gnus-inews-sent-ids)) | 508 gnus-inews-sent-ids)) |
509 (setcdr end nil)) | 509 (setcdr end nil)) |
510 (nnheader-temp-write gnus-sent-message-ids-file | 510 (nnheader-temp-write gnus-sent-message-ids-file |
511 (gnus-prin1 `(setq gnus-inews-sent-ids ',gnus-inews-sent-ids))) | 511 (gnus-prin1 `(setq gnus-inews-sent-ids ',gnus-inews-sent-ids))) |
512 nil))))) | 512 nil))))) |
538 (t emacs-version)))) | 538 (t emacs-version)))) |
539 | 539 |
540 ;; Written by "Mr. Per Persson" <pp@gnu.ai.mit.edu>. | 540 ;; Written by "Mr. Per Persson" <pp@gnu.ai.mit.edu>. |
541 (defun gnus-inews-insert-mime-headers () | 541 (defun gnus-inews-insert-mime-headers () |
542 (goto-char (point-min)) | 542 (goto-char (point-min)) |
543 (let ((mail-header-separator | 543 (let ((mail-header-separator |
544 (progn | 544 (progn |
545 (goto-char (point-min)) | 545 (goto-char (point-min)) |
546 (if (and (search-forward (concat "\n" mail-header-separator "\n") | 546 (if (and (search-forward (concat "\n" mail-header-separator "\n") |
547 nil t) | 547 nil t) |
548 (not (search-backward "\n\n" nil t))) | 548 (not (search-backward "\n\n" nil t))) |
549 mail-header-separator | 549 mail-header-separator |
563 (or (mail-position-on-field "Content-Transfer-Encoding") | 563 (or (mail-position-on-field "Content-Transfer-Encoding") |
564 (insert "7bit"))))))) | 564 (insert "7bit"))))))) |
565 | 565 |
566 | 566 |
567 ;;; | 567 ;;; |
568 ;;; Gnus Mail Functions | 568 ;;; Gnus Mail Functions |
569 ;;; | 569 ;;; |
570 | 570 |
571 ;;; Mail reply commands of Gnus summary mode | 571 ;;; Mail reply commands of Gnus summary mode |
572 | 572 |
573 (defun gnus-summary-reply (&optional yank wide) | 573 (defun gnus-summary-reply (&optional yank wide) |
574 "Start composing a reply mail to the current message. | 574 "Start composing a reply mail to the current message. |
575 If prefix argument YANK is non-nil, the original article is yanked | 575 If prefix argument YANK is non-nil, the original article is yanked |
576 automatically." | 576 automatically." |
577 (interactive | 577 (interactive |
578 (list (and current-prefix-arg | 578 (list (and current-prefix-arg |
579 (gnus-summary-work-articles 1)))) | 579 (gnus-summary-work-articles 1)))) |
580 ;; Stripping headers should be specified with mail-yank-ignored-headers. | 580 ;; Stripping headers should be specified with mail-yank-ignored-headers. |
581 (gnus-set-global-variables) | 581 (gnus-set-global-variables) |
582 (when yank | 582 (when yank |
583 (gnus-summary-goto-subject (car yank))) | 583 (gnus-summary-goto-subject (car yank))) |
584 (let ((gnus-article-reply t)) | 584 (let ((gnus-article-reply t)) |
585 (gnus-setup-message (if yank 'reply-yank 'reply) | 585 (gnus-setup-message (if yank 'reply-yank 'reply) |
586 (gnus-summary-select-article) | 586 (gnus-summary-select-article) |
587 (set-buffer (gnus-copy-article-buffer)) | 587 (set-buffer (gnus-copy-article-buffer)) |
596 (interactive "P") | 596 (interactive "P") |
597 (gnus-summary-reply (gnus-summary-work-articles n) wide)) | 597 (gnus-summary-reply (gnus-summary-work-articles n) wide)) |
598 | 598 |
599 (defun gnus-summary-wide-reply (&optional yank) | 599 (defun gnus-summary-wide-reply (&optional yank) |
600 "Start composing a wide reply mail to the current message. | 600 "Start composing a wide reply mail to the current message. |
601 If prefix argument YANK is non-nil, the original article is yanked | 601 If prefix argument YANK is non-nil, the original article is yanked |
602 automatically." | 602 automatically." |
603 (interactive | 603 (interactive |
604 (list (and current-prefix-arg | 604 (list (and current-prefix-arg |
605 (gnus-summary-work-articles 1)))) | 605 (gnus-summary-work-articles 1)))) |
606 (gnus-summary-reply yank t)) | 606 (gnus-summary-reply yank t)) |
607 | 607 |
608 (defun gnus-summary-wide-reply-with-original (n) | 608 (defun gnus-summary-wide-reply-with-original (n) |
609 "Start composing a wide reply mail to the current message. | 609 "Start composing a wide reply mail to the current message. |
638 "Forward the current article to a newsgroup. | 638 "Forward the current article to a newsgroup. |
639 If FULL-HEADERS (the prefix), include full headers when forwarding." | 639 If FULL-HEADERS (the prefix), include full headers when forwarding." |
640 (interactive "P") | 640 (interactive "P") |
641 (gnus-summary-mail-forward full-headers t)) | 641 (gnus-summary-mail-forward full-headers t)) |
642 | 642 |
643 (defvar gnus-nastygram-message | 643 (defvar gnus-nastygram-message |
644 "The following article was inappropriately posted to %s.\n\n" | 644 "The following article was inappropriately posted to %s.\n\n" |
645 "Format string to insert in nastygrams. | 645 "Format string to insert in nastygrams. |
646 The current group name will be inserted at \"%s\".") | 646 The current group name will be inserted at \"%s\".") |
647 | 647 |
648 (defun gnus-summary-mail-nastygram (n) | 648 (defun gnus-summary-mail-nastygram (n) |
649 "Send a nastygram to the author of the current article." | 649 "Send a nastygram to the author of the current article." |
650 (interactive "P") | 650 (interactive "P") |
651 (when (or gnus-expert-user | 651 (when (or gnus-expert-user |
652 (gnus-y-or-n-p | 652 (gnus-y-or-n-p |
653 "Really send a nastygram to the author of the current article? ")) | 653 "Really send a nastygram to the author of the current article? ")) |
654 (let ((group gnus-newsgroup-name)) | 654 (let ((group gnus-newsgroup-name)) |
655 (gnus-summary-reply-with-original n) | 655 (gnus-summary-reply-with-original n) |
656 (set-buffer gnus-message-buffer) | 656 (set-buffer gnus-message-buffer) |
657 (message-goto-body) | 657 (message-goto-body) |
703 (skip-chars-forward " ") | 703 (skip-chars-forward " ") |
704 (while (not (eobp)) | 704 (while (not (eobp)) |
705 (setq beg (point)) | 705 (setq beg (point)) |
706 (skip-chars-forward "^,") | 706 (skip-chars-forward "^,") |
707 (while (zerop | 707 (while (zerop |
708 (save-excursion | 708 (save-excursion |
709 (save-restriction | 709 (save-restriction |
710 (let ((i 0)) | 710 (let ((i 0)) |
711 (narrow-to-region beg (point)) | 711 (narrow-to-region beg (point)) |
712 (goto-char beg) | 712 (goto-char beg) |
713 (logand (progn | 713 (logand (progn |
727 (defun gnus-inews-add-to-address (group) | 727 (defun gnus-inews-add-to-address (group) |
728 (let ((to-address (mail-fetch-field "to"))) | 728 (let ((to-address (mail-fetch-field "to"))) |
729 (when (and to-address | 729 (when (and to-address |
730 (gnus-alive-p)) | 730 (gnus-alive-p)) |
731 ;; This mail group doesn't have a `to-list', so we add one | 731 ;; This mail group doesn't have a `to-list', so we add one |
732 ;; here. Magic! | 732 ;; here. Magic! |
733 (gnus-group-add-parameter group (cons 'to-list to-address))))) | 733 (gnus-group-add-parameter group (cons 'to-list to-address))))) |
734 | 734 |
735 (defun gnus-put-message () | 735 (defun gnus-put-message () |
736 "Put the current message in some group and return to Gnus." | 736 "Put the current message in some group and return to Gnus." |
737 (interactive) | 737 (interactive) |
738 (let ((reply gnus-article-reply) | 738 (let ((reply gnus-article-reply) |
739 (winconf gnus-prev-winconf) | 739 (winconf gnus-prev-winconf) |
740 (group gnus-newsgroup-name)) | 740 (group gnus-newsgroup-name)) |
741 | 741 |
742 (or (and group (not (gnus-group-read-only-p group))) | 742 (or (and group (not (gnus-group-read-only-p group))) |
743 (setq group (read-string "Put in group: " nil | 743 (setq group (read-string "Put in group: " nil |
744 (gnus-writable-groups)))) | 744 (gnus-writable-groups)))) |
745 (when (gnus-gethash group gnus-newsrc-hashtb) | 745 (when (gnus-gethash group gnus-newsrc-hashtb) |
746 (error "No such group: %s" group)) | 746 (error "No such group: %s" group)) |
761 | 761 |
762 (when (get-buffer gnus-group-buffer) | 762 (when (get-buffer gnus-group-buffer) |
763 (when (gnus-buffer-exists-p (car-safe reply)) | 763 (when (gnus-buffer-exists-p (car-safe reply)) |
764 (set-buffer (car reply)) | 764 (set-buffer (car reply)) |
765 (and (cdr reply) | 765 (and (cdr reply) |
766 (gnus-summary-mark-article-as-replied | 766 (gnus-summary-mark-article-as-replied |
767 (cdr reply)))) | 767 (cdr reply)))) |
768 (when winconf | 768 (when winconf |
769 (set-window-configuration winconf))))) | 769 (set-window-configuration winconf))))) |
770 | 770 |
771 (defun gnus-article-mail (yank) | 771 (defun gnus-article-mail (yank) |
772 "Send a reply to the address near point. | 772 "Send a reply to the address near point. |
773 If YANK is non-nil, include the original article." | 773 If YANK is non-nil, include the original article." |
774 (interactive "P") | 774 (interactive "P") |
775 (let ((address | 775 (let ((address |
776 (buffer-substring | 776 (buffer-substring |
777 (save-excursion (re-search-backward "[ \t\n]" nil t) (1+ (point))) | 777 (save-excursion (re-search-backward "[ \t\n]" nil t) (1+ (point))) |
778 (save-excursion (re-search-forward "[ \t\n]" nil t) (1- (point)))))) | 778 (save-excursion (re-search-forward "[ \t\n]" nil t) (1- (point)))))) |
779 (when address | 779 (when address |
780 (message-reply address) | 780 (message-reply address) |
888 (set-buffer gnus-original-article-buffer) | 888 (set-buffer gnus-original-article-buffer) |
889 (gnus-setup-message 'compose-bounce | 889 (gnus-setup-message 'compose-bounce |
890 (let* ((references (mail-fetch-field "references")) | 890 (let* ((references (mail-fetch-field "references")) |
891 (parent (and references (gnus-parent-id references)))) | 891 (parent (and references (gnus-parent-id references)))) |
892 (message-bounce) | 892 (message-bounce) |
893 ;; If there are references, we fetch the article we answered to. | 893 ;; If there are references, we fetch the article we answered to. |
894 (and fetch parent | 894 (and fetch parent |
895 (gnus-summary-refer-article parent) | 895 (gnus-summary-refer-article parent) |
896 (gnus-summary-show-all-headers))))) | 896 (gnus-summary-show-all-headers))))) |
897 | 897 |
898 ;;; Gcc handling. | 898 ;;; Gcc handling. |
899 | 899 |
900 ;; Do Gcc handling, which copied the message over to some group. | 900 ;; Do Gcc handling, which copied the message over to some group. |
901 (defun gnus-inews-do-gcc (&optional gcc) | 901 (defun gnus-inews-do-gcc (&optional gcc) |
902 (interactive) | |
902 (when (gnus-alive-p) | 903 (when (gnus-alive-p) |
903 (save-excursion | 904 (save-excursion |
904 (save-restriction | 905 (save-restriction |
905 (message-narrow-to-headers) | 906 (message-narrow-to-headers) |
906 (let ((gcc (or gcc (mail-fetch-field "gcc" nil t))) | 907 (let ((gcc (or gcc (mail-fetch-field "gcc" nil t))) |
910 (message-remove-header "gcc") | 911 (message-remove-header "gcc") |
911 (widen) | 912 (widen) |
912 (setq groups (message-tokenize-header gcc " ,")) | 913 (setq groups (message-tokenize-header gcc " ,")) |
913 ;; Copy the article over to some group(s). | 914 ;; Copy the article over to some group(s). |
914 (while (setq group (pop groups)) | 915 (while (setq group (pop groups)) |
915 (gnus-check-server | 916 (gnus-check-server |
916 (setq method | 917 (setq method |
917 (cond ((and (null (gnus-get-info group)) | 918 (cond ((and (null (gnus-get-info group)) |
918 (eq (car gnus-message-archive-method) | 919 (eq (car gnus-message-archive-method) |
919 (car | 920 (car |
920 (gnus-server-to-method | 921 (gnus-server-to-method |
921 (gnus-group-method group))))) | 922 (gnus-group-method group))))) |
922 ;; If the group doesn't exist, we assume | 923 ;; If the group doesn't exist, we assume |
923 ;; it's an archive group... | 924 ;; it's an archive group... |
924 gnus-message-archive-method) | 925 gnus-message-archive-method) |
932 (gnus-request-create-group group method)) | 933 (gnus-request-create-group group method)) |
933 (save-excursion | 934 (save-excursion |
934 (nnheader-set-temp-buffer " *acc*") | 935 (nnheader-set-temp-buffer " *acc*") |
935 (insert-buffer-substring cur) | 936 (insert-buffer-substring cur) |
936 (goto-char (point-min)) | 937 (goto-char (point-min)) |
937 (when (re-search-forward | 938 (when (re-search-forward |
938 (concat "^" (regexp-quote mail-header-separator) "$") | 939 (concat "^" (regexp-quote mail-header-separator) "$") |
939 nil t) | 940 nil t) |
940 (replace-match "" t t )) | 941 (replace-match "" t t )) |
941 (unless (gnus-request-accept-article group method t) | 942 (unless (gnus-request-accept-article group method t) |
942 (gnus-message 1 "Couldn't store article in group %s: %s" | 943 (gnus-message 1 "Couldn't store article in group %s: %s" |
943 group (gnus-status-message method)) | 944 group (gnus-status-message method)) |
944 (sit-for 2)) | 945 (sit-for 2)) |
945 (kill-buffer (current-buffer)))))))))) | 946 (kill-buffer (current-buffer)))))))))) |
946 | 947 |
947 (defun gnus-inews-insert-gcc () | 948 (defun gnus-inews-insert-gcc () |
948 "Insert Gcc headers based on `gnus-outgoing-message-group'." | 949 "Insert Gcc headers based on `gnus-outgoing-message-group'." |
949 (save-excursion | 950 (save-excursion |
950 (save-restriction | 951 (save-restriction |
951 (gnus-inews-narrow-to-headers) | 952 (gnus-inews-narrow-to-headers) |
952 (let* ((group gnus-outgoing-message-group) | 953 (let* ((group gnus-outgoing-message-group) |
953 (gcc (cond | 954 (gcc (cond |
954 ((gnus-functionp group) | 955 ((gnus-functionp group) |
955 (funcall group)) | 956 (funcall group)) |
956 ((or (stringp group) (list group)) | 957 ((or (stringp group) (list group)) |
957 group)))) | 958 group)))) |
958 (when gcc | 959 (when gcc |
966 (let* ((var gnus-message-archive-group) | 967 (let* ((var gnus-message-archive-group) |
967 (group (or group gnus-newsgroup-name "")) | 968 (group (or group gnus-newsgroup-name "")) |
968 result | 969 result |
969 gcc-self-val | 970 gcc-self-val |
970 (groups | 971 (groups |
971 (cond | 972 (cond |
972 ((null gnus-message-archive-method) | 973 ((null gnus-message-archive-method) |
973 ;; Ignore. | 974 ;; Ignore. |
974 nil) | 975 nil) |
975 ((stringp var) | 976 ((stringp var) |
976 ;; Just a single group. | 977 ;; Just a single group. |
987 (t | 988 (t |
988 ;; An alist of regexps/functions/forms. | 989 ;; An alist of regexps/functions/forms. |
989 (while (and var | 990 (while (and var |
990 (not | 991 (not |
991 (setq result | 992 (setq result |
992 (cond | 993 (cond |
993 ((stringp (caar var)) | 994 ((stringp (caar var)) |
994 ;; Regexp. | 995 ;; Regexp. |
995 (when (string-match (caar var) group) | 996 (when (string-match (caar var) group) |
996 (cdar var))) | 997 (cdar var))) |
997 ((gnus-functionp (car var)) | 998 ((gnus-functionp (car var)) |
1012 (insert "Gcc: ") | 1013 (insert "Gcc: ") |
1013 (if (and gnus-newsgroup-name | 1014 (if (and gnus-newsgroup-name |
1014 (setq gcc-self-val | 1015 (setq gcc-self-val |
1015 (gnus-group-find-parameter | 1016 (gnus-group-find-parameter |
1016 gnus-newsgroup-name 'gcc-self))) | 1017 gnus-newsgroup-name 'gcc-self))) |
1017 (progn | 1018 (progn |
1018 (insert | 1019 (insert |
1019 (if (stringp gcc-self-val) | 1020 (if (stringp gcc-self-val) |
1020 gcc-self-val | 1021 gcc-self-val |
1021 group)) | 1022 group)) |
1022 (if (not (eq gcc-self-val 'none)) | 1023 (if (not (eq gcc-self-val 'none)) |
1025 (beginning-of-line) | 1026 (beginning-of-line) |
1026 (kill-line)))) | 1027 (kill-line)))) |
1027 (while (setq name (pop groups)) | 1028 (while (setq name (pop groups)) |
1028 (insert (if (string-match ":" name) | 1029 (insert (if (string-match ":" name) |
1029 name | 1030 name |
1030 (gnus-group-prefixed-name | 1031 (gnus-group-prefixed-name |
1031 name gnus-message-archive-method))) | 1032 name gnus-message-archive-method))) |
1032 (when groups | 1033 (when groups |
1033 (insert " "))) | 1034 (insert " "))) |
1034 (insert "\n"))))))) | 1035 (insert "\n"))))))) |
1035 | 1036 |
1036 (defun gnus-summary-send-draft () | 1037 (defun gnus-summary-send-draft () |
1037 "Enter a mail/post buffer to edit and send the draft." | 1038 "Enter a mail/post buffer to edit and send the draft." |
1038 (interactive) | 1039 (interactive) |
1039 (gnus-set-global-variables) | 1040 (gnus-set-global-variables) |
1040 (let (buf) | 1041 (let (buf) |
1041 (if (not (setq buf (gnus-request-restore-buffer | 1042 (if (not (setq buf (gnus-request-restore-buffer |
1042 (gnus-summary-article-number) gnus-newsgroup-name))) | 1043 (gnus-summary-article-number) gnus-newsgroup-name))) |
1043 (error "Couldn't restore the article") | 1044 (error "Couldn't restore the article") |
1044 (switch-to-buffer buf) | 1045 (switch-to-buffer buf) |
1045 (when (eq major-mode 'news-reply-mode) | 1046 (when (eq major-mode 'news-reply-mode) |
1046 (local-set-key "\C-c\C-c" 'gnus-inews-news)) | 1047 (local-set-key "\C-c\C-c" 'gnus-inews-news)) |
1051 (insert mail-header-separator) | 1052 (insert mail-header-separator) |
1052 ;; Configure windows. | 1053 ;; Configure windows. |
1053 (let ((gnus-draft-buffer (current-buffer))) | 1054 (let ((gnus-draft-buffer (current-buffer))) |
1054 (gnus-configure-windows 'draft t) | 1055 (gnus-configure-windows 'draft t) |
1055 (goto-char (point)))))) | 1056 (goto-char (point)))))) |
1056 | 1057 |
1057 (gnus-add-shutdown 'gnus-inews-close 'gnus) | 1058 (gnus-add-shutdown 'gnus-inews-close 'gnus) |
1058 | 1059 |
1059 (defun gnus-inews-close () | 1060 (defun gnus-inews-close () |
1060 (setq gnus-inews-sent-ids nil)) | 1061 (setq gnus-inews-sent-ids nil)) |
1061 | 1062 |
1062 ;;; Allow redefinition of functions. | 1063 ;;; Allow redefinition of functions. |
1063 | 1064 |
1064 (gnus-ems-redefine) | 1065 (gnus-ems-redefine) |
1065 | 1066 |
1066 (provide 'gnus-msg) | 1067 (provide 'gnus-msg) |