Skip to content
Snippets Groups Projects
Commit afdfdc05 authored by dkirov's avatar dkirov
Browse files

add completion for single message dialog

parent c159894c
No related branches found
No related tags found
No related merge requests found
......@@ -1252,6 +1252,29 @@ class SingleMessageWindow:
self.subject = ''
self.subject_entry.set_text(self.subject)
self.completion_dict = {}
if to == '':
liststore = gtkgui_helpers.get_completion_liststore(self.to_entry)
# add all contacts to the model
for jid in gajim.contacts.get_jid_list(account):
contact = gajim.contacts.get_contact_with_highest_priority(
account, jid)
self.completion_dict[jid] = contact
name = contact.name
if self.completion_dict.has_key(name):
contact1 = self.completion_dict[name]
del self.completion_dict[name]
self.completion_dict['%s (%s)' % (name, contact1.jid)] = \
contact1
self.completion_dict['%s (%s)' % (name, jid)] = contact
else:
self.completion_dict[name] = contact
for jid in self.completion_dict.keys():
contact = self.completion_dict[jid]
img = gajim.interface.roster.jabber_state_images['16'][
contact.show]
liststore.append((img.get_pixbuf(), jid))
self.xml.signal_autoconnect(self)
if gajim.config.get('saveposition'):
......@@ -1357,6 +1380,8 @@ class SingleMessageWindow:
_('Please make sure you are connected with "%s".' % self.account))
return
to_whom_jid = self.to_entry.get_text().decode('utf-8')
if self.completion_dict.has_key(to_whom_jid):
to_whom_jid = self.completion_dict[to_whom_jid].jid
subject = self.subject_entry.get_text().decode('utf-8')
begin, end = self.message_tv_buffer.get_bounds()
message = self.message_tv_buffer.get_text(begin, end).decode('utf-8')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment