--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+@summary: A class for encapsulating the information from a chain of Postfix log entries
+
+@author: Frank Brehm
+@contact: frank.brehm@pixelpark.com
+@copyright: © 2024 by Frank Brehm, Berlin
+"""
+from __future__ import absolute_import
+
+# Standard modules
+import datetime
+import logging
+import re
+
+# Third party modules
+from
+from fb_tools.obj import FbGenericBaseObject
+
+__version__ = '0.1.0'
+
+LOG = logging.getLogger(__name__)
+
+UTC = utc = datetime.timezone(0, 'UTC')
+
+
+# =============================================================================
+class PostfixLogchainInfo(FbGenericBaseObject):
+ """A class for encapsulating the information from a chain of Postfix log entries."""
+
+ # -------------------------------------------------------------------------
+ def __init__(
+ self, client_host=None, client_addr=None, start=None, end=None, message_id=None, postfix_pid=None,
+ ehlo=None, starttls=None, quit=None, auth=None, commands=None, rcpt=None, data=None,
+ mail=None, from_address=None, to_address=None):
+ """Initialize this object."""
+ self._auth = None
+ self._client_addr = None
+ self._client_host = None
+ self._commands = None
+ self._data = None
+ self._end = None
+ self._ehlo = None
+ self._from_address = None
+ self._mail = None
+ self._message_id = None
+ self._postfix_pid = None
+ self._quit = None
+ self._rcpt = None
+ self._start = None
+ self._starttls = None
+ self._to_address = None
+
+ self.auth = auth
+
+ # -----------------------------------------------------------
+ @property
+ def auth(self):
+ """Return, whether an auth command was used in SMTP dialogue."""
+ return self._auth
+
+ @auth.setter
+ def auth(self, value):
+ if value is None:
+ self._auth = None
+ return
+
+ val = str(value).strip()
+ if val == '':
+ self._auth = None
+ else:
+ self._auth = val
+
+
+ # -------------------------------------------------------------------------
+ def __repr__(self):
+ """Typecast into a string for reproduction."""
+ out = '<%s(' % (self.__class__.__name__)
+
+ fields = []
+
+ if self.auth is not None:
+ fields.append('auth={!r}'.format(self.auth))
+
+ out += ', '.join(fields) + ')>'
+ return out
+
+ # -------------------------------------------------------------------------
+ def as_dict(self, short=True):
+ """
+ Transform the elements of the object into a dict.
+
+ @param short: don't include local properties in resulting dict.
+ @type short: bool
+
+ @return: structure as dict
+ @rtype: dict
+ """
+ res = super(PostfixLogchainInfo, self).as_dict(short=short)
+
+ res['auth'] = self.auth
+
+ return res
+
+
+
+# =============================================================================
+
+if __name__ == '__main__':
+
+ pass
+
+# =============================================================================
+
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4