diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-06-12 14:14:52 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-06-12 14:14:52 +0000 |
commit | 0ca75a346af06bdf6a2d5c6d0d9731240c04898e (patch) | |
tree | 7b2a595470652e90af38ee73c7b5bedcfeb71d68 /src/message.py | |
parent | ad8d892aa1608dc76e3e29de70911953169b91d3 (diff) | |
download | poezio-0ca75a346af06bdf6a2d5c6d0d9731240c04898e.tar.gz poezio-0ca75a346af06bdf6a2d5c6d0d9731240c04898e.tar.bz2 poezio-0ca75a346af06bdf6a2d5c6d0d9731240c04898e.tar.xz poezio-0ca75a346af06bdf6a2d5c6d0d9731240c04898e.zip |
add missing file
Diffstat (limited to 'src/message.py')
-rw-r--r-- | src/message.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/message.py b/src/message.py new file mode 100644 index 00000000..7bbb1893 --- /dev/null +++ b/src/message.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +# -*- coding:utf-8 -*- +# +# Copyright 2010 Le Coz Florent <louizatakk@fedoraproject.org> +# +# This file is part of Poezio. +# +# Poezio is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# Poezio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Poezio. If not, see <http://www.gnu.org/licenses/>. + +from common import debug +from datetime import datetime + +class Message(object): + """ + A message with all the associated data (nickname, time, color, etc) + """ + def __init__(self, txt, time=None, nickname=None, user=None, color=None): + """ + time is a datetime object, None means 'now'. + If no nickname is specified, it's an information. + user is an User object (used for the color, etc) + """ + self.txt = txt + self.nickname = nickname + self.time = time + self.user = user + self.color = color + + def __repr__(self): + return "<Message txt=%s, nickname=%s, time=%s, user=%s>" % (self.txt, self.nickname, str(self.time), str(self.user)) + def __str__(self): + return self.__repr__() + |