diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-07-04 21:38:00 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-04-12 21:03:04 +0200 |
commit | a7b70492bb7f30ae375d2ce48684348acbaf578b (patch) | |
tree | 7e4ea2ed4f20aa1e981af46567ccacd737c55ef8 | |
parent | b79a9a1221b35a03aec3b949a32d97d2e2ce66af (diff) |
m_spanningtree FTOPIC handler: Keep only one topic if the two topic timestamps match but the topics differ
-rw-r--r-- | src/modules/m_spanningtree/ftopic.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
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<std::string>& 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<std::string>& 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; |