diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-10-03 13:46:28 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-10-03 13:46:28 +0000 |
commit | 9716d24be9e3e567308f6d144a65eeaccd65484a (patch) | |
tree | 78d19137cdc1a87133741c65c397207651f7d4f1 /src/modules/m_remove.cpp | |
parent | ab58b38578dfaeda2f53ba84e475ed9638e5f6da (diff) |
New helper class irc::stringjoiner - it pwns you.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5403 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_remove.cpp')
-rw-r--r-- | src/modules/m_remove.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 839530487..be4292e56 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -48,7 +48,8 @@ class RemoveBase enum ModeLevel { PEON = 0, HALFOP = 1, OP = 2, ADMIN = 3, OWNER = 4, ULINE = 5 }; /* This little function just converts a chanmode character (U ~ & @ & +) into an integer (5 4 3 2 1 0) */ - /* XXX - this could be handy in the core, so it can be used elsewhere */ + /* XXX - We should probably use the new mode prefix rank stuff + * for this instead now -- Brain */ ModeLevel chartolevel(const std::string &privs) { if(privs.empty()) @@ -180,20 +181,16 @@ class RemoveBase if ((ulevel > PEON) && (ulevel >= tlevel) && (tlevel != OWNER)) { // no you can't just go from a std::ostringstream to a std::string, Om. -nenolod - std::ostringstream reason_stream; - std::string reasonparam; + // but you can do this, nenolod -brain + + std::string reasonparam("No reason given"); /* If a reason is given, use it */ if(pcnt > 2) { - /* Use all the remaining parameters as the reason */ - for(int i = 2; i < pcnt; i++) - { - reason_stream << " " << parameters[i]; - } - - reasonparam = reason_stream.str(); - reason_stream.clear(); + /* Join params 2 ... pcnt - 1 (inclusive) into one */ + irc::stringjoiner reason_join(" ", parameters, 2, pcnt - 1); + reasonparam = reason_join.GetJoined(); } /* Build up the part reason string. */ |