plugin XEP-0346: "Form Discovery and Publishing" implementation:
this implementation replaces the former non standard node schema, and works in a similar way (the schema is put in a separated node instead of a special field, thus it will now work with most/all PubSub services, and not only SàT PubSub). The implementation has been done in a way that nothing should be changed in frontends (bridge methods names and arguments stay the same). The nodes are modified, but if values are taken from backend, it's automatically adapted.
This commit is contained in:
parent
df6f87d69a
commit
968ee50d31
1 changed files with 158 additions and 134 deletions
|
|
@ -32,7 +32,7 @@ PLUGIN_INFO = {
|
|||
C.PI_NAME: "tickets import",
|
||||
C.PI_IMPORT_NAME: "TICKETS_IMPORT",
|
||||
C.PI_TYPE: C.PLUG_TYPE_IMPORT,
|
||||
C.PI_DEPENDENCIES: ["IMPORT", "XEP-0060", "XEP-0277", "PUBSUB_SCHEMA"],
|
||||
C.PI_DEPENDENCIES: ["IMPORT", "XEP-0060", "XEP-0277", "XEP-0346"],
|
||||
C.PI_MAIN: "TicketsImportPlugin",
|
||||
C.PI_HANDLER: "no",
|
||||
C.PI_DESCRIPTION: _(
|
||||
|
|
@ -45,7 +45,7 @@ OPT_MAPPING = "mapping"
|
|||
FIELDS_LIST = ("labels", "cc_emails") # fields which must have a list as value
|
||||
FIELDS_DATE = ("created", "updated")
|
||||
|
||||
NS_TICKETS = "org.salut-a-toi.tickets:0"
|
||||
NS_TICKETS = "fdp/submitted/org.salut-a-toi.tickets:0"
|
||||
|
||||
|
||||
class TicketsImportPlugin(object):
|
||||
|
|
@ -59,7 +59,7 @@ class TicketsImportPlugin(object):
|
|||
self._importers = {}
|
||||
self._p = host.plugins["XEP-0060"]
|
||||
self._m = host.plugins["XEP-0277"]
|
||||
self._s = host.plugins["PUBSUB_SCHEMA"]
|
||||
self._s = host.plugins["XEP-0346"]
|
||||
host.plugins["IMPORT"].initialize(self, "tickets")
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
|
@ -161,8 +161,10 @@ class TicketsImportPlugin(object):
|
|||
id=id_, title=ticket_data.get("title", "")
|
||||
)
|
||||
)
|
||||
return self._s.sendDataFormItem(
|
||||
client, service, node, ticket_data, session["schema"], id_
|
||||
return defer.ensureDeferred(
|
||||
self._s.sendDataFormItem(
|
||||
client, service, node, ticket_data, session["schema"], id_
|
||||
)
|
||||
)
|
||||
|
||||
def itemFilters(self, client, ticket_data, session, options):
|
||||
|
|
|
|||
Loading…
Reference in a new issue