Class CurlEmailReceiver

Inheritance Relationships

Base Types

Class Documentation

class CurlEmailReceiver : public email::EmailReceiver, public email::CurlExecutor

Email reception wrapper for curl.

Sets the options and executes the commands to receive emails.

Public Functions

explicit CurlEmailReceiver(UserInfo::SharedPtrConst user_info, const bool curl_verbose)

Constructor.

Parameters:
  • user_info – the user information for receiving emails

  • curl_verbose – the curl verbose status

virtual ~CurlEmailReceiver()
virtual std::optional<struct EmailData> get_email(std::optional<std::chrono::nanoseconds> polling_period = std::nullopt)

Get a new email.

This function fetches a new email through polling.

The caller can specify a polling period, which will be used as a target polling rate. This means that, if the internal polling call takes more time than the polling period, the next call will be executed right away.

If the polling period value is equal to 0, the sleep call will be skipped, and polling will be done as fast as possible. This is the default value.

Parameters:

polling_period – the polling period

Returns:

the new email, or std::nullopt if it failed

Protected Functions

virtual bool init_options()

Initialize concrete options.

Inheriting classes should implement this and initialize options specific to them.

Returns:

true if success, false otherwise