Stories
Slash Boxes
Comments

Slash Open Source Project

This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login
Loading... please wait.
  • 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.

    • I have most of it ready for a site of mine inside my office Intranet: it works out of an email alias subscribed to some mailing lists. Every message is a new story unless some headers (In-Reply-To, References) make it count as a reply to some other comment.

      What it's not there is the handling of MIME types: in fact if it's not text/plain it bails out. Also I also have some logic to find a suitable topic out of Subject - sometimes it works, sometimes not.

      I need to rewrite for Fry because the handling of comments has changed, and my site is still running Bender. I will try to post the script once it's cleaned up.
      --

      Check out the Slash in Italian Project [kenobi.it]

      • I'd love to see this script. This is a feature my site really needs.

        Having each new message as a new discussion instead of a story would probably make more sense in my case. But I guess this is trivial to do if new messages are posted as new stories.
        • It's available at my site [sevenseas.org]. Please note it's for Bender (not Fry!), doesn't handle messages other than text/plain (you can put demime in front of it) and text to html transformation is done internally by a bunch of regexs instead of using an external module (HTML::FromText [cpan.org] being a candidate).

          Apart from this, it works. I use it as a sendmail alias:
          slashpost: | mail2slash virtualuser

          --

          Check out the Slash in Italian Project [kenobi.it]

    • 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]