Bridge API - Microblogging/en

De Goffiwiki
Aller à : navigation, rechercher


Microblogging need at least plugin XEP-0277 and its dependencies to work

Microblogging is a major feature of SàT, it manages rich contents (in any text-syntaxes plugin supported syntax), comments, group permissions, etc.

We'll see how to get microblogs first, then how to send them.

The microblogging data is managed between the frontend and the backend by a dictionary of strings, which can contain the following keys:

  • id: item identifier
  • atom_id: atom entry identifier
  • updated: time of last update (unix time)
  • published: time of initial publication (unix time)
  • language: language of the content
  • comments*: uri to the comments node, if any
  • comments*_service: service for comments, if any
  • comments*_node: node for comments, if any
  • tag*: tag, if any
  • author: human readable name of the entry author
  • author_jid: jid of the entry author. In frontend to backend direction, if it's not specified, profile's jid will be used.
  • author_email: email of the entry author
  • author_jid_verified: if False, the jid can't be guaranted (a warning symbol should be displayed to the user), if True it is checked
  • content: the text content of the message
  • content_rich: the rich content of the message, in current text syntax. It will be automatically converted to xhtml. content_rich is never provided by backend, it can only be provided by frontend to backend.
  • content_xhtml: the XHTML content of the message
  • title: the title of the message
  • title_rich: the rich title of the message, in current text syntax. It will be automatically converted to xhtml. title_rich is never provided by backend, it can only be provided by frontend to backend.
  • title_xhtml: the XHTML content of the message

at least one content or title is mandatory, if no text content is given, the backend will make one from the xhtml one. There cannot be rich and xhtml contents at the same time.

multiple keys

For keys using a "*" in their name, there can be several of them. The first one will then be named "xxx", when the following ones will be "xxx#1, "xxx#2" and so on.

example: there can be 0, 1 or more comments nodes. If present, the first key will be named comments, then comments#1, comments#2, etc.

You can use sat.tools.common.data_format.dict2iter and iter2dict to handle (de)serialising lists with this convention.

Frontend to backend

The folowing keys only make sense in frontend to backend direction

  • allow_comments (default: False): True to accept comments. If True, a comment node will be created, and linked to the blog item.