fmbiete / Z-Push-contrib

Z-Push fork with changes that I will try to contrib
GNU Affero General Public License v3.0
135 stars 62 forks source link

Notes backend #65

Open fortiko opened 10 years ago

fortiko commented 10 years ago

Hello!

I got the first bits and pieces of a BackendNotes working, based heavily in the IMAP code: since Mail.app (and perhaps other applications?) seem to be using a special "Notes" folder on IMAP for that functionality, I decided to copy that approach.

Working functionality:

Somewhat working:

Not working yet:

If you are interested, I can upload the code: basically imap.php with a new config file and a few changes. Perhaps you could have a look and drastically improve it.

fmbiete commented 10 years ago

Hi!

Feel free to create a merge request, just remember to put in the commit message that you are releasing the code under the AGPL license.

Regards

N0ury commented 10 years ago

Hello Fransisco and fortiko.

I was looking for something like that when I found this tread.

I have my own mail server with imap. I also use Sogo. The main advantage is that for this purpuse all processes listen on localhost only. No port is open to the outside world (except smtp for mail receiving and https for all the rest).

Since 2 weeks I have a macbook. I had before an iphone. Both use "Notes" folder on imap server to store notes. So I have added such folder on my server and everything is ok.

The problem is that it works on the imap server directely, and that I can do that only at home or via vpn. I don't want to open imap/imaps...

I thought Zpush-contrib could do that, and wanted to ask for.

Notes app on Mac and on iphone can read, write and sync notes. I think syncing is a delete/create operation.

I have written a small python script to insert new note to server. It syncs with the two others. I have tried it also on gmail (just to create notes, not syncing)

If there's some code (a new backend) to test to have activesync with notes, I can do that. Just tell me where to get it.

Regards

nbenm

N0ury commented 10 years ago

Fortiko,

When you create a new note, is it with mail.app on osx ? If so do you use the following headers ? X-Universally-Unique-Identifier: followed by an uuid X-Uniform-Type-Identifier: com.apple.mail-note

example of full headers used today and that works fine with accented characters:

From nobody Tue Sep 9 10:26:17 2014 X-Universally-Unique-Identifier: 4e32871e-deb7-4872-a656-d77ead310d4e X-Uniform-Type-Identifier: com.apple.mail-note Subject: Mon test avec des caractères accentués Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-ID: 20140909082617.12588.47769@colibri.dagami.org Date: Tue, 09 Sep 2014 10:26:17 +0200 MIME-Version: 1.0

fortiko commented 10 years ago

Right now, the backend syncs all the "notes" (basically emails with the headers you mention above) from the server to the client, and also supports deletion of the notes on the client (which then syncs back to the server).

Creating new messages and updating existing messages does not work.

I believe that "update" has to be a 2-step process in case the content has changed: a) delete existing note with old content b) create new note with new content

The current version is basically the IMAP backend which only looks in the a specific folder, and sets the correct message type for the messages in that folder folder to show up as notes on the device.

Do you want me to upload a TGZ somewhere?

N0ury commented 10 years ago

Thank you fortiko. It's so small you can send it to me by mail at: nb.at.dagami.dot.org

I'll try it the do a feedback here. I'm not a php developper, but I can try to help to understand what goes well, and what goes wrong. I think it would be ggod to have the ability to sync notes via imap folders.

Regards

nb

Le Vendredi 12 Septembre 2014 10:16 CEST, fortiko notifications@github.com a écrit:

Right now, the backend syncs all the "notes" (basically emails with the headers you mention above) from the server to the client, and also supports deletion of the notes on the client (which then syncs back to the server).

Creating new messages and updating existing messages does not work.

I believe that "update" has to be a 2-step process in case the content has changed: a) delete existing note with old content b) create new note with new content

The current version is basically the IMAP backend which only looks in the a specific folder, and sets the correct message type for the messages in that folder folder to show up as notes on the device.

Do you want me to upload a TGZ somewhere?


Reply to this email directly or view it on GitHub: https://github.com/fmbiete/Z-Push-contrib/issues/65#issuecomment-55373876

N0ury commented 10 years ago

Hi,

This is a question for fmbiete. As it is possible to sync correctly a device using real imap protocol, why it is not possible to do it using z-push imap backend. I tried to put "SYNC_FOLDER_TYPE_NOTE => 'i'," in combined/config.php, but nothong happens.

I think there's something I don't understand about z-push syncing.

Thanks in advance

regards

nb

fmbiete commented 10 years ago

BackendIMAP (letter "i" in the combined/config) knows how to sync objects of type "IPM.Note" (that's a message). But it doesn't know how to sync objects of type "IPM.Post" (that should be a note).

For that reason, you need a new backend (new letter in the combined/config).

Regards,

N0ury commented 10 years ago

Ok, thank you. I'm still waiting for fortiko's backend to try it.

Regards

nb

fortiko commented 9 years ago

backend_notes tgz

Please find enclose a very simple version of the Notes backend for IMAP folders.

Download the "image" above https://cloud.githubusercontent.com/assets/1612534/4447853/2505f62a-480e-11e4-9eeb-3a539352a7f5.png and rename to backend_notes.tgz, and unpack.

Put the two files into the folder z-push/backend/notes, update z-push/backend/combined/combined.php as follows:

[..] 'd' => array( 'name' => 'BackendCardDAV', ), 'n' => array( 'name' => 'BackendNotes', ),

[..] SYNC_FOLDER_TYPE_NOTE => 'n', [..] SYNC_FOLDER_TYPE_USER_NOTE => 'n', [..]

and see the "emails"/notes that are in the IMAP folder as defined in config.php:

define('NOTES_FOLDER', 'Notes');

show up on your device. You might have to delete and reprovision the device so that the "Notes" line shows up.

Working functionality:

Somewhat working: = Create new note on device gets synced to server, but exists 2x on device

Not working yet:

Let me know if you can make any progress!

realizelol commented 5 years ago
19/10/2018 15:13:18 [ 9762] [WARN] [$FULL_EMAIL_VAR] /usr/share/z-push/backend/notes/notes.php:1588 Undefined variable: sourceMessage (8)
19/10/2018 15:13:18 [ 9762] [WARN] [$FULL_EMAIL_VAR] /usr/share/z-push/backend/notes/notes.php:1589 Undefined variable: sourceMessage (8)
19/10/2018 15:13:18 [ 9762] [WARN] [$FULL_EMAIL_VAR] /usr/share/z-push/backend/notes/notes.php:1591 Undefined property: SyncNote::$mime (8)
19/10/2018 15:13:18 [ 9762] [WARN] [$FULL_EMAIL_VAR] /usr/share/z-push/backend/notes/notes.php:1604 Undefined variable: subject_header (8)
19/10/2018 15:13:19 [ 9762] [WARN] [$FULL_EMAIL_VAR] BackendNotes->StatMessage('bc8ab57b','1'): Failed to retrieve overview:
19/10/2018 15:13:19 [ 9762] [WARN] [$FULL_EMAIL_VAR] /usr/share/z-push/lib/wbxml/wbxmlencoder.php:174 stream_filter_append() expects parameter 1 to be resource, string given (2)
19/10/2018 15:13:19 [ 9762] [WARN] [$FULL_EMAIL_VAR] /usr/share/z-push/lib/wbxml/wbxmlencoder.php:292 fstat() expects parameter 1 to be resource, string given (2)
19/10/2018 15:13:19 [ 9762] [WARN] [$FULL_EMAIL_VAR] /usr/share/z-push/lib/wbxml/wbxmlencoder.php:305 stream_copy_to_stream() expects parameter 1 to be resource, string given (2)
19/10/2018 15:13:19 [ 9762] [WARN] [$FULL_EMAIL_VAR] /usr/share/z-push/lib/wbxml/wbxmlencoder.php:181 stream_filter_remove() expects parameter 1 to be resource, boolean given (2)
19/10/2018 15:13:19 [ 9762] [WARN] [$FULL_EMAIL_VAR] /usr/share/z-push/lib/wbxml/wbxmlencoder.php:184 fclose() expects parameter 1 to be resource, string given (2)

Are you still developing this "BackendNotes" for Z-Push?

root@mail /usr/share/z-push # echo "URL: $(git config --get remote.origin.url)" && echo "Branch: $(git branch | sed -e "/^[^]/d" -e "s/ (.*)/\1/")" && echo "Version: $(git describe)" URL: https://github.com/Z-Hub/Z-Push/ Branch: master Version: 2.4.4 (just moved the "src" folder)