1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

funny activity stream encoding for xmpp

This commit is contained in:
psyc://psyced.org/~lynX 2011-05-15 22:59:30 +02:00
parent 5d0dad8b89
commit 19d9420eaa

View file

@ -27,7 +27,6 @@ Here's an example from paragraph 4.4.2 of RFC 6121.
to='benvolio@example.net'> to='benvolio@example.net'>
<show>away</show> <show>away</show>
</presence> </presence>
}}} }}}
And here's the same information in a JSON rendition: And here's the same information in a JSON rendition:
@ -59,11 +58,132 @@ np
}}} }}}
=== An average chat message === === An average chat message ===
=== A social network activity ===
{{{
<message
from='juliet@example.com/balcony'
id='ktx72v49'
to='romeo@example.net'
type='chat'
xml:lang='en'>
<body>Art thou not Romeo, and a Montague?</body>
</message>
}}}
=== A new status updated activity ===
Example taken from http://onesocialweb.org/spec/1.0/osw-activities.html
You could call this XML namespace hell:
{{{
<iq type='set'
from='hamlet@denmark.lit/snsclient'
to='hamlet@denmark.lit'
id='osw1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='urn:xmpp:microblog:0'>
<item>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:activity="http://activitystrea.ms/spec/1.0/"
xmlns:osw="http://onesocialweb.org/spec/1.0/">
<title>to be or not to be ?</title>
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
<activity:object>
<activity:object-type>http://onesocialweb.org/spec/1.0/object/status</activity:object-type>
<content type="text/plain">to be or not to be ?</content>
</activity:object>
<osw:acl-rule>
<osw:acl-action permission="http://onesocialweb.org/spec/1.0/acl/permission/grant">
http://onesocialweb.org/spec/1.0/acl/action/view
</osw:acl-action>
<osw:acl-subject type="http://onesocialweb.org/spec/1.0/acl/subject/everyone"/>
</osw:acl-rule>
</entry>
</item>
</publish>
</pubsub>
</iq>
}}}
http://activitystrea.ms/head/json-activity.html proposes a JSON encoding
of this. We'll have to add a routing header to it.
{{{
["activity",{"from":"hamlet@denmark.lit/snsclient"},{"verb":"post",
"title":"to be or not to be ?","object":{"type":"status",
"content":"to be or not to be ?","contentType":"text/plain"}]
}}}
http://about.psyc.eu/Activity suggests a PSYC mapping for activity
streams. Should a "status post" be considered equivalent to a presence
description announcement or just a message in the "microblogging" channel?
We'll use the latter here:
{{{
:_context psyc://denmark.lit/~hamlet#_follow
:_subject to be or not to be ?
:_type_content text/plain
_message
to be or not to be ?
|
}}}
=== A message with JSON-unfriendly characters === === A message with JSON-unfriendly characters ===
{{{
<message
from='romeo@example.net/orchard'
id='sl3nx51f'
to='juliet@example.com/balcony'
type='chat'
xml:lang='en'>
<body>"Neither, fair saint, if either thee dislike.", he said.
And
the
rest
is
history.</body>
</message>
}}}
=== A message with XML-unfriendly characters === === A message with XML-unfriendly characters ===
{{{
<message
from='juliet@example.com/balcony'
id='z94nb37h'
to='romeo@example.net'
type='chat'
xml:lang='en'>
<body>Wherefore art thou, Romeo?</body>
<body xml:lang='cs'>
Pro&#x010D;e&#x017D; jsi ty, Romeo?
</body>
</message>
}}}
=== A message with PSYC-unfriendly strings ===
{{{
<message
from='juliet@example.com/balcony'
id='c8xg3nf8'
to='romeo@example.net'
type='chat'
xml:lang='en'>
<subject>I implore you with a pointless
newline in a header variable</subject>
<body>Wherefore art thou, Romeo?
|
And for practicing purposes we added a PSYC packet delimiter.</body>
</message>
}}}
=== A packet containing a JPEG photograph === === A packet containing a JPEG photograph ===
... TBD ...
=== A random data structure === === A random data structure ===
In this test we'll not consider XMPP at all and simply compare the In this test we'll not consider XMPP at all and simply compare the
@ -107,6 +227,8 @@ _profile_user
== Conclusions == == Conclusions ==
... TBD ...
== Criticism == == Criticism ==
Are we comparing apples and oranges? Yes and no, depends on what you Are we comparing apples and oranges? Yes and no, depends on what you
@ -139,3 +261,9 @@ the performance of a chat client using the two protocols,
for instance by using libpurple with XMPP and PSYC accounts. for instance by using libpurple with XMPP and PSYC accounts.
To this purpose we first need to integrate libpsyc into libpurple. To this purpose we first need to integrate libpsyc into libpurple.
== Futures ==
After a month of development libpsyc is already performing pretty
well, but we presume various optimizations, like rewriting parts
in assembler, are possible.