Changeset 9123 for branches/pep/src/common/events.py
- Timestamp:
- 12/12/07 09:44:46 (12 months ago)
- Files:
-
- 1 modified
-
branches/pep/src/common/events.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pep/src/common/events.py
r8478 r9123 2 2 ## 3 3 ## 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> 7 7 ## Vincent Hanquez <tab@snarc.org> 8 8 ## Nikos Kouremenos <kourem@gmail.com> … … 10 10 ## Travis Shirk <travis@pobox.com> 11 11 ## 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 14 17 ## it under the terms of the GNU General Public License as published 15 ## by the Free Software Foundation; version 2only.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, 18 21 ## but WITHOUT ANY WARRANTY; without even the implied warranty of 19 22 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 23 ## 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/>. 21 27 ## 22 28 … … 160 166 161 167 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: [] 163 171 optionnaly only from given type''' 164 172 if not self._events.has_key(account): 165 173 return [] 166 174 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 168 184 if not self._events[account].has_key(jid): 169 185 return []
