diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-18 21:43:37 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-18 21:43:37 +0000 |
commit | 983f18f8348c96edd3086e750db29778bec8b042 (patch) | |
tree | 1f4de85b4fc476ff39eee9f7d9341ae930a3584e /src/message.cpp | |
parent | 69f280701b651fcbdc22f68db1714c384b9098f4 (diff) |
Tried to implement sprintf that returns std::string of any size, realized it would scale like unreal scales to ircnet (e.g. it wouldnt!) so took it back out.
Moved chop() functionality into userrec::AddWriteBuf and make it nicer (no strlen)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4433 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/message.cpp')
-rw-r--r-- | src/message.cpp | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/message.cpp b/src/message.cpp index e49663e55..e4dc380cd 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -76,80 +76,6 @@ int common_channels(userrec *u, userrec *u2) return 0; } -void tidystring(char* str) -{ - // strips out double spaces before a : parameter - - char temp[MAXBUF]; - bool go_again = true; - - if (!str) - return; - - // pointer voodoo++ --w00t - while ((*str) && (*str == ' ')) - str++; - - while (go_again) - { - bool noparse = false; - int t = 0, a = 0; - go_again = false; - const int lenofstr = strlen(str); - - /* - * by caching strlen() of str, we theoretically avoid 3 expensive calls each time this loop - * rolls around.. should speed things up a nanosecond or two. ;) - */ - - while (a < lenofstr) - { - if ((a < lenofstr - 1) && (noparse == false)) - { - if ((str[a] == ' ') && (str[a+1] == ' ')) - { - log(DEBUG,"Tidied extra space out of string: %s",str); - go_again = true; - a++; - } - } - - if (a < lenofstr - 1) - { - if ((str[a] == ' ') && (str[a+1] == ':')) - { - noparse = true; - } - } - - temp[t++] = str[a++]; - } - - temp[t] = '\0'; - strlcpy(str,temp,MAXBUF); - } -} - -/* chop a string down to 512 characters and preserve linefeed (irc max - * line length) */ - -void chop(char* str) -{ - if (!str) - { - log(DEBUG,"ERROR! Null string passed to chop()!"); - return; - } - if (strlen(str) >= 511) - { - str[510] = '\r'; - str[511] = '\n'; - str[512] = '\0'; - log(DEBUG,"Excess line chopped."); - } -} - - void Blocking(int s) { int flags = fcntl(s, F_GETFL, 0); |