Mercurial > libervia-backend
comparison src/plugins/plugin_misc_smtp.py @ 587:952322b1d490
Remove trailing whitespaces.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 18 Jan 2013 17:55:34 +0100 |
parents | 89f9a50ce7bf |
children | beaf6bec2fcd |
comparison
equal
deleted
inserted
replaced
586:6a718ede8be1 | 587:952322b1d490 |
---|---|
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(): |
53 | 53 |
54 params = """ | 54 params = """ |
55 <params> | 55 <params> |
56 <general> | 56 <general> |
57 <category name="Mail Server"> | 57 <category name="Mail Server"> |
58 <param name="SMTP Port" value="10125" type="string" /> | 58 <param name="SMTP Port" value="10125" type="string" /> |
62 """ | 62 """ |
63 | 63 |
64 def __init__(self, host): | 64 def __init__(self, host): |
65 info(_("Plugin SMTP Server initialization")) | 65 info(_("Plugin SMTP Server initialization")) |
66 self.host = host | 66 self.host = host |
67 | 67 |
68 #parameters | 68 #parameters |
69 host.memory.importParams(self.params) | 69 host.memory.importParams(self.params) |
70 | 70 |
71 port = int(self.host.memory.getParamA("SMTP Port", "Mail Server")) | 71 port = int(self.host.memory.getParamA("SMTP Port", "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: |
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 |
83 self.message=[] | 83 self.message=[] |
84 | 84 |
85 def lineReceived(self, line): | 85 def lineReceived(self, line): |
86 """handle another line""" | 86 """handle another line""" |
87 self.message.append(line) | 87 self.message.append(line) |
88 | 88 |
89 def eomReceived(self): | 89 def eomReceived(self): |
165 """ | 165 """ |
166 implements(checkers.ICredentialsChecker) | 166 implements(checkers.ICredentialsChecker) |
167 credentialInterfaces = (credentials.IUsernamePassword, | 167 credentialInterfaces = (credentials.IUsernamePassword, |
168 credentials.IUsernameHashedPassword) | 168 credentials.IUsernameHashedPassword) |
169 | 169 |
170 | 170 |
171 def __init__(self, host): | 171 def __init__(self, host): |
172 self.host = host | 172 self.host = host |
173 | 173 |
174 def _cbPasswordMatch(self, matched, profile): | 174 def _cbPasswordMatch(self, matched, profile): |
175 if matched: | 175 if matched: |
201 smtp.SMTPFactory.startedConnecting(self, connector) | 201 smtp.SMTPFactory.startedConnecting(self, connector) |
202 | 202 |
203 def clientConnectionLost(self, connector, reason): | 203 def clientConnectionLost(self, connector, reason): |
204 debug (_("SMTP server connection lost (reason: %s)"), reason) | 204 debug (_("SMTP server connection lost (reason: %s)"), reason) |
205 smtp.SMTPFactory.clientConnectionLost(self, connector, reason) | 205 smtp.SMTPFactory.clientConnectionLost(self, connector, reason) |
206 | 206 |
207 def buildProtocol(self, addr): | 207 def buildProtocol(self, addr): |
208 p = smtp.SMTPFactory.buildProtocol(self, addr) | 208 p = smtp.SMTPFactory.buildProtocol(self, addr) |
209 # add the challengers from imap4, more secure and complicated challengers are available | 209 # add the challengers from imap4, more secure and complicated challengers are available |
210 p.challengers = {"LOGIN": LOGINCredentials, "PLAIN": PLAINCredentials} | 210 p.challengers = {"LOGIN": LOGINCredentials, "PLAIN": PLAINCredentials} |
211 return p | 211 return p |