Projects
Kolab:16
pykolab-python3
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 7
View file
debian.changelog
Changed
@@ -1,4 +1,4 @@ -pykolab (0.9.0-0~kolab2) unstable; urgency=low +pykolab (0.9.0-0~kolab3) unstable; urgency=low * Release of version 0.9.0
View file
pykolab-0.9.0.tar.gz/wallace/__init__.py
Changed
@@ -154,6 +154,50 @@ break +class WallaceSMTPChannel(smtpd.SMTPChannel): + callback = None + + def __init__(self, connection, address, callback): + self.callback = callback + if conf.debuglevel > 8: + smtpd.DEBUGSTREAM = pykolab.logger.StderrToLogger(log) + super().__init__(self, connection, address) + + def data_header(self, mailfrom, rcpttos): + return "X-Kolab-From: " + mailfrom + "\r\n" + \ + "X-Kolab-To: " + ', '.join(rcpttos) + "\r\n" + + def process_message(self, peer, mailfrom, rcpttos, data, **kwargs): + """ + We have retrieved the message. This should be as fast as possible, + and not ever block. + """ + + header = self.data_header(mailfrom, rcpttos) + + try: + (fp, filename) = tempfile.mkstemp(dir="/var/spool/pykolab/wallace/") + + # @TODO: and add line separator (\n or \r\n?) + # we should make sure there's only one line separator between + # kolab headers and the original message (data) + os.write(fp, bytes(header.encode("UTF-8"))) + os.write(fp, data) + except Exception as errmsg: + log.warning( + _l("failed to write to file: %s" % (errmsg)) + ) + finally: + os.close(fp) + + self.callback(filename) + + return "250 OK Message %s queued" % (filename) + + def loop(self): + asyncore.loop() + + class WallaceDaemon: heartbeat = None timer = None @@ -345,25 +389,22 @@ time.sleep(0.5) pair = s.accept() - log.debug( - _l("Accepted connection %r with address %r") % ( - pair if pair is not None else (None, None) - ), - level=8 - ) if pair is not None: - self.current_connections += 1 connection, address = pair + log.debug( + _l("Accepted connection %r with address %r") % ( + connection, address + ), + level=8 + ) - _smtpd = smtpd - # Set DEBUGSTREAM of smtpd to log to pykolab logger - if conf.debuglevel > 8: - _smtpd.DEBUGSTREAM = pykolab.logger.StderrToLogger(log) + def callback(filename): + self.pool.apply_async(pickup_message, (filename, (self.modules))) - log.debug(_l("Creating SMTPChannel for accepted message"), level=8) - _smtpd.SMTPChannel(self, connection, address) - asyncore.loop() + self.current_connections += 1 + WallaceSMTPChannel(connection, address, callback).loop() + self.current_connections -= 1 else: log.error(_l("Socket accepted, but (conn, address) tuple is None.")) @@ -378,13 +419,6 @@ self.timer.cancel() self.timer.join() - # pylint: disable=no-self-use - def data_header(self, mailfrom, rcpttos): - COMMASPACE = ', ' - - return "X-Kolab-From: " + mailfrom + "\r\n" + \ - "X-Kolab-To: " + COMMASPACE.join(rcpttos) + "\r\n" - def pickup_spool_messages(self, sync=False): # Mind you to include the trailing slash pickup_path = '/var/spool/pykolab/wallace/' @@ -474,30 +508,6 @@ self.current_connections -= 1 - def process_message(self, peer, mailfrom, rcpttos, data): - """ - We have retrieved the message. This should be as fast as possible, - and not ever block. - """ - - header = self.data_header(mailfrom, rcpttos) - - (fp, filename) = tempfile.mkstemp(dir="/var/spool/pykolab/wallace/") - - # @TODO: and add line separator (\n or \r\n?) - # we should make sure there's only one line separator between - # kolab headers and the original message (data) - os.write(fp, header) - os.write(fp, data) - os.close(fp) - - log.debug(_l("Started processing accepted message %s") % filename, level=8) - self.pool.apply_async(pickup_message, (filename, (self.modules))) - - self.current_connections -= 1 - - return "250 OK Message %s queued" % (filename) - def reload_config(self, *args, **kwargs): pass
View file
pykolab-0.9.0.tar.gz/wallace/modules.py
Changed
@@ -140,6 +140,11 @@ # NOTE: Use "127.0.0.1" here for IPv6 (see also the service # definition in master.cf). + # Sanity check. We run into this if we end up reading an empty file, because sender ends up being an empty list + if not sender or not recipients: + log.warning(_("Sending email failed from %r to %r") % (sender, recipients)) + return False + sl = pykolab.logger.StderrToLogger(log) smtplib.stderr = sl
View file
pykolab.dsc
Changed
@@ -2,7 +2,7 @@ Source: pykolab Binary: pykolab, kolab-cli, kolab-conf, kolab-saslauthd, kolab-server, kolab-telemetry, kolab-xml, wallace Architecture: all -Version: 0.9.0-0~kolab2 +Version: 0.9.0-0~kolab3 Maintainer: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Uploaders: Paul Klos <kolab@klos2day.nl> Homepage: http://www.kolab.org
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.