Bug 291143

Summary: Creating folders on IMAP account doesn't work
Product: [Frameworks and Libraries] Akonadi Reporter: karaluh <karaluh>
Component: IMAP resourceAssignee: Kevin Ottens <ervin>
Status: RESOLVED FIXED    
Severity: normal CC: amantia, andy, asanchezm, dvratil, ervin, kdepim-bugs, vkrause
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.2

Description karaluh 2012-01-10 10:03:12 UTC
Version:           unspecified
OS:                Linux

As in summary. 

Reproducible: Always

Steps to Reproduce:
Create folder in kmail.
Log in to the account using webmail client

Actual Results:  
There is no newly created folder

Expected Results:  
Folder is created
Comment 1 Kevin Ottens 2012-02-11 10:50:05 UTC
Did you get a sync in the meantime? The newly created folders are not pushed on the server before such a sync occurs.

I cannot reproduce it here, so if it still happens, please provide the communication between the resource and the imap server so that we can check what's going on:
http://techbase.kde.org/Projects/PIM/Akonadi/Debug_IMAP
Comment 2 karaluh 2012-02-13 08:12:12 UTC
(In reply to comment #1)
> Did you get a sync in the meantime?

No, as you said, the folder appeared after the sync. I beleive however, that it should be visible immediately.
Comment 3 Kevin Ottens 2012-02-14 21:25:52 UTC
Not sure if I have any control of that from the resource... Bouncing to Akonadi general just in case.
Comment 4 Volker Krause 2012-03-11 16:07:34 UTC
Writing back changes is independent of syncing (syncing is only for polling for remote changes), you get an collectionAdded() signal immediately in this case, assuming the resource is online.
Comment 5 András Manţia 2013-03-28 21:45:54 UTC
Git commit d8fd7a28e7d6d8a89dd398311d423118ff529718 by Andras Mantia.
Committed on 28/03/2013 at 22:45.
Pushed by amantia into branch 'KDE/4.10'.

1) Fix creation of new toplevel folders (and all its subfolder): it used to generate a broken remote id and separtor ("i") causing weird problems.
2) Make sure toplevel imap folders are shown immediately, without a need to sync the account (workarounds an ETM bug 291143)
3) Warn the user if creating a folder failed on server-side and remove the folder locally. Otherwise if creation failed, it was impossible to create again a folder with the same name,
as it was already a folder with that name in the akonadi cache...
4) Make sure deleting folder "foo" doesn't deleted all folders starting with "foo" as it did before.
5) Just fix folder deletion. :) It could fail in certain cases.
6) Fix and adapt the tests.

Reporters of closed bugs: if you can still see the bug in 4.10.2, please reopen and state the details.

REVIEW: 109276
FIXED-IN: 4.10.2291143291143
Related: bug 312435, bug 305269, bug 301088, bug 292418, bug 305987

M  +6    -1    resources/imap/addcollectiontask.cpp
M  +1    -1    resources/imap/changecollectiontask.cpp
M  +16   -0    resources/imap/imapresource.cpp
M  +7    -0    resources/imap/imapresource.h
M  +11   -8    resources/imap/removecollectionrecursivetask.cpp
M  +1    -0    resources/imap/removecollectionrecursivetask.h
M  +10   -0    resources/imap/resourcetask.cpp
M  +2    -0    resources/imap/resourcetask.h
M  +4    -1    resources/imap/tests/dummyresourcestate.cpp
M  +7    -5    resources/imap/tests/testremovecollectiontask.cpp

http://commits.kde.org/kdepim-runtime/d8fd7a28e7d6d8a89dd398311d423118ff529718
Comment 6 Alejandro G Sánchez Martínez 2013-09-28 02:39:08 UTC
I create a folder and it creates but kmail does not show if I enter a directory webmail works fine but can not mostar kmail. 4.11.1 kmail and reproduced and 4 desktop.

kubuntu 13.04  clean install

kubuntu 13.04 upgrade 

and other desktop

plase reopen this bug
Comment 7 Daniel Vrátil 2013-09-29 10:41:14 UTC
Alejandro, could you please follow the steps described in http://techbase.kde.org/Projects/PIM/Akonadi/Debug_IMAP and provide log of communication between Akonadi IMAP resource and IMAP server while trying to create the folder, so that we cat find out whats's failing?
Comment 8 Andreas Stöhr 2013-10-08 16:51:51 UTC
Client:
Gentoo stable
KMail 4.10.5
Akonadi Console 0.99

Server:
Debian wheezy
dovecot 2.1.7

create new toplevel-folder in kmail
imap.log.pid.2:
C: A000009 CREATE "NewToplevelFolder"
S: A000009 OK Create completed.
C: A000010 SUBSCRIBE "NewToplevelFolder"
S: A000010 OK Subscribe completed.
C: A000011 LIST "" *
S: * LIST ( \HasNoChildren ) . NewToplevelFolder
S: * LIST ( \HasNoChildren ) . INBOX
S: A000011 OK List completed.

there is no new folder in kmail

in db you can see:
SELECT * from CollectionTable where parentId=686;
+-----+--------------------+-------------------+----------+
| id  | remoteId           | name              | parentId |
+-----+--------------------+-------------------+----------+
| 687 | .INBOX             | INBOX             |      686 |
| 690 | /NewToplevelFolder | NewToplevelFolder |      686 |
+-----+--------------------+-------------------+----------+

change the remoteid:
Update collectionTable set remoteId='.NewToplevelFolder' where id=690;
select id, remoteId, name, parentId from CollectionTable where parentId=686;
+-----+--------------------+-------------------+----------+
| id  | remoteId           | name              | parentId |
+-----+--------------------+-------------------+----------+
| 687 | .INBOX             | INBOX             |      686 |
| 690 | .NewToplevelFolder | NewToplevelFolder |      686 |
+-----+--------------------+-------------------+----------+

the folder is usable.