Group: GNU Social P2P/Design/End2End
m |
(friend request) |
||
Line 6: | Line 6: | ||
=== Send Message === | === Send Message === | ||
+ | |||
+ | An e-mail style message can be sent to a friend in the following fashion: | ||
put("/mail/message/$id", | put("/mail/message/$id", | ||
Line 25: | Line 27: | ||
=== Receive Message === | === Receive Message === | ||
− | + | On the receiving side, the following event fires when the ''send'' from the previous section is received: | |
on_receive("/mounts/mail/$friend_id/mail/message/$id"): | on_receive("/mounts/mail/$friend_id/mail/message/$id"): | ||
− | + | the UI sticks a pointer to the new message in the local inbox: | |
− | $ | + | put("/mail/inbox/$seq", { path: "/mounts/mail/$friend_id/mail/message/$id"}) |
− | + | and notifies user. | |
− | + | === Add Blog Post === | |
− | + | This is a blog post style message, not addressed to a particular friend: | |
put("/blog/body/$id", | put("/blog/body/$id", | ||
Line 58: | Line 60: | ||
for each friend that is able to read ''/tag/work'': | for each friend that is able to read ''/tag/work'': | ||
send($friend, "/blog/$blog_id/post/$seq") | send($friend, "/blog/$blog_id/post/$seq") | ||
+ | |||
+ | === Friend Request === | ||
+ | |||
+ | The path "/public" is always mounted by default and is writable by anybody. | ||
+ | |||
+ | The requesting party obtains the route and pubkey for the potential friend. It then performs the following actions: | ||
+ | |||
+ | put("/public/friend/request/$id", { id: $requester_id, route: $requester_route, name: $requester_name, pubkey: $requester_pubkey }) | ||
+ | send($other_route, "/public/friend/request/$id") | ||
+ | |||
+ | On the receiving side, the following event fires: | ||
+ | |||
+ | on_receive("/public/friend/request/$id") | ||
+ | |||
+ | And the UI performs: | ||
+ | |||
+ | get("/public/friend/request/$id") | ||
+ | |||
+ | The request is presented to the receiving human, and if accepted: | ||
+ | |||
+ | put("/public/friend/accept/$id1", { id: $accepter_id, route: $accepter_route, name: $accepter_name }) | ||
+ | send($requester_route, "/public/friend/accept/$id1") | ||
+ | |||
+ | put("/friend/$requester_id", { route: $requester_route, name: $requester_name, pubkey: $requester_pubkey }) | ||
+ | mount(...) | ||
+ | |||
+ | On the requester side, the following event fires: | ||
+ | |||
+ | on_receive("/public/friend/accept/$id1") | ||
+ | |||
+ | and the UI performs: | ||
+ | |||
+ | put("/friend/$accepter_id", { route: $accepter_route, name: $accepter_name, pubkey: $accepter_pubkey }) | ||
+ | mount(...) |
Revision as of 00:21, 31 May 2010
Contents
End to End Examples
Values in curly braces are JSON encoded and encrypted.
Send Message
An e-mail style message can be sent to a friend in the following fashion:
put("/mail/message/$id", { sender: $sender, recipients: $recipients, headers: $headers, body: $body, signature: $signature } )
put("/mail/sent/$seq", { id: $id })
for each recipient:
set_control_key("/mail/message/$id", "/friend/$friend_id") send($friend, "/mail/message/$id")
Receive Message
On the receiving side, the following event fires when the send from the previous section is received:
on_receive("/mounts/mail/$friend_id/mail/message/$id"):
the UI sticks a pointer to the new message in the local inbox:
put("/mail/inbox/$seq", { path: "/mounts/mail/$friend_id/mail/message/$id"})
and notifies user.
Add Blog Post
This is a blog post style message, not addressed to a particular friend:
put("/blog/body/$id", { content: $content } )
put("/blog/blog/$blog_id/post/$seq", { author: $author, meta: $meta, body_id: $id, blog_id: $blog_id, } )
set_control_key(..., "/tag/work")
for each friend that is able to read /tag/work:
send($friend, "/blog/$blog_id/post/$seq")
Friend Request
The path "/public" is always mounted by default and is writable by anybody.
The requesting party obtains the route and pubkey for the potential friend. It then performs the following actions:
put("/public/friend/request/$id", { id: $requester_id, route: $requester_route, name: $requester_name, pubkey: $requester_pubkey }) send($other_route, "/public/friend/request/$id")
On the receiving side, the following event fires:
on_receive("/public/friend/request/$id")
And the UI performs:
get("/public/friend/request/$id")
The request is presented to the receiving human, and if accepted:
put("/public/friend/accept/$id1", { id: $accepter_id, route: $accepter_route, name: $accepter_name }) send($requester_route, "/public/friend/accept/$id1") put("/friend/$requester_id", { route: $requester_route, name: $requester_name, pubkey: $requester_pubkey }) mount(...)
On the requester side, the following event fires:
on_receive("/public/friend/accept/$id1")
and the UI performs:
put("/friend/$accepter_id", { route: $accepter_route, name: $accepter_name, pubkey: $accepter_pubkey }) mount(...)