Mercurial > libervia-backend
comparison sat/plugins/plugin_exp_invitation.py @ 3781:e2a1ac1afb38
plugin invitation: use `store` hint to be sure that the invitation is archived
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 16 May 2022 14:20:01 +0200 |
parents | be6d91572633 |
children | 3ef988734869 |
comparison
equal
deleted
inserted
replaced
3780:2c187445a3d3 | 3781:e2a1ac1afb38 |
---|---|
35 PLUGIN_INFO = { | 35 PLUGIN_INFO = { |
36 C.PI_NAME: "Invitation", | 36 C.PI_NAME: "Invitation", |
37 C.PI_IMPORT_NAME: "INVITATION", | 37 C.PI_IMPORT_NAME: "INVITATION", |
38 C.PI_TYPE: "EXP", | 38 C.PI_TYPE: "EXP", |
39 C.PI_PROTOCOLS: [], | 39 C.PI_PROTOCOLS: [], |
40 C.PI_DEPENDENCIES: ["XEP-0060", "XEP-0329", "LIST_INTEREST"], | 40 C.PI_DEPENDENCIES: ["XEP-0060", "XEP-0329", "XEP-0334", "LIST_INTEREST"], |
41 C.PI_RECOMMENDATIONS: ["EMAIL_INVITATION"], | 41 C.PI_RECOMMENDATIONS: ["EMAIL_INVITATION"], |
42 C.PI_MAIN: "Invitation", | 42 C.PI_MAIN: "Invitation", |
43 C.PI_HANDLER: "yes", | 43 C.PI_HANDLER: "yes", |
44 C.PI_DESCRIPTION: _("Experimental handling of invitations"), | 44 C.PI_DESCRIPTION: _("Experimental handling of invitations"), |
45 } | 45 } |
55 | 55 |
56 def __init__(self, host): | 56 def __init__(self, host): |
57 log.info(_("Invitation plugin initialization")) | 57 log.info(_("Invitation plugin initialization")) |
58 self.host = host | 58 self.host = host |
59 self._p = self.host.plugins["XEP-0060"] | 59 self._p = self.host.plugins["XEP-0060"] |
60 self._h = self.host.plugins["XEP-0334"] | |
60 # map from namespace of the invitation to callback handling it | 61 # map from namespace of the invitation to callback handling it |
61 self._ns_cb = {} | 62 self._ns_cb = {} |
62 | 63 |
63 def getHandler(self, client): | 64 def getHandler(self, client): |
64 return PubsubInvitationHandler(self) | 65 return PubsubInvitationHandler(self) |
111 "type": C.MESS_TYPE_CHAT, | 112 "type": C.MESS_TYPE_CHAT, |
112 "subject": {}, | 113 "subject": {}, |
113 "extra": {}, | 114 "extra": {}, |
114 } | 115 } |
115 client.generateMessageXML(mess_data) | 116 client.generateMessageXML(mess_data) |
117 self._h.addHintElements(mess_data["xml"], [self._h.HINT_STORE]) | |
116 invitation_elt = mess_data["xml"].addElement("invitation", NS_INVITATION) | 118 invitation_elt = mess_data["xml"].addElement("invitation", NS_INVITATION) |
117 if name is not None: | 119 if name is not None: |
118 invitation_elt["name"] = name | 120 invitation_elt["name"] = name |
119 thumb_url = extra.get('thumb_url') | 121 thumb_url = extra.get('thumb_url') |
120 if thumb_url: | 122 if thumb_url: |