Callbacks

HeaderRawValueFormatter (header, options, value, charset)

ObjectForeachFunc (parent, part, *user_data)

ParserHeaderRegexFunc (parser, header, value, offset, *user_data)

ParserWarningFunc (offset, errcode, item, *user_data)

PasswordRequestFunc (ctx, user_id, prompt, reprompt, response)

Details

GMime.HeaderRawValueFormatter(header, options, value, charset)
Parameters:
Returns:

the encoded and formatted raw header value.

Return type:

str

Function callback for encoding and formatting a header value.

GMime.ObjectForeachFunc(parent, part, *user_data)
Parameters:

The function signature for a callback to GMime.Message.foreach() and GMime.Multipart.foreach().

GMime.ParserHeaderRegexFunc(parser, header, value, offset, *user_data)
Parameters:
  • parser (GMime.Parser) – The GMime.Parser object.

  • header (str) – The header field matched.

  • value (str) – The header field value.

  • offset (int) – The header field offset.

  • user_data (object or None) – The user-supplied callback data.

Function signature for the callback to g_mime_parser_set_header_regex().

GMime.ParserWarningFunc(offset, errcode, item, *user_data)
Parameters:
  • offset (int) – parser offset where the issue has been detected, or -1 if it is unknown

  • errcode (GMime.ParserWarning) – a GMime.ParserWarning

  • item (str) – a NUL-terminated string containing the value causing the issue, may be None

  • user_data (object or None) – User-supplied callback data.

The function signature for a callback to GMime.ParserOptions.set_warning_callback().

GMime.PasswordRequestFunc(ctx, user_id, prompt, reprompt, response)
Parameters:
  • ctx (GMime.CryptoContext) – the GMime.CryptoContext making the request

  • user_id (str) – the user_id of the password being requested

  • prompt (str) – a string containing some helpful context for the prompt

  • reprompt (bool) – True if this password request is a reprompt due to a previously bad password response

  • response (GMime.Stream) – a stream for the application to write the password to (followed by a newline ‘\n’ character)

Returns:

True on success or False on error.

Return type:

bool

A password request callback allowing a GMime.CryptoContext to prompt the user for a password for a given key.