<?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>MesQuilla &#187; Mailnews development</title>
	<atom:link href="http://mesquilla.com/category/mailnewsdev/feed/" rel="self" type="application/rss+xml" />
	<link>http://mesquilla.com</link>
	<description>Messaging with Mozilla by rkent</description>
	<lastBuildDate>Wed, 21 Jul 2010 16:14:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Junk management for newsgroups in Thunderbird 3</title>
		<link>http://mesquilla.com/2010/07/21/junk-management-for-newsgroups-in-thunderbird-3/</link>
		<comments>http://mesquilla.com/2010/07/21/junk-management-for-newsgroups-in-thunderbird-3/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 16:14:13 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[JunQuilla]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=939</guid>
		<description><![CDATA[Thunderbird since version 3 has had experimental support for junk filtering in newsgroups. The feature basically works fine, but the user interface mostly fights against your attempts to use it. I&#8217;d like to give brief instructions here for anyone who wants to try it. You&#8217;ll need to install my addon JunQuilla to enable one critical [...]]]></description>
			<content:encoded><![CDATA[<p>Thunderbird since version 3 has had experimental support for junk filtering in newsgroups. The feature basically works fine, but the user interface mostly fights against your attempts to use it. I&#8217;d like to give brief instructions here for anyone who wants to try it.</p>
<p>You&#8217;ll need to install my addon <a href="https://addons.mozilla.org/en-US/thunderbird/addon/9886">JunQuilla</a> to enable one critical piece of user interface. JunQuilla supports a folder property that lets you selectively enable or disable junk processing for a tree of folders. So after you&#8217;ve installed JunQuilla, enable processing of junk for a newsgroup:</p>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2010/07/EnableJunk.jpg"><img class="aligncenter size-full wp-image-940" style="border: 0pt none;" title="Enable Junk" src="http://mesquilla.com/wp-content/uploads/2010/07/EnableJunk.jpg" alt="" width="624" height="379" /></a></p>
<p>This will run future posts sent to the newsgroup m.d.a.thunderbird through the bayes junk filter in Thunderbird. After this is enabled, some of the junk management controls on the folder should be enabled. Try &#8220;Run Junk Controls on Folder&#8221; to process existing posts for junk.</p>
<p>But nothing will appear to happen when you do, because there is no functionality to delete or hide the junk messages for newsgroups built in. Still, you can see the results using JunQuilla&#8217;s &#8220;junk percent&#8221; and &#8220;junk status +&#8221; columns:</p>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2010/07/JunkMessagesInNewsgoup.jpg"><img class="aligncenter size-full wp-image-943" style="border: 0pt none;" title="Junk Messages In Newsgoup" src="http://mesquilla.com/wp-content/uploads/2010/07/JunkMessagesInNewsgoup.jpg" alt="" width="566" height="346" /></a></p>
<p style="text-align: left;">The next step is to remove those junk messages from your view. The easiest thing to do is to create a virtual folder that shows the messages in the newsgroup without the junk messages. This is where the user interface fights against you. But you can trick it in the following manner.</p>
<p style="text-align: left;">Create a virtual folder on a message folder with search criteria &#8220;Junk Percent &lt; 80&#8243;. Save the folder as a subfolder of a local mail folder. Now open the virtual folder and change the folders that it scans, removing the original folder and replacing it with the newsgroup folder:</p>
<p style="text-align: left;"><a href="http://mesquilla.com/wp-content/uploads/2010/07/Change-Searched-Folder.jpg"><img class="aligncenter size-full wp-image-945" style="border: 0pt none;" title="Change Searched Folder" src="http://mesquilla.com/wp-content/uploads/2010/07/Change-Searched-Folder.jpg" alt="" width="614" height="576" /></a></p>
<p style="text-align: left;">Now the spam posts are hidden from this virtual folder:</p>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2010/07/View-without-Spam.jpg"><img class="aligncenter size-full wp-image-947" style="border: 0pt none;" title="View without Spam" src="http://mesquilla.com/wp-content/uploads/2010/07/View-without-Spam.jpg" alt="" width="637" height="437" /></a></p>
<p style="text-align: left;">You may need to specifically train the junk filter using a few junk and good messages in news. But the good news is that newsgroup spammers are not really optimizing against bayes filters, so it seems to be a lot easier to detect newsgroup spam than mail spam.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/07/21/junk-management-for-newsgroups-in-thunderbird-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending a Message (Mailnews Exchange Support)</title>
		<link>http://mesquilla.com/2010/07/15/sending-a-message-mailnews-exchange-support/</link>
		<comments>http://mesquilla.com/2010/07/15/sending-a-message-mailnews-exchange-support/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 21:33:47 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=901</guid>
		<description><![CDATA[I can now send a message through Exchange server from my Thunderbird installation. Perhaps it would be interesting to show how I hooked into the sending function in the user interface. I asked the usual suspects, and it was not clear to anyone that it could be done without adding backend hooks &#8211; which I [...]]]></description>
			<content:encoded><![CDATA[<p>I can now send a message through Exchange server from my Thunderbird installation.</p>
<p>Perhaps it would be interesting to show how I hooked into the sending function in the user interface. I asked the usual suspects, and it was not clear to anyone that it could be done without adding backend hooks &#8211; which I would like to avoid as much as possible to increase my chances of getting some initial alphas of this released to work with existing TB 3.1 users.</p>
<p>It turned out to be fairly straight forward. In <a href="http://mxr.mozilla.org/comm-central/source/mail/components/compose/content/MsgComposeCommands.js#2047">MsgComposeCommands.js </a>there is an observer notification that occurs, called &#8220;mail:composeOnSend&#8221;. This occurs right before the UI is ready to call SendMsg on the <a href="http://mxr.mozilla.org/comm-central/source/mailnews/compose/public/nsIMsgCompose.idl">nsIMsgCompose</a> object gMsgCompose. So what I needed to do was to intercept that call, and implement my own version of SendMsg rather than the SMTP/Rfc822-focused standard C++ code. To do that, I create a new object when I receive the notification with the old object as its prototype, then include a custom SendMsg that only applies if the sending account is an Exchange server. The overlay code ends up looking like this (greatly simplified):</p>
<pre>function observe(subject, topic, data) {
 // wrap the gMsgCompose object so that we can detect attempts to
 //  send using ews.
 let newCompose = new ewsCompose(gMsgCompose);
 gMsgCompose = newCompose;
}

// ewsCompose provides a wrapper around the compose object, so that we
//  can override functions.
function ewsCompose(oldCompose) {
 this.oldCompose = oldCompose;
 this.SendMsg = function ewsSendMsg
     (msgType, identity, currentAccountKey, msgWindow, progress) {
   if (incomingServer instanceof Ci.msqIEwsIncomingServer) {
     // sending using Exchange Web Services (details not shown)
     // ...
     ewsCompose.sendMsg();
     return;
   }
   else
     return this.oldCompose.SendMsg
       (msgType, identity, currentAccountKey, msgWindow, progress);
 }
 this.__proto__ = oldCompose;
}
</pre>
<p>This seems to work just fine. It was a little tricky getting the compose code to believe that I had actually sent the message, so it could quit complaining of an unsent message. What I ended up doing in my &#8220;sending succeeded&#8221; callback is to add a few shutdown calls:</p>
<pre>let ewsEventListener = {
  // msqIEwsEventListener implementation
  onEvent: function onEvent(aItem, aEvent, aData, aResult) {
    if (aEvent == 'StopRequest') {
      // ewsProgress was saved from the "progress" variable
      //   in nsMsgComposeCommands.js
      if (ewsProgress)
        ewsProgress.closeProgressDialog(aResult == Cr.NS_OK ? false : true);
      stateListener.ComposeProcessDone(aResult);
      MsgComposeCloseWindow(true);
    }
  }
}
</pre>
<p>With the ability now to send and receive messages, I&#8217;ve completed a single vertical pass through all of the key functionality. There are many, many details that I have passed over in the process. But it&#8217;s time to start thinking about what I would need to make work to get a usable alpha release of this, perhaps in about six weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/07/15/sending-a-message-mailnews-exchange-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Persistence (Mailnews Exchange Support)</title>
		<link>http://mesquilla.com/2010/06/25/data-persistence-mailnews-exchange-support/</link>
		<comments>http://mesquilla.com/2010/06/25/data-persistence-mailnews-exchange-support/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 22:55:33 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=884</guid>
		<description><![CDATA[My project to provide Exchange Web Services (EWS) support to applications based on the Mozilla mailnews codebase entered a new phase this week, where I am starting to consider the issue of local persistence of data downloaded from the server. (In the previous week, I got two other things working: display of HTML emails, and [...]]]></description>
			<content:encoded><![CDATA[<p>My project to provide Exchange Web Services (EWS) support to applications based on the Mozilla mailnews codebase entered a new phase this week, where I am starting to consider the issue of local persistence of data downloaded from the server. (In the previous week, I got two other things working: display of HTML emails, and updating of UNREAD status from the local app to the server).</p>
<p>EWS messages do not come from the server in RFC-822 format, so it seems like a pity to store them that way, though that is the common method used in the rest of the mailnews codebase. Instead, I decided to implement a local storage scheme based on <a href="http://www.sqlite.org/">SQLite</a> and <a href="https://developer.mozilla.org/en/Storage">Mozilla&#8217;s Storage interface.</a> <a href="http://www.visophyte.org/blog/">Andrew Sutherland</a> has done a lot of great work setting up an environment similar to this for the gloda database, so there are lots of good examples to pull from. Also, because the datamodel for EWS includes not only messages but also Calendar and Contact items, I can have a common database infrastucture that I can leverage over those other pieces once I get it working for the messaging part.</p>
<p>I&#8217;ve now replaced my previous in-memory datastore for message metadata with an SQLite version. This is equivalent to the <a href="http://mxr.mozilla.org/comm-central/source/mailnews/db/gloda/modules/datastore.js">datastore module in gloda</a>, and the data it is storing is like the RFC-822 headers. I still have to do the storage for the body, and also hook this up with folder change state so that the code knows that it has data it can trust.</p>
<p>As I have done this, I&#8217;ve had a new set of insights into the relationship of the various objects in the Mozilla mailnews world (which I sometimes call Skink). Previously, I had sort of expected that the natural progression of gloda would be to slowly displace the role of the message summary database, <a href="http://mxr.mozilla.org/comm-central/source/mailnews/base/public/nsIMsgHdr.idl">nsIMsgDBHdr</a>.  But now I see that a more natural progression would be for SQLite to be used as a replacement for the local mailstore (currently mbox, with maildir support <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=402392">moving forward</a> as well.) Really the main issue is the async nature of the SQLite calls, which sort of precludes its easy use as a replacement for nsIMsgDBHdr. But the datastores are typically accessed async anyway. If the message metadata in the message stores was stored primarily in SQLite format, as I will be doing, then it would be much easier to hookup an SQLite-based global search facility to all of these databases. Yes that is what gloda does now, but it has to go through all of the work to maintain a separate version of everything. Why have three copies of everything (Mork, MBox, and Gloda) when you could only have two (Mork and Gloda)?</p>
<p>As another insight, while looking through the gloda code I noticed that a JSON object was being saved to store some of the items. I though that was a good idea at first &#8211; but then I tried to write a simple serializer to convert from my internal native format to JSON objects, and saw that it was not going to be an easy project. But then I remembered that SOAP is really just a mechanism to serialize typed objects, and I already have a SOAP encoder and decoder! So instead of using JSON, I use objects serialized with my SOAP XML encoder to store unindexed items in my SQLite store. So a message (sans body) ends up looking like this as a TEXT item in SQLite:</p>
<pre>&lt;Message xmlns="http://schemas.microsoft.com/exchange/services/2006/types"&gt;
 &lt;Subject&gt;Postini First Junk Email Safely Quarantined&lt;/Subject&gt;
 &lt;DateTimeReceived&gt;2010-06-04T22:19:30Z&lt;/DateTimeReceived&gt;
 &lt;Size&gt;2612&lt;/Size&gt;
 &lt;Importance&gt;Normal&lt;/Importance&gt;
 &lt;DisplayTo&gt;Kent James&lt;/DisplayTo&gt;
 &lt;Culture&gt;en-US&lt;/Culture&gt;
 &lt;Sender&gt;
  &lt;Mailbox&gt;
   &lt;Name&gt;Postini Support&lt;/Name&gt;
   &lt;EmailAddress&gt;noreply@hostedmsexchange.com&lt;/EmailAddress&gt;
   &lt;RoutingType&gt;SMTP&lt;/RoutingType&gt;
  &lt;/Mailbox&gt;
 &lt;/Sender&gt;
 &lt;ToRecipients&gt;
  &lt;Mailbox&gt;
   &lt;Name&gt;Kent James&lt;/Name&gt;
   &lt;EmailAddress&gt;rkentjames@caspia.org&lt;/EmailAddress&gt;
   &lt;RoutingType&gt;SMTP&lt;/RoutingType&gt;
  &lt;/Mailbox&gt;
 &lt;/ToRecipients&gt;
 &lt;From&gt;
  &lt;Mailbox&gt;
   &lt;Name&gt;Postini Support&lt;/Name&gt;
   &lt;EmailAddress&gt;noreply@hostedmsexchange.com&lt;/EmailAddress&gt;
   &lt;RoutingType&gt;SMTP&lt;/RoutingType&gt;
  &lt;/Mailbox&gt;
 &lt;/From&gt;
 &lt;InternetMessageId&gt;&amp;lt;0c34b5a4-5f3c-4654-bf9d-99c9a8cb439b@HUB02.4emm.local&amp;gt;
 &lt;/InternetMessageId&gt;
 &lt;IsRead&gt;1&lt;/IsRead&gt;
&lt;/Message&gt;
</pre>
<p>At first it bothered me to save what is essentially a duplicate of what is coming over the wire, but why not? It&#8217;s not conceptually any different than RFC-822, or JSON, in function.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/06/25/data-persistence-mailnews-exchange-support/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Showing the header (Mailnews Exchange Support)</title>
		<link>http://mesquilla.com/2010/06/10/showing-the-header-mailnews-exchange-support/</link>
		<comments>http://mesquilla.com/2010/06/10/showing-the-header-mailnews-exchange-support/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 06:42:05 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<category><![CDATA[Mailnews development]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=863</guid>
		<description><![CDATA[In my last post, I thought it was going to be tricky to get the message header to display in my Thunderbird Exchange Web Services extension. Turned out it wasn&#8217;t so hard after all. After I display the body, I just had to pretend like I was the Mime processor, and spit out headers to [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://mesquilla.com/2010/06/04/reading-the-body-mailnews-exchange-support/">last post</a>, I thought it was going to be tricky to get the message header to display in my Thunderbird Exchange Web Services extension. Turned out it wasn&#8217;t so hard after all. After I display the body, I just had to pretend like I was the Mime processor, and spit out headers to an nsIMsgHeaderSink that is listening on the message window. The details of what to do are in nsMimeHtmlEmitter.cpp. The result:</p>
<p style="text-align: left;"><a href="http://mesquilla.com/wp-content/uploads/2010/06/headerPane.jpg"><br />
</a><a href="http://mesquilla.com/wp-content/uploads/2010/06/headerPane.jpg"><img class="aligncenter size-full wp-image-864" style="border: 0pt none;" title="Header Pane Now Displayed" src="http://mesquilla.com/wp-content/uploads/2010/06/headerPane.jpg" alt="" width="571" height="325" /></a></p>
<p style="text-align: left;">Thunderbird dies a horrible death if I click on any of the actions in the header though. Got to work on that.</p>
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/06/10/showing-the-header-mailnews-exchange-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading the Body (Mailnews Exchange Support)</title>
		<link>http://mesquilla.com/2010/06/04/reading-the-body-mailnews-exchange-support/</link>
		<comments>http://mesquilla.com/2010/06/04/reading-the-body-mailnews-exchange-support/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 22:58:26 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=850</guid>
		<description><![CDATA[Just as a status update, my Exchange Server extension can now read message bodies. But note that there is no header information displayed with the message: Why no header information? Because the header summary, for reasons that I cannot explain, reads the message file directly &#8211; and assumes that the message is in RFC 2822 [...]]]></description>
			<content:encoded><![CDATA[<p>Just as a status update, my Exchange Server extension can now read message bodies. But note that there is no header information displayed with the message:</p>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2010/06/ExQuillaBody21.jpg"><img class="aligncenter size-full wp-image-855" style="border: 0pt none;" title="Message with Body" src="http://mesquilla.com/wp-content/uploads/2010/06/ExQuillaBody21.jpg" alt="" width="623" height="384" /></a></p>
<p style="text-align: left;">Why no header information? Because the header summary, for reasons that I cannot explain, reads the message file directly &#8211; and assumes that the message is in <a href="http://www.ietf.org/rfc/rfc2822.txt">RFC 2822</a> format. But Exchange Server has already done all of that parsing, and separated the message into its components, including metadata (like subject), body, and attachments.</p>
<p style="text-align: left;">An important issue going forward for the Mozilla Mailnews (Skink) codebase is, what exactly is the thingy that Thunderbird purports to be? Is it a processor of RFC 2822 messages? Or is it something more, that easily incorporates other forms of communications? I hope to write a longer post on that issue soon.</p>
<p style="text-align: left;">
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/06/04/reading-the-body-mailnews-exchange-support/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Thread pane and nsIMsgDBHdr/nsIMsgDatabase (Mailnews Exchange Support)</title>
		<link>http://mesquilla.com/2010/05/21/thread-pane-and-nsimsgdbhdrnsimsgdatabase-mailnews-exchange-support/</link>
		<comments>http://mesquilla.com/2010/05/21/thread-pane-and-nsimsgdbhdrnsimsgdatabase-mailnews-exchange-support/#comments</comments>
		<pubDate>Fri, 21 May 2010 22:23:28 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=800</guid>
		<description><![CDATA[Now that I have a state machine to handle situations that need multiple SOAP calls, it was not a big leap forward to hookup the SOAP requests to the mailnews summary database. That&#8217;s what gets the messages displayed in Thunderbird&#8217;s thread pane. So here&#8217;s a picture to show where I am at. The two messages [...]]]></description>
			<content:encoded><![CDATA[<p>Now that<a href="http://mesquilla.com/2010/05/10/mailbox-state-machine-exchange-support/"> I have a state machine</a> to handle situations that need multiple SOAP calls, it was not a big leap forward to hookup the SOAP requests to the mailnews summary database. That&#8217;s what gets the messages displayed in Thunderbird&#8217;s thread pane.</p>
<p>So here&#8217;s a picture to show where I am at. The two messages are real messages that exist on the Exchange server, and have been read by my extension. The message body is not real:</p>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2010/05/ThreadPane.jpg"><img class="aligncenter size-full wp-image-801" style="border: 0pt none;" title="Thread Pane" src="http://mesquilla.com/wp-content/uploads/2010/05/ThreadPane.jpg" alt="" width="646" height="443" /></a></p>
<p style="text-align: left;">One problem that I had to solve is to make the nsMsgDatabase object extendable. The standard code for that does lots of static casts to the pointer for the XPCOM object, which either caused crashes, or duplicate database caches, depending on the approach that I took to get around that.  I ended up writing a patch for the base code to solve this, which presumably I will land for TB 3.2. I still think there must be some way to cleverly avoid this problem without patching the base code, but I could not figure it out.</p>
<p style="text-align: left;">I&#8217;m not real happy about requiring a base patch for this work, because I had hoped to be able to release a prototype for this on Thunderbird 3.1 / comm-central 1.9.2, even though the main release should be in Thunderbird 3.2/ comm-central 1.9.3. Maybe I can still figure out a solution that does not require a base patch.</p>
<h3 style="text-align: left;">Fun with Branding</h3>
<p>I&#8217;ve talked about the <a href="http://mesquilla.com/2010/05/10/mailbox-state-machine-exchange-support/">Colonial</a> layer and the <a href="http://mesquilla.com/2010/03/16/mailnews-exchange-support-the-ews-native-layer/">Native</a> layer in my application. What&#8217;s above the Colonial layer? I want to be able to distinguish between the code shared with Firefox, and the specific code that is used by messaging applications (Thunderbird and SeaMonkey), because I want portions of my work to be loadable into a FireFox extension (just in case). It could be called by the name of the main directory (mailnews) or that directory&#8217;s parent (comm-central). Personally I find mailnews very unattractive as a brand. (A <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=513527">bug asks</a> &#8220;What&#8217;s the name of MailNews?&#8221;)</p>
<p>Although I got no traction when <a href="http://groups.google.com/group/mozilla.dev.apps.thunderbird/browse_thread/thread/da8e9ab0cba06ed8">I suggested it</a> on m.d.a.thunderbird, I&#8217;m going to experiment personally with calling the Mozilla code that implements messaging functionality, and is not included in Firefox, as the Skink layer instead of &#8220;mailnews&#8221; (following Mozilla&#8217;s lizard analogy and Gecko). Yes I am being bullheaded, but this is my personal blog, so I can do what I want, right?</p>
<p>I also managed to register the domain exquilla.com, as ExQuilla is the logical brand for my Exchange Server integration functionality.</p>
<p style="text-align: left;">
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/05/21/thread-pane-and-nsimsgdbhdrnsimsgdatabase-mailnews-exchange-support/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mailbox state machine (Mailnews Exchange support)</title>
		<link>http://mesquilla.com/2010/05/10/mailbox-state-machine-exchange-support/</link>
		<comments>http://mesquilla.com/2010/05/10/mailbox-state-machine-exchange-support/#comments</comments>
		<pubDate>Mon, 10 May 2010 21:41:15 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=756</guid>
		<description><![CDATA[Previously I have described interfaces that allowed me to display Exchange Web Server objects in Thunderbird&#8217;s folder tree and account manager. My goal lately has been to display lists of messages in the thread pane. To do that, I have to acquire, store and interface message metadata (the message summary database) to the Mozilla mailnews [...]]]></description>
			<content:encoded><![CDATA[<p>Previously I have described interfaces that allowed me to display Exchange Web Server objects in Thunderbird&#8217;s <a href="http://mesquilla.com/2010/03/25/mailnews-exchange-support-first-folder-discovery/">folder tree</a> and <a href="http://mesquilla.com/2010/04/21/mailnews-exchange-support-account-manager/">account manager</a>. My goal lately has been to display lists of messages in the thread pane. To do that, I have to acquire, store and interface message metadata (the message summary database) to the Mozilla mailnews interfaces.</p>
<p>Unfortunately an issue has loomed too large to ignore: the need to sequence a number of SOAP requests when I need to send multiple requests to meet a single goal. Previously I had simply kludged around this, but I needed to make some decisions to be able to move forward in an orderly manner.</p>
<p>I&#8217;m also having enormous problems deciding what to name things. So before I can even talk about what I decided to do, I need to give a little lesson on the naming that surrounds my architecture.</p>
<h3>Overall Architecture</h3>
<p>Since my<a href="http://mesquilla.com/2010/03/16/mailnews-exchange-support-the-ews-native-layer/"> last diagram</a>, I have clarified things a little, so the structure now looks like this:</p>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2010/05/ExQuilla-UML1.png"><img class="aligncenter size-full wp-image-777" style="border: 0pt none;" title="EWS architecture" src="http://mesquilla.com/wp-content/uploads/2010/05/ExQuilla-UML1.png" alt="" width="515" height="595" /></a></p>
<p style="text-align: left;">The architectural layers are:</p>
<p style="text-align: left;"><strong>Mailnews: </strong>the existing Mozilla Mailnews code and objects.</p>
<p style="text-align: left;"><strong>Colonial</strong>: the Colonial layer provides the glue between objects represented in Mozilla mailnews format, and Exchange server format. The &#8220;colonial&#8221; analogy is an extension of the &#8220;native&#8221; layer analogy <a href="http://mesquilla.com/2010/03/16/mailnews-exchange-support-the-ews-native-layer/">presented earlier</a>. That is, if we picture Mozilla mailnews as the mother country, trying to make sense of some aboriginal &#8220;native&#8221; tribe, then there exists a colonial administration that pretends to have the same laws as the mother country, but has to translate all of those laws into some sort of actions involving native people. So the objects that pretend to be following the laws of the mother country (Mozilla mailnews), but in fact really exist in some other culture, are Colonial objects.</p>
<p style="text-align: left;">In my architecture, the Colonial objects are subclasses of base Mailnews objects like nsMsgDatabase, nsMsgDBFolder, nsMsgIncomingServer, etc.</p>
<p style="text-align: left;"><strong>Native</strong>: This layer&#8217;s objects exist as XPCOM objects on the Mozilla platform, but are represented in the native &#8220;Exchange&#8221; format rather than in Mailnews format. So for example they are identified primarily by string object ids (and not integer keys like Mailnews objects), and they are located in the Exchange tree. For example, folders containing contacts, the inbox, and tasks are all subfolders of a root mailbox folder, as in Exchange Server.</p>
<p style="text-align: left;"><strong>EWS</strong>: This layer provides translation of methods to perform operations on native-layer objects (like get subfolders, or sync message metadata) with objects that can be directly translated into SOAP web calls. (I actually use an intermediate representation, called a &#8220;property list&#8221;, that is very similar to an nsIPropertyBag, but supports ordered, multiple-valued lists such as are present in the SOAP protocols. But these property list objects can be translated directly into the SOAP protocol using the schema provided by Exchange Web Services).</p>
<p style="text-align: left;"><strong>SOAP</strong>: As <a href="http://mesquilla.com/2010/02/01/toward-mailnews-exchange-web-services-support-soap-calls/">discussed earlier</a>, this is an updated version of Mozilla&#8217;s abandoned webservices package.</p>
<p style="text-align: left;"><strong>Exchange</strong>: The Exchange Messaging Server itself, implementing a SOAP interface.</p>
<h3 style="text-align: left;">State Machine to implement Mailnews Object methods</h3>
<p>Let me now describe the problem, and what I decided to do. This is the msqEwsMachine class in the diagram.</p>
<p>The interface to Mozilla mailnews frequently consists of methods that are executed on mailnews interfaces, for example nsIMsgFolder.getNewMessages(). Such methods will get translated into a sequence of requests to a web server, which leave the SOAP layer as a sequence of nsXMLHttpRequests.</p>
<p>Which object is responsible for taking the method call, managing the series of requests to the web server, and generating appropriate events and callbacks when the method has been completed? That has been the issue of the last two weeks.</p>
<p>Originally, I had it done by the colonial-layer representation of nsIMsgIncomingServer, msqEwsIncomingServer. But I did not like how that forced the incoming server object to know way too much about the details of the SOAP calls, when at that layer all it really needed to know was the data results. I also tested using the service layer objects, either the colonial layer object that implements nsIMsgMessageService, or its Native-layer counterpart. But I found that everything that I did needed access to the root of the Native layer data representation, which is the native mailbox object.</p>
<p>So that is where the management ended up: methods on an object, msqEwsMachine, which is fully owned by the the native-layer mailbox object (The mailbox is the native-layer analog of nsIMsgIncomingServer).</p>
<p>A simple request to the mailbox layer would be &#8220;discover subfolders&#8221;, which requests that the Exchange server provide a list of all defined folders, their parent/child relationship, and some basic folder properties such as the display name. That requires two SOAP requests: 1) a first to translate the so-called &#8220;DistinguishedFolderId&#8221; such as &#8220;inbox&#8221; into the guid equivalent for the limited number of distinguished folders, and 2) a second call where the root folder is asked for all of its children recursively. At the end of the whole process, an &#8220;onStop&#8221; event is generated, which will ultimately be translated into the appropriate mailnews notifications.</p>
<h3>Next step: message metadata and nsIMsgDBHdr</h3>
<p>Yes this has been a rather boring post, but I didn&#8217;t want anyone to think nothing was happening! As the next step, I am now ready to start generating a list of messages per folder, and their corresponding nsIMsgDBHdr objects. Then I can show messages in the thread pane.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/05/10/mailbox-state-machine-exchange-support/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mailnews Exchange Support: Account Manager</title>
		<link>http://mesquilla.com/2010/04/21/mailnews-exchange-support-account-manager/</link>
		<comments>http://mesquilla.com/2010/04/21/mailnews-exchange-support-account-manager/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 22:19:01 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=731</guid>
		<description><![CDATA[To ease my transition back into ews after getting my brain all wrapped around filters for awhile, I thought I would tackle something that is mostly internal to the mailnews code. So I took on the task of getting a basic custom Account Manager interface up for the exchange web services account type. The account [...]]]></description>
			<content:encoded><![CDATA[<p>To ease my transition back into ews after getting my brain all <a href="http://mesquilla.com/2010/04/12/what-filters-need/">wrapped around filters</a> for awhile, I thought I would tackle something that is mostly internal to the mailnews code. So I took on the task of getting a basic custom Account Manager interface up for the exchange web services account type.</p>
<p>The account manager interface was apparently written by an <a href="http://en.wikipedia.org/wiki/Ancient_%28Stargate%29">ancient advanced intelligence</a> (oops I mean <a href="http://en.wikipedia.org/wiki/Netscape">here</a>), that used <a href="http://www.w3.org/RDF/">mysterious technologies</a> that are <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=420506">no longer understood</a> by humankind. Renowned cybernetic archaeologist <a href="http://quetzalcoatal.blogspot.com/2010/04/developing-new-account-types-part-2.html">Joshua Cranmer</a> has tried to unravel some of its mysteries, but that provided me more of a hint of where to look for issues than a roadmap of what I needed to really do. So I was forced into my last resort &#8211; reading the code and trying to figure it out. There were some surprises.</p>
<p>First, a brief description of terms. When you first create a new account type (unless you are using the new email interface for Thunderbird 3.0), you enter into the account wizard. That sets up up all of the initial values. After that, if you try to edit those you end up in the account manager. They are closely-related, but distinct, interfaces.</p>
<p>First, how do you add a new account type at all to these interfaces? It turns out that kill-rdf missed a spot, and it is still possible to use rdf to add a new hook into the account wizard. Extensions can have a subdirectory &#8220;isp&#8221;, and into that subdirectory you can inject an rdf file that contains some information about your account manager hook. The rss implementation gives some <a href="http://mxr.mozilla.org/comm-central/source/mailnews/extensions/newsblog/rss.rdf">hints</a> of how that is done.</p>
<p>Once you add the rdf file, your new account type shows up in the account setup under &#8220;add other account &#8230;&#8221;:</p>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2010/04/EwsAccountWizard.jpg"><img class="aligncenter size-full wp-image-734" style="border: 0pt none;" title="Ews Account Wizard Entry" src="http://mesquilla.com/wp-content/uploads/2010/04/EwsAccountWizard.jpg" alt="" width="565" height="317" /></a></p>
<p>The rdf file that you add contains all sorts of information about the account that you are trying to setup. Through some magic, the rdf items get linked directly (at least in theory) to default values for the main account objects.</p>
<p>But unfortunately, extensibility of the account manager has never really been carefully supported, so things just don&#8217;t work out quite the way you would like. Some examples:</p>
<ul>
<li>My account type represents a new protocol type, &#8220;ews&#8221; instead of &#8220;imap&#8221; or &#8220;pop3&#8243;. But at one point the server page looks into the standard file &#8220;messenger.properties&#8221; for strings like &#8220;serverType-imap=IMAP Mail Server&#8221; which of course do not exist for &#8220;serverType-ews&#8221;.</li>
<li>The pages that show in the account wizard are partly hard wired for the existing account types.</li>
<li>Although the account manager has some attempts at extensibility, most of its options are setup as a list of account types to exclude when showing certain screens. This is maddening if you are adding a new account type, because since your account type previously did not exist, of course it does not show up in all of the exclusion lists.</li>
</ul>
<p>So this intricately designed infrastructure that the ancients designed is basically unusable at present to add new account types, as far as I can tell. For each little option that you want to add, you need to trace for hours through very abstract code to figure out whether it will work, or if there is some hidden gotcha. Ultimately, it really is easier just to throw it out and start over again.</p>
<p>Fortunately, through the wonders of javascript function replacements, I was able to create enough hooks to get my new account added, without requiring a patch to the core code. Here is a rough outline of the steps that I took:</p>
<ol>
<li>First, the account wizard seems to use the existence of identities to decide if your have a mail account type, and if you do it forces you to use the standard mail account wizard types. I managed to override this in javascript.</li>
<li>After you do that, through some bizarre quirk the rdf property &#8220;NC:wizardShortName&#8221; is actually a list of the wizard pages that you want to appear for custom account types. So I can add a line to the rdf file:
<pre>&lt;NC:wizardShortName&gt;identitypage,ewsServerPage&lt;/NC:wizardShortName&gt;</pre>
<p>and that will allow me to specify precisely which pages are shown in the wizard. &#8220;ewsServerPage&#8221; is a custom page that I add though an overlay.</li>
<li>In the account manager, there is no easy way to control which subpages appear in the account tree for a custom account type. Once again I can use a javascript function hook to manually adjust the available pages. I wanted to remove the default server page (which asks if I want pop3 or imap), and add my own page in its place. I also wanted to be able to remove pages I did not want. That lets me control the list precisely, so that I now get this account tree:</li>
</ol>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2010/04/EwsAccountTree.jpg"><img class="aligncenter size-full wp-image-737" style="border: 0pt none;" title="Account Manager tree with Exchange support" src="http://mesquilla.com/wp-content/uploads/2010/04/EwsAccountTree.jpg" alt="" width="263" height="247" /></a></p>
<p style="text-align: left;">I suppose dmose would like me to organize all of this into a sample extension that others could use. One of the reasons that it is hard to get motivated to do this is that there is no real plan for the future of any of this, yet I hear rumors that a lot of this is scheduled for demolition (rdf, account wizard, even binary extensions that my entire application relies on.) Plus I&#8217;m not sure any sane person would want to do the kludges that I am doing to get this to work. Is there even any real demand for custom account types in the mailnews code, beyond what I am doing?</p>
<p style="text-align: left;">Anyway, the good news for the Exchange Web Services integration project is that I now have basic hooks into the account manager interface, so that I can easily add custom changes to the account manager setup to support Exchange Server. The most basic information (user name and server address) can be entered through the account manager interface, and used to access the correct Exchange server.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 637px; width: 1px; height: 1px;">
<pre lang="en">serverType-imap=IMAP Mail Server
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/04/21/mailnews-exchange-support-account-manager/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>What Filters Need</title>
		<link>http://mesquilla.com/2010/04/12/what-filters-need/</link>
		<comments>http://mesquilla.com/2010/04/12/what-filters-need/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 21:22:34 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=714</guid>
		<description><![CDATA[I&#8217;ve just completed a two-week hiatus from my work on Exchange Web Services (EWS) integration project to focus on fixing a few filter issues in mailnews core (Thunderbird and SeaMonkey) prior to TB&#8217;s 3.1 feature freeze. I will now return to EWS as my primary focus. But before I do, I think it would be [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just completed a two-week hiatus from my work on Exchange Web Services (EWS) integration project to focus on fixing a few filter issues in mailnews core (Thunderbird and SeaMonkey) prior to TB&#8217;s 3.1 feature freeze. I will now return to EWS as my primary focus. But before I do, I think it would be useful to give an overview of some big-picture issues in filter and traditional search (which are closely related), providing something resembling a roadmap but without any real commitment by anyone to move forward.</p>
<h3>Mailnews Traditional Filter and Search &#8211; Big Issues for Enhancements</h3>
<h4>1. Integrate full boolean search into Search Term editor</h4>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=297852"><strong>Bug 297852</strong></a> &#8211;        Search/Filter and Boolean expressions</li>
</ul>
<p>The mailnews backend traditional search logic supports full boolean expressions, but the user interface has never been updated to allow this. With asuth&#8217;s pending update to the quick search UI, making extensive use of boolean expressions internally, we are getting to the point where quick search can express certain searches that so-called &#8220;advanced search&#8221; cannot (and vice versa.)</p>
<h4>2. Store filters globally, and apply them to selected account/folder trees/contexts</h4>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=11039"><strong>Bug 11039</strong></a> &#8211;        Filter outgoing messages (perhaps to use a different Sent/FCC folder)</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=166842"><strong>Bug 166842</strong></a> &#8211;        [RFE] Ability to import and export message filters</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=129883"><strong>Bug 129883</strong></a> &#8211;        Filters Should be Shareable Across Multiple E-mail Accounts</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=59365"><strong>Bug 59365</strong></a> &#8211;        Filters should have triggers</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=34973"><strong>Bug 34973</strong></a> &#8211;            (GlobalFilters)        global message filter option</li>
</ul>
<p>Filters are currently stored per account (except in news, where they can also be per-folder). But when people define a particular filter, they frequently want it to apply to more than one account. There is no easy way currently to do this, short of recreating all filters on each account. Moving filters is also a pain when accounts are reorganized.</p>
<p>I would store filters in a single location, and provide some sort of UI to define where and when each filter is applied. That would not only be the account or folder, but also the context (such as incoming, manual, sending, or triggered.)</p>
<h4>3. Eliminate context and account dependencies of search and filter options</h4>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=67421"><strong>Bug 67421</strong></a> &#8211;        Missing possibility to filter on text in body for IMAP</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=223591"><strong>Bug 223591</strong></a> &#8211;        Junk classification should execute on each message as it&#8217;s received, not after all have been fetched</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=196036"><strong>Bug 196036</strong></a> &#8211;        Add junk mail status to search/filter criteria</li>
</ul>
<p>A necessary prerequisite of &#8220;Store filters globally&#8221; is to eliminate the current complex dependencies that search terms and filter actions have on the precise capabilities of a particular account, folder, or context. Some examples:</p>
<ol>
<li>Body search is not available for IMAP unless &#8220;download for offline use&#8221; is selected for the account</li>
<li>Junk search terms are not available unless the filter context is &#8220;after classification&#8221;.</li>
<li>News has a much more restricted group of available search terms and filter actions than mail.</li>
</ol>
<p>A major reason that we currently store and define filters the way that we do is to support these restrictions. Yet somehow we manage to silently ignore them without grave consequences in saved searches &#8211; you can define a particular saved search, and then expand its application to include folders and account where the underlying search terms perhaps make no sense.</p>
<p>Unfortunately this creates major problems for the user, who has no way of discovering that in order to activate a junk-based filter, he has to define it as &#8220;after classification&#8221;. Or before she can do a body search on IMAP, &#8220;download for offline use&#8221; must be enabled. It also means that the whole concept of a global filter, which is much desired, goes against the current philosophy of precise enabling of available features.</p>
<p>I will confess that I have been a major contributor to these issues in the last couple of years, in my zeal to maximimize the availability of features while minimizing the impact on existing behavior. But I don&#8217;t really like the result. I think, instead, we should just let the user define what they want, and have the software silently change the behavior to match (download the IMAP body if they want to search on it, delay filters until after bayes classification if they want to search on junk terms.) For cases where something makes no sense at all (like asking to search a news folder for cc) we should define reasonable defaults, and just ignore that the search does not make sense. Perhaps if the filter is being defined only on a news folder, then we could partially hide terms that don&#8217;t make sense (or gray them out). But a global filter should have all terms available, even if they don&#8217;t make sense in all circumstances.</p>
<h4>4. Centralize storage of message metadata related to MIME processing</h4>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=105169"><strong>Bug 105169</strong></a> &#8211;        Filter for Attachments</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=224392"><strong>Bug 224392</strong></a> &#8211;        Feature request: Add ability to filter by attachment name (extension)</li>
</ul>
<p>Currently, MIME processing is done on demand when a message is displayed, or as part of gloda indexing. But MIME processing is relatively expensive as well as async, which means that its results are not available in traditional search and filtering. We really need to perform MIME processing on all messages, and store basic MIME-related metadata so that it only needs to be done once, and that information would then be available to all consumers, including traditional filter and search.</p>
<h4>5. Provide discoverable path to optional search and filter features</h4>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=19442"><strong>Bug 19442</strong></a> &#8211;        Regular expressions in mail and news filters</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=9309"><strong>Bug 9309</strong></a> &#8211;        option to have attachments auto saved to chosen location</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=438441"><strong>Bug 438441</strong></a> &#8211;            (bifftones)        Custom bifftones for mail filters (like custom ringtones)</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=200252"><strong>Bug 200252</strong></a> &#8211;        filter action &#8220;print message&#8221;</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=397009"><strong>Bug 397009</strong></a> &#8211;        A filter will let me tag, but not untag</li>
</ul>
<p>These are a sample of requests that have been implemented in my extensions. There will always be lots more possibilities for search terms and filter actions than make sense to implement in core. I am not convinced that the current method of expecting users to search for extensions to do things is optimal. In the case of custom filter actions and search terms, it might make sense to have a whole category of normally disabled custom actions and terms that can be discovered by all users, added to by extensions, that enable turning on rarely needed actions and terms.</p>
<h3>Bug-related issues</h3>
<p>There are another class of important filter and search bugs that are problems rather than enhancements, and whose fix rely on solving difficult core issues. Some of these are:</p>
<h4>6. Resolve architectural issues of new message notification</h4>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=11040"><strong>Bug 11040</strong></a> &#8211;        Allow filters to control biff UI (i.e. only notify me of &#8220;important&#8221; msg)</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=222068"><strong>Bug 222068</strong></a> &#8211;        Reading filtered mails does not clear &#8220;New Mail&#8221; icon</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=228168"><strong>Bug 228168</strong></a> &#8211;        Getting new mail notification with 0 mails when mail is filtered to local folder from IMAP (&#8220;&lt;account&gt; has 0 new messages&#8221;)</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=233929"><strong>Bug 233929</strong></a> &#8211;        Still get notification on junk if messages left in Inbox</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=378582"><strong>Bug 378582</strong></a> &#8211;        Filter which moves messages from IMAP account to Local Folder prevents new mail alert</li>
</ul>
<p>As I have said before, new message notification is hopelessly confused in mailnews, and needs refactoring.  There are lots of notification-related bugs that I an afraid to touch until that is done.</p>
<h4>7. Queue operations for busy folders</h4>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=196732"><strong>Bug 196732</strong></a> &#8211;        Some messages correctly identified as junk are not moved to the Junk Mail folder</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=168648"><strong>Bug 168648</strong></a> &#8211;        Cannot filter (move) messages to Inbox that is busy (fetching its own mail)</li>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=139215"><strong>Bug 139215</strong></a> &#8211;        mail not filtered while compacting folders</li>
</ul>
<p>Currently if a folder is unavailable for some reason, then filtering just fails. This creates a constant source of unreliable filtering. We really need some explicit method to handle this, perhaps a queue of operations to apply to a folder when it is available again.</p>
<h3>Next steps</h3>
<p>I don&#8217;t really have the time to implement any of these issues for the foreseeable future. I don&#8217;t know for sure what MoMo&#8217;s priorities are, but I would guess that filtering is generally not high on the list. So I guess I&#8217;ll need to put out a help wanted sign (but don&#8217;t believe the &#8220;reward&#8221; part!).</p>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2010/04/Wantedw400.jpg"><img class="aligncenter size-full wp-image-723" style="border: 0pt none;" title="Wanted - Filter Developer" src="http://mesquilla.com/wp-content/uploads/2010/04/Wantedw400.jpg" alt="" width="400" height="548" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/04/12/what-filters-need/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Mailnews Exchange Support: First Folder Discovery</title>
		<link>http://mesquilla.com/2010/03/25/mailnews-exchange-support-first-folder-discovery/</link>
		<comments>http://mesquilla.com/2010/03/25/mailnews-exchange-support-first-folder-discovery/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 19:16:08 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=681</guid>
		<description><![CDATA[I set a goal for myself a few weeks ago to perform a single vertical slice through my Mailnews Exchange Support project, focusing on displaying Microsoft Exchange folders in the Thunderbird folderpane. I have now filled in the missing glue from the architecture in my last post, and have my first display of Exchange Web [...]]]></description>
			<content:encoded><![CDATA[<p>I set a goal for myself a few weeks ago to perform a single vertical slice through my Mailnews Exchange Support project, focusing on displaying Microsoft Exchange folders in the Thunderbird folderpane. I have now filled in the missing glue from the architecture in my <a href="http://mesquilla.com/2010/03/16/mailnews-exchange-support-the-ews-native-layer/">last post</a>, and have my first display of Exchange Web Services (EWS) objects in the Thunderbird user interface.</p>
<p><a href="http://mesquilla.com/wp-content/uploads/2010/03/FirstFolderDiscovery.jpg"><img class="size-full wp-image-682 alignleft" style="border: 0pt none; margin: 5px 10px;" title="First Folder Discovery" src="http://mesquilla.com/wp-content/uploads/2010/03/FirstFolderDiscovery.jpg" alt="" width="306" height="378" /></a>The account &#8220;rkent@caspia.org&#8221; is an Exchange account, and is finding the standard first-level Exchange folders &#8211; including some like &#8220;Calendar&#8221; and &#8220;Contacts&#8221; that I suppose should be suppressed here, and shown instead in their correct location in Thunderbird&#8217;s Calendar and Address Book.</p>
<p>The main issue in getting this phase to work was trying to understand how mailnews startup really works, which was complicated because my usual fountain of all knowledge (David Bienvenu) was on vacation when I needed to make progress. I think that I have figured out that nsIMsgFolder-&gt;GetAllSubfoders has been overloaded with the side-effect of initialization, and that happens only at startup, but there are still lots of holes in my understanding of Thunderbird&#8217;s IMAP initialization, which is the closest parallel to Exchange within the Mozilla Mailnews Environment (MME). It did become really clear to me though that the IMAP implementation is very much a problem of synchronization betweem two data stores, though that synchronization is fairly invisible in normal modes of using IMAP. All I am doing now is, on expanding the account&#8217;s root folder, looking for MME objects representing each of the folders that exist in EWS, creating them if needed. (I am also supposed to be deleting any MME folders that are not in EWS, but you can see from the &#8220;rerer&#8221; folder that that is not working for some reason.)</p>
<p>This is currently a barely working implementation (like it asserts with a corrupt database the second time I call it). but the point of this was really to better understand the scope of the entire project, and to provide a basis for an initial development of the architecture, followed by a serious evaluation prior to continuing with the bulk of the project.</p>
<p>Having now completed this initial goal, I need to turn for the next few weeks to landing some bugs that sorely need fixing in Thunderbird&#8217;s filter code prior to 3.1, as I have been ignoring that for way too long. But before I do, let me record some thoughts on critical issues that I need to face when I return to this.</p>
<p><strong>1. Code division between C++ and JavaScript, internal and external linkage, and comm-central dependencies</strong>.</p>
<p>My current implementation is written entirely in C++ as XPCOM objects, but tested using xpcshell unit tests written in JavaScript. The code is split into two extensions.  &#8220;webservices&#8221; implements the <a href="http://mesquilla.com/2010/02/01/toward-mailnews-exchange-web-services-support-soap-calls/">SOAP layer</a>, resides in /mozilla/extensions, and uses external linkage. &#8220;exchangews&#8221; resides in /mailnews/extensions, consists of both the <a href="http://mesquilla.com/2010/03/03/mailnews-exchange-support-basic-mail-infrastructure/">exchange-specific mailnews objects</a>, as well as the <a href="http://mesquilla.com/2010/03/16/mailnews-exchange-support-the-ews-native-layer/">Exchange Native</a> layer, and uses internal linkage. The dependencies are setup so that the SOAP layer is independent, the Exchange Native layer needs the SOAP layer, and the mailnews layer needs the Native layer, and (very weakly) the SOAP layer.</p>
<p>I would like to consider implementing both the SOAP layer and Native layers using external linkage with frozen Mozilla interfaces, so that they could be provided without version dependencies. Then perhaps I could add some generic factories for starter MME objects to the core Thunderbird code in version 3.2, which I could extend using JavaScript to provide the Exchange-specific mailnews objects. That way I could greatly reduce my dependencies on versions in the shipped code.</p>
<p><strong>2. Error logging</strong></p>
<p>The Mozilla framework does not really have a robust centralized error logging and reporting facility, instead there seems to be a multitude of different approaches that don&#8217;t cooperate. My current sprinkling of &#8220;NS_WARNING&#8221; printouts won&#8217;t really help in an imagined future where customers encounter failures. I need to reach some decision on how to do this, so that I don&#8217;t have to redo the error management when I want to release something.</p>
<p><strong>3. Synchronization</strong></p>
<p>This is very much a synchronization application. I need to consider the overall synchronization strategy, and how much to follow the lead of MME&#8217;s existing IMAP implementation.</p>
<p><strong>4. SOAP layer</strong></p>
<p>Partly as a personal education in SOAP, and against the recommendation of several people more experienced than myself, I updated and used the old abandoned <a href="http://mxr.mozilla.org/mozilla1.8/source/extensions/webservices/">Mozilla webservices code</a> as the SOAP layer. Although that is now generally working OK for me, others have suggested that I could accomplish the same thing in an easier, more robust manner using standard XML manipulation routines. I want to attempt to replace one of my SOAP calls using standard XML routines, to see which I prefer, before I implement the 50 or so calls that I will need to glue my Exchange Native layer to the SOAP layer.</p>
<p><strong>5. People</strong></p>
<p>So far, this project has been entirely my own personal effort. But in the future, I envision a small company of 3 &#8211; 5 people who provide and support this code, and are able to make a living doing so. The hope is that I could be independent of, but cooperative with, the main <a href="http://www.mozillamessaging.com/">Mozilla Messaging</a> team that supports Thunderbird. (That is, I hope to answer &#8220;no&#8221; to my question &#8220;<a href="http://mesquilla.com/2009/03/23/do-meals-need-a-fork/">Do MEALS need a fork?</a>&#8220;) At what point should I be adding people to this team? A one-person development team can be quite efficient if it can get the job done, as you eliminate all of the effort associated with maintaining relationships and communication. I think there is a reasonable (50/50) chance that I can get this project done on my own by the end of 2010 and/or in sync with Thunderbird 3.2, as is my current goal. I&#8217;ll need to firm this up by the end of June. But I would be open now to beginning to partner with one of the experienced volunteer mailnews developers (you know who you are) who has similar interests.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/03/25/mailnews-exchange-support-first-folder-discovery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
