<?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; Planet MozillaMessaging</title>
	<atom:link href="http://mesquilla.com/category/mozillamessaging/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>Thunderbird&#8217;s Strategic Dilemma</title>
		<link>http://mesquilla.com/2010/07/15/thunderbirds-strategic-dilemma/</link>
		<comments>http://mesquilla.com/2010/07/15/thunderbirds-strategic-dilemma/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 00:58:07 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>
		<category><![CDATA[Thunderbird's future]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=920</guid>
		<description><![CDATA[In a recent tb-planning post, neandr wrote: With all respect for the people working at Mozilla/Thunderbird and fully understand the limitation they are faced with, I would like to see a more detailed mission statement for the products (TB/LG) and the future of it. Only expressing TB is for individual users, SOHO and not for [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent <a href="http://groups.google.com/group/tb-planning/msg/0c1b9ba8567fab88">tb-planning post</a>, neandr wrote:</p>
<blockquote cite="mid:4C3F520E.7080704@gmx.de"><p>With all  respect for the people working at Mozilla/Thunderbird and     fully understand the limitation they are faced with, I would like to     see a more detailed mission statement for the products (TB/LG) and     the future of it. Only expressing TB is for individual users, SOHO     and not for the Enterprise is a very vague  statement</p></blockquote>
<p>I was going to respond to that in the thread, but I got wordy so I posted this blog entry instead.</p>
<p>At the recently completed <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CBUQFjAA&amp;url=https%3A%2F%2Fwiki.mozilla.org%2FSummit2010&amp;ei=xJ0_TIzWIIHUtQONs6D0Bg&amp;usg=AFQjCNH_U_QseT5RdA2A5Ycy8dzG_kSCWg&amp;sig2=QMjtzdsYwpXCbN6YitCRLw">Mozilla Summit</a>, variations of this request  were made by many people that are close to the Thunderbird project  (including myself). But after listening to several days of Firefox  people extolling the virtues of moving everything to the browser, and  being &#8220;more like the web&#8221;, I have a new appreciation of how difficult  the development of a vision statement is for the Thunderbird team.</p>
<p>The standard game plan that Mozilla projects are expected to follow is  to develop an application with a significantly high market share so that  they can use their market influence to fight for the rights of  individual users. Mozilla is a fascinating organization as a hybrid  commercial/public interest organization, and they take their values  quite seriously.</p>
<p>Unfortunately Thunderbird, which is the only real product that <a href="http://www.mozillamessaging.com/">MoMo</a> currently has, hovers around 6 million users, which is much lower than  the number they believe are necessary to have the influence they would  like (I have heard 100 million users as a goal). Nobody currently has a  concrete plan to develop a product with 100 million users. So the  current strategy (as I see it) is to try a series of experiments to try  to develop some concepts that might be used to specify the 100 million  user product. I can&#8217;t resist naming things (<a href="http://speechtree.com/">my wife</a> calls me &#8220;an Adam&#8221;),  so let&#8217;s call this future product by the code name &#8220;Gigabird&#8221;.</p>
<p>One such experiment is <a href="https://mozillalabs.com/raindrop">Raindrop</a>. Other experiments are <a href="https://mozillalabs.com/messaging/mailing-list-manager/">going on in  extensions</a> to Thunderbird, which seem to be focusing on changes to the  user interface. Right now, that is where the vast majority of the  developer resources are focused at MoMo.</p>
<p>So if your real strategic mission is to develop Gigabird, what do you do  with your legacy product Thunderbird? The big problem is that the  &#8220;ordinary users&#8221; that are the primary focus of Firefox (and by  implication also MoMo) are migrating away from email for many forms of  messaging to other media &#8211; Twitter, Facebook, text messages, web forums,  blog comments, etc. The hardcore users of email (who are likely to  continue to use a desktop client) are sitting in office cubicles, yet  going after these &#8220;enterprise&#8221; users is counter-cultural for Mozilla.</p>
<p>So what are the strategic choices available to MoMo?</p>
<h3>the HailMary</h3>
<p>The goal here is to try to come up with one or more really clever  innovations that will form the basis of Gigabird. This is, after all,  the way that some of the new messaging formats have occurred, with  Twitter as the poster child. Using these innovations as a base, the  basic plan for Gigabird will be formulated at some point in the future.  This is the current MoMo strategy, at least as I see it. Given the  existing Mozilla culture, I would probably do this as well. (Warning:  should this strategy every become publicly revealed, <a href="http://ascher.ca/blog/">the director</a> will <a href="http://en.wikipedia.org/wiki/Mission_Impossible"> disavow any knowledge</a> of these actions.)</p>
<h3>the AboutFace</h3>
<p>Here you notice that the values-driven direction that you felt so  passionate about is actually not going to get you anywhere, so you make a  major readjustment in values to allow you to pragmatically accept a new  direction. Such moves have been done by Mozilla in the past, and are  part of the standard <a href="http://www.imakenews.com/worldwit/e_article000392891.cfm?x=b11,0,w">corporate Myth</a> propagated by Mitchell Baker (the  story about how in the early days they were adamant about never shipping  a binary). The application to MoMo could be to accept that what they  have is an email product, and their future users are going to be sitting  in cubicles. Users in cubicles should have rights too, so there could  be a valid Mozilla Foundation purpose in fighting for the rights of  these &#8220;enterprise users&#8221; and let Thunderbird develop into an enterprise  product.</p>
<h3>the SlowPlod</h3>
<p>This is the direction that existing Thunderbird users are hoping for.  The ultimate goal is to slowly improve Thunderbird until it is  undeniably the best email client around. You fix any important bugs.  You  support all of the hot new messaging concepts. You spiff up the user  interface, incrementally adding new features that provide small  improvements to usability. You keep your power uses happy with lots of  extensions for specialized purposes. It&#8217;s pretty clear that <a href="http://groups.google.com/group/tb-planning/msg/fb959ff59bde6207">dmose does  not believe</a> that he has sufficient resources to pursue this strategy,  nor is he likely to have them in the foreseeable future. The Thunderbird  code base is also really hard to adapt to these  new media (witness the struggles that <a href="http://mesquilla.com/category/exchange-web-services-ews/">I have had</a> or <a href="http://quetzalcoatal.blogspot.com">jcranmer&#8217;s blog</a> ). I think that the MoMo team wishes  us well, but believes that the future lies elsewhere.</p>
<h3>the VacuumTube</h3>
<p>Just because you can&#8217;t change the direction of humanity does not mean  that you have nothing. Vacuum tubes are long gone &#8211; yet the guitar  player at <a href="http://www.ecreekside.com/">my church</a> proudly uses his fancy amp with glowing tubes  showing through plexiglass.<a href="http://www.istimaging.com/"> The company</a> that bought one of <a href="http://www.quadtek.com/">my previous  businesses</a> had also previously purchased a manufacturer of vacuum tubes,  which had morphed into specialized purposes like lamps for  spectroscopy, and nuclear-warfare-resistant cathode ray tubes. Email  clients will be with us forever, and in the hands of people who love  them could have a useful future in various niches.</p>
<h2>My Prediction</h2>
<p>MoMo will pursue the HailMary until they have enough ideas to formulate a  real plan. At that point, they will want to devote all of their  resources to Gigabird, and be looking for an honorable way to retreat  from Thunderbird &#8211; which will be a variation of the VacuumTube. The likely retreat will probably be some sort of  future custodianship by a conglomeration of companies that provide a  freemium strategy. So if there was a basic, free Thunderbird product  that could be enhanced with addons with commercial value (like my  <a href="http://mesquilla.com/category/exchange-web-services-ews/">Exchange Web Services</a> product, or<a href="http://www.postbox-inc.com/"> Postbox</a> as a Thunderbird addon), then  MoMo could pursue their vision without abandoning their Thunderbird  users, and let companies like <a href="http://mesquilla.com">MesQuilla </a>and <a href="http://www.postbox-inc.com/">Postbox</a> support Thunderbird.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/07/15/thunderbirds-strategic-dilemma/feed/</wfw:commentRss>
		<slash:comments>24</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>Javascript filter action in Thunderbird with FiltaQuilla</title>
		<link>http://mesquilla.com/2010/06/16/javascript-filter-action-in-thunderbird-with-filtaquilla/</link>
		<comments>http://mesquilla.com/2010/06/16/javascript-filter-action-in-thunderbird-with-filtaquilla/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 23:54:04 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[FiltaQuilla]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=875</guid>
		<description><![CDATA[I received an email today asking that I add a feature to FiltaQuilla. Slightly edited, the author said: Something I&#8217;ve found myself doing at work is creating a new filter for every folder I create. I work on technical cases and for each new case number I create a new folder and have all emails [...]]]></description>
			<content:encoded><![CDATA[<p>I received an email today asking that I add a feature to FiltaQuilla. Slightly edited, the author said:</p>
<p style="padding-left: 30px;"><em>Something I&#8217;ve found myself doing at work is creating a new filter for  every folder I create. I work on technical cases and for each new case  number I create a new folder and have all emails with that case number  go into that folder.  The crappy part about it is that I literally have  hundreds of cases I deal with, and hence hundreds of filters.  You&#8217;ve  already got the regex match criteria in filtaqulla, I&#8217;d love to be able  to take that match criteria and use whatever string it matches as the  destination folder action criteria. Sample subject line contains the following: 2010-0609-518<br />
</em></p>
<p>One of the features added to my extension FiltaQuilla recently is the ability to add custom javascript actions. I thought that I would give a shot at doing this request as a custom javascript action. The author of the email was expecting this to get linked to the regex search term, but that is not the easiest way to do it. It is easier to just let the filter action also do the regex search.</p>
<p>After installing FiltaQuilla, you need to enable the custom javascript action, which is done on the Addon options page. After that, you can add a javascript custom action in the filter editor.</p>
<p>Then you need to write the javascript code for the action. I&#8217;ve done similar work in the past, so that took me about an hour to get correct. Then insert the code into the action field for the javascript action, and it&#8217;s ready to go! You have to have some sort of search in the filter as well. You could just search for everything if you wanted, or you could add a regex search for the precise term if you want. It doesn&#8217;t matter much, as all of the work is really being done in the action. You just need to make sure that the action gets called for each message that might need to be moved. There&#8217;s more documentation of this feature available at the <a href="http://mesquilla.com/extensions/filtaquilla/">FiltaQuilla page</a> on this site.</p>
<p>The code I came up with is:</p>
<pre>let digitsRegex = /20\d\d\-[0-1]\d[0-3]\d\-\d\d\d/;
let acctmgr = Cc["@mozilla.org/messenger/account-manager;1"]
                .getService(Ci.nsIMsgAccountManager);
let copyService = Cc["@mozilla.org/messenger/messagecopyservice;1"]
                    .getService(Ci.nsIMsgCopyService);
for (let index = 0; index &lt; msgHdrs.length; index++)
{
  let hdr = msgHdrs.queryElementAt(index, Ci.nsIMsgDBHdr);
  let theDigits = digitsRegex.exec(hdr.subject);
  let folders = acctmgr.allFolders;
  let length = folders.length;
  for (let i = 0; i &lt; length; i++) {
    let folder = folders.queryElementAt(i, Ci.nsIMsgFolder);
    if (folder.name == theDigits) {
      let messages = Cc["@mozilla.org/array;1"]
                       .createInstance(Ci.nsIMutableArray);
      messages.appendElement(hdr, false);
      copyService.CopyMessages(hdr.folder, messages, folder, true,
                               null, msgWindow, false);
    }
  }
}
</pre>
<p>With this filter, if you create a folder with a name like &#8220;2010-0616-001&#8243;, and your message has that in the subject, the message will get moved to that folder.</p>
<p>If you are having trouble getting it to work, an easy way to debug is just to insert statements like this into the javascript:</p>
<pre>Cu.reportError("I am here");
</pre>
<p>Those printouts will show up on the error console, so you should be able to see if your filter action code is working or not.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/06/16/javascript-filter-action-in-thunderbird-with-filtaquilla/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>Lessons from Google: Thunderbird as a Firefox extension!</title>
		<link>http://mesquilla.com/2010/06/01/lessons-from-google-thunderbird-as-a-firefox-extension/</link>
		<comments>http://mesquilla.com/2010/06/01/lessons-from-google-thunderbird-as-a-firefox-extension/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 19:39:16 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>
		<category><![CDATA[Thunderbird's future]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=829</guid>
		<description><![CDATA[During my current trek to the Bay Area, I seem to be bombarded with news about Google. I was particularly interested in the different way that Google views its business model, and that got me thinking about how Thunderbird fits into Mozilla&#8217;s business model. In an extensive article in Atlantic magazine (I always read the [...]]]></description>
			<content:encoded><![CDATA[<p>During my current trek to the Bay Area, I seem to be bombarded with news about Google. I was particularly interested in the different way that Google views its business model, and that got me thinking about how Thunderbird fits into Mozilla&#8217;s business model.</p>
<p><a href="http://mesquilla.com/wp-content/uploads/2010/06/google.png"><img class="size-full wp-image-833 alignright" style="border: 0pt none;" title="google" src="http://mesquilla.com/wp-content/uploads/2010/06/google.png" alt="Google logo" width="275" height="95" /></a></p>
<p>In an extensive <a href="http://www.theatlantic.com/magazine/archive/2010/06/how-to-save-the-news/8095">article in Atlantic magazine</a> (I always read the Atlantic while travelling), <a href="http://www.theatlantic.com/james-fallows">James Fallow</a> describes efforts that Google is undertaking to try to revive the viability of news reporting as a professional activity. A lot of this revolves around different methods of bundling content with monetization schemes. In the traditional newspaper model, news is one of many parts of the bundle, with monetization provided by various advertising streams. The internet has provided many ways to unbundle the various pieces of the newspaper, with the result that the hard news content no longer has a sufficient bundling with the monetization schemes.</p>
<p>Google may be viewed as a new kind of bundle, with its many services (search, maps, email, news, etc.) all part of the bundle of services that are attached to the monetization scheme of search advertising. The Atlantic article notes that:</p>
<p style="padding-left: 30px;"><em>Virtually all of Google’s (enormous) revenue comes from a tiny handful of its activities: mainly the searches people conduct when they’re looking for something to buy. That money subsidizes all the other services the company offers &#8230;</em></p>
<p>That requires a new way of thinking about understanding the relationship of traditional &#8220;cost centers&#8221; to &#8220;revenue&#8221;. When Google&#8217;s Andy Rubin was asked to justify the expense of Android development in this <a href="http://www.mercurynews.com/business/ci_15184465">interview in the San Jose Mercury News</a>, he responded:</p>
<p style="padding-left: 30px;"><em>So all we have to focus on are  those types of innovations that scale for large audiences, and &#8230; the revenue crank just  turns.</em></p>
<p>So what is Mozilla&#8217;s bundle and monetization scheme, and how does Thunderbird contribute to that bundle?</p>
<p><a href="http://mesquilla.com/wp-content/uploads/2010/06/firefox.png"><img class="size-full wp-image-835 alignright" style="border: 0pt none;" title="firefox" src="http://mesquilla.com/wp-content/uploads/2010/06/firefox.png" alt="Firefox logo" width="400" height="105" /></a>Mozilla&#8217;s main bundle that is attached to a monetization scheme is the FireFox browser, which is monetized through people&#8217;s use of a particular search provider when connected through the bundle. Thunderbird (and its related <a href="http://www.mozillamessaging.com/">Mozilla Messaging</a> cost center) do not currently contribute anything directly to that bundle and its monetization scheme.</p>
<p>I don&#8217;t believe that Mozilla&#8217;s subsidization of Thunderbird can continue indefinitely. Perhaps that was possible for awhile, but Mozilla&#8217;s bundle can be expected to come under continual competitive attack, which will eventually force them to marshall the resources needed to defend the bundle. Mozilla Messaging and Thunderbird need to be part of the solution, and not just a cost drag, when the tough decisions are being made to defend the bundle.</p>
<p><a href="http://mesquilla.com/wp-content/uploads/2010/06/thunderbird.png"><img class="size-full wp-image-834 alignright" style="border: 0pt none;" title="thunderbird" src="http://mesquilla.com/wp-content/uploads/2010/06/thunderbird.png" alt="" width="458" height="104" /></a>If we think like Google, it&#8217;s pretty obvious what the step is that is needed for Thunderbird to become a major contributor to Mozilla&#8217;s main business of &#8220;Firefox the bundle&#8221;.  We need to figure out ways to attract people to the bundle, and get them to linger as long as possible on the bundle while the &#8220;revenue crank just  turns.&#8221; The obvious solution is that the underlying communications code that drives Thunderbird needs to be repackaged as a FireFox extension. (Since I call that codebase Skink, let&#8217;s temporarily use the code name SkinkFox to describe the Thunderbird-as-Firefox-extension product.)  SkinkFox could have the same relationship to Thunderbird that  Lightning has to Sunbird: the same product packaged both standalone, and  as an extension.</p>
<p>&#8220;That&#8217;s just SeaMonkey!&#8221; you say. Well no it is not. If you think like an engineer and focus on features, then I guess SkinkFox is similar to SeaMonkey. But thinking like a marketer, the goal of this is to build the FireFox brandname and revenue stream, and SeaMonkey does not contribute to that while SkinkFox does.</p>
<p>Technically, <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=377319">great efforts</a> are already being made to reduce the barriers that keep the mailnews (Skink) codebase separate from FireFox. I don&#8217;t think it would be a huge leap to figure out how to merge Thunderbird&#8217;s user interface and tab system into FireFox&#8217;s.</p>
<p>As Thunderbird enters a critical rethinking in the next few months in the aftermath of Thunderbird 3.0/3.1, SkinkFox is one of a variety of thoughts I will be giving on possible futures for messaging at Mozilla.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/06/01/lessons-from-google-thunderbird-as-a-firefox-extension/feed/</wfw:commentRss>
		<slash:comments>29</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>Javascript custom filter action in new FiltaQuilla</title>
		<link>http://mesquilla.com/2010/05/20/javascript-custom-filter-action-in-new-filtaquilla/</link>
		<comments>http://mesquilla.com/2010/05/20/javascript-custom-filter-action-in-new-filtaquilla/#comments</comments>
		<pubDate>Thu, 20 May 2010 17:00:05 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[FiltaQuilla]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=788</guid>
		<description><![CDATA[I recently released a new version of FiltaQuilla for Thunderbird and SeaMonkey, and one of its cool new features is a custom filter action that runs arbitrary JavaScript. This relies on new backend features, so you&#8217;ll need TB 3.1 beta2 or later for this to work. Mitra recently pinged bug 249191 asking for a filter [...]]]></description>
			<content:encoded><![CDATA[<p>I recently released a new version of <a href="http://mesquilla.com/extensions/filtaquilla/">FiltaQuilla</a> for Thunderbird and SeaMonkey, and one of its cool new features is a custom filter action that runs arbitrary JavaScript. This relies on new backend features, so you&#8217;ll need <a href="ftp://ftp.mozilla.org/pub/thunderbird/releases/3.1b2">TB 3.1 beta2</a> or later for this to work.</p>
<p>Mitra recently pinged <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=249191">bug 249191</a> asking for a filter action that affects remote content. That looked like a good application of a javascript filter action, so I tried it out.</p>
<p>Looking at the underlying code in <a href="http://mxr.mozilla.org/comm-central/source/mailnews/base/src/nsMsgContentPolicy.cpp">nsMsgContentPolicy.cpp</a>, there is a message header property &#8220;remoteContentPolicy&#8221; that can be used to enable showing of remote content for a message. Unfortunately disallowing content appears more complex, as the address book whitelisting appears to override the message header value. But really I think that allowing remote content on a per message basis is probably the more common action need, so let me demo that.</p>
<p>In my <a href="http://mesquilla.com/extensions/filtaquilla/">documentation for FiltaQuilla</a>, I show a simple basic javascript example of a custom action that affects a message header subject property:</p>
<pre>for (let index = 0; index &lt; msgHdrs.length; index++)
{
  let hdr = msgHdrs.queryElementAt(index, Ci.nsIMsgDBHdr);
  hdr.subject = "[Hello, world] " + hdr.subject;
}
</pre>
<p>It&#8217;s fairly easy to modify this to set the remoteContentPolicy instead. The result is:</p>
<pre>for (let index = 0; index &lt; msgHdrs.length; index++)
{
 let hdr = msgHdrs.queryElementAt(index, Ci.nsIMsgDBHdr);
 hdr.setUint32Property("remoteContentPolicy", 2);
}
</pre>
<p>So if you enter this as a JavaScript custom filter in JunQuilla, you can enable remote content on messages controlled by a filter.</p>
<p>I tested it on a spam message that had &#8220;Exxon&#8221; in the subject. The resulting filter, including the javascript, looks like this:</p>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2010/05/RemoteContentPolicy2.jpg"><img class="aligncenter size-full wp-image-793" title="Remote Content Policy Action" src="http://mesquilla.com/wp-content/uploads/2010/05/RemoteContentPolicy2.jpg" alt="" width="660" height="790" /></a></p>
<p>I&#8217;m sure that defining these filters is beyond the skill of all but a few advanced users, but once the code is written it&#8217;s pretty much just cut and paste to get this to work. If I collect a few more examples, I suppose I should create a webpage to show them.</p>
<p>Thanks to jcranmer, Standard8, and bienvenu on IRC channel #maildev for helping to point me to the base code that manages remote content policy.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/05/20/javascript-custom-filter-action-in-new-filtaquilla/feed/</wfw:commentRss>
		<slash:comments>3</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>
	</channel>
</rss>
