Show
Ignore:
Timestamp:
12/12/07 09:44:46 (12 months ago)
Author:
asterix
Message:

merge diff from trunk

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/pep/src/common/events.py

    r8478 r9123  
    22## 
    33## Contributors for this file: 
    4 ##      - Yann Le Boulanger <asterix@lagaule.org> 
    5 ## 
    6 ## Copyright (C) 2006 Yann Le Boulanger <asterix@lagaule.org> 
     4##      - Yann Leboulanger <asterix@lagaule.org> 
     5## 
     6## Copyright (C) 2006 Yann Leboulanger <asterix@lagaule.org> 
    77##                    Vincent Hanquez <tab@snarc.org> 
    88##                    Nikos Kouremenos <kourem@gmail.com> 
     
    1010##                    Travis Shirk <travis@pobox.com> 
    1111##                    Norman Rasmussen <norman@rasmussen.co.za> 
    12 ## 
    13 ## This program is free software; you can redistribute it and/or modify 
     12## Copyright (C) 2007 Stephan Erb <steve-e@h3c.de>  
     13## 
     14## This file is part of Gajim. 
     15## 
     16## Gajim is free software; you can redistribute it and/or modify 
    1417## it under the terms of the GNU General Public License as published 
    15 ## by the Free Software Foundation; version 2 only. 
    16 ## 
    17 ## This program is distributed in the hope that it will be useful, 
     18## by the Free Software Foundation; version 3 only. 
     19## 
     20## Gajim is distributed in the hope that it will be useful, 
    1821## but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1922## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    2023## GNU General Public License for more details. 
     24## 
     25## You should have received a copy of the GNU General Public License 
     26## along with Gajim.  If not, see <http://www.gnu.org/licenses/>. 
    2127## 
    2228 
     
    160166 
    161167        def get_events(self, account, jid = None, types = []): 
    162                 '''if event is not specified, get all events from this jid, 
     168                '''returns all events from the given account of the form 
     169                {jid1: [], jid2: []} 
     170                if jid is given, returns all events from the given jid in a list: [] 
    163171                optionnaly only from given type''' 
    164172                if not self._events.has_key(account): 
    165173                        return [] 
    166174                if not jid: 
    167                         return self._events[account] 
     175                        events_list = {} # list of events 
     176                        for jid_ in self._events[account]: 
     177                                events = [] 
     178                                for ev in self._events[account][jid_]: 
     179                                        if not types or ev.type_ in types: 
     180                                                events.append(ev) 
     181                                if events: 
     182                                        events_list[jid_] = events 
     183                        return events_list 
    168184                if not self._events[account].has_key(jid): 
    169185                        return []