#761: trim message
--------------------------+-------------------------------------------------
  Reporter:  prior        |       Owner:  emostar 
      Type:  enhancement  |      Status:  assigned
  Priority:  normal       |   Milestone:          
 Component:  licq daemon  |     Version:          
Resolution:  None         |    Keywords:          
--------------------------+-------------------------------------------------
Old description:

> it is annoying, when i receive a message from a windows
> user. windows-icq sends an extra CRLF at the end of the
> message.
>
> it looks like this:
> (23:33:24) [D---] windows: test123
>
> (23:33:39) [D---] windows: test456
>
> (23:33:57) [D---] windows: test789
>
> (23:37:33) [D---] me: foo
> (23:37:42) [D---] me: bar
> (23:37:55) [D---] me: meep
>

> i've written a small patch:
>
> --- rtf.cc.org  2005-09-05 23:08:22.000000000 +0200
> +++ rtf.cc      2005-09-05 23:38:01.000000000 +0200
> @@ -2408,6 +2408,16 @@
>      else
>        str = rtf;
>
> +    uint32_t i = str.find_first_not_of("
> ");
> +    if (i != 0) {
> +        str.erase(0, i);
> +    }
> +    if (str.size() > 0) {
> +        i = str.find_last_not_of("
> ");
> +        if (i != str.size() - 1) {
> +            str.erase(i + 1, string::npos);
> +        }
> +    }
>      char *szReturn = new char[str.length() + 1];
>      strcpy(szReturn, str.c_str());
>      szReturn[str.length()] = '

New description:

 it is annoying, when i receive a message from a windows user. windows-icq
 sends an extra CRLF at the end of the message.

 it looks like this:
 {{{
 (23:33:24) [D---] windows: test123

 (23:33:39) [D---] windows: test456

 (23:33:57) [D---] windows: test789

 (23:37:33) [D---] me: foo
 (23:37:42) [D---] me: bar
 (23:37:55) [D---] me: meep
 }}}

 i've written a small patch:
 {{{
 #!diff
 --- rtf.cc.org  2005-09-05 23:08:22.000000000 +0200
 +++ rtf.cc      2005-09-05 23:38:01.000000000 +0200
 @@ -2408,6 +2408,16 @@
      else
        str = rtf;

 +    uint32_t i = str.find_first_not_of(" ");
 +    if (i != 0) {
 +        str.erase(0, i);
 +    }
 +    if (str.size() > 0) {
 +        i = str.find_last_not_of(" ");
 +        if (i != str.size() - 1) {
 +            str.erase(i + 1, string::npos);
 +        }
 +    }
      char *szReturn = new char[str.length() + 1];
      strcpy(szReturn, str.c_str());
      szReturn[str.length()] = '
 }}}

-- 
Ticket URL: <http://trac.licq.org/ticket/761#comment:3>
Licq <http://www.licq.org/>
Licq - an instant messaging client for UNIX.

Reply via email to