<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Manitou-Mail Blog &#187; Development</title>
	<atom:link href="http://www.manitou-mail.org/blog/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.manitou-mail.org/blog</link>
	<description>on the use and development of the Manitou-Mail program</description>
	<lastBuildDate>Mon, 23 Aug 2010 19:50:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Windows developement environment, final part</title>
		<link>http://www.manitou-mail.org/blog/2009/09/windows-developement-environment-final-part/</link>
		<comments>http://www.manitou-mail.org/blog/2009/09/windows-developement-environment-final-part/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 14:15:50 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.manitou-mail.org/blog/?p=72</guid>
		<description><![CDATA[<p>In part 1, we installed the build tools. In part 2, we built Qt and the PostgreSQL libraries from source. In this part, let&#8217;s see how to use these to finally build the Manitou-Mail user interface.</p>
<p>The starting point is the set of sources as fetched from the SF.net subversion repository. The latest version can be [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.manitou-mail.org/blog/2009/08/windows-developement-environment-part-1/">part 1</a>, we installed the build tools. In <a href="http://www.manitou-mail.org/blog/2009/09/windows-developement-environment-part-2/">part 2</a>, we built Qt and the PostgreSQL libraries from source. In this part, let&#8217;s see how to use these to finally build the Manitou-Mail user interface.</p>
<p>The starting point is the set of sources as fetched from the SF.net subversion repository. The latest version can be checked out with for example, <a href="http://tortoisesvn.tigris.org/">Tortoise SVN</a>, as shown in this screenshot:</p>
<div id="attachment_75" class="wp-caption alignnone" style="width: 478px"><img class="size-full wp-image-75" src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/09/svn-checkout-tortoise.png" alt="Source checkout with Tortoise" width="468" height="361" /><p class="wp-caption-text">Source checkout with Tortoise</p></div>
<p>The difference between a source tarball and sources from the repository is mostly that the configure script and Makefile.in inside each directory are present in the tarball but not in the repository: these files are to be generated by autoconf and automake.</p>
<p>Here are the steps from the checkout of the source to getting the executable file:</p>
<ol>
<li>
<p>Make sure that Qt binaries are in the path:<br />
<code>export PATH=/c/Qt/4.5.2/bin:$PATH</code></li>
<li>
<p>Generate configure script and Makefile.in files:<br />
<code><br />
aclocal<br />
autoheader<br />
autoconf<br />
automake -a -c<br />
</code></li>
<li>
<p>Configure:<br />
<code><br />
./configure --with-pgsql-includes=/usr/local/pgsql/include  --with-pgsql-libs=/usr/local/pgsql/lib<br />
</code></li>
<li>Compile:<br />
<code><br />
make<br />
</code></li>
</ol>
<p>The compilation produces the final executable, manitou.exe, in the src/ directory. While it&#8217;s possible to run &#8216;make install&#8217; at this point as we would do in an Unix environment, personally I don&#8217;t use it. This is because I just want to package the executable along with libraries inside an installer that is targeted at Windows systems that generally don&#8217;t have MSYS with its Unix-like filiesystem layout.</p>
<p>To package the Manitou-Mail interface for Windows along with the required Qt, PostgreSQL and MingW libraries into a self-contained installer program, I currently use <a href="http://nsis.sourceforge.net">NSIS</a>. The  current <a href="http://www.manitou-mail.org/wiki/doku.php/nsis_script">NSIS script</a> is available on the wiki.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manitou-mail.org/blog/2009/09/windows-developement-environment-final-part/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows developement environment, part 2</title>
		<link>http://www.manitou-mail.org/blog/2009/09/windows-developement-environment-part-2/</link>
		<comments>http://www.manitou-mail.org/blog/2009/09/windows-developement-environment-part-2/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 16:02:25 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.manitou-mail.org/blog/?p=54</guid>
		<description><![CDATA[<p>In part 1, we installed the tools that are required to build from source.
This post shows how to use them to compile Qt and the PostgreSQL libraries we need.</p>
Qt-4.5.2
<p>Qt is huge and building it from scratch takes a long time, typically several hours on a current desktop machine. Using pre-compiled binaries as available on the [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.manitou-mail.org/blog/2009/08/windows-developement-environment-part-1/">part 1</a>, we installed the tools that are required to build from source.<br />
This post shows how to use them to compile <a href="http://www.qtsoftware.com">Qt</a> and the <a href="http://www.postgresql.org">PostgreSQL</a> libraries we need.</p>
<h1>Qt-4.5.2</h1>
<p>Qt is huge and building it from scratch takes a long time, typically several hours on a current desktop machine. Using pre-compiled binaries as available on the Qt site can be preferred, although it is only since quite recently (4.5.2?) that the pre-compiled version can be used to build manitou-mail (As I mentioned in <a href="http://lists.trolltech.com/qt-interest/2008-03/msg00158.html">this message to qt-interest</a>, there was a problem with the pre-compiled qmake that precluded its use with autotools scripts launched in MSYS. But this appears to have been fixed).<br />
If however a custom compilation is chosen, here are the steps to follow:</p>
<ol>
<li>Download Qt sources into c:\qt\4.5.2 or similar
<li>Open CMD.EXE and make sure g++ is in the PATH. Add it manually if necessary.
<li>Inside, c:\qt\4.5.2, run configure.exe -platform win32-g++.
<li>Run mingw32-make as told at the end of configure, and don&#8217;t expect the result before several hours <img src='http://www.manitou-mail.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</ol>
<p>Beware: contrary to the Unix way of installing from source, no make install is necessary nor possible with Qt/Windows : the build must happen directly inside the destination directory.</p>
<h1>PostgreSQL&#8217;s libpq</h1>
<ol>
<li>Grab postgresql source tar archive and untar it. I&#8217;ve used <a href="http://www.postgresql.org/ftp/source/v8.4.0/">version 8.4.0</a>, the latest available at the time of this post.
<li>If /mingw/include/libz.h doesn&#8217;t exist, grab and unpack the <a href="http://sourceforge.net/projects/mingw/files/MSYS%20zlib/zlib-1.2.3-1/zlib-1.2.3-1-msys-1.0.11-dev.tar.gz/download">zlib dev archive</a> in /mingw.
<li>cd into postgresql source directory and run ./configure
<li> cd into src/interfaces/libpq
<li> run make &amp;&amp; make install
</ol>
<p>Once this is done, the headers files to be found in /usr/local/pgsql/include and the libraries (.a and .dll) in /usr/local/pgsql/lib</p>
<h1>Conclusion of part 2</h1>
<p>Now that Qt and PostgreSQL are built, in the next and final part of this series we&#8217;ll compile the manitou-mail application itself for windows, with the toolchain that we installed in part 1.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manitou-mail.org/blog/2009/09/windows-developement-environment-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows developement environment, part 1</title>
		<link>http://www.manitou-mail.org/blog/2009/08/windows-developement-environment-part-1/</link>
		<comments>http://www.manitou-mail.org/blog/2009/08/windows-developement-environment-part-1/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 11:09:21 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.manitou-mail.org/blog/?p=23</guid>
		<description><![CDATA[<p>This is the first post (out of 3) about setting up a development environment to build the user interface of Manitou-Mail on Windows. In this part, we&#8217;re installing the compiler (GCC packaged by MinGW), the MSYS environment, and the autotools (autoconf and automake).
In the second part, we&#8217;ll build Qt itself and the PostgreSQL client libraries [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first post (out of 3) about setting up a development environment to build the user interface of Manitou-Mail on Windows. In this part, we&#8217;re installing the compiler (<a href="http://gcc.gnu.org/">GCC</a> packaged by <a href="http://www.mingw.org">MinGW</a>), the <a href="http://www.mingw.org/wiki/msys">MSYS </a>environment, and the <a href="http://en.wikipedia.org/wiki/GNU_build_system">autotools</a> (autoconf and automake).<br />
In the second part, we&#8217;ll build <a href="http://www.qtsoftware.com">Qt </a>itself and the <a href="http://www.postgresql.org">PostgreSQL </a>client libraries from source. In the third part, we&#8217;ll build manitou.exe from the sources off the <a href="http://sourceforge.net/scm/?type=svn&amp;group_id=107272">subversion repository</a>.</p>
<h1>MinGW (compiler) installation</h1>
<p>The current version is 5.1.4 is available here: <a href="http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW%205.1.4/MinGW-5.1.4.exe/download">MingW-5.1.4 installer on sourceforge.net</a>.<br />
Let&#8217;s run the installer and choose &#8220;Download and install&#8221;:<br />
<img src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/08/w1.PNG" alt="MinGW install start" width="503" height="394" class="alignnone size-full wp-image-25" /></p>
<p>After accepting the license, we get to choose the destination directory. Let&#8217;s install into c:\mingw, the default choice.</p>
<p><img src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/08/w5.PNG" alt="MinGW destination directory" width="503" height="392" class="alignnone size-full wp-image-30" /></p>
<p>We want the &#8220;current&#8221; version:<br />
<img src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/08/w2.PNG" alt="MinGW version&#39;s choice" width="504" height="394" class="alignnone size-full wp-image-27" /></p>
<p>The next screen is about choosing the components.<br />
We need to check the following ones:</p>
<ul>
<li>MinGW base tools
<li>g++ compiler
<li>MinGW Make
</ul>
<p><img src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/08/w3.PNG" alt="MinGW components" width="502" height="393" class="alignnone size-full wp-image-28" /></p>
<p>After that, a rapid succession of screens appear, that show the packages that are being downloaded and installed.<br />
<img src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/08/w6.PNG" alt="MinGW packages getting installed" width="433" height="147" class="alignnone size-full wp-image-29" /></p>
<p>Then the install finished and we end up with a c:\mingw directory containing about 60MB of programs. It turns out that in my case, I&#8217;m also finding .tar.gz archives of the compiler packages on my desktop (from which I launched the installer), so let&#8217;s delete them.<br />
<img src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/08/w71.PNG" alt="Remaining files" width="88" height="458" class="alignnone size-full wp-image-32" /></p>
<h1>MSYS (shell environment) installation</h1>
<p>MSYS stands for minimal system. It&#8217;s a light unix-like environment with a shell and enough capabilities to support the <a href="http://en.wikipedia.org/wiki/GNU_build_system">autotools</a>.</p>
<p>Like MingW, MSYS has a base system and packages, except that it has a lot more packages. We need only a half-dozen of them.<br />
The current version of the MSYS base is available at:</p>
<p><a href="http://sourceforge.net/projects/mingw/files/MSYS%20Base%20System/Current%20Release_%20MSYS-1.0.11/MSYS-1.0.11.exe/download">MSYS-1.0.11 installer on sourceforge.net</a></p>
<p>Let&#8217;s select the default directory: c:\msys\1.0<br />
<img src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/08/m1.PNG" alt="MSys destination directory" width="502" height="391" class="alignnone size-full wp-image-34" /><br />
At the end of the installation, a post-installer script running in a CMD window &#8220;will try to normalize&#8221; with MingW, so we just accept what it suggests and type the path of our mingw directory as told (c:/mingw)<br />
<img src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/08/m3.PNG" alt="MSYS post-install" width="670" height="338" class="alignnone size-full wp-image-36" /></p>
<p>Once the installation is done, we have this icon on the desktop to launch an MSYS shell :<br />
<img src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/08/m4.PNG" alt="MSYS shortcut" width="50" height="69" class="alignnone size-full wp-image-37" /></p>
<h1>Autotools installation</h1>
<p>MSYS has an <a href="http://sourceforge.net/projects/mingw/files/MSYS%20Supplementary%20Tools/Current%20Release_%20msysDTK-1.0.1/msysDTK-1.0.1.exe/download">MSYS Developer Toolkit</a> in the form of a .EXE that installs automake, autoconf and the perl interpreter they depend on, but unfortunately their versions are too old for manitou&#8217;s configure script. It installs autoconf version 2.56 and automake 1.7.1 that date back from 2002, while we need at least autoconf version 2.60. Perl is version 5.6.1.</p>
<p>Still, let&#8217;s install that package, if just to have Perl, and upgrade separately automake and autoconf.</p>
<p>We install MSYS DTK into the recommended location<br />
<img src="http://www.manitou-mail.org/blog/wp-content/uploads/2009/08/m5.PNG" alt="MSYS Developer Toolkit install" width="499" height="389" class="alignnone size-full wp-image-38" /></p>
<p>Now, following the advice from the <a href="http://www.mingw.org/wiki/msys">MSYS wiki</a>, we get the source archives for autoconf and automake directly off the main GNU FTP server (so it&#8217;s the baseline, not modified versions for MSYS).<br />
The current sources are <a href="http://ftp.gnu.org/gnu/autoconf/autoconf-2.64.tar.bz2">autoconf-2.64.tar.bz2</a> and <a href="http://ftp.gnu.org/gnu/automake/automake-1.11.tar.bz2">automake-1.11.tar.bz2</a>.</p>
<p>Let&#8217;s download these archives into c:/tmp/ and unpack them (all the subsequent commands are run inside the MSYS shell)</p>
<pre>
$ cd c:/tmp
$ tar xjf autoconf-2.64.tar.bz2
$ tar xjf automake-1.11.tar.bz2
</pre>
<p>The MSYS wiki says it&#8217;s important to compile into separate build directories so we do as told:</p>
<pre>
$ mkdir build-autoconf
$ cd build-autoconf
$ ../autoconf-2.64/configure --prefix=/mingw
$ make
$ make install
</pre>
<p>Same thing for automake:</p>
<pre>
$ mkdir build-automake
$ cd build-automake
$ ../automake-1.11/configure --prefix=/mingw
$ make
$ make install
</pre>
<p>Now that they&#8217;re both installed, <tt>autoconf --version</tt> displays:</p>
<pre>
$ autoconf --version
autoconf (GNU Autoconf) 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.
</pre>
<p>And automake &#8211;version:</p>
<pre>
$ automake --version
automake (GNU automake) 1.11
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey
       and Alexandre Duret-Lutz .
</pre>
<h1>Conclusion of part 1</h1>
<p>With MinGW and MSYS, we have an environment that is good enough to build programs on Windows the same way that they are on unix (basically: configure &amp;&amp; make &amp;&amp; make install)<br />
With autotools we can regenerate the configure script and the Makefile.in files, which is something we need to add new source files to the project or modify the configure.in script.<br />
Also, we&#8217;re ready to compile Qt and a PostgreSQL client, which will be done in the next part.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manitou-mail.org/blog/2009/08/windows-developement-environment-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Indexing HTML parts</title>
		<link>http://www.manitou-mail.org/blog/2009/08/indexing-html-parts/</link>
		<comments>http://www.manitou-mail.org/blog/2009/08/indexing-html-parts/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 13:12:44 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[manitou-mdx]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.manitou-mail.org/blog/?p=3</guid>
		<description><![CDATA[<p>While HTML integration is improving in Manitou-Mail, the current version (0.9.12) does not index the contents of HTML parts. This is generally not a problem because messages tend to carry a text version inside a multipart/alternative MIME construct, and that version gets indexed so that the message can still be retrieved by the words it [...]]]></description>
			<content:encoded><![CDATA[<p>While HTML integration is improving in Manitou-Mail, the current version (0.9.12) does not index the contents of HTML parts. This is generally not a problem because messages tend to carry a text version inside a multipart/alternative MIME construct, and that version gets indexed so that the message can still be retrieved by the words it contains. But still, some people send HTML-only messages, in which case we want to automatically extract the text from the HTML and pass it to the indexer.</p>
<p>It&#8217;s relatively easy to write a manitou-mdx Perl plugin that does just that, by using a CPAN module to do the HTML to text conversion: <a href="http://search.cpan.org/~sburke/HTML-Format-2.04/lib/HTML/FormatText.pm">HTML::FormatText</a></p>
<p>Apart from the usual <strong>init</strong> and <strong>process</strong> functions that are described in the <a href="http://www.manitou-mail.org/mdx/plugins-reference.html">mdx plugins reference</a>, we need to provide two functions: one that recursively descends the MIME tree to find the html parts, and another that extracts them to text and pass them to the indexer.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">sub</span> index_contents <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$fh</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$ctxt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$html</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$text</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">local</span> <span style="color: #0000ff;">$/</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$html</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$fh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">getline</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">defined</span> <span style="color: #0000ff;">$html</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$tree</span> <span style="color: #339933;">=</span> HTML<span style="color: #339933;">::</span><span style="color: #006600;">TreeBuilder</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$tree</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">parse_content</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$html</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$formatter</span> <span style="color: #339933;">=</span> HTML<span style="color: #339933;">::</span><span style="color: #006600;">FormatText</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span>leftmargin<span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> rightmargin<span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">78</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$text</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$formatter</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">format</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$tree</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">defined</span> <span style="color: #0000ff;">$text</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Manitou<span style="color: #339933;">::</span><span style="color: #006600;">Words</span><span style="color: #339933;">::</span><span style="color: #006600;">index_words</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$ctxt</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'dbh'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$ctxt</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'mail_id'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> process_parts <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$obj</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$ctxt</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">is_multipart</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$subobj</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">parts</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      process_parts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$subobj</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$ctxt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;"># recurse</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$type</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">effective_type</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$type</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">&quot;text/html&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$io</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">bodyhandle</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">open</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      index_contents<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$io</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$ctxt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #0000ff;">$io</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">close</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The full source code and download link are available on the <a href="http://www.manitou-mail.org/wiki/doku.php/plugins:html_indexer">wiki</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.manitou-mail.org/blog/2009/08/indexing-html-parts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
