diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree/commands.h | 16 | ||||
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 8 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/modules/m_spanningtree/commands.h b/src/modules/m_spanningtree/commands.h index c0043f0a4..d901d69e0 100644 --- a/src/modules/m_spanningtree/commands.h +++ b/src/modules/m_spanningtree/commands.h @@ -143,10 +143,22 @@ class CommandFJoin : public ServerCommand static const size_t maxline = 480; std::string::size_type pos; + protected: + void add(Membership* memb, std::string::const_iterator mbegin, std::string::const_iterator mend); + bool has_room(std::string::size_type nummodes) const; + public: Builder(Channel* chan, TreeServer* source = Utils->TreeRoot); - void add(Membership* memb); - bool has_room(Membership* memb) const; + void add(Membership* memb) + { + add(memb, memb->modes.begin(), memb->modes.end()); + } + + bool has_room(Membership* memb) const + { + return has_room(memb->modes.size()); + } + void clear(); const std::string& finalize(); }; diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index f0d804880..bcd8afe73 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -245,16 +245,16 @@ CommandFJoin::Builder::Builder(Channel* chan, TreeServer* source) push_raw(chan->ChanModes(true)).push_raw(" :"); } -void CommandFJoin::Builder::add(Membership* memb) +void CommandFJoin::Builder::add(Membership* memb, std::string::const_iterator mbegin, std::string::const_iterator mend) { - push_raw(memb->modes).push_raw(',').push_raw(memb->user->uuid); + push_raw(mbegin, mend).push_raw(',').push_raw(memb->user->uuid); push_raw(':').push_raw_int(memb->id); push_raw(' '); } -bool CommandFJoin::Builder::has_room(Membership* memb) const +bool CommandFJoin::Builder::has_room(std::string::size_type nummodes) const { - return ((str().size() + memb->modes.size() + UIDGenerator::UUID_LENGTH + 2 + membid_max_digits + 1) <= maxline); + return ((str().size() + nummodes + UIDGenerator::UUID_LENGTH + 2 + membid_max_digits + 1) <= maxline); } void CommandFJoin::Builder::clear() |