Summary: | Kopete parse error on URLs | ||
---|---|---|---|
Product: | [Unmaintained] kopete | Reporter: | Jes Hall <jes> |
Component: | Yahoo Plugin | Assignee: | Kopete Developers <kopete-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | illissius |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Jes Hall
2004-08-14 13:22:29 UTC
do you have debug output? I don't, I don't know how to. ok, no worries. Can you give me the url the person was trying to send you? of course. It was a number of URLs, but this was one of them http://www.lowendmac.com/pb2/2300.shtml CVS commit by mattr: Rearrange the message parsing a bit so we do it all before we create the KopeteMessage object for it. Workaround gaim's bugginess when sending URLs so that there aren't parse errors. CCMAIL: 87190@bugs.kde.org M +55 -46 yahooaccount.cpp 1.94 --- kdenetwork/kopete/protocols/yahoo/yahooaccount.cpp #1.93:1.94 @@ -121,4 +121,8 @@ QString YahooAccount::stripMsgColorCodes filteredMsg.replace( QRegExp("\033\\[1m"), "<b>" ); filteredMsg.replace( QRegExp("\033\\[x1m"), "</b>" ); + //work around gaim's broken sending + filteredMsg.remove( QRegExp( "\033\\[xlm" ) ); + filteredMsg.remove( QRegExp( "\033\\[lm" ) ); + //end work around filteredMsg.replace( QRegExp("\033\\[3m"), "<i>" ); filteredMsg.replace( QRegExp("\033\\[x3m"), "</i>" ); @@ -610,11 +614,8 @@ void YahooAccount::slotGotIm( const QStr } - KopeteMessageManager *mm = contact(who)->manager(); - - // Tell the message manager that the buddy is done typing - mm->receivedTypingMsg(contact(who), false); - - justMe.append(myself()); - + //Parse the message for it's properties + kdDebug(14180) << "Original message is '" << msg << "'" << endl; + //kdDebug(14180) << "Message color is " << getMsgColor(msg) << endl; + QColor fgColor = getMsgColor( msg ); if (tm == 0) msgDT.setTime_t(time(0L)); @@ -622,24 +623,32 @@ void YahooAccount::slotGotIm( const QStr msgDT.setTime_t(tm, Qt::LocalTime); - KopeteMessage kmsg(msgDT, contact(who), justMe, msg, - KopeteMessage::Inbound , KopeteMessage::PlainText); - - QString newMsg = stripMsgColorCodes(kmsg.plainBody()); + QString newMsgText = stripMsgColorCodes( msg ); - kmsg.setFg(getMsgColor(msg)); -// kdDebug(14180) << "Message color is " << getMsgColor(msg) << endl; + kdDebug(14180) << "Message after stripping color codes '" << newMsgText << "'" << endl; - if (newMsg.find("<font") != -1) + if (newMsgText.find("<font") != -1) { - msgFont.setFamily(newMsg.section('"', 1,1)); + msgFont.setFamily(newMsgText.section('"', 1,1)); - if (newMsg.find("size")) - msgFont.setPointSize(newMsg.section('"', 3,3).toInt()); + if (newMsgText.find("size")) + msgFont.setPointSize(newMsgText.section('"', 3,3).toInt()); //remove the font encoding since we handle them ourselves - newMsg.remove(newMsg.mid(0, newMsg.find('>')+1)); + newMsgText.remove(newMsgText.mid(0, newMsgText.find('>')+1)); } - //set the new body that has correct HTML - kmsg.setBody(newMsg, KopeteMessage::RichText); + + kdDebug(14180) << "Message after removing font tags '" << newMsgText << "'" << endl; + + KopeteMessageManager *mm = contact(who)->manager(); + + // Tell the message manager that the buddy is done typing + mm->receivedTypingMsg(contact(who), false); + + justMe.append(myself()); + + KopeteMessage kmsg(msgDT, contact(who), justMe, newMsgText, + KopeteMessage::Inbound , KopeteMessage::RichText); + + kmsg.setFg( fgColor ); kmsg.setFont(msgFont); mm->appendMessage(kmsg); CVS commit by mattr: Backport of the fix for the parse errors when we've been sent URLs in yahoo. This should be in KDE 3.3.1 CCMAIL: 87190-done@bugs.kde.org M +29 -20 yahooaccount.cpp 1.93.2.1 --- kdenetwork/kopete/protocols/yahoo/yahooaccount.cpp #1.93:1.93.2.1 @@ -121,4 +121,8 @@ QString YahooAccount::stripMsgColorCodes filteredMsg.replace( QRegExp("\033\\[1m"), "<b>" ); filteredMsg.replace( QRegExp("\033\\[x1m"), "</b>" ); + //work around gaim's broken sending + filteredMsg.remove( QRegExp( "\033\\[xlm" ) ); + filteredMsg.remove( QRegExp( "\033\\[lm" ) ); + //end work around filteredMsg.replace( QRegExp("\033\\[3m"), "<i>" ); filteredMsg.replace( QRegExp("\033\\[x3m"), "</i>" ); @@ -610,11 +614,8 @@ void YahooAccount::slotGotIm( const QStr } - KopeteMessageManager *mm = contact(who)->manager(); - - // Tell the message manager that the buddy is done typing - mm->receivedTypingMsg(contact(who), false); - - justMe.append(myself()); - + //Parse the message for it's properties + kdDebug(14180) << "Original message is '" << msg << "'" << endl; + //kdDebug(14180) << "Message color is " << getMsgColor(msg) << endl; + QColor fgColor = getMsgColor( msg ); if (tm == 0) msgDT.setTime_t(time(0L)); @@ -622,24 +623,32 @@ void YahooAccount::slotGotIm( const QStr msgDT.setTime_t(tm, Qt::LocalTime); - KopeteMessage kmsg(msgDT, contact(who), justMe, msg, - KopeteMessage::Inbound , KopeteMessage::PlainText); - - QString newMsg = stripMsgColorCodes(kmsg.plainBody()); + QString newMsgText = stripMsgColorCodes( msg ); - kmsg.setFg(getMsgColor(msg)); -// kdDebug(14180) << "Message color is " << getMsgColor(msg) << endl; + kdDebug(14180) << "Message after stripping color codes '" << newMsgText << "'" << endl; - if (newMsg.find("<font") != -1) + if (newMsgText.find("<font") != -1) { - msgFont.setFamily(newMsg.section('"', 1,1)); + msgFont.setFamily(newMsgText.section('"', 1,1)); - if (newMsg.find("size")) - msgFont.setPointSize(newMsg.section('"', 3,3).toInt()); + if (newMsgText.find("size")) + msgFont.setPointSize(newMsgText.section('"', 3,3).toInt()); //remove the font encoding since we handle them ourselves - newMsg.remove(newMsg.mid(0, newMsg.find('>')+1)); + newMsgText.remove(newMsgText.mid(0, newMsgText.find('>')+1)); } - //set the new body that has correct HTML - kmsg.setBody(newMsg, KopeteMessage::RichText); + + kdDebug(14180) << "Message after removing font tags '" << newMsgText << "'" << endl; + + KopeteMessageManager *mm = contact(who)->manager(); + + // Tell the message manager that the buddy is done typing + mm->receivedTypingMsg(contact(who), false); + + justMe.append(myself()); + + KopeteMessage kmsg(msgDT, contact(who), justMe, newMsgText, + KopeteMessage::Inbound , KopeteMessage::RichText); + + kmsg.setFg( fgColor ); kmsg.setFont(msgFont); mm->appendMessage(kmsg); |