diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hashcomp.cpp | 22 | ||||
-rw-r--r-- | src/modules/m_conn_waitpong.cpp | 6 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 060d78fe2..f927fbc99 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -335,19 +335,37 @@ void irc::modestacker::PushMinus() this->Push('-',""); } -int irc::modestacker::GetStackedLine(std::deque<std::string> &result) +int irc::modestacker::GetStackedLine(std::deque<std::string> &result, int max_line_size) { + if (sequence.empty()) + { + result.clear(); + return 0; + } + int n = 0; + int size = 1; /* Account for initial +/- char */ + int nextsize = 0; result.clear(); result.push_back(adding ? "+" : "-"); - while (!sequence[0].empty() && (sequence.size() > 1) && (result.size() < MAXMODES+1)) + if (sequence.size() > 1) + nextsize = sequence[1].length(); + + while (!sequence[0].empty() && (sequence.size() > 1) && (result.size() < MAXMODES+1) && ((size+nextsize) < max_line_size)) { result[0] += *(sequence[0].begin()); if (!sequence[1].empty()) + { result.push_back(sequence[1]); + size += sequence[1].length() + 2; /* Account for mode character and whitespace */ + } sequence[0].erase(sequence[0].begin()); sequence.erase(sequence.begin() + 1); + + if (sequence.size() > 1) + nextsize = sequence[1].length(); + n++; } diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index e6e6456ff..d7a4b833a 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -81,19 +81,23 @@ class ModuleWaitPong : public Module { if(command == "PONG") { + ServerInstance->Log(DEBUG,"PONG command"); char* pingrpl; user->GetExt(extenstr, pingrpl); if(pingrpl) { + ServerInstance->Log(DEBUG,"PONG command - has extend"); if(strcmp(pingrpl, parameters[0]) == 0) { + ServerInstance->Log(DEBUG,"PONG command - pong matches ping "); DELETE(pingrpl); user->Shrink(extenstr); return 1; } else { + ServerInstance->Log(DEBUG,"PONG command - pong doesnt match ping"); if(killonbadreply) userrec::QuitUser(ServerInstance, user, "Incorrect ping reply for registration"); return 1; @@ -101,11 +105,13 @@ class ModuleWaitPong : public Module } } + ServerInstance->Log(DEBUG,"PONG command - fall through"); return 0; } virtual bool OnCheckReady(userrec* user) { + ServerInstance->Log(DEBUG,"PONG command - oncheckready"); char* pingrpl; return (!user->GetExt(extenstr, pingrpl)); } |