Show
Ignore:
Timestamp:
05/02/08 04:32:28 (7 months ago)
Author:
bct
Message:

fixed groupchat

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/session_centric/src/message_window.py

    r9548 r9556  
    397397                        gtkgui_helpers.set_unset_urgency_hint(self.window, False) 
    398398 
    399         def set_active_tab(self, session): 
    400                 ctrl = self._controls[session.conn.name][session.jid][session.thread_id] 
     399        def set_active_tab(self, ctrl): 
    401400                ctrl_page = self.notebook.page_num(ctrl.widget) 
    402401                self.notebook.set_current_page(ctrl_page) 
     
    539538                        ctrl.update_tags() 
    540539 
    541         def get_control(self, key, acct): 
     540        def get_control(self, key, acct, thread_id): 
    542541                '''Return the MessageControl for jid or n, where n is a notebook page index. 
    543                 When key is an int index acct may be None''' 
     542                When key is an int index acct and thread_id may be None''' 
    544543                if isinstance(key, str): 
    545544                        key = unicode(key, 'utf-8') 
     
    548547                        jid = key 
    549548                        try: 
    550                                 return self._controls[acct][jid] 
     549                                return self._controls[acct][jid][thread_id] 
    551550                        except: 
    552551                                return None 
     
    558557                        nth_child = notebook.get_nth_page(page_num) 
    559558                        return self._widget_to_control(nth_child) 
     559 
     560        def get_gc_control(self, jid, acct): 
     561                return self.get_control(jid, acct, 'gc') 
     562 
     563        def get_controls(self, jid, acct): 
     564                try: 
     565                        return self._controls[acct][jid].values() 
     566                except KeyError: 
     567                        return [] 
    560568 
    561569        def change_key(self, old_jid, new_jid, acct): 
     
    595603                                if ind < 0: 
    596604                                        ind = self.notebook.get_n_pages() - 1 
    597                         ctrl = self.get_control(ind, None) 
     605                        ctrl = self.get_control(ind, None, None) 
    598606                        if ctrl.get_nb_unread() > 0: 
    599607                                found = True 
     
    787795        def get_window(self, jid, acct): 
    788796                for win in self.windows(): 
    789                         if win.get_control(jid, acct): 
    790                                 return win 
     797                        try: 
     798                                if win._controls[acct][jid]: 
     799                                        return win 
     800                        except KeyError: 
     801                                pass 
     802                return None 
     803 
     804        def get_gc_control(self, jid, acct): 
     805                win = self.get_window(jid, acct) 
     806 
     807                if win: 
     808                        return win.get_gc_control(jid, acct) 
     809 
    791810                return None 
    792811 
     
    915934                                return 
    916935 
    917         def get_control(self, jid, acct): 
     936        def get_control(self, jid, acct, session): 
    918937                '''Amongst all windows, return the MessageControl for jid''' 
    919938                win = self.get_window(jid, acct) 
    920939                if win: 
    921                         return win.get_control(jid, acct) 
     940                        return win.get_control(jid, acct, session) 
    922941                return None 
    923942 
     
    930949                                ctrls.append(c) 
    931950                return ctrls 
     951 
     952        def get_chat_controls(self, jid, acct): 
     953                win = self.get_window(jid, acct) 
     954 
     955                if win: 
     956                        return win.get_controls(jid, acct) 
     957                else: 
     958                        return [] 
    932959 
    933960        def windows(self):