From 64174491dac84c559db5c48ed850177fa3eb4da0 Mon Sep 17 00:00:00 2001 From: jellybrick Date: Sat, 14 Mar 2020 23:21:30 +0900 Subject: Fix #127, #128 & Code quality improvements It seems that the author of this code misunderstood 'Array of PollOption' as 'PollOption'. --- include/tgbot/EventBroadcaster.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include/tgbot/EventBroadcaster.h') diff --git a/include/tgbot/EventBroadcaster.h b/include/tgbot/EventBroadcaster.h index 38d5be6..978a6fe 100644 --- a/include/tgbot/EventBroadcaster.h +++ b/include/tgbot/EventBroadcaster.h @@ -107,12 +107,12 @@ private: } } - inline void broadcastAnyMessage(const Message::Ptr message) const { + inline void broadcastAnyMessage(const Message::Ptr& message) const { broadcast(_onAnyMessageListeners, message); } - inline bool broadcastCommand(const std::string command, const Message::Ptr message) const { - std::unordered_map::const_iterator iter = _onCommandListeners.find(command); + inline bool broadcastCommand(const std::string& command, const Message::Ptr& message) const { + auto iter = _onCommandListeners.find(command); if (iter == _onCommandListeners.end()) { return false; } @@ -120,23 +120,23 @@ private: return true; } - inline void broadcastUnknownCommand(const Message::Ptr message) const { + inline void broadcastUnknownCommand(const Message::Ptr& message) const { broadcast(_onUnknownCommandListeners, message); } - inline void broadcastNonCommandMessage(const Message::Ptr message) const { + inline void broadcastNonCommandMessage(const Message::Ptr& message) const { broadcast(_onNonCommandMessageListeners, message); } - inline void broadcastInlineQuery(const InlineQuery::Ptr query) const { + inline void broadcastInlineQuery(const InlineQuery::Ptr& query) const { broadcast(_onInlineQueryListeners, query); } - inline void broadcastChosenInlineResult(const ChosenInlineResult::Ptr result) const { + inline void broadcastChosenInlineResult(const ChosenInlineResult::Ptr& result) const { broadcast(_onChosenInlineResultListeners, result); } - inline void broadcastCallbackQuery(const CallbackQuery::Ptr result) const { + inline void broadcastCallbackQuery(const CallbackQuery::Ptr& result) const { broadcast(_onCallbackQueryListeners, result); } -- cgit v1.2.3