Bug 83311 - dcopAddMessage doesn't support emails with same subject in one folder
Summary: dcopAddMessage doesn't support emails with same subject in one folder
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 88383 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-13 18:35 UTC by Laurence Anderson
Modified: 2007-09-14 12:17 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for KMail/KMailCVT (against CVS) (35.76 KB, patch)
2005-01-31 22:43 UTC, Danny Kukawka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurence Anderson 2004-06-13 18:35:01 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

The dcopAddMessage function in kmkernel.cpp will return -4 if you try to add two messages with the same subject into the same folder. When importing emails via kmailcvt it is sometimes possible for emails to have the same subject, so they can't be imported.
Comment 1 Chris Howells 2004-08-29 15:23:52 UTC
I don't really understand this bug report. The mails seem to be imported just fine even if the dcop function returns 4.
Comment 2 Chris Howells 2004-08-31 23:23:12 UTC
Are you able to add any more information please Laurence? Did the import fail for you when KMail reported a duplicate subject?

Thanks
Comment 3 Laurence Anderson 2004-09-07 15:17:27 UTC
Yes, I put a workaround in KMailCVT. From memory the paths aren't appended properly in the kmail source if you use the QString version. 

Workaround:
http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdepim/kmailcvt/filters.cxx.diff?r1=1.42&r2=1.43&sortby=date&f=h

Offending code in kmkernel:

return dcopAddMessage(foldername, KURL(msgUrlString));

The KURL constructor would interpret # in the url as a reference (for example).
Comment 4 Laurence Anderson 2004-09-07 15:18:42 UTC
Scratch that, wrong bug.

I'll try to find the mails I had problems with
Comment 5 Laurence Anderson 2004-09-07 15:23:28 UTC
kmkernel may have been fixed, I could never figure why subjects had to be unique in a folder. There were some users asking that messages that weren't sucessfully imported to be listed, but I guess a message box is over the top
Comment 6 Danny Kukawka 2005-01-31 22:42:08 UTC
I wrote a patch for this bug and posted it on KMail developers mailing list [1][2].

I attach the patch (against CVS).

Danny

--------------------------------------
Fixed problems:
- dublicated messages during import
- performance of import 

Change log:
--------------------------------------
KMail:

- fixed dcopAddMessage() in kmail, now messageID is used to find duplicated 
messages (see comment in the patch)
- added new function dcopAddMessage_fastImport() to kmail for much more faster  
import without search for duplicated messages (I didn't integrate this to 
dcopAddMessage() , because maybe other programs use this function.)
- added possibility to destroy the static QStringList (see:  dcopAddMessage()) 
with msgIDs if import finished

-------------------------------------
KMailCVT:

- added checkbox in KSelFilterPageDlg to enable 'remove duplicated messages 
during import'. Now import without check for duplicated messages is default.
- updated all filters in kmailcvt 
- changed name of evolution filter in the filterdialog because the filter only 
support Evolution 1.x
- removed info->alert() if duplicated messages was found, added info for user
how many duplicated messages were not imported 
- fixed info->setOverall() in filter_mbox.* and filter_mailapp.* 
- fixed filecheck in filter_mbox.* and filter_mailapp.* (if 
mbox.open(IO_ReadOnly) failed the filter started import anyway (empty 
messages))

Short little performance benchmark:
-----------------------------------------
- mbox: 11 MB, 2911 messages:
  - 1.) remove duplicate messages [old]: 26 sec
  - 2.) without remove                      [new]: 24 sec 
- mbox: 140 MB, 20514 messages:
  - 1.) 802 sec
  - 2.) 730 sec 
- mbox: 133 MB, 35065 messages:
  - 1.) 1055 sec, 1111 sec
  - 2.) 647 sec, 632 sec      (-38,7 %, -43 %)
--------------------------------------------------

[1] http://article.gmane.org/gmane.comp.kde.devel.kmail/36165 
[2] http://article.gmane.org/gmane.comp.kde.devel.kmail/36168
Comment 7 Danny Kukawka 2005-01-31 22:43:15 UTC
Created attachment 9379 [details]
Patch for KMail/KMailCVT (against CVS)
Comment 8 Daniel Molkentin 2005-02-01 03:13:15 UTC
CVS commit by danimo: 

* Applying slightly adopted patches by Danny Kukawka <dkukawka@suse.de>, fixing an averanche of bugs:

- Gets rid of duplicated messages
- Allows for unattended import
- Eliminates severe performance issues
- Add filters for Evolution 2, Thunderbird 1.0 and Opera

* Reorder combobox entries, specific applications first, generic importers last
* Slight markup fixes

BUG:51844
BUG:87971
BUG:81634
BUG:83311

Danny, please check if everything still works as expected.

CCMAIL:dkukawka@suse.de


  A            filter_evolution_v2.cxx   1.1 [GPL (v2+)]
  A            filter_evolution_v2.hxx   1.1 [GPL (v2+)]
  A            filter_opera.cxx   1.1 [GPL (v2+)]
  A            filter_opera.hxx   1.1 [GPL (v2+)]
  A            filter_thunderbird.cxx   1.1 [GPL (v2+)]
  A            filter_thunderbird.hxx   1.1 [GPL (v2+)]
  M +7 -2      Makefile.am   1.28
  M +17 -3     filter_evolution.cxx   1.3
  M +46 -30    filter_mailapp.cxx   1.2
  M +52 -28    filter_mbox.cxx   1.7
  M +14 -3     filter_oe.cxx   1.16
  M +1 -1      filter_oe.hxx   1.4
  M +18 -2     filter_plain.cxx   1.21
  M +24 -6     filter_pmail.cxx   1.34
  M +54 -8     filters.cxx   1.45
  M +9 -3      filters.hxx   1.30
  M +1 -1      kmailcvt.cpp   1.32
  M +15 -3     kselfilterpage.cpp   1.11
  M +1 -0      kselfilterpage.h   1.7
  M +47 -33    kselfilterpagedlg.ui   1.8



Comment 9 Laurence Anderson 2005-02-02 01:54:17 UTC
Thanks for committing Daniel, I've been really busy lately!
Comment 10 Danny Kukawka 2005-02-03 10:53:29 UTC
*** Bug 88383 has been marked as a duplicate of this bug. ***