From 8dcff0b2fe24617acb5c14a7098bf888487335b8 Mon Sep 17 00:00:00 2001 From: Schimon Jehudah Date: Wed, 24 Jan 2024 18:59:10 +0000 Subject: [PATCH] Fix configuration --- slixfeed/__main__.py | 14 +++++++------- slixfeed/assets/accounts.ini | 10 +++++----- slixfeed/xmpp/process.py | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/slixfeed/__main__.py b/slixfeed/__main__.py index 50c1e0f..82954e4 100644 --- a/slixfeed/__main__.py +++ b/slixfeed/__main__.py @@ -237,16 +237,16 @@ def main(): # Try configuration file values = get_value( "accounts", "XMPP Client", [ - "alias", "username", "password", "hostname", "port"]) + "alias", "jid", "password", "hostname", "port"]) alias = values[0] - username = values[1] + jid = values[1] password = values[2] hostname = values[3] port = values[4] # Use arguments if were given if args.jid: - username = args.jid + jid = args.jid if args.password: password = args.password if args.alias: @@ -257,8 +257,8 @@ def main(): port = args.port # Prompt for credentials if none were given - if not username: - username = input("Username: ") + if not jid: + jid = input("JID: ") if not password: password = getpass("Password: ") if not alias: @@ -266,9 +266,9 @@ def main(): match xmpp_type: case "client": - JabberClient(username, password, alias) + JabberClient(jid, password, alias) case "component": - JabberComponent(username, password, hostname, port, alias) + JabberComponent(jid, password, hostname, port, alias) sys.exit(0) if __name__ == "__main__": diff --git a/slixfeed/assets/accounts.ini b/slixfeed/assets/accounts.ini index ef5f150..1af250a 100644 --- a/slixfeed/assets/accounts.ini +++ b/slixfeed/assets/accounts.ini @@ -2,13 +2,15 @@ # and also from which accounts it receives instructions. [XMPP] +# JID of bot master +operator = reconnect_timeout = 30 type = client #type = component [XMPP Client] alias = Slixfeed -username = +jid = password = # Hostname (also address) may be an i2p or onion hostname hostname = @@ -17,22 +19,20 @@ port = [XMPP Component] alias = Slixfeed -username = +jid = password = hostname = port = [XMPP Profile] name = Slixfeed -alias = Slixfeed +nickname = Slixfeed role = Syndication News Bot organization = RSS Task Force url = https://gitgud.io/sjehuda/slixfeed description = XMPP news bot (supports Atom, JSON, RDF and RSS). note = This is a syndication news bot powered by Slixfeed. birthday = 21 June 2022 -# JID of bot master -operator = [XMPP Proxy] # NOTE You might want to consider support for socks4 too (this diff --git a/slixfeed/xmpp/process.py b/slixfeed/xmpp/process.py index 4824575..cdf39e2 100644 --- a/slixfeed/xmpp/process.py +++ b/slixfeed/xmpp/process.py @@ -202,7 +202,7 @@ async def message(self, message): response = None match message_lowercase: # case "breakpoint": - # if jid == get_value("accounts", "XMPP Profile", "operator"): + # if jid == get_value("accounts", "XMPP", "operator"): # breakpoint() # print("task_manager[jid]") # print(task_manager[jid]) @@ -372,7 +372,7 @@ async def message(self, message): send_reply_message(self, message, response) case _ if message_lowercase.startswith("bookmark -"): if jid == get_value( - "accounts", "XMPP Profile", "operator"): + "accounts", "XMPP", "operator"): muc_jid = message_text[11:] await bookmark.remove(self, muc_jid) response = ( @@ -386,7 +386,7 @@ async def message(self, message): send_reply_message(self, message, response) case "bookmarks": if jid == get_value( - "accounts", "XMPP Profile", "operator"): + "accounts", "XMPP", "operator"): response = await action.list_bookmarks(self) else: response = (