From a7b70492bb7f30ae375d2ce48684348acbaf578b Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 4 Jul 2012 21:38:00 +0200 Subject: m_spanningtree FTOPIC handler: Keep only one topic if the two topic timestamps match but the topics differ --- src/modules/m_spanningtree/ftopic.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/m_spanningtree/ftopic.cpp b/src/modules/m_spanningtree/ftopic.cpp index 3094b38e1..bf1ff8a78 100644 --- a/src/modules/m_spanningtree/ftopic.cpp +++ b/src/modules/m_spanningtree/ftopic.cpp @@ -40,6 +40,15 @@ CmdResult CommandFTopic::Handle(const std::vector& params, User *us if (ts < c->topicset) return CMD_FAILURE; + /* + * If the topics were updated at the exact same second, accept + * the remote only when it's "bigger" than ours as defined by + * string comparision, so non-empty topics always overridde + * empty topics if their timestamps are equal + */ + if ((ts == c->topicset) && (c->topic > params[3])) + return CMD_FAILURE; // Topics were set at the exact same time, keep our topic and setter + if (c->topic != params[3]) { // Update topic only when it differs from current topic @@ -47,7 +56,7 @@ CmdResult CommandFTopic::Handle(const std::vector& params, User *us c->WriteChannel(user, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str()); } - // Always update setter and settime. + // Update setter and settime c->setby.assign(params[2], 0, 127); c->topicset = ts; -- cgit v1.2.3