comparison src/plugins/plugin_misc_smtp.py @ 588:beaf6bec2fcd

Remove every old-style class.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 18 Jan 2013 17:55:35 +0100
parents 952322b1d490
children e629371a28d3
comparison
equal deleted inserted replaced
587:952322b1d490 588:beaf6bec2fcd
47 "main": "SMTP_server", 47 "main": "SMTP_server",
48 "handler": "no", 48 "handler": "no",
49 "description": _("""Create a SMTP server that you can use to send your "normal" type messages""") 49 "description": _("""Create a SMTP server that you can use to send your "normal" type messages""")
50 } 50 }
51 51
52 class SMTP_server(): 52 class SMTP_server(object):
53 53
54 params = """ 54 params = """
55 <params> 55 <params>
56 <general> 56 <general>
57 <category name="Mail Server"> 57 <category name="Mail Server">
72 info(_("Launching SMTP server on port %d"), port) 72 info(_("Launching SMTP server on port %d"), port)
73 73
74 self.server_factory = SmtpServerFactory(self.host) 74 self.server_factory = SmtpServerFactory(self.host)
75 reactor.listenTCP(port, self.server_factory) 75 reactor.listenTCP(port, self.server_factory)
76 76
77 class SatSmtpMessage: 77 class SatSmtpMessage(object):
78 implements(smtp.IMessage) 78 implements(smtp.IMessage)
79 79
80 def __init__(self, host, profile): 80 def __init__(self, host, profile):
81 self.host=host 81 self.host=host
82 self.profile=profile 82 self.profile=profile
101 101
102 def connectionLost(self): 102 def connectionLost(self):
103 """handle message truncated""" 103 """handle message truncated"""
104 raise smtp.SMTPError 104 raise smtp.SMTPError
105 105
106 class SatSmtpDelivery: 106 class SatSmtpDelivery(object):
107 implements(smtp.IMessageDelivery) 107 implements(smtp.IMessageDelivery)
108 108
109 def __init__(self, host, profile): 109 def __init__(self, host, profile):
110 self.host=host 110 self.host=host
111 self.profile=profile 111 self.profile=profile
142 @return: origin or a Deferred whose callback will be 142 @return: origin or a Deferred whose callback will be
143 passed origin. 143 passed origin.
144 """ 144 """
145 return origin 145 return origin
146 146
147 class SmtpRealm: 147 class SmtpRealm(object):
148 implements(portal.IRealm) 148 implements(portal.IRealm)
149 149
150 def __init__(self,host): 150 def __init__(self,host):
151 self.host = host 151 self.host = host
152 152
155 profile=avatarID.decode('utf-8') 155 profile=avatarID.decode('utf-8')
156 if smtp.IMessageDelivery not in interfaces: 156 if smtp.IMessageDelivery not in interfaces:
157 raise NotImplementedError 157 raise NotImplementedError
158 return smtp.IMessageDelivery, SatSmtpDelivery(self.host,profile), lambda:None 158 return smtp.IMessageDelivery, SatSmtpDelivery(self.host,profile), lambda:None
159 159
160 class SatProfileCredentialChecker: 160 class SatProfileCredentialChecker(object):
161 """ 161 """
162 This credential checker check against SàT's profile and associated jabber's password 162 This credential checker check against SàT's profile and associated jabber's password
163 Check if the profile exists, and if the password is OK 163 Check if the profile exists, and if the password is OK
164 Return the profile as avatarId 164 Return the profile as avatarId
165 """ 165 """