;;; .gnus.common.el --- 

;; Copyright (C) 1999 Sebastien Tanguy
;;
;; Author: sebastien.tanguy@wanadoo.fr
;; Version: $Id: .gnus.common.el,v 0.0 1999/12/26 19:00:58 seb Exp $

;; Les en-tetes par defaut pour les messages sortants:
(setq my-message-default-headers 
      (concat 
       "Mail-Copies-To: never\n"
       "Organization: GULLIVER (secretariat)\n"
       "X-headers: are fun - yeah -\n"
       "X-URL: <http://perso.wanadoo.fr/sebastien.tanguy/>\n"
       "X-UIN: 37815107\n"
       "X-uptime: "
       (substring (shell-command-to-string "uptime") 0 -1)
       )
      )

;; Mon adresse (Surprise !)
(setq user-mail-address "sebastien.tanguy@wanadoo.fr")

(defun je-signe (lang)
  (let ((seb-sig-dir (concat seb-sig-dir-base lang "/")))
    (let ((files (file-name-all-completions "sig" seb-sig-dir)))
      (if files (concat seb-sig-dir (nth (random (length files)) files)))
      )
    )
  )



;; comment citer
(autoload 'sc-cite-original     "supercite" "Supercite 3.1" t)

;;; Cf. page de R. Socha
;;*
;;* This one takes care of fucked-up signatures
;;* much enhanced version from the example in the docs by Torsten
;;*  Hilbrich <Torsten.Hilbrich@gmx.net>
;;*================================
(setq gnus-signature-separator
      "^\\(--  \\|^-- *\\|________\\========*\\)$") 

(defun ee::sc-pre-hook ()
  (save-excursion
    (let ((start (point))
          (end (mark t)))
      (goto-char end)
      (when (re-search-backward gnus-signature-separator start t)
        (forward-line -1)
        (while (looking-at "[ \t]*$")
          (forward-line -1))
        (forward-line 1)
        (setq mark (set-marker (make-marker) (point)))
        (delete-region mark (mark t))
        )
      )
    )
  )

;;* Do not insert the original author's signature when citing with
;;* supercite by Erik Eriksson
;;*================================
(add-hook `sc-pre-hook `ee::sc-pre-hook)

(setq 
 sc-citation-leader " "
; sc-preferred-attribution-list '("x-attribution"
;                                 "sc-lastchoice"
;				 "initials" 
;				 "firstname" 
;				 "lastname")
 message-cite-function 'sc-cite-original
 sc-auto-fill-region-p nil
 sc-nested-citation-p t
 )


;;*
;;* Prompts for new subject and puts old one in parents
;;*================================
(defun dpi::change-subject (neues-subject)
  "introduces new subject."
  (interactive "snew Subject: ")
  (let ((case-fold-search nil))
    (goto-line 0)
    (re-search-forward "^Subject: ")
    (if (re-search-forward "R[Ee]: " nil t)
        (replace-match "")
      )
    (insert-string neues-subject)
    (insert-string " (was: ")
    (end-of-line)
    (insert-string ")")
    )
  )


;;*================================
;;* quick nuke people :-)
(global-set-key "\C-cx" 'gnus-scum-expunge)
;;* This function should be called from the summary buffer with point
;;* on the article to nuke.  It puts a rule in ~/News/SPAMMERS to lower
;;* scores of author
;;* It needs an entry in all.SCORE of (files "/usr/agb/News/SPAMMERS").
;; I changed it to only add the from line.
(defun gnus-scum-expunge ()
  "Remove this spammer from existance as much as possible."
  (interactive)
  (let* ((hdr (gnus-summary-article-header))
         (subj (aref hdr 1))
         (auth (aref hdr 2))
         (artid (aref hdr 4))
         (atsign (string-match "@" artid))
         (host (substring artid (+ atsign 1) (- (length artid) 1)))
         (oldscfile gnus-current-score-file))
    ;; Change to our spammer score file
    (gnus-score-change-score-file "SPAMMERS")
    ;; Add our horrible spammer scores
    ;;(gnus-summary-score-entry "Subject" subj 'S' -1000 nil)
    (gnus-summary-score-entry "From" auth 'S' -1001 nil)
    ;; (gnus-summary-score-entry "Message-ID" host 'S' -5 nil) ; mild
    ;; Change back to old current score file
    (gnus-score-change-score-file oldscfile)
    (gnus-score-save)))




;;; .gnus.common.el ends here