Mercurial > libervia-backend
comparison src/plugins/plugin_misc_imap.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 |
---|---|
49 "description": _("""Create an Imap server that you can use to read your "normal" type messages""") | 49 "description": _("""Create an Imap server that you can use to read your "normal" type messages""") |
50 } | 50 } |
51 | 51 |
52 class IMAP_server(): | 52 class IMAP_server(): |
53 #TODO: connect profile on mailbox request, once password is accepted | 53 #TODO: connect profile on mailbox request, once password is accepted |
54 | 54 |
55 params = """ | 55 params = """ |
56 <params> | 56 <params> |
57 <general> | 57 <general> |
58 <category name="Mail Server"> | 58 <category name="Mail Server"> |
59 <param name="IMAP Port" value="10143" type="string" /> | 59 <param name="IMAP Port" value="10143" type="string" /> |
63 """ | 63 """ |
64 | 64 |
65 def __init__(self, host): | 65 def __init__(self, host): |
66 info(_("Plugin Imap Server initialization")) | 66 info(_("Plugin Imap Server initialization")) |
67 self.host = host | 67 self.host = host |
68 | 68 |
69 #parameters | 69 #parameters |
70 host.memory.importParams(self.params) | 70 host.memory.importParams(self.params) |
71 | 71 |
72 port = int(self.host.memory.getParamA("IMAP Port", "Mail Server")) | 72 port = int(self.host.memory.getParamA("IMAP Port", "Mail Server")) |
73 info(_("Launching IMAP server on port %d"), port) | 73 info(_("Launching IMAP server on port %d"), port) |
74 | 74 |
75 self.server_factory = ImapServerFactory(self.host) | 75 self.server_factory = ImapServerFactory(self.host) |
76 reactor.listenTCP(port, self.server_factory) | 76 reactor.listenTCP(port, self.server_factory) |
77 | 77 |
78 class Message(): | 78 class Message(): |
79 implements(imap4.IMessage) | 79 implements(imap4.IMessage) |
82 debug('Message Init') | 82 debug('Message Init') |
83 self.uid=uid | 83 self.uid=uid |
84 self.flags=flags | 84 self.flags=flags |
85 self.mess_fp=mess_fp | 85 self.mess_fp=mess_fp |
86 self.message=Parser().parse(mess_fp) | 86 self.message=Parser().parse(mess_fp) |
87 | 87 |
88 def getUID(self): | 88 def getUID(self): |
89 """Retrieve the unique identifier associated with this message. | 89 """Retrieve the unique identifier associated with this message. |
90 """ | 90 """ |
91 debug('getUID (message)') | 91 debug('getUID (message)') |
92 return self.uid | 92 return self.uid |
219 | 219 |
220 def destroy(self): | 220 def destroy(self): |
221 """Called before this mailbox is deleted, permanently. | 221 """Called before this mailbox is deleted, permanently. |
222 """ | 222 """ |
223 debug('destroy') | 223 debug('destroy') |
224 | 224 |
225 | 225 |
226 def requestStatus(self, names): | 226 def requestStatus(self, names): |
227 """Return status information about this mailbox. | 227 """Return status information about this mailbox. |
228 @param names: The status names to return information regarding. | 228 @param names: The status names to return information regarding. |
229 The possible values for each name are: MESSAGES, RECENT, UIDNEXT, | 229 The possible values for each name are: MESSAGES, RECENT, UIDNEXT, |
338 _flags.update(set(flags)) | 338 _flags.update(set(flags)) |
339 new_flags=list(_flags) | 339 new_flags=list(_flags) |
340 setF(mess_id, new_flags) | 340 setF(mess_id, new_flags) |
341 ret[mess_id] = tuple(new_flags) | 341 ret[mess_id] = tuple(new_flags) |
342 return ret | 342 return ret |
343 | 343 |
344 if uid: | 344 if uid: |
345 messages.last = self.mailbox.getMaxUid() | 345 messages.last = self.mailbox.getMaxUid() |
346 messages.getnext = self.mailbox.getNextExistingUid | 346 messages.getnext = self.mailbox.getNextExistingUid |
347 ret = updateFlags(self.mailbox.getFlagsUid,self.mailbox.setFlagsUid) | 347 ret = updateFlags(self.mailbox.getFlagsUid,self.mailbox.setFlagsUid) |
348 for listener in self.listeners: | 348 for listener in self.listeners: |
349 listener.flagsChanged(ret) | 349 listener.flagsChanged(ret) |
350 return ret | 350 return ret |
351 | 351 |
352 else: | 352 else: |
353 messages.last = self.getMessageCount() | 353 messages.last = self.getMessageCount() |
354 ret = updateFlags(self.mailbox.getFlags,self.mailbox.setFlags) | 354 ret = updateFlags(self.mailbox.getFlags,self.mailbox.setFlags) |
355 newFlags={} | 355 newFlags={} |
356 for idx in ret: | 356 for idx in ret: |
410 """ | 410 """ |
411 implements(checkers.ICredentialsChecker) | 411 implements(checkers.ICredentialsChecker) |
412 credentialInterfaces = (credentials.IUsernamePassword, | 412 credentialInterfaces = (credentials.IUsernamePassword, |
413 credentials.IUsernameHashedPassword) | 413 credentials.IUsernameHashedPassword) |
414 | 414 |
415 | 415 |
416 def __init__(self, host): | 416 def __init__(self, host): |
417 self.host = host | 417 self.host = host |
418 | 418 |
419 def _cbPasswordMatch(self, matched, profile): | 419 def _cbPasswordMatch(self, matched, profile): |
420 if matched: | 420 if matched: |