summaryrefslogtreecommitdiff
path: root/docs/olpc.xml
blob: e376b768a6c4c00ea5577829285634db525f9b9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep [
  <!ENTITY NS_OLPC_ACTIVITIES "http://laptop.org/xmpp/activities">
  <!ENTITY NS_OLPC_ACTIVITY_PROPS "http://laptop.org/xmpp/activity-properties">
  <!ENTITY NS_OLPC_BUDDY_PROPS "http://laptop.org/xmpp/buddy-properties">
  <!ENTITY NS_OLPC_CURRENT_ACTIVITY "http://laptop.org/xmpp/current-activity">
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
  <title>OLPC-specific properties (as used in Trial-3 and 1.0)</title>
  <abstract>Properties for the Activity and Buddy abstractions used in the
    One Laptop per Child's Sugar environment.</abstract>
  <legal>Copyright (c) 2007 Collabora Limited. This document may be
    distributed under the same terms as the Telepathy specification.</legal>
  <number>proto-olpc-trial3</number>
  <status>ProtoXEP</status>
  <type>Extension</type>
  <sig>Standards</sig>
  <approver>Telepathy project</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XEP-0045</spec>
    <spec>XEP-proto-llmuc</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>NOT YET ASSIGNED</shortname>
  <author>
    <firstname>Simon</firstname>
    <surname>McVittie</surname>
    <email>simon.mcvittie@collabora.co.uk</email>
    <jid>simon.mcvittie@collabora.co.uk</jid>
  </author>
  <revision>
    <version>0.0.1</version>
    <date>2007-10-01</date>
    <initials>smcv</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>
<section1 topic='Introduction' anchor='intro'>
  <p>This document describes the protocol used to transfer OLPC-specific
    buddy (contact) and activity (chat room) information.</p>
</section1>
<section1 topic='Requirements' anchor='reqs'>
  <p>The OLPC Sugar environment has the abstractions of a Buddy (corresponding
    to a child and/or their laptop (XO), represented in XMPP by a JID and in
    link-local XMPP by a _presence._tcp record) and an Activity (corresponding to
    a shared activity, represented in XMPP by a MUC and in link-local XMPP by a
    llmuc chatroom). The API requires that various properties can be browsed for
    (without joining any activities or chatrooms).</p>
</section1>

<section1 topic='Use Cases' anchor='usecases'>
  <section2 topic='Buddy properties'>

    <p>Buddy properties are published in PEP. As currently implemented,
      all XOs subscribe to the presence and buddy properties of all other
      XOs on the same server.</p>

    <p>The buddy properties currently supported are ip4-address, key and
      color.</p>

    <example caption='Publishing buddy properties'>
    <![CDATA[
    <iq type="set" id="345265478350"
      from='1111111111111111111111111111111111111111@jabber.laptop.org'>
      <pubsub xmlns="http://jabber.org/protocol/pubsub">
        <publish node="http://laptop.org/xmpp/buddy-properties">
          <item>
            <properties xmlns="http://laptop.org/xmpp/buddy-properties">
              <property type="str" name="ip4-address">10.0.0.123</property>
              <property type="bytes" name="key">Base64Base64...</property>
              <property type="str" name="color">#005FE4,#00A0FF</property>
            </properties>
          </item>
        </publish>
      </pubsub>
    </iq>
    ]]>
    </example>

    <p>Subscribers receive the change notification, as usual for PEP.
      (For all the other PEP nodes described in this document, the process
      is the same, and has been omitted from this document for
      conciseness.)</p>

    <example caption='Subscriber receives buddy properties notification'>
    <![CDATA[
    <message
      from='1111111111111111111111111111111111111111@jabber.laptop.org'
      to='2222222222222222222222222222222222222222@jabber.laptop.org/Telepathy'>
      <event xmlns='http://jabber.org/protocol/pubsub#event'>
        <items node='http://laptop.org/xmpp/current-activity'>
          <item>
            <properties xmlns="http://laptop.org/xmpp/buddy-properties">
              <property type="str" name="ip4-address">10.0.0.123</property>
              <property type="bytes" name="key">Base64Base64...</property>
              <property type="str" name="color">#005FE4,#00A0FF</property>
            </properties>
          </item>
        </items>
      </event>
    </message>
    ]]>
    </example>

    <section3 topic='Buddy properties in link-local XMPP'>
      <p>In link-local XMPP, none of this happens. Instead, the ip4-address
        property is implicitly available, and the key and color properties
        are encoded in the _presence._tcp TXT record.</p>

      <p>The 'color' property is mapped to the 'olpc-color' TXT record key:</p>

      <code>
        11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-color=#005FE4,#00A0FF"
      </code>

      <p>The 'key' property is mapped to the 'olpc-key-part0',
        'olpc-key-part1', ... properties, split as necessary to fit in
        the 255-byte limit for TXT records. Because mDNS TXT records
        are 8-bit-clean, the segments contain raw binary rather than
        the Base64 binary used in XMPP:</p>

      <code>
        11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-key-part0=binarybinary..."
        11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-key-part1=binarybinary..."
        11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-key-part2=binarybinary..."
      </code>

      <p>(As currently implemented, the "raw binary" is in fact *also*
        Base64, so the data seen in XMPP is doubly Base64'd. However, this
        is not guaranteed to remain the case, so the protocols need to
        assume the underlying byte array for the key can contain
        anything.)</p>

      <p>Implementors must be careful to ensure that there is no key
        in the TXT record for the key segment 1 greater than the last one
        they need (in this case, olpc-key-part3 must be removed if
        present).</p>
    </section3>

  </section2>

  <section2 topic='Current activity'>

    <p>The Neighbourhood view on the OLPC groups XO icons by their
      current activity, so XOs must notify each other of current-activity
      changes.</p>

    <p>As currently implemented, this is done for both public and private
      activities, which represents an information leak. (FIXME)</p>

    <p>Note that the 'type' attribute is in fact the activity ID; the name is
      for historical reasons.</p>

    <example caption='Publishing current activity'>
    <![CDATA[
    <iq type="set" id="364923889843"
      from='1111111111111111111111111111111111111111@jabber.laptop.org'>
      <pubsub xmlns="http://jabber.org/protocol/pubsub">
        <publish node="http://laptop.org/xmpp/current-activity">
          <item>
            <activity xmlns="http://laptop.org/xmpp/current-activity">
              room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org"
              type="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"/>
          </item>
        </publish>
      </pubsub>
    </iq>
    ]]>
    </example>

    <section3 topic='Current activity in link-local XMPP'>
      <p>In link-local XMPP, the current activity is mapped to a pair of
        keys in the TXT record: olpc-current-activity (the activity ID)
        and olpc-current-activity-room (the Salut rMulticast chat room
        name).</p>

      <code>
        11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-current-activity=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-current-activity-room=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      </code>
    </section3>

  </section2>

  <section2 topic='Public activity properties'>

    <p>For activities to be handled by the Sugar environment, certain
      properties are needed. Because there is no server-side storage
      corresponding to a chat room and accessible by all participants,
      participants each publish the properties of all their activities.</p>

    <p>To keep participants' idea of the activity properties in sync,
      when the properties change, the participant making the change MUST
      send a broadcast message to the chatroom, notifying other participants
      of the new properties.</p>

    <p>This &lt;message/&gt; MUST be sent before updating the PEP node
      with the activity properties.</p>

    <example caption='Notifying the chatroom of a properties change'>
    <![CDATA[
    <message type="groupchat"
      from='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org/1111111111111111111111111111111111111111'>
      to='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'>
      <properties xmlns="http://laptop.org/xmpp/activity-properties"
        activity="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org">
        <property type="str" name="type">org.laptop.Connect</property>
        <property type="str" name="name">Connect Activity</property>
        <property type="str" name="tags"></property>
        <property type="str" name="color">#005FE4,#00A0FF</property>
        <property type="bool" name="private">0</property>
      </properties>
    </message>
    ]]>
    </example>

    <p>For public activities, the participants all announce all their
      activities and their properties in a PEP node.</p>

    <p>When an activity becomes private, the participants all delete it
      from their activity-properties PEP nodes.</p>

    <example caption='Publishing activity properties'>
    <![CDATA[
    <iq type="set" id="275828931562"
      from='1111111111111111111111111111111111111111@jabber.laptop.org'>
      <pubsub xmlns="http://jabber.org/protocol/pubsub">
        <publish node="http://laptop.org/xmpp/activity-properties">
          <item>
            <activities xmlns="http://laptop.org/xmpp/activity-properties">
              <properties
                xmlns="http://laptop.org/xmpp/activity-properties"
                activity="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org">
                <property type="str" name="type">org.laptop.Connect</property>
                <property type="str" name="name">Connect Activity</property>
                <property type="str" name="tags"></property>
                <property type="str" name="color">#005FE4,#00A0FF</property>
                <property type="bool" name="private">0</property>
              </properties>
              <properties
                xmlns="http://laptop.org/xmpp/activity-properties"
                activity="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
                room="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@conference.jabber.laptop.org">
                <property type="str" name="type">org.laptop.HelloMesh</property>
                <property type="str" name="name">Example Activity</property>
                <property type="str" name="tags"></property>
                <property type="str" name="color">#005FE4,#00A0FF</property>
                <property type="bool" name="private">0</property>
              </properties>
            </activities>
          </item>
        </publish>
      </pubsub>
    </iq>
    ]]>
    </example>

    <p>The participants all announce all their list of activities in yet
      another PEP node, for backwards compatibility. This mechanism
      will be removed in a future version of this protocol.</p>

    <p>Note that again, the 'type' attribute is in fact the activity ID;
      the name is for historical reasons.</p>

    <example caption='Publishing public activity list'>
    <![CDATA[
    <iq type="set" id="116108118099">
      <pubsub xmlns="http://jabber.org/protocol/pubsub">
        <publish node="http://laptop.org/xmpp/activities">
          <item>
            <activities xmlns="http://laptop.org/xmpp/activities">
              <activity
                room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org"
                type="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"/>
              <activity
                room="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@conference.jabber.laptop.org"
                type="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"/>
            </activities>
          </item>
        </publish>
      </pubsub>
    </iq>
    ]]>
    </example>

    <section3 topic='Activity properties in link-local XMPP'>
      <p>In link-local XMPP, the activity properties are mapped to
        the _olpc-activity._udp record. Each participant in each public
        activity publishes an mDNS service named
        <em>chatroomname</em>:<em>publishedname</em>@<em>hostname</em>,
        like so:</p>

      <code>
        ; Advertised by 11111...
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity._udp.local. IN SRV 0 xo-12-34-56.local.
        _olpc_activity._udp.local. IN PTR aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity._udp.local.
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "txtvers=0"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "room=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "activity-id=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "name=Connect Activity"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "color=#005FE4,#00A0FF"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "type=org.laptop.ConnectActivity"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "tags="
        bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity._udp.local. IN SRV 0 xo-12-34-56.local.
        _olpc_activity._udp.local. IN PTR bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity._udp.local.
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "txtvers=0"
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "room=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "activity-id=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "name=Example Activity"
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "color=#005FE4,#00A0FF"
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "type=org.laptop.HelloMesh"
       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity._udp.local IN TXT "tags="

       ; Advertised by 22222... - suppose here that 22222... is in the activity
       ; aaaaa... but not in bbbbb...
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity._udp.local. IN SRV 0 xo-22-22-22.local.
       _olpc_activity._udp.local. IN PTR aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity._udp.local.
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity._udp.local IN TXT "txtvers=0"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity._udp.local IN TXT "room=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity._udp.local IN TXT "activity-id=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity._udp.local IN TXT "name=Connect Activity"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity._udp.local IN TXT "color=#005FE4,#00A0FF"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity._udp.local IN TXT "type=org.laptop.ConnectActivity"
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity._udp.local IN TXT "tags="
      </code>

      <p>The &lt;message/&gt; sent to the chat room with the updated
        properties is much the same as for XMPP:</p>

      <example caption='Notifying the chatroom of a properties change (link-local)'>
      <![CDATA[
      <!-- Sent via chatroom aaaaa... using rMulticast -->
      <message type="groupchat"
        from='11111@xo-12-34-56'
        to='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'>
        <properties xmlns="http://laptop.org/xmpp/activity-properties"
          activity="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
          room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa">
          <property type="str" name="type">org.laptop.Connect</property>
          <property type="str" name="name">Connect Activity</property>
          <property type="str" name="tags"></property>
          <property type="str" name="color">#005FE4,#00A0FF</property>
          <property type="bool" name="private">0</property>
        </properties>
      </message>
      ]]>
      </example>

    </section3>

  </section2>

  <section2 topic='Private activities'>

    <p>When an activity becomes private, the participants all delete it
      from their activity-properties and activities PEP nodes. In
      this example, the XO whose JID starts with 11111 makes the activity
      whose ID starts with aaaaa private, and removes it from their PEP nodes;
      the XO whose JID starts with 22222 responds by removing it from
      their PEP nodes too.</p>

    <p>To a third XO observing the PEP nodes, this is indistinguishable from
      both XOs leaving the activity simultaneously, which is what we want.</p>

    <example caption='Making an activity private'>
    <![CDATA[
    <message type="groupchat"
      from='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org/1111111111111111111111111111111111111111'>
      to='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'>
      <properties xmlns="http://laptop.org/xmpp/activity-properties"
        activity="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org">
        <property type="str" name="type">org.laptop.Connect</property>
        <property type="str" name="name">Connect Activity</property>
        <property type="str" name="tags"></property>
        <property type="str" name="color">#005FE4,#00A0FF</property>
        <property type="bool" name="private">1</property>
      </properties>
    </message>

    <iq type="set" id="275828931562"
      from='1111111111111111111111111111111111111111@jabber.laptop.org'>
      <pubsub xmlns="http://jabber.org/protocol/pubsub">
        <publish node="http://laptop.org/xmpp/activity-properties">
          <item>
            <activities xmlns="http://laptop.org/xmpp/activity-properties">
              <properties
                xmlns="http://laptop.org/xmpp/activity-properties"
                activity="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
                room="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@conference.jabber.laptop.org">
                <property type="str" name="type">org.laptop.HelloMesh</property>
                <property type="str" name="name">Example Activity</property>
                <property type="str" name="tags"></property>
                <property type="str" name="color">#005FE4,#00A0FF</property>
                <property type="bool" name="private">0</property>
              </properties>
            </activities>
          </item>
        </publish>
      </pubsub>
    </iq>

    <iq type="set" id="116108118099">
      <pubsub xmlns="http://jabber.org/protocol/pubsub">
        <publish node="http://laptop.org/xmpp/activities">
          <item>
            <activities xmlns="http://laptop.org/xmpp/activities">
              <activity
                room="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@conference.jabber.laptop.org"
                type="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"/>
            </activities>
          </item>
        </publish>
      </pubsub>
    </iq>

    <!-- 22222... receives the above <message/>, and responds by deleting
    activity aaaaa... from their PEP records. We assume here that 22222
    is not in any other public activity. -->

    <iq type="set" id="103874931562"
      from='2222222222222222222222222222222222222222@jabber.laptop.org'>
      <pubsub xmlns="http://jabber.org/protocol/pubsub">
        <publish node="http://laptop.org/xmpp/activity-properties">
          <item>
            <activities xmlns="http://laptop.org/xmpp/activity-properties">
            </activities>
          </item>
        </publish>
      </pubsub>
    </iq>

    <iq type="set" id="116108239899">
      <pubsub xmlns="http://jabber.org/protocol/pubsub">
        <publish node="http://laptop.org/xmpp/activities">
          <item>
            <activities xmlns="http://laptop.org/xmpp/activities">
            </activities>
          </item>
        </publish>
      </pubsub>
    </iq>
    ]]>
    </example>

    <section3 topic='Private activities in link-local XMPP'>
      <p>Instead of deleting activities from their PEP records,
        link-local peers delete them from their mDNS records.</p>

      <p>The &lt;message/&gt; sent to the chat room with the updated
        properties is, again, much the same as for XMPP.</p>
    </section3>

  </section2>

  <section2 topic='Invitations'>

    <p>Before inviting a buddy to an activity, OLPC users are expected to
      send them the activity properties. These are sent in a &lt;message/&gt;
      stanza referred to as a "pseudo-invitation". If the activity
      is private, then this is the only opportunity the invitee has to
      get the activity properties.</p>

    <example caption='Inviting a buddy to an activity'>
    <![CDATA[
    <!-- 11111 sends pseudo-invitation directly to 33333 -->
    <message
      from='1111111111111111111111111111111111111111@jabber.laptop.org/Telepathy'
      to='3333333333333333333333333333333333333333@jabber.laptop.org'>
      <properties xmlns='http://laptop.org/xmpp/activity-properties'
        activity='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
        room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'>
        <property type='str' name='type'>org.laptop.Connect</property>
        <property type='str' name='name'>Connect Activity</property>
        <property type='str' name='tags'/>
        <property type='str' name='color'>#0d1c38,#49bce4</property>
        <property type='bool' name='private'>1</property>
      </properties>
    </message>

    <!-- 11111 sends invitation to 33333 via MUC service -->
    <message
      to='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'>
      <x xmlns="http://jabber.org/protocol/muc#user">
        <invite to="3333333333333333333333333333333333333333@jabber.laptop.org"/>
      </x>
    </message>

    <!-- MUC service relays invitation to 33333 -->
    <message type='normal'
      from='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'
      to='3333333333333333333333333333333333333333@jabber.laptop.org'>
      <x xmlns='http://jabber.org/protocol/muc#user'>
        <invite from='1111111111111111111111111111111111111111@jabber.laptop.org/Telepathy'>
          <reason/>
        </invite>
      </x>
      <x xmlns='jabber:x:conference' jid='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'/>
    </message>
    ]]>
    </example>

    <p>If the activity properties change before the invitee joins the
      activity, the inviter must notify the invitee by re-sending the
      pseudo-invitation (only).</p>

    <example caption='Updating a buddy on activity properties'>
    <![CDATA[
    <message
      from='1111111111111111111111111111111111111111@jabber.laptop.org/Telepathy'
      to='3333333333333333333333333333333333333333@jabber.laptop.org'>
      <properties xmlns='http://laptop.org/xmpp/activity-properties'
        activity='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
        room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'>
        <property type='str' name='type'>org.laptop.Connect</property>
        <property type='str' name='name'>this name changed</property>
        <property type='str' name='tags'/>
        <property type='str' name='color'>#0d1c38,#49bce4</property>
        <property type='bool' name='private'>1</property>
      </properties>
    </message>
    ]]>
    </example>

    <p>If the inviter leaves the activity before the invitee joins, the
      invitee can no longer rely on being notified about any changes;
      if the activity was private, the invitee can't even rely on being
      able to see whether it exists. Accordingly, the inviter should cancel
      their invitation; if all invitations to a private activity have been
      cancelled, the invitee should assume that the activity has
      disappeared.</p>

    <example caption='Cancelling an invitation'>
    <![CDATA[
    <message
      from='1111111111111111111111111111111111111111@jabber.laptop.org/Telepathy'
      to='3333333333333333333333333333333333333333@jabber.laptop.org'>
      <uninvite xmlns='http://laptop.org/xmpp/activity-properties'
        id='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
        room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'/>
    </message>
    ]]>
    </example>
  </section2>

    <section3 topic='Invitations in link-local XMPP'>
      <p>There isn't the concept of sending an invitation via the MUC service
        in link-local XMPP, so the process can be made somewhat simpler.</p>

      <example caption='Inviting a buddy to an activity (link-local)'>
      <![CDATA[
      <!-- Sent over unicast TCP connection between xo-12-34-56.local.
      and xo-33-33-33.local. -->
      <message from='11111@xo-12-34-56' to='33333@xo-33-33-33'>
        <x xmlns='http://collabora.co.uk/protocol/llmuc'>
          <invite protocol='rmulticast'>
            <roomname>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</roomname>
            <address>224.0.0.1</address>
            <port>23453</port>
            <properties xmlns='http://laptop.org/xmpp/activity-properties'
              activity='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
              room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'>
              <property type='str' name='type'>org.laptop.Connect</property>
              <property type='str' name='name'>Connect Activity</property>
              <property type='str' name='tags'/>
              <property type='str' name='color'>#0d1c38,#49bce4</property>
              <property type='bool' name='private'>1</property>
            </properties>
          </invite>
        </x>
      </message>
      ]]>
      </example>

      <example caption='Updating a buddy on activity properties (link-local)'>
      <![CDATA[
      <!-- Sent over unicast TCP connection between xo-12-34-56.local.
      and xo-33-33-33.local. -->
      <message
        from='11111@xo-12-34-56'
        to='33333@xo-33-33-33'>
        <properties xmlns='http://laptop.org/xmpp/activity-properties'
          activity='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
          room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'>
          <property type='str' name='type'>org.laptop.Connect</property>
          <property type='str' name='name'>this name changed</property>
          <property type='str' name='tags'/>
          <property type='str' name='color'>#0d1c38,#49bce4</property>
          <property type='bool' name='private'>1</property>
        </properties>
      </message>
      ]]>
      </example>

      <example caption='Cancelling an invitation (link-local)'>
      <![CDATA[
      <!-- Sent over unicast TCP connection between xo-12-34-56.local.
      and xo-33-33-33.local. -->
      <message from='11111@xo-12-34-56' to='33333@xo-33-33-33'>
        <uninvite xmlns='http://laptop.org/xmpp/activity-properties'
          id='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
          room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'/>
      </message>
      ]]>
      </example>

    </section3>

</section1>
<section1 topic='Business Rules' anchor='rules'>
  <p>Properties have the same syntax and semantics as the "parameters" in
    XEP-proto-tubes.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
  <p>Putting the current activity in a PEP node, even if it's private,
    leaks the room name.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
  <p>None.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  <p>None.</p>
</section1>
<section1 topic='XML Schema' anchor='schema'>
  <code>
    <![CDATA[
    <!-- Buddy properties -->
    <xs:schema
      xmlns:xs='http://www.w3.org/2001/XMLSchema'
      targetNamespace='http://laptop.org/xmpp/buddy-properties'
      xmlns='http://laptop.org/xmpp/buddy-properties'
      elementFormDefault='qualified'>

      <!-- Published in the PEP node of the same namespace -->
      <xs:element name='properties'>
        <xs:complexType>
          <xs:sequence>
            <xs:element name='property' minOccurs='0' maxOccurs='unbounded'
              type='name-value-pair'/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <!-- A name-value pair (the same format as Tubes parameters, as it
      happens) -->
      <xs:complexType name='name-value-pair'>
        <xs:simpleContent>
          <xs:extension base='xs:string'>
            <xs:attribute name='name' type='xs:string'/>
            <xs:attribute name='type'>
              <xs:simpleType>
                <xs:restriction base='xs:NCName'>
                  <xs:enumeration value='bool'/>
                  <xs:enumeration value='str'/>
                  <xs:enumeration value='bytes'/>
                  <xs:enumeration value='int'/>
                  <xs:enumeration value='uint'/>
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
          </xs:extension>
        </xs:simpleContent>
      </xs:complexType>
    </xs:schema>
    ]]>
    <![CDATA[
    <!-- Activity properties -->
    <xs:schema
      xmlns:xs='http://www.w3.org/2001/XMLSchema'
      targetNamespace='http://laptop.org/xmpp/activity-properties'
      xmlns='http://laptop.org/xmpp/activity-properties'
      elementFormDefault='qualified'>

      <!-- Sent in pseudo-invitations, published in the PEP node
      of the same namespace, and sent in chatrooms -->
      <xs:element name='properties'>
        <xs:complexType>
          <!-- XMPP MUC's (bare) JID -->
          <xs:attribute name='room' use='required' type='xs:string'/>
          <!-- OLPC Activity ID (a 40-character hex string, as of Trial-3) -->
          <xs:attribute name='activity' use='required' type='xs:string'/>

          <xs:element name='property' minOccurs='0' maxOccurs='unbounded'
            type='name-value-pair'/>
        </xs:complexType>
      </xs:element>

      <!-- Sent to cancel invitations -->
      <xs:element name='uninvite'>
        <xs:complexType>
          <xs:attribute name='room' use='required' type='xs:string'/>
          <xs:attribute name='id' use='required' type='xs:string'/>
        </xs:complexType>
      </xs:element>

      <!-- A name-value pair (the same format as Tubes parameters, as it
      happens) -->
      <xs:complexType name='name-value-pair'>
        <xs:simpleContent>
          <xs:extension base='xs:string'>
            <xs:attribute name='name' type='xs:string'/>
            <xs:attribute name='type'>
              <xs:simpleType>
                <xs:restriction base='xs:NCName'>
                  <xs:enumeration value='bool'/>
                  <xs:enumeration value='str'/>
                  <xs:enumeration value='bytes'/>
                  <xs:enumeration value='int'/>
                  <xs:enumeration value='uint'/>
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
          </xs:extension>
        </xs:simpleContent>
      </xs:complexType>

      <xs:simpleType name='empty'>
        <xs:restriction base='xs:string'>
          <xs:enumeration value=''/>
        </xs:restriction>
      </xs:simpleType>
    </xs:schema>
    ]]>
    <![CDATA[
    <!-- Buddy's Activities list -->
    <xs:schema
      xmlns:xs='http://www.w3.org/2001/XMLSchema'
      targetNamespace='http://laptop.org/xmpp/activities'
      xmlns='http://laptop.org/xmpp/activities'
      elementFormDefault='qualified'>

      <!-- Published in the PEP node of the same namespace -->
      <xs:element name='activities'>
        <xs:complexType>
          <xs:sequence>
            <xs:element name='activity'>
              <xs:complexType>
                <!-- Despite its name, this attribute is actually the
                OLPC activity ID! Historical reasons... -->
                <xs:attribute name='type' type='xs:string'/>
                <!-- XMPP MUC (bare) JID -->
                <xs:attribute name='room' type='xs:string'/>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:simpleType name='empty'>
        <xs:restriction base='xs:string'>
          <xs:enumeration value=''/>
        </xs:restriction>
      </xs:simpleType>
    </xs:schema>
    ]]>
    <![CDATA[
    <!-- Buddy's current activity -->
    <xs:schema
      xmlns:xs='http://www.w3.org/2001/XMLSchema'
      targetNamespace='http://laptop.org/xmpp/current-activity'
      xmlns='http://laptop.org/xmpp/current-activity'
      elementFormDefault='qualified'>

      <!-- Published in the PEP node of the same namespace -->
      <xs:element name='activity'>
        <xs:complexType>
          <!-- Despite its name, this attribute is actually the
          OLPC activity ID! Historical reasons...
          Empty if no current activity. -->
          <xs:attribute name='type' type='xs:string'/>
          <!-- XMPP MUC (bare) JID, or empty if no current activity -->
          <xs:attribute name='room' type='xs:string'/>
        </xs:complexType>
      </xs:element>

      <xs:simpleType name='empty'>
        <xs:restriction base='xs:string'>
          <xs:enumeration value=''/>
        </xs:restriction>
      </xs:simpleType>
    </xs:schema>
    ]]>
  </code>
</section1>
</xep>