<?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; Exchange Web Services (EWS)</title>
	<atom:link href="http://mesquilla.com/category/exchange-web-services-ews/feed/" rel="self" type="application/rss+xml" />
	<link>http://mesquilla.com</link>
	<description>Messaging with Mozilla by rkent</description>
	<lastBuildDate>Wed, 01 Feb 2012 00:05:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ExQuilla (Microsoft Exchange Server for Thunderbird) beta version released</title>
		<link>http://mesquilla.com/2012/01/31/exquilla-microsoft-exchange-server-for-thunderbird-beta-version-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exquilla-microsoft-exchange-server-for-thunderbird-beta-version-released</link>
		<comments>http://mesquilla.com/2012/01/31/exquilla-microsoft-exchange-server-for-thunderbird-beta-version-released/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 00:05:19 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<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=1231</guid>
		<description><![CDATA[<p>I am pleased to announce that ExQuilla, a Thunderbird addon that provides access to messages and contacts in Microsoft Exchange Server, is now available. This is a beta-quality release.  ExQuilla is currently only available for Windows, in English, and supports Thunderbird version 9, 10, and 11. Linux and Mac versions are planned for the future.</p> <p>The most current version of ExQuilla is available from the MesQuilla site here. A slightly older version (due to review delays) is available from Mozilla&#8217;s addon site here.</p> <p>This version supports access to messages and personal contacts from a Microsoft Exchange Server 2007 or 2010 [...]]]></description>
			<content:encoded><![CDATA[<p>I am pleased to announce that <a title="ExQuilla home page" href="http://exquilla.zendesk.com/home">ExQuilla</a>, a Thunderbird addon that provides access to messages and contacts in Microsoft Exchange Server, is now available. This is a beta-quality release.  ExQuilla is currently only available for Windows, in English, and supports Thunderbird version 9, 10, and 11. Linux and Mac versions are planned for the future.</p>
<p>The most current version of ExQuilla is available from the <a title="ExQuilla current release download" href="http://mesquilla.net/exquilla-currentrelease-tb-windows.xpi">MesQuilla site here</a>. A slightly older version (due to review delays) is available from <a title="ExQuilla Windows download from Mozilla Addons site" href="https://addons.mozilla.org/thunderbird/downloads/file/142027/exquilla_exchange_web_services-11.0-tb-windows.xpi">Mozilla&#8217;s addon site here</a>.</p>
<p>This version supports access to messages and personal contacts from a Microsoft Exchange Server 2007 or 2010 using Exchange Web Services (EWS). Calendar support is not currently enabled, but is under development.</p>
<p>For an overview of ExQuilla, visit the <a title="ExQuilla support site" href="http://exquilla.zendesk.com/home">ExQuilla support site</a>.</p>
<p>Kent James</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmesquilla.com%2F2012%2F01%2F31%2Fexquilla-microsoft-exchange-server-for-thunderbird-beta-version-released%2F&amp;title=ExQuilla%20%28Microsoft%20Exchange%20Server%20for%20Thunderbird%29%20beta%20version%20released" id="wpa2a_2"><img src="http://mesquilla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2012/01/31/exquilla-microsoft-exchange-server-for-thunderbird-beta-version-released/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Address Book accounts</title>
		<link>http://mesquilla.com/2011/03/08/address-book-accounts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=address-book-accounts</link>
		<comments>http://mesquilla.com/2011/03/08/address-book-accounts/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 20:16: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>
		<category><![CDATA[Skinkglue]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=1126</guid>
		<description><![CDATA[New account types in Javascript for Thunderbird (Part 4) <p>Now that I am essentially feature complete in adding Address Book features to my Exchange Web Services implementation ExQuilla, I&#8217;d like to discuss how SkinkGlue was used to allow this to mostly be done in JavaScript.</p> <p>As review, SkinkGlue is my attempt to add an interface layer to Thunderbird to allow new account types to be added using javascript. SkinkGlue provides the necessary C++ interfaces to allow standard Thunderbird objects to be created without writing C++ code. SkinkGlue is licensed inder the standard Mozilla licenses, so it could be used by [...]]]></description>
			<content:encoded><![CDATA[<h2>New account types in Javascript for Thunderbird (Part 4)</h2>
<p>Now that I am essentially feature complete in adding Address Book features to my Exchange Web Services implementation <a href="../extensions/exquilla/">ExQuilla</a>, I&#8217;d like to discuss how SkinkGlue was used to allow this to mostly be done in JavaScript.</p>
<p>As review, <a href="http://mesquilla.com/category/skinkglue/">SkinkGlue</a> is my attempt to add an interface layer to Thunderbird to allow new account types to be added using javascript. SkinkGlue provides the necessary C++ interfaces to allow standard Thunderbird objects to be created without writing C++ code. SkinkGlue is licensed inder the standard Mozilla licenses, so it could be used by other extensions, or implemented as a Thunderbird standard feature. The current source is available <a href="http://hg.mozilla.org/users/kent_caspia.com/skinkglue/">here</a>.</p>
<h3>Adding Exchange Server contacts to the address book</h3>
<p>While <a href="http://mesquilla.com/extensions/exquilla/">ExQuilla</a> itself is mostly written in C++, I thought I would try to do the interface to the address book mostly in javascript.</p>
<p>At first I thought that would be straightforward, as the address book interfaces are much simpler than the mail interfaces, and there was supposed to be an existing extension that already did this. But I could not make this work reliably by trying to create a full javascript implementation of the nsIAbDirectory interface.</p>
<p>The main culprit is that the address book implementation seems to require that directory objects also derive from nsRDFResource. The underlying interface nsIRdfResource has the non-scriptable method GetValueConst, which is used by core Mozilla code in accessing RDF items. Perhaps I could have figured out how to work around this, but given the work I had already done in SkinkGlue, it seemed easier to just add a SkinkGlue type that allowed me to create an nsIAbDirectory object.  Another advantage of this is that I could take advantage of the existing full  generic C++ implementations, and then only override methods that I needed to change.</p>
<p>So in the end, I created a SkinkGlue object to be used for address book directories that can be extended using javascript. The C++ implementation of this derives from both nsRDFResource as well as nsAbDirProperty, and provides the minimum needed interfaces. This is actually quite parallel to the mailnews SkinkGlue objects, as the address book object nsAbDirProperty is similar in role to the mail object nsMsgDBFolder. Both provide a generic C++ implementation of key interfaces, and are used in standard mailnews C++ objects as a parent class. By adding this to SkinkGlue, I am simply allowing javascript users to follow the same methods that C++ users employ.</p>
<p>For address book cards, this was not necessary. There is an existing object &#8220;@mozilla.org/addressbook/cardproperty;1&#8243; which works just fine.</p>
<p>The result is that the standard Exchange Server &#8220;Contacts&#8221; folder and subfolders appear in the Thunderbird address book:</p>
<p style="text-align: center;"><a href="http://mesquilla.com/wp-content/uploads/2011/03/AddressBook.jpg"><img class="aligncenter size-full wp-image-1129" style="border: 0pt none;" title="Address Book" src="http://mesquilla.com/wp-content/uploads/2011/03/AddressBook.jpg" alt="" width="579" height="402" /></a></p>
<p style="text-align: left;">Note this is a Mork-free implementation, unlike the mailnews SkinkGlue objects.</p>
<p style="text-align: left;">Since the address book interface does not support a tree of directories, I had to implement the subfolder &#8220;Test subfolder&#8221; as a top-level address book with an extended name.</p>
<p style="text-align: left;">I hope to demonstrate this publically soon by adding &#8220;address book&#8221; support  to my <a href="http://mesquilla.com/extensions/tweequilla/">TweeQuilla</a> Twitter extension, where an address directory would be  interpreted as a list of followers.</p>
<h3 style="text-align: left;">Changes needed to Address Book to make this easier</h3>
<p>The address book interfaces are much cleaner on average than the mail interfaces, but unfortunately not completely there yet. What would make this easier to do?</p>
<h4>1. Remove address book dependencies on RDF</h4>
<p>The use of RDF is ultimately what forces me to create a C++ object to backup my javascript implementation.</p>
<h4>2. Add async access capability to key interfaces</h4>
<p>Most new address book accounts that might be supported would be remote sources. While the existing LDAP implementation manages to work around that, it is not at all clear from the interfaces how this is done. Really async access needs to be thought through and applied consistently. In my implementation, I essentially end up loading all of the contacts into memory, which will not scale well to large implementations.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmesquilla.com%2F2011%2F03%2F08%2Faddress-book-accounts%2F&amp;title=Address%20Book%20accounts" id="wpa2a_4"><img src="http://mesquilla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2011/03/08/address-book-accounts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exquilla alpha 0.2 released</title>
		<link>http://mesquilla.com/2010/11/19/exquilla-alpha-0-2-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exquilla-alpha-0-2-released</link>
		<comments>http://mesquilla.com/2010/11/19/exquilla-alpha-0-2-released/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 00:43:36 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<category><![CDATA[Planet Mozilla]]></category>
		<category><![CDATA[Planet MozillaMessaging]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=1038</guid>
		<description><![CDATA[<p>Today I release alpha version 0.2 of ExQuilla Exchange Web Service. This may be downloaded at the AMO site for the ExQuilla.</p> <p>This release adds support for most primary email features, but not the EWS address book or calendar. However, this is still Alpha quality code, which means that many of the features have minor glitches.</p> Major Additions since last release Cross-account message copies and moves Message Filters Junk Processing (though moves of junk messages are not working) Virtual Folders Save message as a file Show message source Message print Improvements in handling of Unicode character sets <p>Further information is [...]]]></description>
			<content:encoded><![CDATA[<p>Today I release alpha version 0.2 of ExQuilla Exchange Web Service. This may be downloaded at the <a href="https://addons.mozilla.org/en-US/thunderbird/addon/244848/">AMO site for the ExQuilla</a>.</p>
<p>This release adds support for most primary email features, but not the EWS address book or calendar. However, this is still Alpha quality code, which means that many of the features have minor glitches.</p>
<h3>Major Additions since last release</h3>
<ul>
<li>Cross-account message copies and moves</li>
<li>Message Filters</li>
<li>Junk Processing (though moves of junk messages are not working)</li>
<li>Virtual Folders</li>
<li>Save message as a file</li>
<li>Show message source</li>
<li>Message print</li>
<li>Improvements in handling of Unicode character sets</li>
</ul>
<p>Further information is available at the <a href="http://mesquilla.com/extensions/exquilla">ExQuilla page</a> on this site.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmesquilla.com%2F2010%2F11%2F19%2Fexquilla-alpha-0-2-released%2F&amp;title=Exquilla%20alpha%200.2%20released" id="wpa2a_6"><img src="http://mesquilla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/11/19/exquilla-alpha-0-2-released/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>ExQuilla alpha 0.1 released (Mailnews Exchange Support)</title>
		<link>http://mesquilla.com/2010/10/22/exquilla-alpha-0-1-released-mailnews-exchange-support/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exquilla-alpha-0-1-released-mailnews-exchange-support</link>
		<comments>http://mesquilla.com/2010/10/22/exquilla-alpha-0-1-released-mailnews-exchange-support/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 23:28:58 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<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=1024</guid>
		<description><![CDATA[<p>Today I released to Mozilla&#8217;s addon site a preview release of my Exchange Web Services extension, which I am calling ExQuilla (see the addons page here to download).</p> <p>This is alpha quality software, which means it is usable if you are brave. (I have been using it for a month with my rkent@mesquilla.com email account).</p> <p>There are many, many non-implemented features. Rather than repeat all of that here, I&#8217;ll just refer you to the extension description page that I have put up. The most severe restrictions are that this is email only, and there is no attempt to support localization [...]]]></description>
			<content:encoded><![CDATA[<p>Today I released to Mozilla&#8217;s addon site a preview release of my Exchange Web Services extension, which I am calling ExQuilla (see the addons page <a href="https://addons.mozilla.org/en-US/thunderbird/addon/244848/">here</a> to download).</p>
<p>This is alpha quality software, which means it is usable if you are brave. (I have been using it for a month with my rkent@mesquilla.com email account).</p>
<p>There are many, many non-implemented features. Rather than repeat all of that here, I&#8217;ll just refer you to the <a href="http://mesquilla.com/extensions/exquilla-exchange-web-services/">extension description page</a> that I have put up. The most severe restrictions are that this is email only, and there is no attempt to support localization or internationalization (so your Russian or Thai spam will look really strange.) Also, this build only supports Windows users running Thunderbird 3.1 Use at your own risk!</p>
<p>There is one major bug that I am aware of. For reasons that I have been unable to determine, sometimes the extension quits working, and sends a variety of messages to the error console. You need to restart to solve this. Hopefully I&#8217;ll figure out soon what is causing this.</p>
<p>The initial download of messages can be quite slow, which seems to be a limitation of Exchange Server (at least for the provider that I am using). But after the initial sync of messages in a particular folder, future use is generally quite fast, so be patient.</p>
<p>I would be interested to hear people&#8217;s experience in trying to get this to work with their own Exchange implementations. It really is too early though to give detailed feedback or bug reports, but I would be interested in anything that prevents it from being used at all for your needs.</p>
<p>I&#8217;ll be away most of next week (going to a<a href="https://www.prisonfellowship.org/oregon2010"> prisoner re-entry conference</a> and visiting a <a href="http://tmtl.org/">reentry facility</a> affiliated with my church) so it may be November until I can get back to you if you have issues.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmesquilla.com%2F2010%2F10%2F22%2Fexquilla-alpha-0-1-released-mailnews-exchange-support%2F&amp;title=ExQuilla%20alpha%200.1%20released%20%28Mailnews%20Exchange%20Support%29" id="wpa2a_8"><img src="http://mesquilla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/10/22/exquilla-alpha-0-1-released-mailnews-exchange-support/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Towards an Alpha supporting Thunderbird 3.1 (Mailnews Exchange Support)</title>
		<link>http://mesquilla.com/2010/08/18/towards-an-alpha-supporting-thunderbird-3-1-mailnews-exchange-support/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=towards-an-alpha-supporting-thunderbird-3-1-mailnews-exchange-support</link>
		<comments>http://mesquilla.com/2010/08/18/towards-an-alpha-supporting-thunderbird-3-1-mailnews-exchange-support/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 18:57:42 +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=954</guid>
		<description><![CDATA[<p>Things have been a little slower lately, what with summer and family visits and so forth, but my project to support Exchange server in Thunderbird proceeds nevertheless. I&#8217;m starting to think seriously of an Alpha release.</p> <p>Originally I had assummed that there would be changes required in core to support what I am doing. But so far, that has not been absolutely necessary. I had problems earlier with the database code, but I&#8217;ve managed to get around that by just using a standard nsMailDatabase object instead of doing my own version.</p> <p>So I tried to build a version that could [...]]]></description>
			<content:encoded><![CDATA[<p>Things have been a little slower lately, what with summer and family visits and so forth, but my project to support Exchange server in Thunderbird proceeds nevertheless. I&#8217;m starting to think seriously of an Alpha release.</p>
<p>Originally I had assummed that there would be changes required in core to support what I am doing. But so far, that has not been absolutely necessary. I had problems earlier with the database code, but I&#8217;ve managed to get around that by just using a standard nsMailDatabase object instead of doing my own version.</p>
<p>So I tried to build a version that could run on current Thunderbird 3.1 releases. That required staring at the build code for a couple of weeks, which I guess is the price that I pay for writing much of this extension in C++.  In the end, the magic that I needed was surprisingly simple:</p>
<pre>ifndef MOZ_STATIC_MAIL_BUILD
 EXTRA_DSO_LIBS = msgbsutl
 else
 SHARED_LIBRARY_LIBS =
   $(DEPTH)/mailnews/base/util/$(LIB_PREFIX)msgbsutl_s.$(LIB_SUFFIX)
endif</pre>
<p>I am now running my EWS extension with my normal Thunderbird profile &#8211; but I have not had the courage yet to use the email address for anything real. Fortunately, the spammers of the world have discovered my test address rkentjames@caspia.org, and are kindly providing me with a wide variety of test emails.</p>
<p>The question I have now is what is the minimum functionality required for an alpha release. I&#8217;ve recently added the ability to read attachments from my Exchange messages, but I don&#8217;t yet have the ability to create emails that contain attachments. I think that after I add that ability, I will have a basic email read/write capability, and will stop adding features and concentrate on fixing annoyances prior to releasing an alpha.</p>
<p>I&#8217;ll still be missing a zillion features, including:</p>
<ul>
<li>using the exchange address book</li>
<li>copying and moving messages to other folders</li>
<li>message filters</li>
</ul>
<p>and a whole lot more. But the alpha application could be used to do a basic check of someone&#8217;s work email from a home Thunderbird installation.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmesquilla.com%2F2010%2F08%2F18%2Ftowards-an-alpha-supporting-thunderbird-3-1-mailnews-exchange-support%2F&amp;title=Towards%20an%20Alpha%20supporting%20Thunderbird%203.1%20%28Mailnews%20Exchange%20Support%29" id="wpa2a_10"><img src="http://mesquilla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/08/18/towards-an-alpha-supporting-thunderbird-3-1-mailnews-exchange-support/feed/</wfw:commentRss>
		<slash:comments>14</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/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=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[<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 MsgComposeCommands.js there is an observer notification that occurs, called [...]]]></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>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmesquilla.com%2F2010%2F07%2F15%2Fsending-a-message-mailnews-exchange-support%2F&amp;title=Sending%20a%20Message%20%28Mailnews%20Exchange%20Support%29" id="wpa2a_12"><img src="http://mesquilla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></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/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=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[<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 [...]]]></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>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmesquilla.com%2F2010%2F06%2F25%2Fdata-persistence-mailnews-exchange-support%2F&amp;title=Data%20Persistence%20%28Mailnews%20Exchange%20Support%29" id="wpa2a_14"><img src="http://mesquilla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/06/25/data-persistence-mailnews-exchange-support/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Showing the header (Mailnews Exchange Support)</title>
		<link>http://mesquilla.com/2010/06/10/showing-the-header-mailnews-exchange-support/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=showing-the-header-mailnews-exchange-support</link>
		<comments>http://mesquilla.com/2010/06/10/showing-the-header-mailnews-exchange-support/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 06:42:05 +0000</pubDate>
		<dc:creator>rkent</dc:creator>
				<category><![CDATA[Exchange Web Services (EWS)]]></category>
		<category><![CDATA[Mailnews development]]></category>

		<guid isPermaLink="false">http://mesquilla.com/?p=863</guid>
		<description><![CDATA[<p>In my last post, I thought it was going to be tricky to get the message header to display in my Thunderbird Exchange Web Services extension. Turned out it wasn&#8217;t so hard after all. After I display the body, I just had to pretend like I was the Mime processor, and spit out headers to an nsIMsgHeaderSink that is listening on the message window. The details of what to do are in nsMimeHtmlEmitter.cpp. The result:</p> <p style="text-align: left;"> </p> <p style="text-align: left;">Thunderbird dies a horrible death if I click on any of the actions in the header though. Got to [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://mesquilla.com/2010/06/04/reading-the-body-mailnews-exchange-support/">last post</a>, I thought it was going to be tricky to get the message header to display in my Thunderbird Exchange Web Services extension. Turned out it wasn&#8217;t so hard after all. After I display the body, I just had to pretend like I was the Mime processor, and spit out headers to an nsIMsgHeaderSink that is listening on the message window. The details of what to do are in nsMimeHtmlEmitter.cpp. The result:</p>
<p style="text-align: left;"><a href="http://mesquilla.com/wp-content/uploads/2010/06/headerPane.jpg"><br />
</a><a href="http://mesquilla.com/wp-content/uploads/2010/06/headerPane.jpg"><img class="aligncenter size-full wp-image-864" style="border: 0pt none;" title="Header Pane Now Displayed" src="http://mesquilla.com/wp-content/uploads/2010/06/headerPane.jpg" alt="" width="571" height="325" /></a></p>
<p style="text-align: left;">Thunderbird dies a horrible death if I click on any of the actions in the header though. Got to work on that.</p>
<p style="text-align: center;">
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmesquilla.com%2F2010%2F06%2F10%2Fshowing-the-header-mailnews-exchange-support%2F&amp;title=Showing%20the%20header%20%28Mailnews%20Exchange%20Support%29" id="wpa2a_16"><img src="http://mesquilla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/06/10/showing-the-header-mailnews-exchange-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading the Body (Mailnews Exchange Support)</title>
		<link>http://mesquilla.com/2010/06/04/reading-the-body-mailnews-exchange-support/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=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[<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;"></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 RFC 2822 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 [...]]]></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;">
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmesquilla.com%2F2010%2F06%2F04%2Freading-the-body-mailnews-exchange-support%2F&amp;title=Reading%20the%20Body%20%28Mailnews%20Exchange%20Support%29" id="wpa2a_18"><img src="http://mesquilla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://mesquilla.com/2010/06/04/reading-the-body-mailnews-exchange-support/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Thread pane and nsIMsgDBHdr/nsIMsgDatabase (Mailnews Exchange Support)</title>
		<link>http://mesquilla.com/2010/05/21/thread-pane-and-nsimsgdbhdrnsimsgdatabase-mailnews-exchange-support/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=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[<p>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.</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;"></p> <p style="text-align: left;">One problem that I had to solve is to make the nsMsgDatabase object extendable. The standard code for [...]]]></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;">
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmesquilla.com%2F2010%2F05%2F21%2Fthread-pane-and-nsimsgdbhdrnsimsgdatabase-mailnews-exchange-support%2F&amp;title=Thread%20pane%20and%20nsIMsgDBHdr%2FnsIMsgDatabase%20%28Mailnews%20Exchange%20Support%29" id="wpa2a_20"><img src="http://mesquilla.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></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>
	</channel>
</rss>

