summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-02-24 18:08:15 +0000
committerSadie Powell <sadie@witchery.services>2021-02-24 18:08:15 +0000
commit5860247c3bf664daac1234f47f68ed30402fe13d (patch)
treecebf3550419945ce75f48f857e6ba31bd98696ba
parentd9b6f869c6671fff7967849c9ee3197d2c8b4d0e (diff)
Refactor OnUserPostMessage in the chanhistory module.
-rw-r--r--src/modules/m_chanhistory.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp
index 4bd230a7c..25110b495 100644
--- a/src/modules/m_chanhistory.cpp
+++ b/src/modules/m_chanhistory.cpp
@@ -221,18 +221,20 @@ class ModuleChanHistory
void OnUserPostMessage(User* user, const MessageTarget& target, const MessageDetails& details) CXX11_OVERRIDE
{
+ if (target.type != MessageTarget::TYPE_CHANNEL || target.status)
+ return;
+
std::string ctcpname;
- if ((target.type == MessageTarget::TYPE_CHANNEL) && (target.status == 0) && (!details.IsCTCP(ctcpname) || irc::equals(ctcpname, "ACTION")))
- {
- Channel* c = target.Get<Channel>();
- HistoryList* list = historymode.ext.get(c);
- if (list)
- {
- list->lines.push_back(HistoryItem(user, details));
- if (list->lines.size() > list->maxlen)
- list->lines.pop_front();
- }
- }
+ if (details.IsCTCP(ctcpname) && !irc::equals(ctcpname, "ACTION"))
+ return;
+
+ HistoryList* list = historymode.ext.get(target.Get<Channel>());
+ if (!list)
+ return;
+
+ list->lines.push_back(HistoryItem(user, details));
+ if (list->lines.size() > list->maxlen)
+ list->lines.pop_front();
}
void OnPostJoin(Membership* memb) CXX11_OVERRIDE