From mikemondragon at gmail.com Sun Dec 2 12:35:36 2007 From: mikemondragon at gmail.com (Mike Mondragon) Date: Sun, 2 Dec 2007 09:35:36 -0800 Subject: [mms2r-users] simplifying adding new carriers In-Reply-To: References: Message-ID: <967d3b9a0712020935l44da7f1aha839ca91c155c282@mail.gmail.com> On Nov 18, 2007 8:57 PM, Luke Francl wrote: > Hey, > > I'm writing instructions on how to add new carrier classes to MMS2R and > while it's not difficult (even I figured out how to do it ;-), it's not as > simple as it could be. > > One simple change that I think would make things easier would be if Media > subclasses registered their email gateway mapping with the module's > CARRIER_CLASSES hash. > > I think that's just as simple as something like this: > > class FoobarMedia < MMS2R::Media > CARRIER_CLASSES['foobarmms.com'] => FoobarMedia > end > > (or maybe a register method on the Media base class could be used to > simplify things further). > > The other part is that MMS2R would have to load all the media subclasses > when it's loaded. I think you talked about doing that with directory > globing, right Mike? > > Does this sound reasonable? > > _______________________________________________ > mms2r-users mailing list > mms2r-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mms2r-users > > (I sent the below directly to Luke but now realize I should have put it out on the list). Right, I'm going to implement a class level registry in 2.0 of MMS2R, something like: class MMS2R::Media::MyCarrier < MMS2R::Media MMS2R::Media.register "mycarrier.com", self end Then when file is loaded from inside or outside of the Gem the MyCarrier class is available. I was trying to get MMS2R 2.0 completed last week but became sidetracked with other work. I'll try to release 2.0 this week. From mikemondragon at gmail.com Sun Dec 2 13:01:35 2007 From: mikemondragon at gmail.com (Mike Mondragon) Date: Sun, 2 Dec 2007 10:01:35 -0800 Subject: [mms2r-users] MMS2R v2.0 features Message-ID: <967d3b9a0712021001k2c5d78fbu8075e28fe558d7b6@mail.gmail.com> Luke received some good European examples from this blog post http://www.railspikes.com/2007/11/13/seeking-mms-sample-data After seeing Luke at RubyConf I knew that we had bunch of updates to do before working on the MMS2R 2.0 version. I wasn't looking forward to doing this work and now I realize why. But I don't like coding on 1.X anymore because its pain to write a bunch of boiler plate files for each new carrier when really all their processing logic is handled in MMS2R::Media . The only carrier that requires special processing is Sprint. And I don't like how the configs are named and laid out in the conf file. I think there is a happy solution and that is to have the configs named based on the carrier. For instance AT&T in the US uses mms.att.net so their config should be aYAML named mms.att.net.yml in the config directory. And that YAML should be a hash of all the things that can processed on the mail either the subject or the ignoring or transforming of content. --- subject: - Multimedia message ignore: text/html: - /^ T-Mobile/ image/gif: - video.gif - audio.gif transform: text/html: - /^(.+?)\s+CARRIER AD HERE/m : \1 And the logic would be applied if the content's file name equals an array element for that mime type in ignores it is ignored, if it matches an array element for that mime type as an regexp it is ignored. Also, I'm going to throw out the external TMail source that is SVNed from Rails in favor of having a dependency on the TMail Gem (http://tmail.rubyforge.org/). The TMail Gem is now being maintained actively. Those are my ideas, I'll be implementing them over the next couple of days.