<?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>Delta XMPP Project</title>
	<atom:link href="http://delta.affinix.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://delta.affinix.com</link>
	<description>Building an XMPP/Jabber Platform</description>
	<lastBuildDate>Thu, 04 Oct 2012 03:31:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Psi 0.15 released</title>
		<link>http://delta.affinix.com/2012/10/03/psi-0-15-released/</link>
		<comments>http://delta.affinix.com/2012/10/03/psi-0-15-released/#comments</comments>
		<pubDate>Thu, 04 Oct 2012 03:30:52 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Jabber]]></category>
		<category><![CDATA[Psi]]></category>

		<guid isPermaLink="false">http://delta.affinix.com/?p=124</guid>
		<description><![CDATA[The final release of 0.15 is here! The website has been updated. Individual language pack downloads will be restored once new instructions are translated. Note: Psi 0.15 uses a new profile data format. Data from 0.14 and prior will be migrated to the new format when you run 0.15 for the first time. Changes: - [...]]]></description>
			<content:encoded><![CDATA[<p>The final release of 0.15 is here! The <a href="http://psi-im.org/download/">website</a> has been updated.</p>
<p>Individual language pack downloads will be restored once new instructions are translated.</p>
<p>Note: Psi 0.15 uses a new profile data format. Data from 0.14 and    prior will be migrated to the new format when you run 0.15 for the first    time.</p>
<p>Changes:<br />
- Merge many changes from Psi+.<br />
- New message history browser.<br />
- New, fast contact list window.<br />
- TURN proxying for voice calls.<br />
- Store data in more standardized locations based on the platform.<br />
- No longer dependent on the Qt3Support library.<br />
- Domains ending in .local now always work, whether via DNS server or mdns.<br />
- Windows 64-bit and Mac 64-bit now supported. Mac PPC deprecated.<br />
- Legacy SSL port probe feature removed.<br />
- Various small features and bugfixes.</p>
<p>Since 0.14, this version contains about two years worth of merges    from the Psi+ project. Thanks to Rion and Dealer_WeARE for diligently    keeping the Psi source repo current all this time.</p>
]]></content:encoded>
			<wfw:commentRss>http://delta.affinix.com/2012/10/03/psi-0-15-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Psi 0.15-rc3 released</title>
		<link>http://delta.affinix.com/2012/09/25/psi-0-15-rc3-released/</link>
		<comments>http://delta.affinix.com/2012/09/25/psi-0-15-rc3-released/#comments</comments>
		<pubDate>Tue, 25 Sep 2012 22:58:12 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Jabber]]></category>
		<category><![CDATA[Psi]]></category>

		<guid isPermaLink="false">http://delta.affinix.com/?p=121</guid>
		<description><![CDATA[The third release candidate of 0.15 is available. Note: Psi 0.15 uses a new profile data format. Data from 0.14 and prior will be migrated to the new format when you run 0.15 for the first time. Changes: - Merge many changes from Psi+. - New message history browser. - New, fast contact list window. [...]]]></description>
			<content:encoded><![CDATA[<p>The third release candidate of 0.15 is <a href="https://sf.net/projects/psi/files/Development%20Snapshots/0.15-rc3/">available.</a></p>
<p>Note: Psi 0.15 uses a new profile data format. Data from 0.14 and   prior will be migrated to the new format when you run 0.15 for the first   time.</p>
<p>Changes:<br />
- Merge many changes from Psi+.<br />
- New message history browser.<br />
- New, fast contact list window.<br />
- TURN proxying for voice calls.<br />
- Store data in more standardized locations based on the platform.<br />
- No longer dependent on the Qt3Support library.<br />
- Domains ending in .local now always work, whether via DNS server or mdns.<br />
- Windows 64-bit and Mac 64-bit now supported. Mac PPC deprecated.<br />
- Legacy SSL port probe feature removed.<br />
- Various small features and bugfixes.</p>
<p>Since 0.14, this version contains about two years worth of merges   from the Psi+ project. Thanks to Rion and Dealer_WeARE for diligently   keeping the Psi source repo current all this time.</p>
<p>Schedule:</p>
<p>Oct 3rd: Final</p>
]]></content:encoded>
			<wfw:commentRss>http://delta.affinix.com/2012/09/25/psi-0-15-rc3-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Psi 0.15-rc2 released</title>
		<link>http://delta.affinix.com/2012/09/12/psi-0-15-rc2-released/</link>
		<comments>http://delta.affinix.com/2012/09/12/psi-0-15-rc2-released/#comments</comments>
		<pubDate>Thu, 13 Sep 2012 04:06:34 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Jabber]]></category>
		<category><![CDATA[Psi]]></category>

		<guid isPermaLink="false">http://delta.affinix.com/?p=117</guid>
		<description><![CDATA[The second release candidate of 0.15 is available. Note: Psi 0.15 uses a new profile data format. Data from 0.14 and prior will be migrated to the new format when you run 0.15 for the first time. Changes: - Merge many changes from Psi+. - New message history browser. - New, fast contact list window. [...]]]></description>
			<content:encoded><![CDATA[<p>The second release candidate of 0.15 is <a href="https://sf.net/projects/psi/files/Development%20Snapshots/0.15-rc2/">available.</a></p>
<p>Note: Psi 0.15 uses a new profile data format. Data from 0.14 and  prior will be migrated to the new format when you run 0.15 for the first  time.</p>
<p>Changes:<br />
- Merge many changes from Psi+.<br />
- New message history browser.<br />
- New, fast contact list window.<br />
- TURN proxying for voice calls.<br />
- Store data in more standardized locations based on the platform.<br />
- No longer dependent on the Qt3Support library.<br />
- Domains ending in .local now always work, whether via DNS server or mdns.<br />
- Windows 64-bit and Mac 64-bit now supported. Mac PPC deprecated.<br />
- Legacy SSL port probe feature removed.<br />
- Various small features and bugfixes.</p>
<p>Since 0.14, this version contains about two years worth of merges  from the Psi+ project. Thanks to Rion and Dealer_WeARE for diligently  keeping the Psi source repo current all this time.</p>
<p>Schedule:</p>
<p>Sep 24: Final</p>
]]></content:encoded>
			<wfw:commentRss>http://delta.affinix.com/2012/09/12/psi-0-15-rc2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Announcing Fanout.io, the versatile push service</title>
		<link>http://delta.affinix.com/2012/09/04/announcing-fanout-io-the-versatile-push-service/</link>
		<comments>http://delta.affinix.com/2012/09/04/announcing-fanout-io-the-versatile-push-service/#comments</comments>
		<pubDate>Tue, 04 Sep 2012 20:04:23 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Jabber]]></category>

		<guid isPermaLink="false">http://delta.affinix.com/?p=113</guid>
		<description><![CDATA[I want to let everyone know about my new project, Fanout.io. I&#8217;ve been working on it since last October, but it is now ready for real use. Basically it&#8217;s a CDN service for outbound XMPP or HTTP traffic. For example, suppose you&#8217;re building an XMPP service that may have a lot of instantaneous outbound traffic [...]]]></description>
			<content:encoded><![CDATA[<p>I want to let everyone know about my new project, <a href="http://fanout.io/">Fanout.io</a>. I&#8217;ve been working on it since last October, but it is now ready for real use.</p>
<p>Basically it&#8217;s a CDN service for outbound XMPP or HTTP traffic. For example, suppose you&#8217;re building an XMPP service that may have a lot of instantaneous outbound traffic (e.g. a pubsub service with many subscribers). Instead of trying to send a thousand stanzas yourself from a single server, you send a single stanza to Fanout, and it will delegate the transmission to a set of worker servers that each handle a slice of the deliveries.</p>
<p>It&#8217;s also got some really good HTTP stuff, for those that need it, like webhooks and long polling. Your one stop shop for scaling push.</p>
<p>Full announcement on the <a href="http://blog.fanout.io/2012/09/03/realtime-multicasting-over-http-xmpp/">Fanout Blog</a>.</p>
<p>If you&#8217;re working on any kind of website or app that delivers data in realtime, be sure to check it out. I hope that if Fanout is successful then it will enable me to put more resources into Psi and other interesting projects, so your support is welcomed and encouraged. <img src='http://delta.affinix.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://delta.affinix.com/2012/09/04/announcing-fanout-io-the-versatile-push-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three years later, a new Psi</title>
		<link>http://delta.affinix.com/2012/08/28/three-years-later-a-new-psi/</link>
		<comments>http://delta.affinix.com/2012/08/28/three-years-later-a-new-psi/#comments</comments>
		<pubDate>Tue, 28 Aug 2012 09:03:32 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Jabber]]></category>
		<category><![CDATA[Psi]]></category>

		<guid isPermaLink="false">http://delta.affinix.com/?p=88</guid>
		<description><![CDATA[The latest development cycle has been a tough one. While Psi releases have never been exactly punctual, the time gap between 0.14 and 0.15 is surely the longest yet. It&#8217;s easy to blame this long cycle on my inability to contribute much since early 2010, but it&#8217;s not as if contribution in general was lacking. [...]]]></description>
			<content:encoded><![CDATA[<p>The latest development cycle has been a tough one. While Psi releases have  never been exactly punctual, the time gap between 0.14 and 0.15 is surely  the longest yet.</p>
<p>It&#8217;s easy to blame this long cycle on my inability to contribute much since early 2010, but it&#8217;s not as if contribution in general was lacking. The <a href="http://psi-plus.com/">Psi+</a> project has remained steadily active, and a couple of years ago we gave commit access to Sergey (Rion), one of the Psi+ founders, and then later on to Khryukin (Dealer_WeARE), another Psi+ developer. Together, they have been merging changes upstream from Psi+ to Psi all this time. I&#8217;m amazed at their dedication, having maintained both repositories for years even though Psi had no clear roadmap or release plan. They are choosy about what to merge, too. Many traditional Psi users regard the Psi+ application as a scary patchfest, but the Psi+ developers are no fools. Sure, they enjoy a bleeding edge app, but they also know what&#8217;s ready and what isn&#8217;t, and only the stuff that is ready finds it way back into Psi. For better or worse, Psi+ is where the action is, so get used to their code being the basis of new Psi releases.</p>
<p>This isn&#8217;t to say there haven&#8217;t been non-Psi+ contributions to 0.15. A big one is TURN proxy support for voice calling. You can set up a <a href="http://turnserver.sourceforge.net/">TURN server</a>, and finally put an end to voice call connectivity problems. This feature was actually implemented just after Psi 0.14 was released, back when I was working at Barracuda Networks. Finally it sees the light of day! Additionally, Michail (mblsha) merged his rewritten contact list code. It uses the Qt 4 model stuff. You can select and drag multiple contacts now, and it should be a lot faster too. This new contact list code, along with some other changes (like the rewritten history window), helped us transition away from Qt3Support at long last. This was primarily important so we could compile against the Cocoa version of Qt/Mac. Of course it&#8217;s also nice to be relieved of having to link to unnecessary libraries like QtSql. Either way, it&#8217;s about time we officially got off of Qt 3. Seriously. Qt 4 has been out for like 7 years, and Qt 5 is just around the corner. Seeeeriously.</p>
<p>So if we&#8217;ve had features in the queue and regular contribution, why the hold up? Well, the real reason it has taken so long to get 0.15 out the door is because making a Psi release is just plain hard. Particularly with the introduction of GStreamer as a dependency since 0.13, a considerable amount of compilation judo is needed to produce official binary packages. Psi has some 20 dependencies. Keeping these current, and producing builds for both Windows and Mac takes more than a passing familiarity with the project. We got by when I was at Barracuda because it was my day job to make this stuff happen. I was also provided various build machines. These resources are now gone (which included a PowerPC Mac, which is one reason why Psi 0.15 is not available for PPC, not that anyone cares). In order to produce Psi builds again, I needed to recreate the environment I had at Barracuda. Actually, I needed to do it one better: I needed to automate as much as possible so that not only Psi but <em>dependencies</em> could be maintained using minimal brainpower. It needed to be possible for me to push a single button and get a release, with no arcane steps that I&#8217;d soon forget the moment I switch focus away from Psi.</p>
<p>In March of this year, I set out to build this magical solution. The result is a new repository, <a href="https://github.com/psi-im/psideps">psideps</a>, which handles the building of dependencies, as well as some additional scripts in Psi&#8217;s own repository to simplify building Psi itself. It&#8217;s all a bunch of bash scripts and makefiles, and fairly straightforward. The devil is in the details though. Most dependencies required patching to build properly, and a lot happens in three years. Growl went payware. Ndhotkeyevent only built with clang. Glib atomic operations got broken on Mac. GStreamer had some critical regressions. Build patches were numerous. Psideps has 24 .diff files, and that&#8217;s not even including any ad-hoc sed crap I do to some of these packages. My favorite patch is the one where I slow down certain configure scripts (by injecting sleeps) because they execute too fast on MinGW and cause random failures. Also, people expect 64-bit builds these days, so the scripts do multiple passes, and of course all that fun install_name_tool stuff in Mac&#8217;s case. It&#8217;s not like all dependencies built cleanly in 64-bit either. I mean, that would have been too easy. Getting this all correct took patience. Builds take a long time, especially in VMs. Suddenly, the Windows build of some dependency breaks. I fix that, but in the process break the Mac build. No wait, it&#8217;s only the 64-bit pass on Mac that I broke, so I&#8217;ll need to fix in a way that doesn&#8217;t break 32-bit. This is build failure whack-a-mole. Rebuild again. Wait 30 minutes again. Curse all of these dependencies of which I am not an author&#8230; again. Finally, everything builds in every combination and there is harmony. All in all, it was a lot of time spent, and hardly any of it was on Psi itself. I did use the past couple of weeks to shake out bugs and get Psi into a release quality state, but all other time since March was put towards build automation. I am quite sick of watching compilations at this point. However, this work was hugely important. The notion of building a Psi release has gone from something completely unapproachable (by its own founder!) to something one might do while sleeping.</p>
<p>Lately I&#8217;ve been wondering where to go from here. Originally, Psi was created to suit myself and other IM geeks. It became a bit more than that, though, inadvertently becoming a flagship XMPP client of sorts, and there were a run of sponsored forks promising greater user-friendliness. I&#8217;d like to think Psi helped further open IM in general, and for awhile this was my major motivation. However, nowadays XMPP is everywhere, and implemented in some pretty amazing clients. Most people I know use Adium, iChat, Pidgin, Gmail, etc. Empathy/telepathy is taking over desktop Linux. What role does Psi play in this world, where XMPP has already won? I&#8217;m happy to report that since 0.15 Beta 2, Psi has already been downloaded over 8000 times from SourceForge. That&#8217;s in just two weeks. I guess the role it plays is an app that many people seem to like. <img src='http://delta.affinix.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Perhaps that is good enough, and we can put the MSN-looking forks and world domination plans to rest. Psi has its niche.</p>
<p>Even after all this time, I still love hacking on Psi, and the challenge has always been balancing it among my other responsibilities. Now that we are on track to be able to produce releases again, I hope we can return to a routine again of releasing semi-regularly, even if it continues to just be patches from Psi+. <img src='http://delta.affinix.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://delta.affinix.com/2012/08/28/three-years-later-a-new-psi/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Psi 0.15-rc1 released</title>
		<link>http://delta.affinix.com/2012/08/27/psi-0-15-rc1-released/</link>
		<comments>http://delta.affinix.com/2012/08/27/psi-0-15-rc1-released/#comments</comments>
		<pubDate>Tue, 28 Aug 2012 03:06:43 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Jabber]]></category>
		<category><![CDATA[Psi]]></category>

		<guid isPermaLink="false">http://delta.affinix.com/?p=83</guid>
		<description><![CDATA[The first release candidate of 0.15 is available. Note: Psi 0.15 uses a new profile data format. Data from 0.14 and prior will be migrated to the new format when you run 0.15 for the first time. Changes: &#8211; Merge many changes from Psi+. &#8211; New message history browser. &#8211; New, fast contact list window. [...]]]></description>
			<content:encoded><![CDATA[<p>The first release candidate of 0.15 is <a href="https://sf.net/projects/psi/files/Development%20Snapshots/0.15-rc1/">available.</a></p>
<p>Note: Psi 0.15 uses a new profile data format. Data from 0.14 and prior will be migrated to the new format when you run 0.15 for the first time.</p>
<p>Changes:<br />
  &#8211; Merge many changes from Psi+.<br />
  &#8211; New message history browser.<br />
  &#8211; New, fast contact list window.<br />
  &#8211; TURN proxying for voice calls.<br />
  &#8211; Store data in more standardized locations based on the platform.<br />
  &#8211; No longer dependent on the Qt3Support library.<br />
  &#8211; Domains ending in .local now always work, whether via DNS server or mdns.<br />
  &#8211; Windows 64-bit and Mac 64-bit now supported. Mac PPC deprecated.<br />
  &#8211; Legacy SSL port probe feature removed.<br />
  &#8211; Various small features and bugfixes.</p>
<p>Since 0.14, this version contains about two years worth of merges from the Psi+ project. Thanks to Rion and Dealer_WeARE for diligently keeping the Psi source repo current all this time.</p>
<p>Schedule:</p>
<p>Sep 17: Final</p>
]]></content:encoded>
			<wfw:commentRss>http://delta.affinix.com/2012/08/27/psi-0-15-rc1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Livefyre: the future of comment sections</title>
		<link>http://delta.affinix.com/2010/07/06/livefyre-the-future-of-comment-sections/</link>
		<comments>http://delta.affinix.com/2010/07/06/livefyre-the-future-of-comment-sections/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 20:03:18 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Jabber]]></category>

		<guid isPermaLink="false">http://delta.affinix.com/2010/07/06/livefyre-the-future-of-comment-sections/</guid>
		<description><![CDATA[Comment sections on today&#8217;s blogs and websites use antiquated technology.  It&#8217;s all more or less the same stuff that has been done a decade ago, just with an emphasis on cloud services (see Disqus, IntenseDebate, etc).  Livefyre offers a next-generation commenting platform.  It also happens to be a cloud service, but that&#8217;s its least noteworthy [...]]]></description>
			<content:encoded><![CDATA[<p>Comment sections on today&#8217;s blogs and websites use antiquated technology.  It&#8217;s all more or less the same stuff that has been done a decade ago, just with an emphasis on cloud services (see Disqus, IntenseDebate, etc).  <a href="http://livefyre.com/">Livefyre</a> offers a next-generation commenting platform.  It also happens to be a cloud service, but that&#8217;s its least noteworthy aspect.</p>
<p>With Livefyre, comments feed into the page live with no refresh needed.  The system is social: you follow friends and topics, and get notifications when interesting things happen across the web (e.g. &#8220;Your friend Julia has just commented on the article &#8216;The Internet Needs More Cats.&#8217;&#8221;).  We also do things like keep track of every user&#8217;s reputation for automatic moderation, and drive traffic to other bloggers based on user interest.  We want to shift website comments from being silo&#8217;d and disconnected, where hardly anyone knows who is leaving what comments and on what websites, towards a highly connected and social system, where website comments become as relevant to people as their Facebook news feed.</p>
<p>And yes, it is powered by XMPP.</p>
<p>Check out the <a href="http://livefyre.com/">Livefyre website</a>, and be sure to read the <a href="http://techcrunch.com/2010/07/06/livefyre-realtime-comments/">TechCrunch article</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://delta.affinix.com/2010/07/06/livefyre-the-future-of-comment-sections/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Meeting expectations in QObjects (Part 2)</title>
		<link>http://delta.affinix.com/2010/01/09/meeting-expectations-in-qobjects-part-2/</link>
		<comments>http://delta.affinix.com/2010/01/09/meeting-expectations-in-qobjects-part-2/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 01:26:47 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://delta.affinix.com/2010/01/09/meeting-expectations-in-qobjects-part-2/</guid>
		<description><![CDATA[In Part 1, we discussed how QObjects often don&#8217;t behave the way we expect. This is largely because developing a QObject that behaves the way we would expect is not always a simple process. Commonly, if you develop a QObject in the most straightforward manner, then it will behave unexpectedly, even to yourself! In this [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="/2008/08/28/meeting-expectations-in-qobjects-part-1/">Part 1</a>, we discussed how QObjects often don&#8217;t behave the way we expect.  This is largely because developing a QObject that behaves the way we would expect is not always a simple process.  Commonly, if you develop a QObject in the most straightforward manner, then it will behave unexpectedly, even to yourself!</p>
<p>In this article we&#8217;ll talk about a tool that can assist with making our objects behave properly: ObjectSession.  It is just one of many tools I&#8217;ve come up with over the years, but I&#8217;m starting to feel confident enough in it that I figure it is time to talk about it. <img src='http://delta.affinix.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Introducing ObjectSession</h3>
<p>The great thing about ObjectSession is that the concept is quite simple and yet it manages to solve many problems.  The way it works is you create an ObjectSession instance that keeps track of a &#8220;session&#8221; of queued signal/slot activity.  Instead of using QMetaObject::invokeMethod() or QTimer to perform queued calls directly, you tell your ObjectSession to perform these calls, with the advantage that you can reset the session at any time to cause all queued calls to be canceled.</p>
<p>Additionally, there is ObjectSessionWatcher which can keep track of session validity.  You know the old trick about using QPointer on the stack, to find out if your object has been deleted after you emitted a signal?  ObjectSessionWatcher is intended to replace this usage.  You create it on the stack in the same way as QPointer, but you use it to find out if your session has been reset instead of if your object has been deleted.  This allows you to easily provide signal safety for all methods, not just destructors.</p>
<p>ObjectSession can currently be found under src/irisnet/corelib in the <a href="/source/">Iris SVN</a>.  Here is a snippet from objectsession.h:</p>
<pre><code>class ObjectSession : public QObject
{
        Q_OBJECT

public:
        ObjectSession(QObject *parent = 0);
        ~ObjectSession();

        void reset();
        bool isDeferred(QObject *obj, const char *method);
        void defer(QObject *obj, const char *method,
                QGenericArgument val0 = QGenericArgument(),
                QGenericArgument val1 = QGenericArgument(),
                [...]);

        [...]
};

class ObjectSessionWatcher
{
public:
        ObjectSessionWatcher(ObjectSession *sess);
        ~ObjectSessionWatcher();

        bool isValid() const;

        [...]
};</code></pre>
<p>There are a few more methods available than shown above, but these are the main ones.</p>
<p>Now let&#8217;s go over some usages.</p>
<h3>Basic setup</h3>
<p>Usually you&#8217;ll have just one ObjectSession per object, set up like such:</p>
<pre><code>class Foo : public QObject
{
        Q_OBJECT

private:
        ObjectSession sess;

public:
        Foo(QObject *parent = 0) :
                QObject(parent),
                sess(this)
        {
        }
};</code></pre>
<p>Note: The defer() call allows you to make queued calls on any object, so it is not necessary for the ObjectSession to live in the &#8220;public&#8221; object like this.  You can easily tuck it away in a private class d-pointer if you want, and still target signals of the public class.</p>
<h3>Emitting a delayed signal, with ability to retract</h3>
<p>The defer() call works just like QMetaObject::invokeMethod(), even allowing you to specify arguments.</p>
<pre><code>void Foo::startServer()
{
        udp = new QUdpSocket(this);
        if(!udp->bind())
        {
                // app expects the error() signal to be asynchronous
                sess.defer(this, "error", Q_ARG(Foo::Error, ErrorBind));
                return;
        }

        [...]
}

void Foo::abort()
{
        sess.reset();
}</code></pre>
<p>Now the user can call startServer(), abort(), startServer() all in a row without returning to the event loop and there is no worry that the above signal might accidentally be misinterpretted as part of the second &#8220;session&#8221;.  The sess.reset() method destroys the deferred call queue.</p>
<h3>Safely emitting a signal in the middle of a code block</h3>
<p>Instead of using QPointer to check if your object is destroyed, use ObjectSessionWatcher to see if your object state is still sane.</p>
<pre><code>void Foo::tcpSocket_connected()
{
        [...]

        ObjectSessionWatcher watch(&amp;sess);
        emit connected();
        if(!watch.isValid())
                return;

        tcpSocket->write("hello world");

        [...]
}

void Foo::abort()
{
        sess.reset();
        tcpSocket->deleteLater();
        tcpSocket = 0;
}</code></pre>
<p>Now if you emit connected() and the user calls abort() during that slot, the watcher is immediately notified that the session is no longer valid.  This way we can bail out instead of crashing on the next line.</p>
<p>Note that destructing ObjectSession also causes any watchers to be invalidated, so we get signal-safety of the destructor for free too.</p>
<h3>Emitting multiple signals in a row</h3>
<p>There are a couple of ways to do this.  One way is to use deferred signals for all but the first:</p>
<pre><code>void Foo::someFunction()
{
        [...]

        sess.defer(this, "sig2");
        emit sig1();

        [...]
}</code></pre>
<p>The other way is to use a watcher:</p>
<pre><code>void Foo::someFunction()
{
        [...]

        ObjectSessionWatcher watch(&amp;sess);
        emit sig1();
        if(!watch.isValid())
                return;
        emit sig2();

        [...]
}</code></pre>
<p>Which way you do it depends on your mood.  The second method is a little more straightforward, but has the drawback that if the user invokes a nested eventloop in response to sig1(), then sig2() will not be emitted during the new eventloop.  So for example if sig1() causes a modal dialog to appear, then the object might seem like it is blocking or not working until the dialog is dismissed.</p>
<p>(That said, nested eventloops are <a href="/2008/11/22/nested-eventloops-are-pure-evil/">pure evil</a> and will cause you all sorts of problems anyway.  Can you imagine other events suddenly activating in your object, while someFunction() is still sitting there partway executed?  Maybe even causing other signals to emit, before sig2() ?  Yeeeesh..)</p>
<h3>Deferring calls to your own slots</h3>
<p>In all the examples so far we&#8217;ve used defer() to invoke signals, but it is also useful for queuing up calls to your own slots.  Here&#8217;s an alternate way to handle the delayed signal from earlier:</p>
<pre><code>void Foo::startServer()
{
        // set object state
        state = Starting;

        udp = new QUdpSocket(this);
        if(!udp->bind())
        {
                // process the error later, so object state remains consistent
                sess.defer(this, "slot_bindError");
                return;
        }

        [...]
}

int Foo::state() const
{
        return state;
}

void Foo::slot_bindError()
{
        // now we atomically change the state and emit error
        state = Inactive;
        emit error(ErrorBind);
}

void Foo::abort()
{
        sess.reset();
}</code></pre>
<p>There is also deferExclusive() to ensure that a call is only queued once at a time.  This is useful for making sure an &#8220;update&#8221;-style function runs at the next eventloop.</p>
<pre><code>void Foo::sendText(const QString &amp;str)
{
        queueOutboundData(str);

        // make sure we push out pending data at the next eventloop
        sess.deferExclusive(this, "doSend");
}

void Foo::sendPhoto(const QPixmap &amp;p)
{
        queueOutboundData(p);

        // make sure we push out pending data at the next eventloop
        sess.deferExclusive(this, "doSend");
}

void Foo::doSend()
{
        // push all items in the queue out the network
        [...]
}</code></pre>
<p>If the session is reset, such deferred slot calls would get canceled in the same way that deferred signals do.  How convenient!  Now you can avoid having background slots continuing to execute when they shouldn&#8217;t be.</p>
<h3>Conclusion</h3>
<p>ObjectSession is a simple class that can be used to solve a number of problems with QObject development that are otherwise quite awkward to solve.  The key for me was to discover that almost all of the problems have to do with an object switching states, stopping, or being destroyed.  So, if there could be a simple way to manage those situations then we could solve just about everything.  I&#8217;m using ObjectSession in a few of my classes now and I&#8217;m quite pleased at how easy it is.</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://delta.affinix.com/2010/01/09/meeting-expectations-in-qobjects-part-2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Psi 0.14 released</title>
		<link>http://delta.affinix.com/2009/12/02/psi-014-released/</link>
		<comments>http://delta.affinix.com/2009/12/02/psi-014-released/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 01:09:14 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Jabber]]></category>
		<category><![CDATA[Psi]]></category>

		<guid isPermaLink="false">http://delta.affinix.com/2009/12/02/psi-014-released/</guid>
		<description><![CDATA[Psi 0.14 is here!  The website download area has been updated. New in 0.14 - Added color options to the chat window. - Can now specify a reason for kick/ban in groupchat. - Improved User Info window, to show more fields and photo view/save. - Support for Enchant as an alternative to Aspell. - Commandline [...]]]></description>
			<content:encoded><![CDATA[<p>Psi 0.14 is here!  <span class="abbc">The website <a href="http://psi-im.org/download/" title="http://psi-im.org/download/">download area</a> has been updated.</span></p>
<p>New in 0.14<br />
- Added color options to the chat window.<br />
- Can now specify a reason for kick/ban in groupchat.<br />
- Improved User Info window, to show more fields and photo view/save.<br />
- Support for Enchant as an alternative to Aspell.<br />
- Commandline interface now supports choosing profile and setting status.<br />
- D-BUS interface now supports setting status and indicating sleep/wake.<br />
- Fixed voice calling compatibility bugs with Pidgin and Empathy.<br />
- Various other minor improvements and bugfixes.</p>
]]></content:encoded>
			<wfw:commentRss>http://delta.affinix.com/2009/12/02/psi-014-released/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Psi 0.14-rc3 released</title>
		<link>http://delta.affinix.com/2009/11/25/psi-014-rc3-released/</link>
		<comments>http://delta.affinix.com/2009/11/25/psi-014-rc3-released/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 19:57:21 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Jabber]]></category>
		<category><![CDATA[Psi]]></category>

		<guid isPermaLink="false">http://delta.affinix.com/2009/11/25/psi-014-rc3-released/</guid>
		<description><![CDATA[Psi 0.14-rc3 is here!  Please download and test. Final on December 2nd if no showstoppers are found. New in 0.14 - Added color options to the chat window. - Can now specify a reason for kick/ban in groupchat. - Improved User Info window, to show more fields and photo view/save. - Support for Enchant as [...]]]></description>
			<content:encoded><![CDATA[<p>Psi 0.14-rc3 is here!  Please <a href="http://sourceforge.net/projects/psi/files/">download and test</a>.</p>
<p>Final on December 2nd if no showstoppers are found.</p>
<p>New in 0.14<br />
- Added color options to the chat window.<br />
- Can now specify a reason for kick/ban in groupchat.<br />
- Improved User Info window, to show more fields and photo view/save.<br />
- Support for Enchant as an alternative to Aspell.<br />
- Commandline interface now supports choosing profile and setting status.<br />
- D-BUS interface now supports setting status and indicating sleep/wake.<br />
- Fixed voice calling compatibility bugs with Pidgin and Empathy.<br />
- Various other minor improvements and bugfixes.</p>
]]></content:encoded>
			<wfw:commentRss>http://delta.affinix.com/2009/11/25/psi-014-rc3-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
