diff options
author | jellybrick <shlee1503@naver.com> | 2020-03-14 23:21:30 +0900 |
---|---|---|
committer | jellybrick <shlee1503@naver.com> | 2020-03-14 23:21:42 +0900 |
commit | 64174491dac84c559db5c48ed850177fa3eb4da0 (patch) | |
tree | 5f7a754d57c2a7ec439f309df5e4b8d964d0834f /include/tgbot/EventBroadcaster.h | |
parent | 19f49b7a2f540a756ed9759b0fa5fb52bf73f20e (diff) |
Fix #127, #128 & Code quality improvements
It seems that the author of this code misunderstood 'Array of PollOption' as 'PollOption'.
Diffstat (limited to 'include/tgbot/EventBroadcaster.h')
-rw-r--r-- | include/tgbot/EventBroadcaster.h | 16 |
1 files changed, 8 insertions, 8 deletions
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<MessageListener, Message::Ptr>(_onAnyMessageListeners, message); } - inline bool broadcastCommand(const std::string command, const Message::Ptr message) const { - std::unordered_map<std::string, MessageListener>::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<MessageListener, Message::Ptr>(_onUnknownCommandListeners, message); } - inline void broadcastNonCommandMessage(const Message::Ptr message) const { + inline void broadcastNonCommandMessage(const Message::Ptr& message) const { broadcast<MessageListener, Message::Ptr>(_onNonCommandMessageListeners, message); } - inline void broadcastInlineQuery(const InlineQuery::Ptr query) const { + inline void broadcastInlineQuery(const InlineQuery::Ptr& query) const { broadcast<InlineQueryListener, InlineQuery::Ptr>(_onInlineQueryListeners, query); } - inline void broadcastChosenInlineResult(const ChosenInlineResult::Ptr result) const { + inline void broadcastChosenInlineResult(const ChosenInlineResult::Ptr& result) const { broadcast<ChosenInlineResultListener, ChosenInlineResult::Ptr>(_onChosenInlineResultListeners, result); } - inline void broadcastCallbackQuery(const CallbackQuery::Ptr result) const { + inline void broadcastCallbackQuery(const CallbackQuery::Ptr& result) const { broadcast<CallbackQueryListener, CallbackQuery::Ptr>(_onCallbackQueryListeners, result); } |