<?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 Mozilla</title>
	<atom:link href="http://mesquilla.com/category/mozilla/feed/" rel="self" type="application/rss+xml" />
	<link>http://mesquilla.com</link>
	<description>Messaging with Mozilla by rkent</description>
	<lastBuildDate>Wed, 03 Mar 2010 22:31:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mailnews Exchange Support: basic mail infrastructure</title>
		<link>http://mesquilla.com/2010/03/03/mailnews-exchange-support-basic-mail-infrastructure/</link>
		<comments>http://mesquilla.com/2010/03/03/mailnews-exchange-support-basic-mail-infrastructure/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 22:31:39 +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=619</guid>
		<description><![CDATA[This post is intended mostly as a status update on my effort to add Microsoft Exchange Server support to the Mozilla mailnews products, including Thunderbird and SeaMonkey.
In my last report, I was testing and updating the old Mozilla SOAP framework for use in communicating with Exchange Web Services (EWS). Using the framework in a Thunderbird [...]]]></description>
			<content:encoded><![CDATA[<p>This post is intended mostly as a status update on my effort to add Microsoft Exchange Server support to the Mozilla mailnews products, including Thunderbird and SeaMonkey.</p>
<p>In my <a href="http://mesquilla.com/2010/02/01/toward-mailnews-exchange-web-services-support-soap-calls/">last report</a>, I was testing and updating the old Mozilla SOAP framework for use in communicating with Exchange Web Services (EWS). Using the framework in a Thunderbird 3.0 environment, I could talk to the BING search SOAP interface. It took a couple of more weeks to resolve issues associated with communicating with EWS. There were a number of features missing from the old Mozilla SOAP, most importantly:</p>
<ul>
<li>attributes in SOAP elements.</li>
<li>arrays of choices with unlimited number of elements. The property bag of the previous interface can&#8217;t handle multiple items with the same name, so I did my own &#8220;property list&#8221; replacement for it.</li>
<li>authenticated access to the SOAP service.</li>
</ul>
<p>I&#8217;ve successfully sent a &#8220;Get Folder&#8221; call to an Exchange Server. The code to define the specific Exchange call looks like this:</p>
<pre>let getFolder = new EwsGetFolder;
getFolder.invoke(responseListener);

function EwsGetFolder()
{
 // defaults
 this.FolderBaseShape = "Default";
 this.FolderIds = "inbox";
}

EwsGetFolder.prototype = new SoapBase(kMessages2007sp1Schema);

EwsGetFolder.prototype.invoke =
  function EwsGetFolder_invoke(aSOAPResponseListener)
{
 let FolderShapeList =
   objectPropertyList({BaseShape: this.FolderBaseShape});
 let FolderIdsList = objectPropertyList(
     {DistinguishedFolderId: objectPropertyList(
       {$attributes: objectPropertyList({Id: this.FolderIds}) })});
 let soapCall = Cc["@mozilla.org/xmlextras/soap/call;1"]
                  .createInstance(Ci.nsISOAPCall);
 let parameters = [];
 let FolderShapeType =
   this._schema.collection.getType(
     'FolderResponseShapeType',
     'http://schemas.microsoft.com/exchange/services/2006/types');
 let FolderIdsType =
   this._schema.collection.getType(
     'NonEmptyArrayOfBaseFolderIdsType',
     'http://schemas.microsoft.com/exchange/services/2006/types');
 parameters.push(
   new soapParameter(
     "FolderShape",
     FolderShapeList,
     FolderShapeType,
     "http://schemas.microsoft.com/exchange/services/2006/messages"));
 parameters.push(
   new soapParameter(
     'FolderIds',
     FolderIdsList,
     FolderIdsType,
     "http://schemas.microsoft.com/exchange/services/2006/messages"));
 soapCall.encode(
   Ci.nsISOAPMessage.VERSION_1_1,
   'GetFolder',
   this._schema.targetNamespace,
   0, null, // header blocks
   parameters.length, parameters);
 soapCall.transportURI = kAccount.url;
 soapCall.asyncInvoke(aSOAPResponseListener,
                      kAccount.user, kAccount.password);
}</pre>
<p>So I can now successfully do SOAP communication to an Exchange Server (2007 SP1), using the standard Exchange schemas to encode the messages. There is still much needed to clean this up, but I&#8217;ve got enough working for now.</p>
<p>So now I turn my attention to the setup of a new account type in Thunderbird. This is the same issue that<a href="http://quetzalcoatal.blogspot.com/2010/01/developing-new-account-types-part-0.html"> jcranmer is working on</a>, but he is specifically trying to do everything in javascript, while I am content (for now) to work partly in C++. So I have to build the darn thing.</p>
<p>Ah, the Mozilla build system. Gotta love it. You have to know the difference between :, ::, :=, =~, (), {}, in a zillion different languages (perl, python, autoconf, automake, bash, make at least). When it works, it works like magic. But sometimes you wave your magic wand, say your magic incantation, and nothing happens. That&#8217;s what makes it so hard. You spend hours seeing if you can get the spell to work, but sometimes you just have to give up and do it the old fashioned way, knowing that there is probably some trivial change you could have done to make the magic work. But I guess I have no right to complain. Everyone said to NOT do it this way, but did I listen? I&#8217;ve been in build hell for a week.</p>
<p>But it turned out to be just build purgatory! Now that I am out, what wonders heaven holds! I can use a real debugger on my code, and not Venkman and dump()! The vast majority of the existing mailnews code is in C++, so I can see what local folders, IMAP, and newsgroups do, and very easily adapt it to my needs. I can subclass the existing implementations!</p>
<p>So as of today, I have a series of subclassed C++ files that contain what will be the future EWS-based objects &#8211; though I have not attempted yet to glue them to EWS, just simulations. I have new C++ files for the folder, message service, incoming server, and summary database &#8211; along with some basic unit tests. (This is very similar to the approach that the RSS implementation takes).</p>
<p>So what can I do? I can just display an account, its subfolders, and a message header (all simulated not real). It looks like this:</p>
<p><a href="http://mesquilla.com/wp-content/uploads/2010/03/ews-message-600.jpg"><img class="alignnone size-full wp-image-623" title="Simulated Exchange Web Service message" src="http://mesquilla.com/wp-content/uploads/2010/03/ews-message-600.jpg" alt="" width="600" height="299" /></a></p>
<p>As you can see, I have not faced the issue yet of registering my protocols, so when I click on the message I get a complaint. I&#8217;ll be doing that next, along with trying to get the real information from EWS instead of this simulation.</p>
<p>OK, I know, you are not impressed &#8211; one simulated message, and that does not even work?  &#8220;Everything is hard to do in Thunderbird&#8221; is my defense, so cut me some slack, all right?</p>
<p>rkent</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/03/03/mailnews-exchange-support-basic-mail-infrastructure/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My uber-cautious checkin procedure</title>
		<link>http://mesquilla.com/2010/02/10/my-uber-cautious-checkin-procedure/</link>
		<comments>http://mesquilla.com/2010/02/10/my-uber-cautious-checkin-procedure/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 17:50:44 +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=604</guid>
		<description><![CDATA[Since I see that checkin errors are fairly common, and a poorly controlled source of potential issues in Mozilla code, I developed my own written process that I follow whenever I do checkins. It&#8217;s probably over cautious, with a practice checkin locally before I do the real thing, but here it is in case anyone [...]]]></description>
			<content:encoded><![CDATA[<p>Since I see that checkin errors are fairly common, and a poorly controlled source of potential issues in Mozilla code, I developed my own written process that I follow whenever I do checkins. It&#8217;s probably over cautious, with a practice checkin locally before I do the real thing, but here it is in case anyone else is interested. This is my actual text, with little massaging for general audiences:</p>
<p>====<br />
Check tinderbox for current checkin status and burns</p>
<p>(cd pristine/src) [This is a directory containing a clone of comm-central from mozilla]<br />
hg pull &#8211;u</p>
<p>(cd mozpush/src) [This is a directory containing a clone of my local pristine repository]</p>
<p>hg pull &#8211;u</p>
<p>(If there are problems, create a new mozpush directory, and do<br />
hg clone /s/tb/pristine/src src)</p>
<p>hg import /f/tb/patch/name.patch<br />
(above starts notepad, give bug &amp; approvals and save)<br />
hg outgoing -p<br />
(check that the patch and comment are correct)<br />
hg push</p>
<p>(cd pristine/src)<br />
hg pull &#8211;rebase<br />
(if changes, you may need hg update, or hg rebase -s revision -d revision)<br />
hg outgoing -p</p>
<p>(if everything looks good)<br />
hg push</p>
<p>Go to http://hg.mozilla.org/comm-central/shortlog and get the diff link for the push, something like:</p>
<p>http://hg.mozilla.org/comm-central/rev/324e7b178ad7</p>
<p>(or http://hg.mozilla.org/releases/comm-1.9.1/shortlog )</p>
<p>Go to bug, comment on checked-in attachment with above link.</p>
<p>Mark resolved/fixed, and add the appropriate pristine/src Target Milestone.</p>
<p>(when you checkin to comm-1.9.1, please set the status-thunderbird3.0 field to &#8220;.1-fixed&#8221; (or whatever the appropriate dot release is)</p>
<p>Follow tinderboxes.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/02/10/my-uber-cautious-checkin-procedure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Toward mailnews Exchange Web Services support: SOAP calls</title>
		<link>http://mesquilla.com/2010/02/01/toward-mailnews-exchange-web-services-support-soap-calls/</link>
		<comments>http://mesquilla.com/2010/02/01/toward-mailnews-exchange-web-services-support-soap-calls/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 22:28:51 +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=593</guid>
		<description><![CDATA[I&#8217;ve embarked on an effort to investigate adding support for Exchange server to the mailnews code. Although Exchange in Windows has traditionally used port 135-based protocols, my understanding is that the future for them is SOAP-based Exchange Web Services (EWS). As a first step, I wanted to get a basic SOAP library working in current [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve embarked on an effort to investigate adding support for Exchange server to the mailnews code. Although Exchange in Windows has traditionally used port 135-based protocols, my understanding is that the future for them is SOAP-based Exchange Web Services (EWS). As a first step, I wanted to get a basic SOAP library working in current mailnews code.</p>
<p>I considered a variety of approaches to this. One extension &#8220;Asertiva Thunderbird Extension for Sugar&#8221; uses the IBM/Prototype js library for SOAP access. Others recommended that I consider one of the open source SOAP libraries, such as a python-based library, or Apache&#8217;s AXIS2 library. Or that I cooperate with the existing project to provide an open-source method of accessing Exchange server.</p>
<p>But I&#8217;m not sure of how &#8220;open source&#8221; I want all of this to be. From my perspective, &#8220;open source&#8221; as a charitable activity is not successful. We all need to eat, and so the revenue model needs to be clear if a project is going to be more than a phase of life I am going through at the moment. So I would rather keep my options open until I understand that better. Anyway, that&#8217;s a long discussion which is beyond the scope of the current posting, which is supposed to be a status update.</p>
<p>I am still in an education phase, trying to understand SOAP and the related protocols, and to figure out what exactly I gain from using any existing library versus doing things more directly from the raw XML. So as both a trial and education step (and against the recommendation of others I might add) I&#8217;ve tried to update the old Gecko webservices extension to work in current Gecko 1.9.2, and to work with some current Microsoft SOAP protocols.</p>
<p>Rather than start with EWS, I started with the simpler BING search calls. I used existing Microsoft demos in C#, and could capture the communications using Wireshark to see what I was supposed to be sending and receiving.</p>
<h3>Updating the abandoned webservices extension to Gecko 1.9.2</h3>
<p>After testing webservices some under an old Firefox 2 build, I upgraded portions of the code to work under a current comm-central trunk build, using Gecko 1.9.2. My requirements are somewhat simpler than the original extension:</p>
<ol>
<li> Most importantly, my target is chrome-based extensions rather than browser code, so a lot of the security issues that FF folks worried about were not important to me.</li>
<li>I had no interest also in allowing native JS creation of components, as I could rely on using .createInstance calls instead.</li>
<li>At least initially, I am not supporting the reading of wsdl files, nor the associated automatic creation of proxy calls and interfaces. Instead, I read in a schema file, and generate my own code for each method. My understanding is that Microsoft, in their EWS libraries, also does not actually automatically generate method calls from a WSDL-based proxy, but follows this same approach of starting with the schema files.</li>
</ol>
<p>That allowed me to avoid about half of the existing code, and focus on the /schema and /soap directories of the webservices extension.</p>
<p>Looking at my hg logs, it took one week of development time, and 17 patches to get to the point where I could write a unit test under Gecko 1.9.2, and confirm that I could create webservices components using a unit test. (I&#8217;m doing things in a test-driven development fashion, writing XPCSHELL unit tests to try out different features of webservices.)</p>
<h3>Learning and testing Gecko webservices</h3>
<p>Although there was a little old documentation around on Gecko webservices, ultimately I just needed to learn things the old fashioned way, reading the code and its interfaces and experimenting to see what worked. I took little baby steps, starting first with an <a href="http://www.w3.org/TR/xmlschema-0/">XML schema primer</a> and eventually working my way toward duplicating the functionality in some <a href="http://msdn.microsoft.com/en-us/library/dd251024.aspx">Microsoft Bing search demo C# code</a>. This phase, starting from the first demonstration of loading of SOAP components under Gecko 1.9.2 through testing of encoding and decoding of a Bing search message, took about 2 weeks of coding and 23 patches, with the creation of 22 unit tests in the process.</p>
<p>The main issue that I had to deal with in the existing SOAP code is that it did not support maxOccurs&gt;1 schema types, such as this one from the Bing schema:</p>
<pre>&lt;xsd:complexType name="ArrayOfNewsArticle"&gt;
  &lt;xsd:sequence&gt;
    &lt;xsd:element minOccurs="0" maxOccurs="unbounded"
                 name="NewsArticle" type="tns:NewsArticle" /&gt;
  &lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;</pre>
<p>I solved this by using an nsIArray to hold multiple values of the same element.</p>
<h3>Sample Code</h3>
<p>So now I can do a Bing search in an XPCSHELL test, and decode and test the results. I want to show some of the js that I use, to give some idea of the complexity (or lack thereof) of using this.</p>
<p>I create a class BingSearch, then encode some values to setup the search. A basic call for a search looks like this:</p>
<pre>function run_test()
{
 do_test_pending();
 getNews = new BingSearch();
 getNews.Query = "obama";
 getNews.Options = ["EnableHighlighting"];
 getNews.Sources = ["News"];
 getNews.News = {Offset: 0, SortBy: "Relevance", Count: 1};
 getNews.invoke(getNewsListener);
}
</pre>
<p>The &#8220;BingSearch&#8221; object is presumably what a sophisticated library would create automatically from the WSDL file. Instead, I create it by hand. Here&#8217;s my partial implementation, that does not support all of the allowed inputs to a Bing search, but works for my tests:</p>
<pre>function BingSearch()
{
 // defaults
 this.Version = "2.0";
 this.AppId = "&lt;you get this from Microsoft for your application&gt;";
 this.Market = "en-us";
}

BingSearch.prototype = new BingBase();

BingSearch.prototype.invoke = function BingSearch_invoke(aSOAPResponseListener)
{
 let parametersBag = objectPropertyBag({
   Version: this.Version,
   Market: this.Market,
   Query: this.Query,
   AppId: this.AppId,
   Options: arrayPropertyBag("SearchOption", this.Options),
   Sources: arrayPropertyBag("SourceType", this.Sources),
   News: objectPropertyBag(this.News)
 });

 // soap message component
 let soapCall = Cc["@mozilla.org/xmlextras/soap/call;1"]
                  .createInstance(Ci.nsISOAPCall);
 let parameters = [];
 parameters.push(new soapParameter("parameters",
                   parametersBag,
                   this._schema.getTypeByName('SearchRequest')));
 soapCall.encode(Ci.nsISOAPMessage.VERSION_1_2,
                 'SearchRequest',
                 this._schema.targetNamespace,
                 0, null, // header blocks
                 parameters.length, parameters);
 soapCall.transportURI = "http://api.bing.net:80/soap.asmx";
 soapCall.encoding = this._encoding;
 soapCall.asyncInvoke(aSOAPResponseListener);
}

const kSchema = {
 file: 'data/bing20.xsd',
 schemaNamespace: 'http://www.w3.org/2001/XMLSchema',
 targetNamespace: 'http://schemas.microsoft.com/LiveSearch/2008/03/Search'
 }

function BingBase()
{
 if (typeof this._schema == "undefined")
 {
   this._schema = getSchema(kSchema);
   // use the 2001 SOAP encoder
   this._encoding = Cc["@mozilla.org/xmlextras/soap/encoding;1"]
                      .createInstance(Ci.nsISOAPEncoding);
   this._encoding.getAssociatedEncoding("http://www.w3.org/2001/09/soap-encoding", true);
   this._encoding.schemaCollection = this._schema.collection;
 }
}
</pre>
<p>So far, the complexity of this does not seem unmanageable to me. I&#8217;ve only shown the endoding step. Decoding the response consists of a creating a call-specific translator similar to the &#8220;BingSearch.prototype.invoke&#8221; function above, which relies on the webservices soap library decode method. All of the other functions I&#8217;ve created (such as arrayPropertyBag) are not at all specific to the nature of the SOAP interface being used. I am not seeing the need to process the WSDL file automatically and generate proxy functions.</p>
<p>I&#8217;m not yet convinced that this resurrection of the old webservices library is the right approach, but I am not seeing any obstacles to using it either. I can generate and decode soap calls fairly efficiently, debug issues that arise, plus I have code that will integrate fairly easily with either javascript or C++ code in a Gecko chrome environment.</p>
<h3>Next steps</h3>
<p>I&#8217;m trying to decide on the next step toward moving this forward. I&#8217;m leaning toward attempting a specific EWS application, such as read-only access to an Exchange calendar as a Lightning extension. Another option might be to add some core mailnews hooks to allow me to create either message accounts or addressbooks using an extension &#8211; though I&#8217;m hoping jcranmer will <a href="http://quetzalcoatal.blogspot.com/2010/01/developing-new-account-types-part-0.html">beat me to it</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/02/01/toward-mailnews-exchange-web-services-support-soap-calls/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>QA -&gt; Developers communication</title>
		<link>http://mesquilla.com/2010/01/22/qa-developers-communication/</link>
		<comments>http://mesquilla.com/2010/01/22/qa-developers-communication/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 18:44:06 +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=588</guid>
		<description><![CDATA[A few weeks ago on IRC dmose and I discussed the general issue of how QA communicates priorities to developers. I&#8217;d like to hear some comments on that from others, and possibly participate in some sort of trial of improvements.
The issue here is that I see lots of good work going on by people who [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago on IRC dmose and I discussed the general issue of how QA communicates priorities to developers. I&#8217;d like to hear some comments on that from others, and possibly participate in some sort of trial of improvements.</p>
<p>The issue here is that I see lots of good work going on by people who are mostly involved in QA, such as wsmwk, WADA, and Ludo, but I as a developer don&#8217;t really know how to make the best use of that work.</p>
<p>I assume there is supposed to be a waterfall here, from (bug reporter)-&gt;(QA)-&gt;(developer)-&gt;(code reviewer)-&gt;(bug landing). I understand all of the steps of the process except this (QA)-&gt;(developer) handoff. I would be curious to hear from people involved in QA about what they view the main outcome of their work is supposed to be, as viewed by a developer.</p>
<p>Here&#8217;s what my understanding is of the current process. After bugs are submitted, QA has three main responsibilities: 1) get the bug in the correct component, 2) move the status to NEW or one of the inactive states (DUPE, INVALID, etc.) 3) clarify the bug information to get clear steps to reproduce.</p>
<p>Is this accurate?</p>
<p>Let&#8217;s look to see how that is working by looking at my recent work. In the last three months, I fixed eight bugs (that&#8217;s a little off my desired pace, but we were frozen a lot of that time). What brought those bugs to my attention?</p>
<p>(3) bugs I reported myself, either due to issues I observed or as a result of following support forums.</p>
<p>(3) bugs are fixes of crashes that wsmwk reported from crash stats</p>
<p>(2) bugs were filed earlier by others. If I recall correctly, both of those bugs were items that I noticed first in support forums, then located the bug in Bugzilla and fixed it.</p>
<p>In no cases did the standard QA waterfall process play a significant role in bringing a bug to my attention. And that concerns me, because I see some very competent and dedicated people working hard on QA, but I don&#8217;t seem to be making effective use of that work.</p>
<p>Am I somehow not following the process that I am supposed to be following, or is that process flawed? In theory I am probably in a better position than most people here, because I primarily track items that appear in the mailnews core/filters component.</p>
<p>I wish there was a clear way for the QA people to bring a limited number of bugs to my attention that are 1) important, 2) clearly defined and reproducible, and 3) likely to be fairly easy to fix.</p>
<p>The mailnews core/filters category currently has 326 NEW/ASSIGNED/REOPENED bugs in it. I could probably fix a few per month that were brought to my attention. A reasonable expectation might be that 10% of those are addressed in the next year. How are the QA folks supposed to influence the selection of which 32 bugs actually get my attention?</p>
<p>(posted to http://mesquilla.com and m.d.a.thunderbird, followup to m.d.a.thunderbird please.)</p>
<p>rkent</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/01/22/qa-developers-communication/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>FiltaQuilla 1.0.0 released, adds custom search terms</title>
		<link>http://mesquilla.com/2009/12/02/filtaquilla-1-0-0-released-adds-custom-search-terms/</link>
		<comments>http://mesquilla.com/2009/12/02/filtaquilla-1-0-0-released-adds-custom-search-terms/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 06:37:35 +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=512</guid>
		<description><![CDATA[Well I finally decided to quit adding new stuff, and just get a compatible FiltaQuilla out the door that works with Thunderbird 3.0 and SeaMonkey 2.0. You can get the new version from Mozilla&#8217;s download site here.
In addition to some new filter actions (print, add sender to address list, and save attachments to a folder) [...]]]></description>
			<content:encoded><![CDATA[<p>Well I finally decided to quit adding new stuff, and just get a compatible <a href="http://mesquilla.com/extensions/filtaquilla/">FiltaQuilla</a> out the door that works with Thunderbird 3.0 and SeaMonkey 2.0. You can get the new version from Mozilla&#8217;s download site <a href="https://addons.mozilla.org/en-US/thunderbird/addon/10052">here</a>.</p>
<p>In addition to some new filter actions (print, add sender to address list, and save attachments to a folder) this release introduces &#8220;custom search terms&#8221; for the first time. This is a new feature that has been added recently to the mailnews core code, and is part of the TB 3.0 and SM 2.0 releases.</p>
<p>The search I am talking about is the old-style Thunderbird search, not the newer global database (gloda) search that was added to Thunderbird. Gloda gets all of the press, but we&#8217;ve also taught the old style search a few tricks as well! These are particularly useful in saved searchs (also called virtual folders).</p>
<p>I think that the most interesting new capability is that you can define a search (and therefore a virtual folder) by adding a few lines of javascript code that does precisely what you want. Let me give a very simple example.</p>
<p>Let&#8217;s assume that you want a virtual  folder to contain all of the active items that you currently need to process involving projects. Incoming emails are marked with tags, either manually or by some sort of filter. You define new tags for each project, and each tag begins with &#8220;pro&#8221; and ends with some sort of project marker, say a number or word. You want to have your active folder contain messages that have a tag containing &#8220;pro&#8221;, but NOT include messages that are tagged &#8220;done&#8221;.</p>
<p>The standard mailnews tag search forces you to enter the tag name for each tag that you want. There is no way to search for tags by the characters in the tags. Plus, searching for several tags is an OR function, and saying to not include DONE messages is an AND function. But the standard mailnews search does not handle complex boolean searches.</p>
<p>The javascript custom search comes to the rescue! Go to the folder that contains the messages that you want, and select the Javascript search term:</p>
<p><img class="alignnone size-full wp-image-513" title="Search Javascript search term" src="http://mesquilla.com/wp-content/uploads/2009/12/SearchJavascript.jpg" alt="Search Javascript search term" width="577" height="194" /></p>
<p>Click on the script icon <img class="alignnone size-full wp-image-494" title="Script edit button" src="http://mesquilla.com/wp-content/uploads/2009/12/script_edit.png" alt="Script edit button" width="16" height="16" /> and you will get a small editor window, where you can enter a few lines of javascript. All that we need to do is grab the string that has the tags in it, and make sure it includes &#8220;pro&#8221; but does not include &#8220;done&#8221;. Our javacript is given a variable &#8220;message&#8221; which is the database header object that can be used to get message properties. We need to execute an expression as the last statement, whose value is either <strong>true</strong> if we want the message, or<strong> false </strong>if we do not. That&#8217;s just the following two lines of javascript:</p>
<pre style="padding-left: 30px;">let tags = message.getStringProperty('keywords');
(/pro/.test(tags) &amp;&amp; !(/done/.test(tags));</pre>
<p>So here&#8217;s what our javascript window and code looks like:</p>
<p><img class="alignnone size-full wp-image-514" title="Enter Javascript code" src="http://mesquilla.com/wp-content/uploads/2009/12/EnterJavascript.jpg" alt="Enter Javascript code" width="489" height="156" /></p>
<p>Now save this as a virtual folder, and you have the exact virtual folder that you want!</p>
<p>OK, this is just for geeks, but it is really powerful in letting you define folders that can precisely define the workflow that you want. There&#8217;s also a few other geek-friendly search terms, including the much-requested regular expression search by subject or other header. For details, see the updated <a href="http://mesquilla.com/extensions/filtaquilla/">FiltaQuilla page</a> on this site.</p>
<p>FiltaQuilla is still in experimental status, though I have now nominated it to be public. Still it may be a few weeks before it gets there. If you are an existing FiltaQuilla user, you will need to go to the <a href="https://addons.mozilla.org/en-US/thunderbird/addon/10052">download page</a> directly and download and install the new version.</p>
<p>Enjoy!</p>
<span class="sfforumlink"><a href="http://mesquilla.com/forum/filtaquilla/filtaquilla-1-0-0-released-adds-custom-search-terms/"><img src="http://mesquilla.com/wp-content/plugins/simple-forum/styles/icons/default/bloglink.png" alt="" /> Join the forum discussion on this post</a> - (1) Posts</span>]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2009/12/02/filtaquilla-1-0-0-released-adds-custom-search-terms/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Extension driven development</title>
		<link>http://mesquilla.com/2009/11/28/extension-driven-development/</link>
		<comments>http://mesquilla.com/2009/11/28/extension-driven-development/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 07:37:49 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=479</guid>
		<description><![CDATA[What then do I mean by &#8220;extension driven development&#8221;? It is the concept of changing the way that Thunderbird is developed and distributed, with a bare minimum set of core code, and the main features presented as a set of extensions, shipped with the product,  that can be enabled or disabled by users.
I don&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>What then do I mean by &#8220;extension driven development&#8221;? It is the concept of changing the way that Thunderbird is developed and distributed, with a bare minimum set of core code, and the main features presented as a set of extensions, shipped with the product,  that can be enabled or disabled by users.</p>
<p>I don&#8217;t have any illusions that this has a significant chance of being implemented, and I&#8217;m not even sure it&#8217;s a good idea myself. But I ask you to suspend disbelief for a minute, and imagine a change to the development culture and process.</p>
<p>An email client is different from a web client in many ways, but one significant way is that there is no real need for a fat uniform core product that developers can target (such as web developers for FireFox). So we are free to allow wide changes in our product configuration that would not make sense for FireFox. There is really no fundamental need for Thunderbird to be presented as a single, fat, feature-laden client.</p>
<p>Instead, ship Thunderbird as a minimal base with a collection of extensions. The extensions could be in a variety of statuses. At one status extreme, &#8220;Core&#8221; extensions would be enabled by default, would be fully localized, and their updates would be shipped with updates to the core product, rather than through AMO. Many existing core features would be converted into &#8220;Core&#8221; extensions that could be disabled if desired (for example bayes junk processing, or gloda.) At the other extreme, &#8220;Pilot&#8221; extensions would be shipped with the core product in a disabled state, would be updated by AMO, and not fully localized. There would also be &#8220;Standard&#8221; extensions that are shipped with the product, not maintained through AMO, but would not be enabled by default. Lightning might be one example of this. FiltaQuilla or JunQuilla could easily get added to this category in the future, or popular extensions like ThunderBrowse.</p>
<p>So why would you do such a crazy thing? For several reasons.</p>
<p>First, you would have a path to add features to the program that is not as generally disruptive as has been, for example, gloda or the new message header. By not using a new extension, an existing user would not see changes to their workflow that they did not want or appreciate. Also, new features need not delay the release of new versions of Thunderbird, as &#8220;Pilot&#8221; status extensions could be updated through AMO.</p>
<p>Second, new complex features like gloda, even though they are developed by the core team (well mostly asuth) are in a state of rapid flux, and would really benefit from allowing updates more frequently than even the accelerated release process will allow.</p>
<p>Third, you provide a natural path for outside developers to add contribution to the product without having to completely submerge themselves in the Mozilla culture, or give up complete control of their creation.</p>
<p>Fourth, this really recognizes that the use of an email client is highly personal. Basic users could be presented a basic email client. Advanced users could easily add advanced features. (Existing AMO-based extensions are also good for this, but the quality is not uniform, and they frequently are not kept up to date. And the standard product is still very fat with lots of features that are unneeded by most users.)</p>
<p>Fifth, this would solve the serious issue with Thunderbird of how hard it is for the average user to install addons (because the most popular and important addons would be shipped with the product).</p>
<p>There&#8217;s another dimension to this, and that is the developer&#8217;s relationship with his or her extension. I know that I feel a responsibility for my extensions that is beyond the responsibility I feel for any core code. You can see that in the documentation that I provide, and my reliability in responding to issues. I think that many other extension developers are like that as well. I&#8217;m guessing that they would be delighted to see a higher level of promotion of their work, without the need to cede complete control that incorporation in core might involve.</p>
<p>I suppose I could write a book on what this might look like, but for now let me leave it here.</p>
<p>rkent</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2009/11/28/extension-driven-development/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>JunQuilla version 1.0.0 released</title>
		<link>http://mesquilla.com/2009/11/16/junquilla-version-1-0-0-released/</link>
		<comments>http://mesquilla.com/2009/11/16/junquilla-version-1-0-0-released/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 21:08:27 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[JunQuilla]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=452</guid>
		<description><![CDATA[Today I released a version of JunQuilla that supports SeaMonkey 2.0, and the latest versions of Thunderbird including the upcoming 3.0RC1 and 3.0.0 The new version can be downloaded from the AMO site here. I&#8217;ve also submitted this version for review so that it can get out of experimental status.
JunQuilla is my attempt to extend [...]]]></description>
			<content:encoded><![CDATA[<p>Today I released a version of <a href="http://mesquilla.com/extensions/junquilla/">JunQuilla</a> that supports SeaMonkey 2.0, and the latest versions of Thunderbird including the upcoming 3.0RC1 and 3.0.0 The new version can be downloaded from the AMO site <a href="https://addons.mozilla.org/en-US/thunderbird/addon/9886">here</a>. I&#8217;ve also submitted this version for review so that it can get out of experimental status.</p>
<p>JunQuilla is my attempt to extend the user interface in the Mozilla mailnews product to provide the information that I believe is needed to properly manage the bayesian junk filter. I suppose that most of these features should really be in the core product, but I found that support for that was not very strong, so I decided to do most of this in an extension instead. These backend features have only been added to the core code in the last couple of years, so this extension will only work on newer versions of the Mozilla email clients (Thunderbird 3.* versions, and SeaMonkey 2.* versions.)</p>
<p>Version 1.0.0 fixes some bugs that have been reported in previous releases, provides partial support for SeaMonkey (except for the &#8220;Uncertain&#8221; folders), and adds a number of new features:</p>
<h4>Junk Options</h4>
<p>You can set critical overall junk options in the standard junk options screen (previously, this was only possible in the more obscure addons/options area). In Thunderbird, select Tools/Options/Security/Junk. In SeaMonkey, select Edit/Preferences/Mail &amp; Newsgoups/JunQuilla. There you will see a display like this:</p>
<p><img class="aligncenter size-full wp-image-396" title="JunQuilla Options" src="http://mesquilla.com/wp-content/uploads/2009/11/JunQuillaOptions.jpg" alt="JunQuilla Options" width="389" height="97" /></p>
<p>&#8220;Junk threshold&#8221; is the percentage value as calculated by the bayes classifier for each message, above which a message will be classified as junk. This should be set as low as possible, though always high enough to avoid having any real messages classified as junk. The default value of 90 is much too high for a well-trained bayes classifier.</p>
<p>The &#8220;Maximum token count&#8221; is a measure of the resources that the junk classifier will use. The higher it is set, the more accurate your classifications will be. The default value of 100,000 is probably too low for good classification performance. I&#8217;ve had good results with 300,000 &#8211; and JunQuilla will set your value to this when first installed. If this value is too high, and you have trained a lot of messages, then memory usage may be excessive.</p>
<p>The other parameters are read only, and are displays of values from your training file. The &#8220;Current token count&#8221; shows how many junk training tokens (which are like words) are currently in use. You probably won&#8217;t get good performance until this number is over 10,000 &#8211; and it really should be more like 100,000.  &#8220;Good&#8221; and &#8220;Junk&#8221; messages trained shows how many messages have been used to train the junk filter. Ideally the number of junk and good messages should be more or less equal. If they are not, then pick some previously untrained messages and train them.</p>
<p>When the number of tokens exceeds the maximum value, then Mozilla mailnews will prune the training file in a large chunk, typically reducing both the number of trained messages, and the number of tokens, in about half.</p>
<h4>Disable/enable junk processing for a folder.</h4>
<p>You can set an &#8220;<a href="http://mesquilla.com/2009/11/06/inherited-folder-properties-revisited/">inherited folder property</a>&#8221; to allow you to selectively enable or disable junk processing for folders. This has two main uses.</p>
<ul>
<li>If you have server-side filters that process email in IMAP, then you may already know that certain folders contain either junk mail or good mail, and don&#8217;t want to waste time processing them locally &#8211; or take the risk that they will be processed incorrectly.</li>
</ul>
<ul>
<li>Mozilla mailnews core code now supports junk processing of RSS and News folders. You can select certain RSS or News folders, and then junk processing will run on new posts to those folders. This will also enable the standard user interface features that allow you to train messages as good or junk in those folders.</li>
</ul>
<p>To set this, right click on a folder in the folder tree, and select Properties, then the &#8220;General Information&#8221; tab. At the bottom, you will see this:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-400" title="JunQuilla Folder Properties" src="http://mesquilla.com/wp-content/uploads/2009/11/JunQuillaFolderProperties.jpg" alt="JunQuillaFolderProperties" width="189" height="114" /></p>
<p>&#8220;Analyze Junk&#8221; is an inherited folder property. What that means is that each folder can either gets its value from its parent, or can be set locally. The default value depends on the characteristics of the folder itself. So for example, this would be disabled in News by default, but enabled in IMAP. To change the value, first reset the &#8220;Inherit&#8221; checkbox, then set the value that you want in &#8220;Enabled&#8221;. If you change a value for a folder, then the value will also change for the children of that folder (assumming that they have the default &#8220;Inherit&#8221; checked.)</p>
<h4>Toolbar &#8220;Is Junk&#8221; and &#8220;Is Good&#8221; button</h4>
<p>You can add two new buttons to your toolbar &#8211; &#8220;Is Junk&#8221; and &#8220;Is Good&#8221;. Here&#8217;s what they look like, next to a standard &#8220;Junk/Not Junk&#8221; icon:</p>
<p><img class="aligncenter size-full wp-image-403" title="JunQuilla Is Good or Is Junk toolbar button" src="http://mesquilla.com/wp-content/uploads/2009/11/JunQuillaIsGoodOrJunk.jpg" alt="JunQuilla Is Good or Is Junk toolbar button" width="231" height="42" /></p>
<p>To add these buttons, right click on a toolbar, select &#8220;Customize&#8221;, then drag the buttons to the desired location.</p>
<p>The standard Junk button will always show as &#8220;Junk&#8221; when it thinks a message is good, and &#8220;Good&#8221; when it thinks that a message is junk. But that means that we can only classify a message as &#8220;Good&#8221; when it has been falsely classified as junk, and we <em>never</em> want our junk filter to do that. The &#8220;Is Good&#8221; button is meant to be used in the &#8220;Uncertain&#8221; folders to give you a means to train a message as &#8220;Good&#8221; there.</p>
<p style="padding-left: 30px;">
<span class="sfforumlink"><a href="http://mesquilla.com/forum/junquilla/junquilla-version-1-0-0-released/"><img src="http://mesquilla.com/wp-content/plugins/simple-forum/styles/icons/default/bloglink.png" alt="" /> Join the forum discussion on this post</a> - (3) Posts</span>]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2009/11/16/junquilla-version-1-0-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inherited Folder Properties &#8211; revisited</title>
		<link>http://mesquilla.com/2009/11/06/inherited-folder-properties-revisited/</link>
		<comments>http://mesquilla.com/2009/11/06/inherited-folder-properties-revisited/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 19:50:52 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[FiltaQuilla]]></category>
		<category><![CDATA[JunQuilla]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>
		<category><![CDATA[TaQuilla]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=317</guid>
		<description><![CDATA[In a previous posting, I introduced the concept of inherited folder properties in the Mozilla mailnews products (Thunderbird and SeaMonkey). In the months since, I have incorporated these into my extensions quite significantly, so here I would like to show the UI I am currently using for this, and also discuss some of the issues [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://mesquilla.com/2009/03/06/inherited-folder-properties/">previous posting</a>, I introduced the concept of inherited folder properties in the Mozilla mailnews products (Thunderbird and SeaMonkey). In the months since, I have incorporated these into my extensions quite significantly, so here I would like to show the UI I am currently using for this, and also discuss some of the issues that I face.</p>
<p>(All references to extensions in this posting refer to the 1.0.0 versions, which as of this writing have not been posted to AMO yet. But they should be available in a few weeks.)</p>
<h3>Implemented UI</h3>
<p>Briefly, inherited properties are a property that can be defined globally, at the server, or at the folder, and its characteristics will be propagated to child objects. This make it easy to specify precisely how the property is applied.</p>
<p>As an example, I have recently implemented a feature &#8220;Index in Global Database&#8221; in <a href="http://mesquilla.com/extensions/glodaquilla/">GlodaQuilla </a>which can be used to selectively suppress certain accounts or folders from being accessed by the global database indexer. In the account manager, where indexing can be disabled for an entire account, the UI looks like this:</p>
<p><img class="aligncenter size-full wp-image-320" title="Index in Global Database account settings" src="http://mesquilla.com/wp-content/uploads/2009/11/AccountIndex1.jpg" alt="Index in Global Database account settings" width="587" height="220" /></p>
<p>Each inherited property has default values which are typically set by the base code. In the case of the gloda database indexer, everything but newgroups are indexed by default. Initially each inherited property is set to just use the standard default processing, but if I clear the &#8220;default&#8221; checkbox, then I can turn off gloda indexing for this account.</p>
<p>If I do that, then go to a first-level folder in the account, I see the following under folder properties:</p>
<p><img class="aligncenter size-full wp-image-321" title="Index in Global Database by folder" src="http://mesquilla.com/wp-content/uploads/2009/11/FolderIndex.jpg" alt="Index in Global Database by folder" width="409" height="310" /></p>
<p>At the folder level, because I disabled global indexing on the account, it is now shown as disabled on the folder. I could clear the inherit box and selectively enable it on just this folder and its children if I wanted.</p>
<p>This particular UI merges naturally with the existing methods of setting properties in mailnews, but I&#8217;m not sure it is optimum for an inherited property. The inherited nature could be more clearly shown, and a particular feature more quickly configured, if I showed a tree of accounts and folders, with checkboxes next to each account to enable or inherit the feature. Maybe in a future version.</p>
<h3>Implemented properties</h3>
<p>Here are some of the implementations of inherited properties that exist in my extensions:</p>
<ol>
<li>(<a href="http://mesquilla.com/extensions/glodaquilla/">GlodaQuilla</a>) Index in Global Database &#8211; suppresses the running of the global database indexer</li>
<li>(<a href="http://mesquilla.com/extensions/filtaquilla/">FiltaQuilla</a>) Apply Filters to Folder &#8211; for Imap folders, allow incoming filters to run on that folder</li>
<li>(<a href="http://mesquilla.com/extensions/junquilla/">JunQuilla</a>) Analyze Junk &#8211; allow junk processing to be turned on or off. This also allows junk processing to run on RSS or news folders.</li>
<li>(<a href="http://mesquilla.com/extensions/taquilla/">TaQuilla</a>) Analyze particular automatic tags.</li>
</ol>
<h3>Issue:<strong> Existing mechanisms</strong></h3>
<p>Ideally, the inherited property would be the one and only way to manage a program feature. But for existing features, the existing mechanisms remain, which can lead to possible confusion. For example, with JunQuilla&#8217;s &#8220;Analyze Junk&#8221; property, there is existing UI to enable junk processing at the account level. Here the inherited property will always override the default mechanism (but that is mostly because I implemented it in core that way, and I have a little influence on how junk processing is handled in core.) For GlodaQuilla&#8217;s &#8220;Index in Global Database&#8221; the behaviour is different. Existing UI will only allow this to be enabled or disabled globally, and the inherited property does not override this. The inherited property code uses the default server preference as a global enable/disable for a property, so if gloda used that same mechanism instead of an independent preference, this issue would go away. I guess I could say the same thing about junk processing as well.</p>
<p>For FiltaQuilla&#8217;s &#8220;Apply Filters to Folder&#8221;, there is a subtle issue in the inherited nature. I did not implement in core the ability of the inherited property to override the existing default as applied to the Inbox, so incoming filters always run on the inbox. That creates 2 ui issues. First, although I show at the account level the &#8220;Apply Filters&#8221; option, it does not actually suppress application to the inbox as one would expect. Second, I currently do not show a folder property for &#8220;Apply Filters to Folder&#8221; for the IMAP inbox since it would not make sense there, so that also means there is no way to enable processing of filters for the children of the inbox. Maybe I should call this feature instead &#8220;Apply Filters to non-Inbox Folders&#8221; to solve this, or change the core code so that the feature also applied to the Inbox.</p>
<h3>Issue: My RDF-inspired property for junk management</h3>
<p>Looking ahead to a world where a number of extensions might try to define bayes filter traits, in code I recommended that properties used to manage junk processing use an RDF-inspired globally unique identifier. Then I followed my own advice and defined the identifier that controls junk processing on a folder as: &#8220;dobayes.mailnews@mozilla.org#junk&#8221; Unfortunately, the existing account manager code does not allow periods in property names, which means I could not use the account manager to manage this. I&#8217;ve filed <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=525024">bug 525024</a> on this issue, and perhaps that can be incorporated after TB 3.0 / SM 2.0.</p>
<h3>Issue: Missing inheritance levels</h3>
<p>I&#8217;ve heard others comment that often they want to set a property on a particular class of folders, say on all Trash folders, or all Sent folders. I&#8217;ve considered implementing another level in the inherited properties feature, that would be a folder type. So you would then set a property that would be inherited by any folder of a particular type, and its children &#8211; and of course also overridden by the local folder property.</p>
<h3>Issue: UI for global property</h3>
<p>All of the inherited properties could also be enabled globally using the &#8220;mail.server.default.&lt;property&gt;&#8221; preference, but I did not give any UI for that in my extensions. I thought that would be too confusing for the user to show those preferences, which would be very similar to existing mechanisms. This is not an issue for properties that use the preference system for server-level issues, but none of the existing server-level preferences are also inherited properties. Perhaps we could move that direction in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2009/11/06/inherited-folder-properties-revisited/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Managing spam with &#8220;after classification&#8221; filters</title>
		<link>http://mesquilla.com/2009/08/28/managing-spam-with-after-classification-filters/</link>
		<comments>http://mesquilla.com/2009/08/28/managing-spam-with-after-classification-filters/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 21:12:24 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[JunQuilla]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=282</guid>
		<description><![CDATA[Nightly builds after 2009-08-19 of Thunderbird (or upcoming 3.0 beta 4) and SeaMonkey  (or upcoming 2.0 beta 2) include a new ability to apply message filters after the internal spam filter has classified the message. Previously, filtering was always done before spam classification, which meant that you could not use any results of the spam [...]]]></description>
			<content:encoded><![CDATA[<p>Nightly builds after 2009-08-19 of Thunderbird (or upcoming 3.0 beta 4) and SeaMonkey  (or upcoming 2.0 beta 2) include a new ability to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=198100">apply message filters after the internal spam filter</a> has classified the message. Previously, filtering was always done before spam classification, which meant that you could not use any results of the spam classification in a filter.</p>
<p>The default spam processing that is available without using filters (whitelisting, move or delete messages with a sufficiently high threshold) should be sufficient for most users. But for people with special requirements you can now implement those requirements in a filter with customizations. Let me give examples in this posting.</p>
<h3><strong>Using the &#8220;after classification&#8221; filters<br />
</strong></h3>
<p>Proper care and feeding of spam really needs to classify messages in three ways. Some messages can be easily detected as spam, and should never be looked at. Others are clearly ham, and should be treated as real. But those in the middle need some handling, which may be either training, or perhaps examined weekly to make sure no false positives are there. Default Mozilla mailnews (which is the generic term for features that are available in any of the applications created from this codebase, including Thunderbird and SeaMonkey) junk management doesn&#8217;t provide any capability to manage these uncertain emails. My <a href="http://mesquilla.com/extensions/filtaquilla/">JunQuilla</a> extension provides an Uncertain folder which is focused on the training issue, but with the new  filter features you can have more precise control of this. (Currently you can&#8217;t install JunQuilla in SeaMonkey, but I will fix that eventually).</p>
<p>First, let&#8217;s see what is new and how it can be enabled.</p>
<p>Create a new filter by selecting Tools/Message Filters &#8230; then New. Open up the search attributes menu, and you&#8217;ll see something like this:</p>
<p><img class="alignnone size-full wp-image-283" title="NoJunkOptions" src="http://mesquilla.com/wp-content/uploads/2009/08/NoJunkOptions.jpg" alt="NoJunkOptions" width="562" height="439" /></p>
<p>No junk options! To get those, you&#8217;ll need to first select one of the &#8220;after classification&#8221; contexts from &#8220;Apply Filter When&#8221;. Then you&#8217;ll see something like this:</p>
<p><img class="alignnone size-full wp-image-284" title="WithJunkOptions" src="http://mesquilla.com/wp-content/uploads/2009/08/WithJunkOptions.jpg" alt="WithJunkOptions" width="519" height="512" /></p>
<p>If &#8220;Checking mail (after classification)&#8221; is disabled, then you probably are trying to set an after-classification filter on a POP3 account that is actually sending its email to another location (the so-called deferred-to server). You need instead to set the &#8220;after classification&#8221; filter on the &#8220;deferred-to&#8221; server, which is typically Local Folders.</p>
<p>Let me explain each of these search attributes.</p>
<p><strong>Junk Percent</strong> is the score returned from the bayes filter when classifying the message, with 100 being the most likely to be junk, and 0 the least likely. The default setting in Thunderbird classifies a message as junk when this score is 90 or greater. It is sort of a probablility, but not really because too many false assumptions are made in the Naive Bayesian Classifier for this to really be a probability. Just treat it like a score. Unfortunately default installs of Thunderbird and SeaMonkey do not provide you with any way to see the value of this on typical messages. <a href="http://mesquilla.com/extensions/junquilla/">JunQuilla</a> though provides a custom column that shows this on each message so you can get a feel for what typical values are.</p>
<p><strong>Junk Status </strong>is pretty simple, it either Is or Isnt Junk. In the normal case where the internal bayes filter is used to classify the message, this means it had a junk percent of greater than 90.</p>
<p><strong>Junk Score Origin</strong> shows you who classified the message. Its values are:</p>
<p style="padding-left: 30px;"><strong>Plugin</strong>: the bayes filter.</p>
<p style="padding-left: 30px;"><strong>User</strong>: you manually classified this message as junk or good (not useful in an incoming filter, but maybe in a manual filter or search).</p>
<p style="padding-left: 30px;"><strong>Filter</strong>: a previous filter action set the junk status.</p>
<p style="padding-left: 30px;"><strong>Whitelist</strong>: the spam processing decided this message was good because it was from someone in your address book.</p>
<p style="padding-left: 30px;"><strong>IMAP Flag</strong>: this message was classified by another system, so we know it is junk or good, but don&#8217;t know why the other system classified it this way. You might see this if you access mail from more than one computer.</p>
<p>Default Thunderbird does not support any way to see the junk score origin on individual messages, though JunQuilla provides a Junk Status + column which uses different icons for each junk score origin.</p>
<h3>Classifying messages as uncertain</h3>
<p>So let&#8217;s design a filter that will move messages to an Uncertain folder if we want to examine them, but not have them clutter the inbox. That&#8217;s pretty easy, we&#8217;ll just move messages with a junk percent in a certain range to that folder:</p>
<p><img class="alignnone size-full wp-image-288" title="UncertainJunk" src="http://mesquilla.com/wp-content/uploads/2009/08/UncertainJunk.jpg" alt="UncertainJunk" width="520" height="374" /></p>
<p>The order of message processing in Mozilla mailnews is:</p>
<ol>
<li>Run normal filters (on each message as it is received)</li>
<li>Check whitelisting (on a message batch, this and subsequent steps)</li>
<li>Run bayes classifier on non-whitelisted messages, and mark messages as junk or good.</li>
<li>Apply &#8220;after classification&#8221; filters.</li>
<li>Apply junk message moves using default junk processing.</li>
</ol>
<p>So at least in theory, you can apply the &#8220;after classification&#8221; filter to the Uncertain messages, and still let the default junk processing move junk messages to a Junk folder. (Testing of this is welcomed!)</p>
<h3>Weak Whitelisting</h3>
<p>As a more complex example, spammers are starting to send out emails that have spoofed From addresses that match the domain of your email, figuring that there is a chance that you have these other addresses whitelisted, so you&#8217;ll get the spam. To fight this, we&#8217;ll setup a filter that does a whitelist that is slightly weaker than the usual all-or-nothing whitelist on those easily spoofed addresses. Because whitelisting occurs before spam processing, and no score will be assigned if the message is whitelisted, you will need to disable the default whitelisting functionality, and rely entirely on message filters for this to work.</p>
<p>We&#8217;ll add the following search terms, all of which must match to apply our weak whitelist:</p>
<ol>
<li>From address appears in an address book (this is normal whitelisting)</li>
<li>My domain appears in the address (because that is easily spoofed)</li>
<li>Junk Score Origin is Plugin (this prevents the filter from running on messages that we classified, in case we run it manually on existing folders).</li>
<li>Junk Status is Junk (we&#8217;ll only whitelist if the bayes filter thought it was junk. I only do this so that I can see that the filter decided to override the decision of the bayes processor, which needs the Junk Status + column from JunQuilla to see.)</li>
<li>Junk Percent is less than 95 (since the bayes filter only marked messages as junk with the percent &gt; 90, this means that we will override the bayes decision for messages between 90 and 95 in score).</li>
</ol>
<p>Putting this all together, you get a filter that looks like this:</p>
<p><img class="alignnone size-full wp-image-291" title="WeakWhitelist" src="http://mesquilla.com/wp-content/uploads/2009/08/WeakWhitelist.jpg" alt="WeakWhitelist" width="549" height="445" /></p>
<p>You would also need to define a filter that is applied after this one, that whitelists any messages that meet the normal whitelist criteria, but were marked as junk by the bayes filter.</p>
<p>I&#8217;m not necessarily recommending this filter, it was meant as a demonstration. But I hope you can see that the new ability to use the bayes filter in combination with other message criteria in a filter provides lots of new possibilities for more precise handling of possible spam messages.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2009/08/28/managing-spam-with-after-classification-filters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filtering changes for Thunderbird 3.0 beta 3</title>
		<link>http://mesquilla.com/2009/07/08/filtering-changes-for-thunderbird-30-beta-3/</link>
		<comments>http://mesquilla.com/2009/07/08/filtering-changes-for-thunderbird-30-beta-3/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 18:37:53 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[FiltaQuilla]]></category>
		<category><![CDATA[Mailnews development]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=270</guid>
		<description><![CDATA[It&#8217;s been a long time since I posted a blog, being busy with things I wanted to get into Thunderbird 3.0 beta 3 (and Seamonkey 2.0 beta 1). Now that we enter the dark days of the freeze prior to the release, I have some time to update extensions to use new features available in [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a long time since I posted a blog, being busy with things I wanted to get into Thunderbird 3.0 beta 3 (and Seamonkey 2.0 beta 1). Now that we enter the dark days of the freeze prior to the release, I have some time to update extensions to use new features available in beta 3. But I&#8217;d like to give details first of changes in the backend areas where I am working, starting with email filtering in this post.</p>
<p>So here are things that are new in Thunderbird 3.0 beta 3 (Seamonkey 2.0 beta 1) that involve message filtering:</p>
<h4>1. Imap filtering on folders that are not the inbox.</h4>
<p>If you have a server filter that moves IMAP messages to a folder other than the inbox, previously you could not use TB filters on it. Now you can, controlled by an <a href="http://mesquilla.com/2009/03/06/inherited-folder-properties/">inherited folder property</a>. There is no user interface for this feature at the moment, but I will add some to <a href="http://mesquilla.com/extensions/filtaquilla/">FiltaQuilla</a>. See bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=257415">257415</a>.</p>
<h4>2. &#8220;From, To, Cc, or Bcc&#8221; filter/search term</h4>
<p>This is a new search term that can be used in advanced search or filters. It does two things: combines all of the normal address fields into a single term, plus adds support for Bcc for the first time.</p>
<p>The support for Bcc needs some comments. Just in case it isn&#8217;t clear, Bcc information is not added to outgoing emails that you send (or the incoming emails that you receive), so the only place it really shows up is in emails that you sent, and have kept your own copy of. So the Bcc term does nothing for emails that you receive, only emails in your sent folder. Also, we currently do not have any mechanism to automatically apply filters to messages that you send, so really the main place Bcc will show up in filter/search is in Advanced search, saved searches (virtual folders), or in manual filters (filter-after-the-fact).</p>
<h4>3. Junk fields in manual filters</h4>
<p>We have now enabled the junk-related search terms of &#8220;Junk Status&#8221;, &#8220;Junk Percent&#8221;, and &#8220;Junk Status Origin&#8221; in manual filters.</p>
<p>There is a subtle change to the behavior of search term editing that was implemented that affected this. Previously, if you caused the filter editor to select an invalid search term (typically by changing the filter context away from &#8220;Manual&#8221;),  that was ignored, and you could save the invalid filter. Now, the invalid terms are grayed out, and attempts to save the filter will result in an error dialog. This behavior was important to allow adding of more complex filtering options.</p>
<h4>4. Custom Search Terms</h4>
<p>The biggest change that affects filters is the ability for extensions to add custom search terms. This is a complement to the addition of custom filter actions, which were available in beta 2, and are the main point of FiltaQuilla. I expect to do a blog post soon detailing the code necessary for an extension to add a custom search term, plus I will add some custom search terms to FiltaQuilla (probably a regex search on a header).</p>
<p>See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=495519">bug 495519</a> for details, including a demonstration extension that adds custom terms.</p>
<h4>5. Fix of message copy/move bug.</h4>
<p>There has been a long-standing bug involving failed moves or copies, that typically occurred when there were automatic copies or moves of emails, such as are done in filters or junk processing. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=497622">Bug 497622</a> hopefully solves this, which should improve the reliability of moves and copies.</p>
<h3>What did&#8217;t make beta 3, but should be in TB3.0</h3>
<p>There are two big changes that have mostly working patches, that did not make beta 3 but hopefully will be available in beta 4.</p>
<h4>1. IMAP body filters.</h4>
<p>IMAP messages are now downloaded by default, so in theory it should be easy to filter on their bodies. This is <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=127250">bug 127250</a> (or possibly the closely related <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=67421">bug 67421</a>). This bug is really critical in combination with the new custom search attributes, as it would be very valuable to write filters that analyze each message body, and then take a particular action when something is found there.</p>
<h4>2. Post-bayes incoming filter context</h4>
<p>Currently, it is not possible to filter on any of the message characteristics that are determined by the bayes filter (including junk status, and the closely related custom traits) automatically while a message is incoming. This is because the bayes analysis, and its related filtering actions, are applied after the standard filters. A post-bayes filter context will allow the user to specify that a particular filter should be applied after the bayes analysis, not before, and then we will be able to enable the junk-related search terms (and an extension could add a filter term that used a custom bayes trait). See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=198100">bug 198100</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2009/07/08/filtering-changes-for-thunderbird-30-beta-3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
