<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
  <!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
  <title>Twas The Night Before Christmas (Jabber Version)</title>
  <abstract>The classic Christmas poem annotated with XMPP protocols.</abstract>
  &LEGALNOTICE;
  <number>0169</number>
  <status>Active</status>
  <type>Humorous</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP IM</spec>
    <spec>XEP-0045</spec>
    <spec>XEP-0060</spec>
    <spec>XEP-0080</spec>
    <spec>XEP-0090</spec>
    <spec>XEP-0107</spec>
    <spec>XEP-0108</spec>
    <spec>XEP-0112</spec>
    <spec>XEP-0163</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>N/A</shortname>
  &stpeter;
  <revision>
    <version>1.1</version>
    <date>2009-12-24</date>
    <initials>psa</initials>
    <remark><p>Corrected several examples and clarified the architectural assumptions.</p></remark>
  </revision>
  <revision>
    <version>1.0</version>
    <date>2005-12-19</date>
    <initials>psa</initials>
    <remark><p>Happy Holidays!</p></remark>
  </revision>
</header>

<section1 topic='Poem' anchor='poem'>

<p>'Twas the night before Christmas,</p>

  <code><![CDATA[
<iq from='narrator@twas-the-night.lit/home'
    id='time1'
    to='twas-the-night.lit'
    type='get'>
  <time xmlns='urn:xmpp:time'/>
</iq>

<iq from='twas-the-night.lit'
    id='time1'
    to='narrator@twas-the-night.lit/home'
    type='result'>
  <time xmlns='urn:xmpp:time'>
    <tzo>-05:00</tzo>
    <utc>1807-12-25T04:58:35Z</utc>
  </time>
</iq>
  ]]></code>

<p>When all through the house,</p>
<p>Not a creature was stirring, not even a mouse:</p>

  <code><![CDATA[
<presence from='mouse@twas-the-night.lit/house'>
  <show>xa</show>
  <status>zzz</status>
</presence>
  ]]></code>

<p>The stockings were hung by the chimney with care,</p>
<p>In hopes that St. Nicholas soon would be there;</p>
<p>The children were nestled all snug in their beds,</p>

  <code><![CDATA[
<message from='child@twas-the-night.lit' 
         to='narrator@twas-the-night.lit'
         type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/geoloc'>
      <item id='current'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
          <room>children&apos;s bedroom</room>
        </geoloc>
      </item>
    </items>
  </event>
</message>
  ]]></code>

<p>While visions of sugar-plums danced in their heads.</p>

  <code><![CDATA[
<message from='child@twas-the-night.lit' 
         to='narrator@twas-the-night.lit'
         type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/activity'>
      <item id='current'>
        <activity xmlns='http://jabber.org/protocol/activity'>
          <inactive>
            <sleeping/>
          </inactive>
          <text xml:lang='en'>dreaming of sugar-plums</text>
        </activity>
      </item>
    </items>
  </event>
</message>
  ]]></code>

<p>And Mama in her 'kerchief, and I in my cap,</p>
<p>Had just settled down for a long winter's nap.</p>

  <code><![CDATA[
<message from='mama@twas-the-night.lit' 
         to='narrator@twas-the-night.lit'
         type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/geoloc'>
      <item id='current'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
          <room>master bedroom</room>
        </geoloc>
      </item>
    </items>
  </event>
</message>
  ]]></code>

<p>When out on the lawn there arose such a clatter,</p>
<p>I sprang from the bed to see what was the matter.</p>
<p>Away to the window I flew like a flash,</p>
<p>Tore open the shutters, and threw up the sash.</p>
<p>The moon on the breast of the new-fallen snow</p>
<p>Gave the lustre of mid-day to objects below,</p>
<p>When, what to my wondering eyes should appear,</p>
<p>But a miniature sleigh, and eight tiny rein-deer,</p>

  <code><![CDATA[
<iq from='sleigh@northpole.lit/sleigh' 
    id='geo87361'
    to='sleigh@northpole.lit' 
    type='set'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='http://jabber.org/protocol/geoloc'>
      <item id='87361'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'>
          <lat>41.70</lat>
          <lon>-73.92</lon>
          <alt>50</alt>
        </geoloc>
      </item>
    </publish>
  </pubsub>
</iq>
  ]]></code>

  <code><![CDATA[
<message from='sleigh@northpole.lit' 
         to='polecom@northpole.lit'
         type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/geoloc'>
      <item id='87361'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'>
          <lat>41.70</lat>
          <lon>-73.92</lon>
          <alt>50</alt>
        </geoloc>
      </item>
    </items>
  </event>
</message>
  ]]></code>

<p>With a little old driver, so lively and quick,</p>
<p>I knew in a moment it must be St. Nick.</p>
<p>More rapid than eagles his coursers they came,</p>
<p>And he whistled, and shouted, and called them by name;</p>

  <code><![CDATA[
<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>Now, Dasher!</body>
</message>

<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>Now, Dancer!</body>
</message>

<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>Now, Prancer and Vixen!</body>
</message> 

<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>On, Comet!</body>
</message>

<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>On, Cupid!</body>
</message>

<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>On, Donder and Blitzen!</body>
</message>

<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>To the top of the porch!</body>
</message>

<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>To the top of the wall!</body>
</message>

<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>Now dash away!</body>
</message>

<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>Dash away!</body>
</message>

<message from='reindeer@chat.northpole.lit/santa' 
         to='reindeer@chat.northpole.lit' 
         type='groupchat'>
  <body>Dash away all!</body>
</message>
  ]]></code>

<p>As dry leaves that before the wild hurricane fly,</p>
<p>When they meet with an obstacle, mount to the sky,</p>
<p>So up to the house-top the coursers they flew,</p>
<p>With the sleigh full of toys, and St. Nicholas too.</p>

  <code><![CDATA[
<iq type='set' 
    from='sleigh@northpole.lit/sleigh' 
    to='info.northpole.lit' 
    id='geo87361'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='sleigh/geoloc'>
      <item id='current'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'>
          <lat>41.70</lat>
          <lon>-73.92</lon>
          <alt>60</alt>
        </geoloc>
      </item>
    </publish>
  </pubsub>
</iq>
  ]]></code>

  <code><![CDATA[
<message from='info.northpole.lit' 
         to='polecom@northpole.lit'
         type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='sleigh/geoloc'>
      <item id='current'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'>
          <lat>41.70</lat>
          <lon>-73.92</lon>
          <alt>60</alt>
        </geoloc>
      </item>
    </items>
  </event>
</message>
  ]]></code>

<p>And then, in a twinkling, I heard on the roof</p>
<p>The prancing and pawing of each little hoof.</p>
<p>As I drew in my hand, and was turning around,</p>
<p>Down the chimney St. Nicholas came with a bound.</p>

  <code><![CDATA[
<iq type='set' 
    from='saintnick@northpole.lit/pda' 
    to='info.northpole.lit' 
    id='geo117362'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='kringle/geoloc'>
      <item id='current'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'>
          <lat>41.70</lat>
          <lon>-73.92</lon>
          <alt>52</alt>
        </geoloc>
      </item>
    </publish>
  </pubsub>
</iq>
  ]]></code>

  <code><![CDATA[
<message from='info.northpole.lit' to='polecom@northpole.lit'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='sleigh/geoloc'>
      <item id='current'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'>
          <lat>41.70</lat>
          <lon>-73.92</lon>
          <alt>52</alt>
        </geoloc>
      </item>
    </items>
  </event>
</message>
  ]]></code>

  <code><![CDATA[
<presence from='saintnick@northpole.lit/pda' to='house@chat.twas-the-night.lit/santa'/>
  ]]></code>

<p>He was dressed all in fur, from his head to his foot,</p>
<p>And his clothes were all tarnished with ashes and soot;</p>
<p>A bundle of toys he had flung on his back,</p>
<p>And he looked like a peddler just opening his pack.</p>
<p>His eyes -- how they twinkled! his dimples how merry!</p>
<p>His cheeks were like roses, his nose like a cherry!</p>
<p>His droll little mouth was drawn up like a bow,</p>
<p>And the beard of his chin was as white as the snow;</p>
<p>The stump of a pipe he held tight in his teeth,</p>
<p>And the smoke it encircled his head like a wreath;</p>
<p>He had a broad face and a little round belly,</p>
<p>That shook, when he laughed, like a bowlful of jelly.</p>
<p>He was chubby and plump, a right jolly old elf,</p>
<p>And I laughed when I saw him in spite of myself;</p>

  <code><![CDATA[
<message from='narrator@twas-the-night.lit' 
         to='mama@twas-the-night.lit'
         type='headline>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='narrator/mood'>
      <item id='current'>
        <mood xmlns='http://jabber.org/protocol/mood'>
          <nervous/>
        </mood>
      </item>
    </items>
  </event>
</message>
  ]]></code>

<p>A wink of his eye and a twist of his head</p>
<p>Soon gave me to know I had nothing to dread.</p>

  <code><![CDATA[
<message from='narrator@twas-the-night.lit' 
         to='mama@twas-the-night.lit'
         type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='narrator/mood'>
      <item ='current'>
        <mood xmlns='http://jabber.org/protocol/mood'>
          <relieved/>
        </mood>
      </item>
    </items>
  </event>
</message>
  ]]></code>

<p>He spoke not a word, but went straight to his work,</p>

  <code><![CDATA[
<iq type='set' 
    from='saintnick@northpole.lit/pda' 
    to='info.northpole.lit' 
    id='activity9412'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='kringle/activity'>
      <item id='current'>
        <activity xmlns='http://jabber.org/protocol/activity'>
          <working/>
          <text xml:lang='en'>delivering toys</text>
        </activity>
      </item>
    </publish>
  </pubsub>
</iq>
  ]]></code>

  <code><![CDATA[
<message from='info.northpole.lit' to='polecom@northpole.lit'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='kringle/activity'>
      <item id='current'>
        <activity xmlns='http://jabber.org/protocol/activity'>
          <working/>
          <text xml:lang='en'>delivering toys</text>
        </activity>
      </item>
    </items>
  </event>
</message>
  ]]></code>

<p>And filled all the stockings; then turned with a jerk,</p>
<p>And laying his finger aside of his nose</p>
<p>And giving a nod, up the chimney he rose.</p>

  <code><![CDATA[
<iq type='set' 
    from='saintnick@northpole.lit/pda' 
    to='info.northpole.lit' 
    id='geo117363'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='kringle/geoloc'>
      <item id='current'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'>
          <lat>41.70</lat>
          <lon>-73.92</lon>
          <alt>60</alt>
        </geoloc>
      </item>
    </publish>
  </pubsub>
</iq>
  ]]></code>

  <code><![CDATA[
<message from='info.northpole.lit' 
         to='polecom@northpole.lit'
         type='headline'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='kringle/geoloc'>
      <item id='current'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'>
          <lat>41.70</lat>
          <lon>-73.92</lon>
          <alt>60</alt>
        </geoloc>
      </item>
    </items>
  </event>
</message>
  ]]></code>

<p>He sprung to his sleigh, to his team gave a whistle,</p>
<p>And away they all flew, like the down of a thistle.</p>

  <code><![CDATA[
<iq type='set' 
    from='sleigh@northpole.lit/sleigh' 
    to='info.northpole.lit' 
    id='geo87362'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='sleigh/geoloc'>
      <item id='current'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'>
          <lat>41.70</lat>
          <lon>-73.92</lon>
          <alt>100</alt>
        </geoloc>
      </item>
    </publish>
  </pubsub>
</iq>
  ]]></code>

  <code><![CDATA[
<message from='info.northpole.lit' to='polecom@northpole.lit'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='sleigh/geoloc'>
      <item id='current'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'>
          <lat>41.70</lat>
          <lon>-73.92</lon>
          <alt>100</alt>
        </geoloc>
      </item>
    </items>
  </event>
</message>
  ]]></code>

<p>But I heard him exclaim, ere he drove out of sight --</p>

  <code><![CDATA[
<message from='house@chat.twas-the-night.lit/santa' 
         to='house@chat.twas-the-night.lit' 
         type='groupchat'>
  <body>Happy Christmas to all, and to all a good night.</body>
</message>
  ]]></code>

  <code><![CDATA[
<presence from='saintnick@northpole.lit/pda' 
          to='house@chat.twas-the-night.lit/santa' 
          type='unavailable'/>
  ]]></code>

</section1>

<section1 topic='References' anchor='refs'>
  <p>The foregoing poem, informally known as <cite>'Twas the Night Before Christmas</cite> but formally entitled <cite>Account of a Visit from St. Nicholas</cite>, was authored by Major Henry Livingston Jr. in 1807 or 1808. <note>As noted at &lt;<link url='http://rpo.library.utoronto.ca/poem/1312.html'>http://rpo.library.utoronto.ca/poem/1312.html</link>&gt;, "In the year 2000, Don Foster, an English professor at Vassar College in Poughkeepsie, New York, used external and internal evidence to show that Clement Clarke Moore could not have been the author of this poem, but that it was probably the work of Livingston, and that Moore had written another, and almost forgotten, Christmas piece, <cite>Old Santeclaus</cite>. Foster's analysis of this deception appears in his <cite>Author Unknown: On the Trail of Anonymous</cite> (New York: Henry Holt, 2000): 221-75." See also &lt;<link url='http://rpo.library.utoronto.ca/poet/204.html'>http://rpo.library.utoronto.ca/poet/204.html</link>&gt; and &lt;<link url='http://www.henrylivingston.com'>http://www.henrylivingston.com/</link>&gt;.</note></p>
  <p>This document makes reference to the following XMPP protocols:</p>
  <ul>
    <li>&rfc6121;</li>
    <li>&xep0045;</li>
    <li>&xep0060;</li>
    <li>&xep0080;</li>
    <li>&xep0090;</li>
    <li>&xep0107;</li>
    <li>&xep0108;</li>
    <li>&xep0163;</li>
  </ul>
  <p>Note: For the sake of brevity, not all protocol exchanges are shown above. Refer to the appropriate specifications for detailed protocol descriptions.</p>
</section1>

<section1 topic='Architectural Assumptions' anchor='arch'>
  <p>This document assumes the following architecture:</p>
  <code><![CDATA[
                                                   +--- info.northpole.lit (pubsub service) *
                                                   |      | 
                                                   |      | (pubsub nodes)
                                                   |      | 
+--------------------+  (s2s)  +---------------+   |      |-- kringle/activity
| twas-the-night.lit | ------- | northpole.lit |---|      |-- kringle/geoloc
+--------------------+         +---------------+   |      |-- sleigh/geoloc
    |             |                |               |
    | (users)     |                | (users)       +--- chat.northpole.lit (MUC service)
    |             |                |                      |
    |-- narrator  |                |-- saintnick          | (occupants)
    |-- mama      |                |-- sleigh             |
    |-- child     |                |-- polecom **         |-- dasher
    |-- mouse     |                                       |-- dancer
                  |                                       |-- prancer
         chat.twas-the-night.lit (MUC service)            |-- vixen
                  |                                       |-- cupid
                  | (occupants)                           |-- donder
                  |                                       |-- blitzen
                  |-- santa et al. 
  ]]></code>
  <p>In addition, we assume that the twas-the-night.lit server is running a virtual pubsub service for each account it hosts (in accordance with <cite>XEP-0163</cite>) and that the users "narrator", "mama", and "child" publish information to personal pubsub nodes related to mood (<cite>XEP-0107</cite>), activity (<cite>XEP-0108</cite>), and physical location (<cite>XEP-0112</cite>).</p>
  <p>* Because millions of people track the movements and activities of Santa, northpole.lit runs a highly scalable, standalone pubsub service instead of PEP at Santa's bare JID.</p>
  <p>** The U.S. Military divides its operations geographically among NORTHCOM, SOUTHCOM, EUCOM, and PACOM. Given the scale of operations implemented by Santa's workshop, it comes as no surprise that the command center at the North Pole is known as POLECOM. Naturally POLECOM subscribes to the pubsub feeds for Santa's geolocation and activity, as well as the sleigh's geolocation, just in case a search and rescue mission needs to be initiated.</p>
</section1>

<section1 topic='Internationalization Considerations' anchor='i18n'>
  <p>The protagonist of this poem is variously called (in English) St. Nicholas, St. Nick, Santa Claus, Kris Kringle, and bears a striking resemblance to the Sinterklaas of Dutch legend. Use of the name "St. Nicholas" is not meant to disparage other names for this character in English or any other language.</p>
</section1>

<section1 topic='Security Considerations' anchor='security'>
  <p>It is NOT RECOMMENDED for mere mortals to fly in reindeer-powered sleighs, to enter and exit houses through chimneys, or to perform other dangerous acts described herein.</p>
</section1>

<section1 topic='IANA Considerations' anchor='iana'>
  <p>This document requires no interaction with &IANA;.</p>
</section1>

<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  <p>This document requires no interaction with the &REGISTRAR;.</p>
</section1>

</xep>
