Overview
The goal of Phase 1 is to provide simple Note Sharing in Tomboy. It should be dirt simple and ready to go "right out of the box".
Sharing Preferences
By default, sharing will not be enabled when a user first runs Tomboy. They've got to actively decide whether they want to publish their notes on the network. A user must also tell Tomboy to look for shared notes on the local network before it will work.
When a user clicks on the "Share my notes on my local network" button, "Share selected notes" is selected by default with none of the notes selected. This is a security feature that prevents a user's notes from being shared for the few moments while they configure which notes should be shared.
A user can change the shared name (the name which shows up to other users/computers).
A user can also specify a password that other Tomboy clients will be required to provide before seeing the shared notes.
1. GConf Preferences
GConf Base Path: /apps/tomboy/sharing
enable_local_browsing
- Type: Boolean
- Default: False
Description: SharingManager watches this preference and starts/stops ServiceLocator, which watches the local network for other Tomboy Clients that are sharing notes.
enable_local_publishing
- Type: Boolean
- Default: False
Description: SharingManager watches this preference and starts/stops SharingServer, which publishes this Tomboy Client on the local network and also starts the WebService Server for remote Tomboy Clients to communicate with this client.
guid
- Type: String
Description: This is used to broadcast the Tomboy Client on the local network. Using a Guid prevents local network name collisions. This is also used internally in the ServiceLocator and SharingManager to store TomboyShareNode objects in a Hashtable. You should not change this preference once it is set.
selected_notes
- Type: Comma-delimited String
- Default: Blank (i.e., an empty string)
- Description: Set to "ALL" to share all notes. Leave blank to not share any notes. Set to a comma-delimited list of Note.Url's to share specific notes.
shared_name
- Type: String
Default: Default is set by "<System.Environment.UserName>-<System.Environment.MachineName>'s Notes"
- Description: This is the name which other users will see in the "Shared Notes" dialog. It does not have to be unique, but a user should try to keep this descriptive so they can distinguish between their computers in the "Shared Notes" dialog.
2. Other Preferences
Rather than use a GConf Preference for passwords, GNOME Keyring is used instead. Tomboy looks for a stored password to know whether password-protection is enabled.
Sharing Dialog
This dialog is available by selecting the "Shared Notes" item from Tomboy's TrayIcon. If "Look for shared notes" is enabled in the sharing preferences, the ServiceLocator (mDNS) will watch the local network for other Tomboy Clients. As it discovers them, they will appear in this list.
When you expand the "computer" row, a connection to the Tomboy client will be attempted. If a password is required, you will be prompted for it. After connecting successfully, a list of shared notes appears.
From this point, you can highlight a note and press the "Download" button (or double-click a note). The note is automatically downloaded to your computer and created as a local note. If one with the same name already exists, a numbered title will be used. For example, if you are attempting to download a note that's titled, "My Note" but you already have a local note with the same name, the downloaded note will be saved as, "My Note 1". The number will automatically be incremented if you already have a note named "My Note 1".
Not implemented: If "Look for shared notes" is not enabled, the "Shared Notes" menu item in the TrayIcon should either be grayed out or...a button/checkbox/other UI should be placed in the "Shared Notes" dialog to allow the user to quickly enable the feature.
Note: The downloaded not is not kept in sync with the computer it was downloaded from. Any type of synchronization of notes will be dealt with in Tomboy/NoteSharing/PhaseTwo.
Architecture
1. mDNS Service Type
The service type for a shared Tomboy client is: _tomboy._tcp
2. mDNS Service Name
A unique identifier on the local network must be used to advertise the Tomboy client on mDNS. By default, the following is used:
<Machine Guid>._tomboy._tcp.local.
When sharing is first enabled, Tomboy will generate a Guid for the machine and store it in GConf under /apps/tomboy/sharing/guid. The GUID will then be used to advertise shared notes.
Example Service Name:
01570188-e414-48ff-af79-748269d0fcb6-bht-tp._tomboy._tcp.local.
3. Text Records
mDNS text records allow other clients to know more information about the mDNS service being advertised on the network.
The following text records will be used for broadcasting a Tomboy client:
Guid
- Described above
Shared Name
- User-defined name that will appear in the GUI (also described in the preferences section above)
Password Protected
- Either "True" or "False"
- If true, a client must provide a password to communicate/download shared notes
Sharing Enabled
- Either "True" or "False"
- Could probably get rid of this, but here for when mDNS synchronizing is enabled. A machine will be advertised on the local network with synchronization enabled, but not sharing.
4. Current Implementation Class Diagram: Tomboy.Sharing Namespace
Communication
1. Current implementation:
For simplicity's sake, I've chosen to use WebServices via Mono.WebServer.dll (xsp) for Tomboy clients to:
- Read the list of shared notes
- Download note content
- Pros:
- Easy to use
- Code is fairly clean
- No maintenance of HttpListener/Web Server/etc.
- Cons:
- More beef than what we really need
- Others?
2. Other possible options:
HttpListener for .NET 1.1 from Maria's WSOC project
- Possibly make it much more lightweight
- Could use DB4O for note serialization
- Write web server similar to what Banshee does
Notebooks
Hopefully someone cleverly hacks something together quickly to add notebook support into Tomboy. Rather than adding features of granular sharing of notes (i.e., share Note A with User A, User B, but not User C or anyone else), notebooks can have their own password. If you want to share a notebook of notes with a certain group of people, share the notebook, add a password to the shared notebook, and hand out the password to the group of people you'd like to share it with.
What is "notebook support?" Well the ability to create notes in sets for specific purposes. For example, I could have a "Tomboy Project" notebook where all the notes I create about Tomboy are stored there. I may also have a "Reminders" notebook or a "Team Meetings" notebook.
Now, whether notes can exist in multiple notebooks? I'll leave that one up to the hacker who submits the patch!