|
| 1 | +# TODO Plugin Implementation Plan |
| 2 | + |
| 3 | +This document outlines the step-by-step plan to add multi-list TODO functionality using XEP-0060 PubSub. Each step can be checked off as it’s implemented. |
| 4 | + |
| 5 | +- [x] 1. Add `api.disco.entities.find(feature)` in `src/headless/plugins/disco/api.js` to lookup JIDs advertising a feature. |
| 6 | +- [x] 2. In `src/headless/plugins/pubsub/api.js`, add `pubsub.subscribe(jid, node)` and `pubsub.unsubscribe(jid, node)` |
| 7 | +- [ ] 3. Modify `src/plugins/todo/plugin.js` to: |
| 8 | + - [ ] Discovers the PubSub service JID via `api.disco.entities.find('http://jabber.org/protocol/pubsub')`. |
| 9 | + - [ ] Subscribes to the master index node `urn:conversejs:todolists:1`. |
| 10 | + - [ ] Listens for item-add and item-delete events to track available TODO lists. |
| 11 | +- [ ] 4. For each index entry, subscribe/unsubscribe to its list node and: |
| 12 | + - [ ] Fetch existing items via `api.pubsub.items(serviceJid, node)`. |
| 13 | + - [ ] Emit high-level events for list item additions/removals. |
| 14 | +- [ ] 5. Implement payload parsing/serialization in PEP Bookmarks style (XEP-0402) or JSON inside `<item>` payloads. |
| 15 | +- [ ] 6. Expose CRUD methods on `api.apps.todo`: |
| 16 | + - [ ] `listLists(): Promise<Array<{ node, title }>>` |
| 17 | + - [ ] `createList(node, title): Promise<void>` |
| 18 | + - [ ] `deleteList(node): Promise<void>` |
| 19 | + - [ ] `listItems(node): Promise<Item[]>` |
| 20 | + - [ ] `addItem(node, data): Promise<void>` |
| 21 | + - [ ] `removeItem(node, id): Promise<void>` |
| 22 | +- [ ] 7. Maintain internal state of lists/items and fire events via `api.emit('todo:lists', lists)` and `api.emit('todo:items', node, items)`. |
| 23 | +- [ ] 8. Write tests for: |
| 24 | + - [x] `api.disco.entities.find` |
| 25 | + - [x] `api.pubsub.subscribe/unsubscribe` |
| 26 | + - [ ] Index module behavior |
| 27 | + - [ ] CRUD API methods |
| 28 | +- [ ] 9. Update documentation in `src/plugins/todo/README.md` and project docs. |
| 29 | + |
| 30 | +Once all items are checked, the multi-list TODO plugin will support dynamic discovery, subscription, and management of multiple TODO lists via XMPP PubSub. |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +When adding a new TODO list, let the user enter a name for the list. |
| 35 | + |
| 36 | +Then, upon submission, automatically look for a pubsub service on the user's domain. |
| 37 | +If none is found, return to the form with a new input to let the user specify a PubSub service. |
0 commit comments