Bug 146380 - newlines seen when sending richtext to gaim and trillian clients
Summary: newlines seen when sending richtext to gaim and trillian clients
Alias: None
Product: kopete
Classification: Applications
Component: ICQ and AIM Plugins (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
Depends on:
Reported: 2007-06-05 05:09 UTC by Matt Rogers
Modified: 2008-10-26 11:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:

screenshot showing the problem (134.69 KB, image/png)
2007-06-05 05:13 UTC, Matt Rogers
Fixes leftover line-break (670 bytes, patch)
2007-06-07 04:35 UTC, Guillermo Antonio Amaral Bastidas

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Rogers 2007-06-05 05:09:33 UTC
Version:           0.12.5 (using KDE KDE 3.5.6)
Installed from:    I Don't Know
Compiler:          gcc 
OS:                Linux

When sending rich text messages to clients using gaim and/or trillian, an extra newline is rendered on the receiving end. This is probably due to sending something like "<span>foo bar baz<br></span>" to the server. If there is only one newline in the message, then kopete should remove the "<br>" tag generated from that in order to avoid sending the newline.
Comment 1 Matt Rogers 2007-06-05 05:13:00 UTC
Created attachment 20779 [details]
screenshot showing the problem

This screenshot shows the problem that gaim and trillian clients will see when
being on the receiving end of a message from Kopete to either of those clients.
Comment 2 Guillermo Antonio Amaral Bastidas 2007-06-07 04:35:54 UTC
Created attachment 20796 [details]
Fixes leftover line-break
Comment 3 Matt Rogers 2007-06-08 21:44:52 UTC
SVN commit 673027 by mattr:

fix bug 146380 by removing the last <br> tag from the message before sending

Based on a patch by Guillermo A. Amaral. Thanks for the patch!
The fix should appear in KDE 3.5.8 when/if that is released.

BUG: 146380
CCMAIL: me@guillermoamaral.com

 M  +3 -0      aimcontact.cpp  

--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/aim/aimcontact.cpp #673026:673027
@@ -440,6 +440,9 @@
 	s.replace ( QRegExp ( QString::fromLatin1("<br[ /]*>")), QString::fromLatin1("<br>") );
+	// strip left over line break
+	s.remove( QRegExp( QString::fromLatin1( "<br>$" ) ) );
 	kdDebug(14190) << k_funcinfo << "sending "
 		<< s << endl;
Comment 4 Matt Rogers 2007-06-09 02:32:26 UTC
SVN commit 673098 by mattr:

Forward port the fix for bug 146380 to KDE 4.
CCBUG: 146380

 M  +2 -0      aimcontactbase.cpp  

--- trunk/KDE/kdenetwork/kopete/protocols/oscar/aimcontactbase.cpp #673097:673098
@@ -198,6 +198,8 @@
 	s.replace ( QRegExp ( QString::fromLatin1("<font ptsize=\"[^\"]*\">")),QString::fromLatin1("<font size=\"7\">"));
 	s.replace ( QRegExp ( QString::fromLatin1("<br[ /]*>")), QString::fromLatin1("<br>") );
+	s.remove ( QRegExp ( QString::fromLatin1("<br>$") ) ); 
 	kDebug(OSCAR_GEN_DEBUG) << k_funcinfo << "sending " << s << endl;
Comment 5 Linus Berglund 2007-07-29 18:29:14 UTC
I can also confirm this in jabber in Kopete. Sending rich text messages with jabber results in an extra space below for the reciever. When exporting the message the messages recieved that has the extra spaces looks like:

<span style="" class="KopeteMessageBody"><p xmlns="http://www.w3.org/1999/xhtml" style="font-family: Sans Serif; ">Bättre nu?<br xmlns="http://www.w3.org/1999/xhtml"><br>

and messages sent when Rich text is on looks like:

<span style="color: #000000; font-family: DejaVu Sans; " class="KopeteMessageBody"><span style="color:#000000">blir det konstiga mellanrum?</span><br></span>

Without rich text there are no <br>s sent.
Comment 6 Josh Berry 2008-10-26 06:40:09 UTC
I am seeing this problem again talking to a friend on AIM with Kopete trunk (r875603).

At line 223 of aimcontactbase.cpp, we are stripping <BR> from the end of the string, but that does not take into account any closing tags that may be present (e.g. "<font size='3'>foo<br></font>").
Comment 7 Roman Jarosz 2008-10-26 11:31:20 UTC
SVN commit 876033 by rjarosz:

Strip last BR before we add closing style tags.

BUG: 146380

 M  +3 -3      aimcontactbase.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=876033
Comment 8 Roman Jarosz 2008-10-26 11:31:44 UTC
SVN commit 876034 by rjarosz:

Backport commit 876033.
Strip last BR before we add closing style tags.

CCBUG: 146380

 M  +3 -3      aimcontactbase.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=876034