summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-06-11 14:15:40 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-06-11 14:15:40 +0200
commitc8f92d97c2cd92a07bbb76b96a67cd089c7e3407 (patch)
tree251053b46d8443040ff69040913aea591b9bea81
parent84e358da3c97ee61fc1374e5551ad789e1258aa6 (diff)
m_spanningtree Assign an id to new Memberships
-rw-r--r--src/modules/m_spanningtree/main.cpp7
-rw-r--r--src/modules/m_spanningtree/main.h4
2 files changed, 10 insertions, 1 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 99f54cce8..6fa494809 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -37,7 +37,9 @@
ModuleSpanningTree::ModuleSpanningTree()
: rconnect(this), rsquit(this), map(this)
- , commands(NULL), DNS(this, "DNS")
+ , commands(NULL)
+ , currmembid(0)
+ , DNS(this, "DNS")
{
}
@@ -509,6 +511,9 @@ void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created_by
if (!IS_LOCAL(memb->user))
return;
+ // Assign the current membership id to the new Membership and increase it
+ memb->id = currmembid++;
+
if (created_by_local)
{
CmdBuilder params("FJOIN");
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 513e86a2f..7fb2c6701 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -63,6 +63,10 @@ class ModuleSpanningTree : public Module
*/
SpanningTreeCommands* commands;
+ /** Next membership id assigned when a local user joins a channel
+ */
+ Membership::Id currmembid;
+
public:
dynamic_reference<DNS::Manager> DNS;