Remove JID from title.

Add a command instead.
Command to be removed.
This commit is contained in:
Schimon Jehudah 2024-02-16 02:14:23 +00:00
parent 4e193a2b02
commit 8b6584fe6d

View file

@ -528,6 +528,9 @@ class Slixfeed(slixmpp.ClientXMPP):
self['xep_0050'].add_command(node='about', self['xep_0050'].add_command(node='about',
name='About', # 📜️ name='About', # 📜️
handler=self._handle_about) handler=self._handle_about)
self['xep_0050'].add_command(node='exploit',
name='Exploit', # 📜️
handler=self._handle_reveal_jid)
# self['xep_0050'].add_command(node='search', # self['xep_0050'].add_command(node='search',
# name='Search', # name='Search',
# handler=self._handle_search) # handler=self._handle_search)
@ -535,12 +538,16 @@ class Slixfeed(slixmpp.ClientXMPP):
# Special interface # Special interface
# http://jabber.org/protocol/commands#actions # http://jabber.org/protocol/commands#actions
async def _handle_reveal_jid(self, iq, session):
jid = session['from'].bare
session['notes'] = [['info', jid]]
return session
async def _handle_filters(self, iq, session): async def _handle_filters(self, iq, session):
jid = session['from'].bare jid = session['from'].bare
jid_file = jid jid_file = jid
db_file = config.get_pathname_to_database(jid_file) db_file = config.get_pathname_to_database(jid_file)
form = self['xep_0004'].make_form('form', form = self['xep_0004'].make_form('form', 'Filters')
'Filters for {}'.format(jid))
form['instructions'] = '🕸️ Manage filters' # 🪄️ form['instructions'] = '🕸️ Manage filters' # 🪄️
value = await sqlite.get_filters_value(db_file, 'allow') value = await sqlite.get_filters_value(db_file, 'allow')
form.add_field(var='allow', form.add_field(var='allow',
@ -578,7 +585,7 @@ class Slixfeed(slixmpp.ClientXMPP):
form = payload form = payload
jid = session['from'].bare jid = session['from'].bare
form = self['xep_0004'].make_form('form', 'Filters for {}'.format(jid)) form = self['xep_0004'].make_form('result', 'Filters')
form['instructions'] = ('✅️ Filters have been updated') form['instructions'] = ('✅️ Filters have been updated')
jid_file = jid jid_file = jid
db_file = config.get_pathname_to_database(jid_file) db_file = config.get_pathname_to_database(jid_file)
@ -707,8 +714,7 @@ class Slixfeed(slixmpp.ClientXMPP):
async def _handle_subscriptions(self, iq, session): async def _handle_subscriptions(self, iq, session):
jid = session['from'].bare jid = session['from'].bare
form = self['xep_0004'].make_form('form', form = self['xep_0004'].make_form('form', 'Subscriptions')
'Subscriptions for {}'.format(jid))
form['instructions'] = '📰️ Manage subscriptions' form['instructions'] = '📰️ Manage subscriptions'
# form.addField(var='interval', # form.addField(var='interval',
# ftype='text-single', # ftype='text-single',
@ -759,8 +765,7 @@ class Slixfeed(slixmpp.ClientXMPP):
# FIXME There are feeds that are missing (possibly because of sortings) # FIXME There are feeds that are missing (possibly because of sortings)
async def _handle_subscription(self, iq, session): async def _handle_subscription(self, iq, session):
jid = session['from'].bare jid = session['from'].bare
form = self['xep_0004'].make_form('form', form = self['xep_0004'].make_form('form', 'Subscriptions')
'Subscriptions for {}'.format(jid))
form['instructions'] = '📰️ Edit subscription' form['instructions'] = '📰️ Edit subscription'
# form.addField(var='interval', # form.addField(var='interval',
# ftype='text-single', # ftype='text-single',
@ -913,8 +918,7 @@ class Slixfeed(slixmpp.ClientXMPP):
async def _handle_subscription_selector(self, payload, session): async def _handle_subscription_selector(self, payload, session):
jid = session['from'].bare jid = session['from'].bare
form = self['xep_0004'].make_form('form', form = self['xep_0004'].make_form('form', 'Subscribe')
'Discovered ubscriptions for {}'.format(jid))
form['instructions'] = ('📰️ Select a subscriptions to add\n' form['instructions'] = ('📰️ Select a subscriptions to add\n'
'Subsciptions discovered for {}' 'Subsciptions discovered for {}'
.format(url)) .format(url))
@ -998,9 +1002,7 @@ class Slixfeed(slixmpp.ClientXMPP):
async def _handle_import(self, iq, session): async def _handle_import(self, iq, session):
jid = session['from'].bare form = self['xep_0004'].make_form('form', 'Import')
form = self['xep_0004'].make_form('form',
'Import data for {}'.format(jid))
form['instructions'] = '🗞️ Import feeds from OPML' form['instructions'] = '🗞️ Import feeds from OPML'
url = form.add_field(var='url', url = form.add_field(var='url',
ftype='text-single', ftype='text-single',
@ -1024,8 +1026,7 @@ class Slixfeed(slixmpp.ClientXMPP):
count = await action.import_opml(db_file, url) count = await action.import_opml(db_file, url)
try: try:
int(count) int(count)
form = self['xep_0004'].make_form('result', form = self['xep_0004'].make_form('result', 'Import')
'Import data for {}'.format(jid))
form['instructions'] = ('✅️ Feeds have been imported') form['instructions'] = ('✅️ Feeds have been imported')
message = '{} feeds have been imported to {}.'.format(count, jid) message = '{} feeds have been imported to {}.'.format(count, jid)
form.add_field(var='message', form.add_field(var='message',
@ -1043,9 +1044,7 @@ class Slixfeed(slixmpp.ClientXMPP):
async def _handle_export(self, iq, session): async def _handle_export(self, iq, session):
jid = session['from'].bare form = self['xep_0004'].make_form('form', 'Export')
form = self['xep_0004'].make_form('form',
'Export data for {}'.format(jid))
form['instructions'] = '🗞️ Export feeds' form['instructions'] = '🗞️ Export feeds'
options = form.add_field(var='filetype', options = form.add_field(var='filetype',
ftype='list-multi', ftype='list-multi',
@ -1066,8 +1065,7 @@ class Slixfeed(slixmpp.ClientXMPP):
async def _handle_export_complete(self, payload, session): async def _handle_export_complete(self, payload, session):
jid = session['from'].bare jid = session['from'].bare
jid_file = jid.replace('/', '_') jid_file = jid.replace('/', '_')
form = self['xep_0004'].make_form('result', form = self['xep_0004'].make_form('result', 'Export')
'Export data for {}'.format(jid))
form['instructions'] = ('✅️ Feeds have been exported') form['instructions'] = ('✅️ Feeds have been exported')
exts = payload['values']['filetype'] exts = payload['values']['filetype']
for ext in exts: for ext in exts:
@ -1285,8 +1283,7 @@ class Slixfeed(slixmpp.ClientXMPP):
jid = session['from'].bare jid = session['from'].bare
jid_file = jid jid_file = jid
db_file = config.get_pathname_to_database(jid_file) db_file = config.get_pathname_to_database(jid_file)
form = self['xep_0004'].make_form('form', form = self['xep_0004'].make_form('form', 'Settings')
'Settings for {}'.format(jid))
form['instructions'] = ('📮️ Customize news updates') form['instructions'] = ('📮️ Customize news updates')
value = config.get_setting_value(db_file, 'enabled') value = config.get_setting_value(db_file, 'enabled')
@ -1401,8 +1398,7 @@ class Slixfeed(slixmpp.ClientXMPP):
# form = payload # form = payload
jid = session['from'].bare jid = session['from'].bare
form = self['xep_0004'].make_form('form', form = self['xep_0004'].make_form('form', 'Settings')
'Settings for {}'.format(jid))
form['instructions'] = ('✅️ Settings have been saved') form['instructions'] = ('✅️ Settings have been saved')
jid_file = jid jid_file = jid