Gnus development mailing list
 help / color / Atom feed
* local ML with Gnus
@ 2019-11-28  4:46 Emanuel Berg
  2019-11-29  0:21 ` Eric Abrahamsen
  0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg @ 2019-11-28  4:46 UTC (permalink / raw)
  To: ding

I think (?) I have succeed in writing software
for a local mailing list based on Gnus!
The code is hopefully understandable just be
reading...

Please help out to improve it tho, if you see
something. Problems that I've already detected
are indicated with comments.

The main style problem is of course that I do
this as a human would, only that is all
automated. While that seems to work fine, one
would wish it to be on the all-computer side of
things, in particular it would execute entirely
in the background.

That's probably not that difficult to do if you
know the right functions... so yeah, that can
be improved :)

File: https://dataswamp.org/~incal/emacs-init/gnus/mail-to-many.el

;;; -*- lexical-binding: t -*-

;; This file: http://user.it.uu.se/~embe8573/emacs-init/gnus/mail-to-many.el
;;            https://dataswamp.org/~incal/emacs-init/gnus/mail-to-many.el

;; Check out:
;;     http://user.it.uu.se/~embe8573/emacs-init/gnus/mailrc.el

(require 'cl-lib)
(require 'gnus-art)
(require 'gnus-msg)
(require 'gnus-sum)
(require 'message)

(defvar mtm-source-group)
(setq mtm-source-group "nnml:mail.obi-one")

(defvar mtm-test-receivers)
(setq mtm-test-receivers '(
                           "JH1 <joehacker1@lam.er>"
                           "JH2 <joehacker2@lam.er>"
                           "JH3 <joehacker3@lam.er>"
                           ))

(defun mtm-test ()
  (interactive)
  (mtm-send-random-article-to-list
   mtm-source-group
   mtm-test-receivers) )
;; (mtm-test)

(defun mtm-send-random-article-to-list (group list)
  (save-window-excursion ; still, annoying buffer flash-by
    (mtm-open-group group)
    (gnus-summary-goto-random-article)
    (gnus-summary-select-article-buffer)
    (let ((body    (gnus-article-get-body))
          (subject (gnus-fetch-field "Subject")) ; must be include in `gnus-visible-headers'
          )
      (send-mail-to-many list subject body) )))

(defun mtm-open-group (group)
  (gnus-group-read-group nil nil group) )

(defun gnus-summary-goto-random-article ()
  (interactive)
  (let*((ids             gnus-newsgroup-articles)
        (article-count   (length ids) )
        (random-position (random article-count))
        (article         (nth random-position ids)) )
    (gnus-summary-goto-article article) ))

(defun gnus-article-get-body ()
  (when (article-goto-body)
    (buffer-substring-no-properties (point) (point-max)) ))

;; TODO: delete mail

(defun send-mail-to-many (to-list subject body)
  (cl-dolist (to to-list)
    (send-mail-to to subject body) ))

(defun send-mail-to (to subject body)
  (gnus-post-news 'post "")
  (message-goto-to)       (insert to)
  (message-goto-subject)  (insert subject)
  (message-goto-body)     (insert body)
  (message-send-and-exit) )

(provide 'mail-to-many)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: local ML with Gnus
  2019-11-28  4:46 local ML with Gnus Emanuel Berg
@ 2019-11-29  0:21 ` Eric Abrahamsen
  2019-11-29  1:59   ` Emanuel Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Abrahamsen @ 2019-11-29  0:21 UTC (permalink / raw)
  To: ding

Emanuel Berg <moasenwood@zoho.eu> writes:

> I think (?) I have succeed in writing software
> for a local mailing list based on Gnus!
> The code is hopefully understandable just be
> reading...

Almost, but... why is the random stuff necessary? What's that actually
for?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: local ML with Gnus
  2019-11-29  0:21 ` Eric Abrahamsen
@ 2019-11-29  1:59   ` Emanuel Berg
  0 siblings, 0 replies; 3+ messages in thread
From: Emanuel Berg @ 2019-11-29  1:59 UTC (permalink / raw)
  To: ding

Eric Abrahamsen wrote:

>> I think (?) I have succeed in writing
>> software for a local mailing list based on
>> Gnus! The code is hopefully understandable
>> just be reading...
>
> Almost, but... why is the random stuff
> necessary? What's that actually for?

It is a just a way of picking the mail to send.
Since it doesn't matter in what order that
happens, I tought it might be random.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28  4:46 local ML with Gnus Emanuel Berg
2019-11-29  0:21 ` Eric Abrahamsen
2019-11-29  1:59   ` Emanuel Berg

Gnus development mailing list

Archives are clonable: git clone --mirror http://inbox.vuxu.org/ding

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.emacs.gnus.general


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git