From 3913f740ef6fd49252b715da925f314d83fd6dc9 Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Thu, 1 Aug 2024 12:53:16 +0300 Subject: [PATCH] Add MUC Ad-Hoc instructions (Thank you roughnecks); Fix automatic publishing mechanism by not excluding own JID; Update index of commands and URLs. --- slixfeed/assets/about.toml | 2 +- slixfeed/assets/commands.toml | 12 +++++ slixfeed/assets/information.toml | 2 +- slixfeed/documentation/adhoc_commands_muc.md | 56 ++++++++++++++++++++ slixfeed/syndication.py | 2 - slixfeed/version.py | 4 +- slixfeed/xmpp/client.py | 12 ++--- 7 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 slixfeed/documentation/adhoc_commands_muc.md diff --git a/slixfeed/assets/about.toml b/slixfeed/assets/about.toml index dfda852..52ff1f5 100644 --- a/slixfeed/assets/about.toml +++ b/slixfeed/assets/about.toml @@ -245,7 +245,7 @@ and webhooks. User ⇄ XMPP client ⇄ XMPP Server ⇄ XMPP Bot ⇄ REST API """] interface = "Groupchat" -url = "https://github.com/nioc/xmpp-bot" +url = "https://git.xmpp-it.net/roughnecks/xmpp-bot" [[legal]] title = "Legal" diff --git a/slixfeed/assets/commands.toml b/slixfeed/assets/commands.toml index d1e5115..753233c 100644 --- a/slixfeed/assets/commands.toml +++ b/slixfeed/assets/commands.toml @@ -213,6 +213,18 @@ read Display specified entry number from given by given . """ +[pubsub] +pubsub = """ +pubsub [off|on] +Designate JID as PubSub service. +""" + +[send] +send = """ +send / +Send feeds to given JID. +""" + [search] feeds = """ feeds diff --git a/slixfeed/assets/information.toml b/slixfeed/assets/information.toml index 0311878..31f244f 100644 --- a/slixfeed/assets/information.toml +++ b/slixfeed/assets/information.toml @@ -3,7 +3,7 @@ info = """ Slixfeed is a news broker bot for syndicated news which aims to be \ an easy to use and fully-featured news aggregating bot. -Slixfeed provides a convenient access to Blogs, News sites and \ +Slixfeed provides a convenient access to Blogs, News websites and \ even Fediverse instances, along with filtering and other privacy \ driven functionalities. diff --git a/slixfeed/documentation/adhoc_commands_muc.md b/slixfeed/documentation/adhoc_commands_muc.md new file mode 100644 index 0000000..7e7eb7f --- /dev/null +++ b/slixfeed/documentation/adhoc_commands_muc.md @@ -0,0 +1,56 @@ +# Set Slixfeed Ad-Hoc Commands in MUC + +This documents provides instructions for setting Slixfeed Ad-Hoc Commands on your XMPP server + +These instruction are currently applied only to Prosody XMPP server. + +We encourage to contribute instructions for other XMPP servers. + +## Prosody + +First of all install the relative Community Module: + +``` +$ sudo prosodyctl install --server=https://modules.prosody.im/rocks/ mod_muc_adhoc_bots +``` + +Then enable the module in your **MUC component** (`/etc/prosody/prosody.cfg.lua`), like this: + +``` +modules_enabled = { +"muc_mam", +"vcard_muc", +… +"muc_adhoc_bots", +… +"server_contact_info" +} +``` + +Last part is the bot's configuration, which goes again under the MUC component settings: + +``` +adhoc_bots = { "bot@jabber.i2p/slixfeed" } +``` + +Substitute `bot@jabber.i2p/slixfeed` with your bot JID and device name which has to correspond to `accounts.toml` settings for Slixfeed configuration: + +``` +[xmpp.client] +alias = "Slixfeed" +jid = "bot@jabber.i2p/slixfeed" +``` + +Reload the Prosody config and then load the module you just enabled under MUC component, or simply restart the XMPP server. + +``` +$ sudo prosodyctl shell + +prosody> config:reload() +prosody> module:load('muc_adhoc_bots', "muc_component.jabber.i2p") +prosody> bye +``` + +Authors: + +- Simone Canaletti (roughnecks) \ No newline at end of file diff --git a/slixfeed/syndication.py b/slixfeed/syndication.py index 4997362..30090e7 100644 --- a/slixfeed/syndication.py +++ b/slixfeed/syndication.py @@ -1376,8 +1376,6 @@ class FeedTask: def restart_task(self, jid_bare): - if jid_bare == self.boundjid.bare: - return if jid_bare not in self.task_manager: self.task_manager[jid_bare] = {} logger.info('Creating new task manager for JID {}'.format(jid_bare)) diff --git a/slixfeed/version.py b/slixfeed/version.py index cb49764..c9b9e9c 100644 --- a/slixfeed/version.py +++ b/slixfeed/version.py @@ -1,2 +1,2 @@ -__version__ = '0.1.93' -__version_info__ = (0, 1, 93) +__version__ = '0.1.94' +__version_info__ = (0, 1, 94) diff --git a/slixfeed/xmpp/client.py b/slixfeed/xmpp/client.py index 42b9306..01cee2e 100644 --- a/slixfeed/xmpp/client.py +++ b/slixfeed/xmpp/client.py @@ -463,7 +463,7 @@ class XmppClient(slixmpp.ClientXMPP): logger.debug(message_log.format(function_name, jid_full)) # await task.check_readiness(self, presence) jid_bare = presence['from'].bare - if jid_bare in self.boundjid.bare: + if jid_bare == self.boundjid.bare: return if presence['show'] in ('away', 'dnd', 'xa'): if (jid_bare in self.task_manager and @@ -532,7 +532,7 @@ class XmppClient(slixmpp.ClientXMPP): message_log = '{}: jid_full: {}' logger.debug(message_log.format(function_name, jid_full)) jid_bare = presence['from'].bare - if jid_bare in self.boundjid.bare: + if jid_bare == self.boundjid.bare: return # FIXME TODO Find out what is the source responsible for a couple presences with empty message # NOTE This is a temporary solution @@ -625,7 +625,7 @@ class XmppClient(slixmpp.ClientXMPP): message_log = '{}: jid_full: {}' logger.debug(message_log.format(function_name, jid_full)) jid_bare = message['from'].bare - if jid_bare in self.boundjid.bare: + if jid_bare == self.boundjid.bare: return if message['type'] in ('chat', 'normal'): # NOTE: Required for Cheogram @@ -671,7 +671,7 @@ class XmppClient(slixmpp.ClientXMPP): message_log = '{}: jid_full: {}' logger.debug(message_log.format(function_name, jid_full)) jid_bare = message['from'].bare - if jid_bare in self.boundjid.bare: + if jid_bare == self.boundjid.bare: return if message['type'] in ('chat', 'normal'): XmppStatusTask.restart_task(self, jid_bare) @@ -688,7 +688,7 @@ class XmppClient(slixmpp.ClientXMPP): message_log = '{}: jid_full: {}' logger.debug(message_log.format(function_name, jid_full)) jid_bare = message['from'].bare - if jid_bare in self.boundjid.bare: + if jid_bare == self.boundjid.bare: return if message['type'] in ('chat', 'normal'): XmppStatusTask.restart_task(self, jid_bare) @@ -705,7 +705,7 @@ class XmppClient(slixmpp.ClientXMPP): message_log = '{}: jid_full: {}' logger.debug(message_log.format(function_name, jid_full)) jid_bare = message['from'].bare - if jid_bare in self.boundjid.bare: + if jid_bare == self.boundjid.bare: return if message['type'] in ('chat', 'normal'): XmppStatusTask.restart_task(self, jid_bare)