# HG changeset patch # User souliane # Date 1425474243 -3600 # Node ID 32ccda01a2beb9ca7d709bdbad7171402ce1fd10 # Parent 273b044fde6defe2c1ad52f7db66cee6c2398b56 frontends (primitivus): fixes MUC nicks completion diff -r 273b044fde6d -r 32ccda01a2be frontends/src/primitivus/primitivus --- a/frontends/src/primitivus/primitivus Wed Mar 04 14:17:38 2015 +0100 +++ b/frontends/src/primitivus/primitivus Wed Mar 04 14:04:03 2015 +0100 @@ -69,25 +69,27 @@ def _nick_completion(self, text, completion_data): """Completion method which complete pseudo in group chat for params, see AdvancedEdit""" - contact = self.host.contact_list.getContact() ###Based on the fact that there is currently only one contact selectable at once - if contact: - chat = self.host.chat_wins[contact] - if chat.type != "group": - return text - space = text.rfind(" ") - start = text[space+1:] - nicks = list(chat.occupants) + nicks = [] + for profile, clist in self.host.contact_lists.iteritems(): + for contact in clist.getContacts(): + chat = self.host.widgets.getWidget(quick_chat.QuickChat, contact, profile) + if chat.type != C.CHAT_GROUP: + continue + space = text.rfind(" ") + start = text[space + 1:] + nicks.extend(list(chat.occupants)) + if nicks: nicks.sort() try: - start_idx=nicks.index(completion_data['last_nick'])+1 + start_idx = nicks.index(completion_data['last_nick']) + 1 if start_idx == len(nicks): start_idx = 0 - except (KeyError,ValueError): + except (KeyError, ValueError): start_idx = 0 - for idx in range(start_idx,len(nicks)) + range(0,start_idx): + for idx in range(start_idx, len(nicks)) + range(0, start_idx): if nicks[idx].lower().startswith(start.lower()): completion_data['last_nick'] = nicks[idx] - return text[:space+1] + nicks[idx] + (': ' if space < 0 else '') + return text[:space + 1] + nicks[idx] + (': ' if space < 0 else '') return text def onTextEntered(self, editBar):