<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>modules/stream/lib/persisted_object.js</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -21,22 +21,7 @@ var applyFilters = compose(
     filters.processImageBinds
 );
 
-
-// Defaults
-var defaultConf = {
-    // For internal use of the storage system
-    _id: 'conf',
-
-    // Every ten seconds, check how many events we're displaying and
-    // remove older ones so that 100 events are left
-    maxEvents: 100,
-    cleanupInterval: 10000,
-
-    muted: {},
-
-    version: '0.10'
-};
-
+var conf;
 
 XML.prettyPrinting = false;
 XML.ignoreWhitespace = false;
@@ -47,13 +32,28 @@ XML.ignoreWhitespace = false;
 
 // Initialize components that don't need the DOM right away
 
-storage.init({conf: defaultConf});
 vcards = { __proto__: null };
 rosters = new XMLList();
 
 // Initialize DOM-dependent components when DOM is ready
 
 $(document).ready(function() {
+    conf =
+        PersistedObject.get('conf', true) ||
+        PersistedObject.create({
+            // For internal use of the storage system
+            _id: 'conf',
+
+            // Every ten seconds, check how many events we're displaying and
+            // remove older ones so that 100 events are left
+            maxEvents: 100,
+            cleanupInterval: 10000,
+
+            muted: {},
+
+            version: 1
+        }, true);
+
     // Initialize xmpp forwarding
 
     xmpp.init();
@@ -114,13 +114,9 @@ $(document).ready(function() {
 
     // Initialize periodic tasks
 
-    // XXX race condition here, custom config isn't necessarily
-    // available here.
-
-    var conf = storage.load('conf');
     window.setInterval(cleanup, conf.cleanupInterval);
 
-    //    simulate();
+// simulate();
 
     // $(window).bind('custom/blur', function() {
     //     $('#stream &gt; .event.reading-cue').removeClass('reading-cue');
@@ -224,8 +220,7 @@ translators.push({
         if(stanza.status.text() == '')
             return false;
         if(stanza.@ns_x4m_in::direction == 'in' &amp;&amp;
-           // XXX maybe should use names
-           JID(stanza.@from).address in storage.load('conf').muted)
+           JID(stanza.@from).address in conf.muted)
             return false;
         if(stanza.@type == 'error')
             return;
@@ -338,7 +333,6 @@ function prepareReply(recipient) {
 
 function cleanup() {
     var events = $('#stream').children();
-    var conf = storage.load('conf');
     if(events.length &gt; conf.maxEvents)
         events.slice(0, events.length-conf.maxEvents).remove();
 }
@@ -351,7 +345,6 @@ function mutePresence(eventDescendant) {
         .find('.origin')
         .attr('href');
 
-    var conf = storage.load('conf');
     conf.muted[entity(originURI).address] = true;
 
     $('#stream .event.presence').filter(function() {</diff>
      <filename>modules/stream/stream.js</filename>
    </modified>
    <modified>
      <diff>@@ -24,6 +24,7 @@
     &lt;script type=&quot;application/x-javascript&quot; src=&quot;lib/display_filters.js&quot;/&gt;
     &lt;script type=&quot;application/x-javascript&quot; src=&quot;lib/utils_ui.js&quot;/&gt;
     &lt;script type=&quot;application/x-javascript&quot; src=&quot;lib/utils_xmpp.js&quot;/&gt;
+    &lt;script type=&quot;application/x-javascript&quot; src=&quot;lib/persisted_object.js&quot;/&gt;
     &lt;script type=&quot;application/x-javascript&quot; src=&quot;lib/storage.js&quot;/&gt;
 
     &lt;!-- local scripts: general --&gt;</diff>
      <filename>modules/stream/stream.xhtml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>32b84d6ef7e890f379cb50edf946a9db063e0260</id>
    </parent>
  </parents>
  <author>
    <name>Massimiliano Mirra</name>
    <email>bard@hyperstruct.net</email>
  </author>
  <url>http://github.com/bard/sameplace/commit/18023306a267d1f6b90b48803c4a2b61e2d8608a</url>
  <id>18023306a267d1f6b90b48803c4a2b61e2d8608a</id>
  <committed-date>2009-04-20T07:18:48-07:00</committed-date>
  <authored-date>2009-04-20T07:18:48-07:00</authored-date>
  <message>Stream app: added PersistedObject class that uses DOM storage as backend.</message>
  <tree>2df7765c6b4d81bd11c88dc3dc15d01164f0a958</tree>
  <committer>
    <name>Massimiliano Mirra</name>
    <email>bard@hyperstruct.net</email>
  </committer>
</commit>
