Hello, I wrote a small patch (applying to Kopete 0.12.3) that adds "support" for multi-person chats in the chat history dialog. As Martijn Klingens explained me, the data on disk is correct, but it is not displayed correctly, i.e. incoming messages are not marked with their sender.
With the patch now the sender of the message is always shown, even if there were only two persons chatting. The patch does not add full support, e.g. in the conversation list the conversation is only shown for one user (this is the user the log was saved for). I don't have chat logs for multi-person chats and had to fake some, so my data could not be correct. However, it works if I add a line <msg nick="Mr. X" in="1" from="123456789" time="11 17:30:40" >Test 3</msg> in the log file. Apparently, if there is more than one line <contact contactId="123456789" /> at the top of the file, it is not parsed or not parsed correctly, at least I did not find any code that would do this. It would be nice if you could point out any mistake I made (especially I would be interested in how these files are named with multi-person chats). Maybe this functionality could go right into KDE 3.5.7 or so, because I consider it a bug that the sender of incoming messages is not displayed. For KDE4 one could add real multi-person functionality, with the chatwindow code (hopefully) being shared. I would be glad if someone could review the patch and point out any mistakes I made. Regards, Johannes -- Black holes are where God divided by zero -- Steven Wright
--- kopete-0.12.2-new/kopete/plugins/history/historydialog.cpp 2006-08-12 02:50:49.000000000 +0200
+++ kopete-0.12.2/kopete/plugins/history/historydialog.cpp 2007-03-22 20:16:44.000000000 +0100
@@ -371,14 +371,13 @@
{
resultHTML = "";
- if (accountLabel.isEmpty() || accountLabel != (*it).from()->account()->accountLabel())
- // If the message's account is new, just specify it to the user
+ if (accountLabel.isEmpty() || accountLabel != (*it).from()->metaContact()->displayName())
+ // This message is the first one, or came from another account than the
+ // previous message, so display the account it came from.
{
- if (!accountLabel.isEmpty())
- resultHTML += "<br/><br/><br/>";
- resultHTML += "<b><font color=\"blue\">" + (*it).from()->account()->accountLabel() + "</font></b><br/>";
+ resultHTML += "<div style=\"font-weight: bold; color: blue; margin: 0px; margin-top:.3em\">" + (*it).from()->metaContact()->displayName() + "</div>";
}
- accountLabel = (*it).from()->account()->accountLabel();
+ accountLabel = (*it).from()->metaContact()->displayName();
QString body = (*it).parsedBody();
@@ -396,6 +395,7 @@
newNode = mHtmlPart->document().createElement(QString::fromLatin1("span"));
newNode.setAttribute(QString::fromLatin1("dir"), dir);
+ newNode.setAttribute(QString::fromLatin1("style"), "margin-left: 1em");
newNode.setInnerHTML(resultHTML);
mHtmlPart->htmlDocument().body().appendChild(newNode);
pgpemZ7qIFl4X.pgp
Description: PGP signature
_______________________________________________ kopete-devel mailing list [email protected] https://mail.kde.org/mailman/listinfo/kopete-devel
