summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-17 14:12:10 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-17 14:12:10 +0000
commit7a76705c4c2014eb8470d81fd30f416518010cbe (patch)
tree8317ba2f7057fb4f480369f0db5d2cbb0b94aab6 /src
parentb6641a519f2c3664fa44c2fa86fef6426d3324a5 (diff)
Improve userrec::AddBuffer (remove craq char to std::string loop)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4932 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/users.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 43d09554d..aab40aa1d 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -480,15 +480,13 @@ bool userrec::HasPermission(const std::string &command)
bool userrec::AddBuffer(const std::string &a)
{
- std::string b = "";
+ std::string b(a);
+ std::string::size_type i = b.rfind('\r');
- /* NB: std::string is arsey about \r and \n and tries to translate them
- * somehow, so we CANNOT use std::string::find() here :(
- */
- for (std::string::const_iterator i = a.begin(); i != a.end(); i++)
+ while (i != std::string::npos)
{
- if (*i != '\r')
- b += *i;
+ b.erase(i, 1);
+ i = b.rfind('\r');
}
if (b.length())