Callbacks

  HeaderForeachFunc (name, value, *user_data)
  HeaderWriter (stream, name, value)
  ObjectForeachFunc (parent, part, *user_data)
  ParserHeaderRegexFunc (parser, header, value, offset, *user_data)
  PasswordRequestFunc (ctx, user_id, prompt_ctx, reprompt, response)

Details

GMime.HeaderForeachFunc(name, value, *user_data)
Parameters:
  • name (str) – The field name.
  • value (str) – The field value.
  • user_data (object or None) – The user-supplied callback data.

Function signature for the callback to GMime.HeaderList.foreach().

GMime.HeaderWriter(stream, name, value)
Parameters:
  • stream (GMime.Stream) – The output stream.
  • name (str) – The field name.
  • value (str) – The field value.
Returns:

the number of bytes written or %-1 on error.

Return type:

int

Function signature for the callback to g_mime_header_list_register_writer().

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.PasswordRequestFunc(ctx, user_id, prompt_ctx, reprompt, response)
Parameters:
  • ctx (GMime.CryptoContext) – the GMime.CryptoContext making the request
  • user_id (str) – the user_id of the password being requested
  • prompt_ctx (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.