ok, this is a short desc. of a maillist2slash gateway I started to work on some time ago.
1. Concepts (Slash / Maillist)
authors = maillist moderators/owners
section = maillist name
story = moderated message/message sent direct by an owner
submission = unmoderated message
comments = RE: to a slash story or comment
bidirectional, please:-)
2. Process (mail to slash)
In the backgroud, have a deamon check for mail (by POP ?).
Get one mail at a time, and begin parsing.
Use the "real email" field and find out who is sending the message (From: ), in slash terms.
If it matches an author, chances are we format a story. If it matches a user, this has to be a reply to some story or comment, or a submission. Otherwise, reject the post.
If this is an ok post, work on it (w/ MIME::Tools ?) to get all bodyparts handy. We need to authenticate the user, understand his goal, translate the message(s) and store in DB.
Parse the textual body parts, and look for (XML-like?) directives in the text placed to govern topic, date, display, etc. (normally, Author is given to us by the email address, and section by the maillist name). Look at the Subject field and so forth to find out a reference to a story/comment in case the message is in fact a comment.
Fallback to defaut topic, section, author... if needed. Now we have all bits of information, process this to see if we should post a story or comment, submit, reject, etc. with a reason. Example: this msg is from Author X; The text included a <DISPLAY = "all"> directive; Does this author has posting rights to index section ?
Inline all textual parts as a story (a comment/a submission) and generate an intro if needed.
Apply filters. Save in DB.
For Slash to mail, use another set of filters and process logic to output stories and comments by mail to maillists. I feel this direction is easier.
Hum. This message is a mess; now you understand why I dropped. Hope it helps anyway.
For the brave at heart : I posted a tar.gz of the script I currently use.
I warn you : it REAL alpha and ugly. Get it on sourceforge.net [sourceforge.net]
My dream gateway (and then my PC caught on fire :) (Score:2)
1. Concepts (Slash / Maillist)
2. Process (mail to slash)
- In the backgroud, have a deamon check for mail (by POP ?).
- Get one mail at a time, and begin parsing.
- Use the "real email" field and find out who is sending the message (From: ), in slash terms.
- If it matches an author, chances are we format a story. If it matches a user, this has to be a reply to some story or comment, or a submission. Otherwise, reject the post.
- If this is an ok post, work on it (w/ MIME::Tools ?) to get all bodyparts handy. We need to authenticate the user, understand his goal, translate the message(s) and store in DB.
- Parse the textual body parts, and look for (XML-like?) directives in the text placed to govern topic, date, display, etc. (normally, Author is given to us by the email address, and section by the maillist name). Look at the Subject field and so forth to find out a reference to a story/comment in case the message is in fact a comment.
- Fallback to defaut topic, section, author... if needed. Now we have all bits of information, process this to see if we should post a story or comment, submit, reject, etc. with a reason. Example: this msg is from Author X; The text included a <DISPLAY = "all"> directive; Does this author has posting rights to index section ?
- Inline all textual parts as a story (a comment/a submission) and generate an intro if needed.
- Apply filters. Save in DB.
For Slash to mail, use another set of filters and process logic to output stories and comments by mail to maillists. I feel this direction is easier.Hum. This message is a mess; now you understand why I dropped. Hope it helps anyway.
Re:My dream gateway (and then my PC caught on fire (Score:2)
I warn you : it REAL alpha and ugly. Get it on sourceforge.net [sourceforge.net]
Parent