diff --git a/publishx.py b/publishx.py index 0761664..886efd5 100644 --- a/publishx.py +++ b/publishx.py @@ -55,14 +55,14 @@ async def create(self, server, node, feed): ftype='text-single', value=description) - task = iq.send(timeout=5) - try: - await task - except IqError as e: - if e.etype == 'cancel' and e.condition == 'conflict': - print(colored('!! node %s is already created, assuming its configuration is correct' % node, 'yellow')) - return - raise + node_exist = await self.plugin['xep_0060'].get_node_config(server, node) + if not node_exist: + task = iq.send(timeout=5) + try: + await task + except (IqError, IqTimeout) as e: + print('Error:', str(e)) + raise async def publish(self, server, node, entry, version): iq = self.Iq(stype="set", sto=server) @@ -153,4 +153,4 @@ async def publish(self, server, node, entry, version): pass def published(self): - print('published') \ No newline at end of file + print('published')