From 99df0b89e9926fb051e10c10aa1bdb7cdd7ec9e0 Mon Sep 17 00:00:00 2001 From: Takatoshi Kondo Date: Tue, 6 Sep 2022 09:51:39 +0900 Subject: [PATCH] Added clear username and password functionality. --- include/mqtt/client.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/mqtt/client.hpp b/include/mqtt/client.hpp index fcba22fe4..527bf303d 100644 --- a/include/mqtt/client.hpp +++ b/include/mqtt/client.hpp @@ -921,6 +921,17 @@ class client : public endpoint { user_name_ = force_move(name); } + /** + * @brief Clear username. + * + * This function should be called before calling connect().
+ * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901071
+ * 3.1.3.5 User Name + */ + void set_user_name() { + user_name_ = nullopt; + } + /** * @brief Set password. * @param password password @@ -933,6 +944,17 @@ class client : public endpoint { password_ = force_move(password); } + /** + * @brief Clear password. + * + * This function should be called before calling connect().
+ * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901072
+ * 3.1.3.6 Password + */ + void set_password() { + password_ = nullopt; + } + /** * @brief Set will. * @param w will