In the chatmode messageview a dialogue usually looks like this:

Message 16:22:23 [D---]
Hey!
Message 16:25:11 [D---]
How's it going?

The user can tell the difference between sent and received messages by 
color, but when copy-pasting the dialogue to another user (or any other 
place where it loses the colors) it becomes impossible to tell who sent 
each message. My patch solves this by putting the sender's alias after 
each header line (as it's done in virtually all other icq clients), like 
this:

16:22:23 [D---] Bones0:
Hey!
16:25:11 [D---] tlbdk:
How's it going?

Also, to save space I've removed "Message". This is because 99% of all 
events are usually messages, so it's not really necessary to print this. 
For other event types they are still printed like always:

Chat Request 14:34:02 [D---] Bones0:
hey...

licq-names-in-chat.patch attached.

/Jonas Jensen

--- licq-old/plugins/qt-gui/src/ewidgets.cpp    Wed May 22 17:54:26 2002
+++ licq/plugins/qt-gui/src/ewidgets.cpp        Wed May 22 17:49:39 2002
@@ -496,12 +496,24 @@
 
   QString n;
   QTextCodec *codec = QTextCodec::codecForLocale();
-  ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R);
-  if (u != NULL)
-  {
-    codec = UserCodec::codecForICQUser(u);
-    n = codec->toUnicode(u->GetAlias());
-    gUserManager.DropUser(u);
+  ICQUser *u;
+  
+  if (e->Direction() == D_RECEIVER) {
+    u = gUserManager.FetchUser(m_nUin, LOCK_R);
+    if (u != NULL)
+    {
+      codec = UserCodec::codecForICQUser(u);
+      n = codec->toUnicode(u->GetAlias());
+      gUserManager.DropUser(u);
+    }
+  } else {
+    ICQOwner *o = gUserManager.FetchOwner(LOCK_R);
+    if (o != NULL)
+    {
+      codec = UserCodec::codecForICQUser(o);
+      n = codec->toUnicode(o->GetAlias());
+      gUserManager.DropOwner();
+    }
   }
 
   QString s;
@@ -518,25 +530,29 @@
   // seem to be buggy in Qt 3 at the time of writing.
   // This can potentially make BiDi support worser, so this string needs to be
   // rewritten to use a separate paragraph for each message when Qt gets fixed.
-  s.sprintf("<font color=\"%s\"><b>%s %s [%c%c%c%c]</b><br>%s</font><br>",
+  s.sprintf("<font color=\"%s\"><b>%s%s [%c%c%c%c] %s:</b><br>%s</font><br>",
             color,
-            EventDescription(e).utf8().data(),
+            e->SubCommand() == ICQ_CMDxSUB_MSG ? "" :
+              (EventDescription(e) + " ").utf8().data(),
             sd.utf8().data(),
             e->IsDirect() ? 'D' : '-',
             e->IsMultiRec() ? 'M' : '-',
             e->IsUrgent() ? 'U' : '-',
             e->IsEncrypted() ? 'E' : '-',
+            n.utf8().data(),
             messageText.utf8().data()
            );
 #else
-  s.sprintf("%c%s %s [%c%c%c%c]\n%s",
+  s.sprintf("%c%s%s [%c%c%c%c] %s:\n%s",
             (e->Direction() == D_RECEIVER) ? '\001' : '\002',
-            EventDescription(e).utf8().data(),
+            e->SubCommand() == ICQ_CMDxSUB_MSG ? "" :
+              (EventDescription(e) + " ").utf8().data(),
             sd.utf8().data(),
             e->IsDirect() ? 'D' : '-',
             e->IsMultiRec() ? 'M' : '-',
             e->IsUrgent() ? 'U' : '-',
             e->IsEncrypted() ? 'E' : '-',
+            n.utf8().data(),
             codec->toUnicode(e->Text()).utf8().data()
            );
 #endif

Reply via email to