# HG changeset patch # User Goffi # Date 1592573972 -7200 # Node ID 04a7d77ed86f4eb83f6d1273388c0eaac1020cbe # Parent 9a174abafdeea06afd184867cc2e02cb0e0cb1bb plugin file sharing management: added a fileSharingDelete method diff -r 9a174abafdee -r 04a7d77ed86f sat/plugins/plugin_comp_file_sharing_management.py --- a/sat/plugins/plugin_comp_file_sharing_management.py Fri Jun 19 15:38:17 2020 +0200 +++ b/sat/plugins/plugin_comp_file_sharing_management.py Fri Jun 19 15:39:32 2020 +0200 @@ -73,6 +73,14 @@ self._c = host.plugins["XEP-0050"] self._t = host.plugins["XEP-0264"] self.files_path = host.getLocalPath(None, C.FILES_DIR, profile=False) + host.bridge.addMethod( + "fileSharingDelete", + ".plugin", + in_sign="ssss", + out_sign="", + method=self._delete, + async_=True, + ) def profileConnected(self, client): self._c.addAdHocCommand( @@ -91,6 +99,16 @@ allowed_magics=C.ENTITY_ALL, ) + def _delete(self, service_jid_s, path, namespace, profile): + client = self.host.getClient(profile) + service_jid = jid.JID(service_jid_s) if service_jid_s else None + return defer.ensureDeferred(self._c.sequence( + client, + [{"path": path, "namespace": namespace}, {"confirm": True}], + NS_FILE_MANAGEMENT_DELETE, + service_jid, + )) + def _err(self, reason): """Helper method to get argument to return for error