Bug 106594 - Can't add invitation to calendar if not in To: list
Summary: Can't add invitation to calendar if not in To: list
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.8
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Till Adam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-01 11:52 UTC by Nick Thompson
Modified: 2006-02-13 18:38 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for bug 106594 (1.72 KB, patch)
2006-01-06 17:36 UTC, Philippe Rigault
Details
Better patch (2.68 KB, patch)
2006-01-06 23:17 UTC, Philippe Rigault
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Thompson 2005-06-01 11:52:11 UTC
Version:           1.8 (using KDE KDE 3.4.0)
Installed from:    Compiled From Sources
Compiler:          gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-42) 
OS:                Linux

It I get an invite that was sent to a group email address, or I get an invite where I am named only in the CC: list, kmail will not allow me to accept the invitation without selecting one of the unapplicable addresses in the To: list. Since I can't accept the invite, it doesn't go into my calendar and I miss the meeting :-)
Comment 1 Andreas Gungl 2005-06-01 13:12:13 UTC
The same problem applies to the development version.
Comment 2 Till Adam 2005-06-26 13:42:02 UTC
Hm, I'll have a look.
Comment 3 Spencer Shimko 2005-09-28 16:22:20 UTC
I can verify this issue still appears with:
Version: Kmail 1.8.91 (kde 3.5 beta1)
Installed from: Gentoo portage
Compiler: gcc (GCC) 3.4.4 (Gentoo 3.4.4, ssp-3.4.4-1.0, pie-8.7.8)
OS: Linux

Comment 4 Philippe Rigault 2006-01-06 17:36:31 UTC
Created attachment 14152 [details]
Patch for bug 106594

Here is a proposed patch to apply to KDE-3.5, where the problem still persists.


It fixes two things:
 1. This very bug, by looking into the CC: addresses as well as in the TO:
addresses
 2. The message informs the user about two different cases:
    - no address found that matches an identity
    - several addresses found that match an identity (new message)

This patch applies readily to konstruct.
Please apply to HEAD and 3.5-branch.

Cheers,

Philippe
Comment 5 Philippe Rigault 2006-01-06 23:17:30 UTC
Created attachment 14160 [details]
Better patch

Improved patch.

The upfront testing of a sole address in the to: list is removed, so it is now
correct to rely on the fact that there is only one recipient in the combined
to: and cc: lists to add the invite to that person's calendar.

Without this fix, if the user (say foo@example.com) is on the cc: list and the
to: list happens to contain only one address (say bar@example.com), then the
reciever of the invite would wrongly be set to the latter one (bar@example.com)
instead of the user (foo@example.com).

I also believe the logic is now clearer in the code.

Cheers,

Philippe
Comment 6 Till Adam 2006-01-18 21:11:15 UTC
Thanks, the patch looks correct to me. I'll apply it to head and ask the translators for permission to add it to 3.5 as well. If they deny it, I'll commit a version which doesn't change strings. Contribution much appreciated. :)
Comment 7 Till Adam 2006-01-22 17:38:11 UTC
Committed to trunk, branch commit pending ok by the translators.
Comment 8 Till Adam 2006-01-22 17:38:35 UTC
I guess we can close it, then.
Comment 9 Philippe Rigault 2006-01-31 19:24:54 UTC
For information, the commit did not make it to KDE-3.5.1. Patch still necessary there.
Comment 10 Till Adam 2006-02-02 14:01:39 UTC
Yeah, the translators refused it, too late in the game, it'll go in now that the branch is unfrozen again.
Comment 11 Till Adam 2006-02-13 18:38:40 UTC
SVN commit 509083 by tilladam:

Backport patch by Philippe Rigault, which makes it possible to accept
invitations if one is not in the invitations To: list, now that the
string freeze is lifted somewhat.

CCMAIL: 106594@bugs.kde.org


 M  +37 -24    callback.cpp  


--- branches/KDE/3.5/kdepim/kmail/callback.cpp #509082:509083
@@ -112,34 +112,47 @@
   mReceiverSet = true;
 
   QStringList addrs = KPIM::splitEmailAddrList( mMsg->to() );
-  if( addrs.count() < 2 )
-    // Only one receiver, so that has to be us
-    mReceiver = mMsg->to();
-  else {
-    int found = 0;
-    for( QStringList::Iterator it = addrs.begin(); it != addrs.end(); ++it ) {
-      if( kmkernel->identityManager()->identityForAddress( *it ) !=
-          KPIM::Identity::null() ) {
-	// Ok, this could be us
-        ++found;
-        mReceiver = *it;
-      }
+  int found = 0;
+  for( QStringList::Iterator it = addrs.begin(); it != addrs.end(); ++it ) {
+    if( kmkernel->identityManager()->identityForAddress( *it ) !=
+        KPIM::Identity::null() ) {
+      // Ok, this could be us
+      ++found;
+      mReceiver = *it;
     }
-
-    if( found != 1 ) {
-      bool ok;
-      mReceiver =
-        KInputDialog::getItem( i18n( "Select Address" ),
-                               i18n( "<qt>None of your identities match the "
-                                     "receiver of this message,<br>please "
-                                     "choose which of the following addresses "
-                                     "is yours:" ),
-                               addrs, 0, FALSE, &ok, kmkernel->mainWin() );
-      if( !ok )
-        mReceiver = QString::null;
+  }
+  QStringList ccaddrs = KPIM::splitEmailAddrList( mMsg->cc() );
+  for( QStringList::Iterator it = ccaddrs.begin(); it != ccaddrs.end(); ++it ) {
+    if( kmkernel->identityManager()->identityForAddress( *it ) !=
+        KPIM::Identity::null() ) {
+      // Ok, this could be us
+      ++found;
+      mReceiver = *it;
     }
   }
+  if( found != 1 ) {
+    bool ok;
+    QString selectMessage;
+    if (found == 0) {
+      selectMessage = i18n("<qt>None of your identities match the "
+          "receiver of this message,<br>please "
+          "choose which of the following addresses "
+          "is yours, if any:");
+    } else {
+      selectMessage = i18n("<qt>Several of your identities match the "
+          "receiver of this message,<br>please "
+          "choose which of the following addresses "
+          "is yours:");
+    }
 
+    mReceiver =
+      KInputDialog::getItem( i18n( "Select Address" ),
+          selectMessage,
+          addrs, 0, FALSE, &ok, kmkernel->mainWin() );
+    if( !ok )
+      mReceiver = QString::null;
+  }
+
   return mReceiver;
 }