Scoop to Email Gateway, a Plan
|
|
By rusty , Section Code [] Posted on Wed Mar 07, 2001 at 12:00:00 PM PST
|
|
For a long while, there's been some call to add an email gateway of some kind to Scoop. With Digest.pl, we have a one-way feed of story summaries, at least, but I think there's call for more. For example, one scoop-using project, Opennic, maintains both a scoop site and a mailing list, which basically overlap as to content. Some people are really married to the email interface, and do not want to switch to a web-based discussion. By far the best solution all around would be to have a transparent, two-way email to Scoop gateway. Below are my ideas on how to implement this.
|
Surprisingly, upon giving it a little thought, the goal of having a complete, read/write interface to scoop via email would not be all that hard to implement. Submitting stuff would come down to:
- Set a mailing address for the gateway. Something like mailbot@scoopsite.oss. Then set up the MX to pipe all incoming mail to that address to the mailbot script.
- Define a data format for input from an email client. This will probably be XML-ish, so to reply to a comment, you'd send an email that included something like the following:
<mb:username>rusty</mb:username>
<mb:password>mypassword</mb:password>
<mb:subject>Put your subject here</mb:subject>
<mb:comment>Comment text goes here.</mb:comment>
<mb:posttype>text</mb:posttype>
[The following is form information to tell the mailbot what to do. Do not edit.]
<mb:op>comments</mb:op>
<mb:sid>10/2/2000/34/56/38975</mb:sid>
<mb:cid>10</mb:cid>
<mb:tool>post</mb:tool>
So the script takes the message, and parses it for these form elements, ignoring everything else in the message text. Obviously, to submit a story, you just use different form tags. You could even vote on stories this way, with like <mb:vote>, and same with polls, if we wanted to go that far.
- Script gets all the bits out of the message, and sees if it has everything it needs to do something. If not, it replies to the poster with (hopefully) a helpful error message.
- If so, it grabs a page from the site you're targeting, to get a valid form key. It constructs a POST query using the formkey and the data in your email, and submits this to the web server.
- Get back the response page, and parse it for success- or failure-indicating text.
On the other side, sending out data is easy. You could add a user pref like "subscribe to all stories" if someone really only wanted to use the site via email. This would send them every story (and possibly every story submitted, if we had voting capability), and each comment. Hopefully it's not hard to get a mailer to recognize that one mail is a reply to another, so threaded mailreaders could display a nice threaded discussion. We could also have a "subscribe" button on the website with each story (like "hotlist") to subscribe to an individual story via email. We'd also need some standard form to unsubscribe to a story, if you don't want it anymore.
There's a little bit of trickery that would need to go on to catch post throttle violations, in case people wrote a batch of messages offline and sent them all at once. but this would be easy. Obviously, the mailer can pre-populate most of the form elements in an email, so that, for example, each comment mailed out would have at the bottom a reply form, pre-filled-in with op, tool, cid, sid, username, and the user's preferred post type. You should only need to fill in subject, comment, and password, and hit send to reply to a comment.
So, that's how a transparent mail to web scoop gateway would work. I think this would make a lot of people very happy. I will no doubt get around to coding this eventually, if no one else does, if only because it's an interesting problem to me. But if anyone else is looking to help out with the project, has some solid perl knowlege, and wants to take a shot at it before me, you're absolutely encouraged to. :-)
|
|
Story Views
|
15 Scoop users have viewed this story.
|
|