[ben@xxxxxxxx.xxx: Mariachi Pluggability]

[prev] [thread] [next] [lurker] [Date index for 2004/06/30]

From: Richard Clamp
Subject: [ben@xxxxxxxx.xxx: Mariachi Pluggability]
Date: 20:27 on 30 Jun 2004
--rQ2U398070+RC21q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


-- 
Richard Clamp <richardc@xxxxxxxxx.xxx>

--rQ2U398070+RC21q
Content-Type: message/rfc822
Content-Disposition: inline

Return-Path: <ben@xxxxxxxx.xxx>
X-Original-To: richardc@xxxxxxxxx.xxx
Delivered-To: richardc@xxxxx.xxxxx.xx.xx
Received: from rongo.sixapart.com (dsl081-057-015.sfo1.dsl.speakeasy.net [64.81.57.15])
	by mirth.demon.co.uk (Postfix) with ESMTP id B62C1740001
	for <richardc@xxxxxxxxx.xxx>; Mon, 28 Jun 2004 23:49:39 +0100 (BST)
Received: from [192.168.100.42] (btrott-laptop.sm.sixapart.com [192.168.100.42])
	by rongo.sixapart.com (Postfix) with ESMTP id 485CC47BFD
	for <richardc@xxxxxxxxx.xxx>; Mon, 28 Jun 2004 14:47:21 -0700 (PDT)
Mime-Version: 1.0 (Apple Message framework v618)
To: richardc@xxxxxxxxx.xxx
Message-Id: <6EACEFEB-C955-11D8-9E11-000A95B33128@xxxxxxxx.xxx>
Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-2-634111383"
From: Benjamin Trott <ben@xxxxxxxx.xxx>
Subject: Mariachi Pluggability
Date: Mon, 28 Jun 2004 15:49:37 -0700
Content-Transfer-Encoding: 7bit
X-Pgp-Agent: GPGMail 1.0.2
X-Mailer: Apple Mail (2.618)


--Apple-Mail-2-634111383
Content-Type: multipart/mixed; boundary=Apple-Mail-1-634111369


--Apple-Mail-1-634111369
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

Hi,

I found and started playing around with Mariachi last Friday--very 
nice! I was looking around for something much more customizable and, 
well, modern than mhonarc, and Mariachi seems to fit the bill.

One of the things I wanted to add right away was an Atom feed of the 
last 20 messages. It was fairly easy to add by defining a subclass of 
Mariachi and a new template, but I wondered--is there another plugin 
mechanism that's available that would allow building multiple plugins 
that can be called at various phases of the archival process, or invent 
new stages? Similar to what the Siesta architecture looks like.

I've attached the Mariachi/Atom.pm and atom.tt2 files, if you're 
interested in taking a look at them.

Ben

--Apple-Mail-1-634111369
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="Atom.pm"
Content-Disposition: attachment;
	filename=Atom.pm

package Mariachi::Atom;
use strict;

use base qw( Mariachi );

sub generate_atom {
    my $self = shift;
    my @msgs = sort { $b->epoch_date <=> $a->epoch_date } @{ $self->messages };
    @msgs = @msgs[0..($#msgs > 19 ? 19 : $#msgs)];
    $self->generate_pages('atom.tt2', 'atom.xml',
        content => \@msgs,
        modified => $msgs[0]->epoch_date,
    );
}

sub perform {
    my $self = shift;
    $self->SUPER::perform(@_);
    $self->generate_atom;
    $self->_bench('atom');
}

package Mariachi::Message;
use strict;

sub atom_id {
    my $msg = shift;
    'mailto:' . substr($msg->header('message-id'), 1, -1);
}

1;

--Apple-Mail-1-634111369
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="atom.tt2"
Content-Disposition: attachment;
	filename=atom.tt2

<?xml version="1.0" encoding="utf-8"?>
[% USE date %]
<feed version="0.3" xmlns="http://purl.org/atom/ns#">;
<title>[% mariachi.config.name %]</title>
<link rel="alternate" type="text/html" href="http://sixapart.com/dev-network/list/"; />
<modified>[% date.format(modified, '%Y-%m-%dT%H:%M:%SZ', 'en_US', 1) %]</modified>

[% FOR mail=content %]
<entry>
<id>[% mail.atom_id | html %]</id>
<title>[% mail.subject | html %]</title>
<link rel="alternate" type="text/html" href="http://sixapart.com/dev-network/list/[% mail.filename %]" />
<issued>[% date.format(mail.epoch_date, '%Y-%m-%dT%H:%M:%SZ', 'en_US', 1) %]</issued>
<modified>[% date.format(mail.epoch_date, '%Y-%m-%dT%H:%M:%SZ', 'en_US', 1) %]</modified>
<author>
<name>[% mail.from | html %]</name>
</author>
<summary mode="escaped" type="text/plain">[% mail.first_paragraph %]</summary>
<content mode="escaped" type="text/html">&lt;pre&gt;[% mail.body_sigless | html | html  %]&lt;/pre&gt;</content>
</entry>
[% END %]

</feed>

--Apple-Mail-1-634111369--

--Apple-Mail-2-634111383
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFA4KCBzGeEk2uv818RAoGeAKCq8IgOci//EG6uXUFBtUfxk8yhqQCgpU2Z
4PLcFcAa1RTOAQ6Csf55S20=
=QCIC
-----END PGP SIGNATURE-----

--Apple-Mail-2-634111383--


--rQ2U398070+RC21q--

Generated at 09:00 on 03 Aug 2004 by mariachi 0.52