Sphene Community Tools

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » Feature Discussions » mailman to forum integration

Hi
I am trying out sphene (really cool btw) and wondered about the best way to integrate a mailing list (mailman) into the forum. The demand is that all posts to the forum go to the mailing list and all to the mailing list go to the appropriate forum/thread. Any pointers from you before I start about the best way to implement this would be great.
i guess it shouldn't be too hard ..

the first part - sending mails about posts in a forum to a mailing list is quite easy .. create a django application and register a signal handler for post_save for the sphene.sphboard.models.Post object..

this would look something like:

from sphene.sphboard.models import Post
from django.db.models import signals

dispatcher.connect(send_to_mailinglist,
                   sender = Post,
                   signal = signals.post_save)



and in send_to_mailinglist you would simply send the message to the mailman address..

in send_to_mailinglist you would have probably to check 1.) if it is really a new post, and not an editing of a post 2.) in the trunk version of SCT there is a new property 'is_hidden' which is True if the post is not "ready" (e.g. a user wants to upload an attachment.. so i create a Post object just to have something to link to in the PostAttachment model) - you probably want to look into the save() method of the Post class to see how it checks if it should send out 'new post' emails .. 3.) this signal is of course also sent, when your mailinglist to forum script creates new posts because an email was sent to the mailing list.. you should check that somehow .. (i'm not sure how though .. maybe always use a specific user to create those posts)


as for the second part - creating new posts for mailing list mails.. i'm not sure how you could identify the correct thread.. maybe by searching for the subject or something ? ..

but simply creating a Post model is very easy .. you could look into sphene/sphboard/views.py into the 'post' method.. it creates a post object:

                newpost = Post( category = category,
                                subject = data['subject'],
                                body = data['body'],
                                author = request.user,
                                thread = thread,
                                )
                newpost.save()


so .. body and subject is easy ... category .. depends on how you want to match the category ? you probably need to define a mailing list -> forum category mapping ? but in the end you probably want to retrieve the category by it's id ? so that's straight forward..

the 'author' depends on if you want that every incoming mail belongs to the same user .. or is matched by it's email address or something similar.. but in the end.. you need a django User object here..

the 'thread' is simply another 'Post' model which has it's 'thread' attribute set to None..


well... i guess there still plenty of problems to solve to have a smooth integration .. but.. i guess this should provide you with a starting point for SCT models/integration

let me know if this was any helpful ;)
Hey, we have Signatures !!! Great, isn't it ? ;)
wow...that is great!!...thx for writing this.

I have been working on this for a while looking at the Mail-News and News-Mail Gateway Settings within mailman. I thought about using these with papercut http://pessoal.org/papercut/ which advertizes itself as "a NNTP server written in Python. Its main objective is to integrate existing web based message board software (Phorum is one of the supported ones) with an Usenet front-end. However, its extensibility enables developers to write their own containers for the storage of the Usenet articles (messages). That means that the code is extensible enough that _you_ could write new containers to integrate the news server with other web message board projects or even other ways to store the messages." This way maybe I could use the sphene database for storage? . I was advised to look into this on the django users list http://groups.google.com/group/django-users/tree/browse_frm/month/2007-10/c57a6d3ae399649a?rnum=161&_done=%2Fgroup%2Fdjango-users%2Fbrowse_frm%2Fmonth%2F2007-10%3F

you have certainly opened my eyes with the signals based approach and i will be posting here regularly about this i imagine as the development progresses
papercut looks very interesting .. i also thought about integrating a NNTP frontend for SCT's forum.. but didn't quite get around it.. because i feared it would be too much work .. but papercut sounds promising .. :)

(i'm not sure though how it works with mailman -> NNTP -> SCT ..)

anyway .. it would be nice if you could post updates about your progress :) .. if you run into any problems with SCT let me know ;)
Hey, we have Signatures !!! Great, isn't it ? ;)

Please login to post a reply.



Powered by Sphene Community Tools