[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenetwork/kopete/protocols/yahoo
From: Matt Rogers <matt () matt ! rogers ! name>
Date: 2004-08-20 4:27:33
Message-ID: 20040820042733.128019245 () office ! kde ! org
[Download RAW message or body]
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);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic