can now complete with NOTHING in the node

This commit is contained in:
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 2010-11-29 18:54:30 +00:00
parent cbcec6a798
commit a96188385f
2 changed files with 10 additions and 8 deletions

View file

@ -930,13 +930,18 @@ class Core(object):
if jid.resource or jid.full.endswith('/'): if jid.resource or jid.full.endswith('/'):
# we are writing the resource: complete the node # we are writing the resource: complete the node
if not the_input.last_completion: if not the_input.last_completion:
items = self.xmpp.plugin['xep_0030'].getItems(jid.server)['disco_items'].getItems() response = self.xmpp.plugin['xep_0030'].getItems(jid.server)
log.debug('HEY: %s\n' % response)
if response:
items = response['disco_items'].getItems()
else:
return True
items = ['%s/%s' % (tup[0], jid.resource) for tup in items] items = ['%s/%s' % (tup[0], jid.resource) for tup in items]
for i in range(len(jid.server) + 2 + len(jid.resource)): for i in range(len(jid.server) + 2 + len(jid.resource)):
log.debug('allo')
the_input.key_backspace() the_input.key_backspace()
else: else:
items = [] items = []
log.debug('%s\n' % items)
the_input.auto_completion(items, '') the_input.auto_completion(items, '')
else: else:
# we are writing the server: complete the server # we are writing the server: complete the server

View file

@ -832,15 +832,12 @@ class Input(Win):
""" """
(y, x) = self._win.getyx() (y, x) = self._win.getyx()
if not self.last_completion: if not self.last_completion:
# begin is the begining of the nick we want to complete # begin is the begining of the word we want to complete
# if self.text.strip() != '' and\ if self.text.strip() and not self.text.endswith(' '):
# not self.text.endswith(after):
if self.text.strip():
begin = self.text.split()[-1].lower() begin = self.text.split()[-1].lower()
else: else:
begin = '' begin = ''
# else: log.debug('BEGIN: [%s]\n' % begin)
# begin = ''
hit_list = [] # list of matching nicks hit_list = [] # list of matching nicks
for word in word_list: for word in word_list:
if word.lower().startswith(begin): if word.lower().startswith(begin):