diff -r eb04ac3a8327 -r 3f4bdea2abbf iro/anbieter/content.py --- a/iro/anbieter/content.py Wed Dec 21 22:07:48 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -# -*- coding: utf-8 -*- -#Copyright (C) 2009 Sandro Knauß - -#This program 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; -#either version 3 of the License, or any later version. -#This program 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 this program; if not, see . - -from email.mime.text import MIMEText -from email.header import Header - -class content: - def __init__(self,content): - self.content=content - - def sendto(self,anbieter,recipients): - pass - - def getContent(self): - return self.content - - def __eq__(self,other): - return self.content == other.content - - def __ne__(self,other): - return not self.__eq__(other) - -class SMS(content): - def __init__(self, cont): - content.__init__(self,cont) - - def sendto(self,anbieter,recipients): - anbieter.sendSMS(self,recipients) - - -class FAX(content): - def __init__(self,header,cont,attachments): - content.__init__(self,cont) - self.header=header - self.attachments=attachments - - def sendto(self,anbieter,recipients): - anbieter.sendFAX(self,recipients) - - def getAttachment(self,i): - return self.attachments[i] - - def __eq__(self,other): - if not content.__eq__(self,other): - return False - - if self.header != other.header: - return False - - if len(self.attachments) != len(other.attachments): - return False - - for i in range(len(self.attachments)): - if self.attachments[i] != other.attachments[i]: - return False - - return True - - - -class Mail(content): - def __init__(self, subject, body, frm): - con=MIMEText(body.encode("utf-8"), _charset='utf-8') - sub=Header(subject.encode('utf-8'), 'utf-8') - con['Subject']=sub - self.frm=frm - content.__init__(self, con) - - def sendto(self,anbieter,recipients): - anbieter.sendMail(self,recipients) - - def as_string(self): - return self.content.as_string() - - def getFrom(self): - return self.frm - - def __eq__(self,other): - if self.as_string() != other.as_string(): - return False - - if self.frm != other.frm: - return False - - return True