Commit 16bdbf10c4370eeb17b380fdc73a727920d873d3

Created message.py move the message class to it

Commit diff

src/__init__.py

 
3030from gsentinel.plugin import PluginManager
3131from gsentinel.ui import GmailStatusIcon
3232
33class Message (dict):
34 """Message struct"""
35 def __init__ (self):
36 self.update( {'id' : "",
37 'title' : "",
38 'summary' : "",
39 'author_name' : "",
40 'author_email' : "",
41 'link' : ""} )
42
43 def __cmp__ (self, msg):
44 """Messages are compared by id"""
45 return cmp(self['id'], msg['id'])
46
47 def __hash__ (self):
48 """Hash method"""
49 return hash(self['id'])
50
5133class GmailSentinel(object):
5234 """Main class."""
5335
toggle raw diff

src/message.py

 
1#! /usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Copyright (C) 2008 Rodrigo Lazo
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20"""
21Gmail Sentinel Message class
22
23This file is only for the message class. Due some problems with
24imports, I decided to put this class alone in its own.
25"""
26
27class Message (dict):
28 """Message struct"""
29 def __init__ (self):
30 self.update( {'id' : "",
31 'title' : "",
32 'summary' : "",
33 'author_name' : "",
34 'author_email' : "",
35 'link' : ""} )
36
37 def __cmp__ (self, msg):
38 """Messages are compared by id"""
39 return cmp(self['id'], msg['id'])
40
41 def __hash__ (self):
42 """Hash method"""
43 return hash(self['id'])
toggle raw diff