Skip to content

Commit e29a5f7

Browse files
committed
Allow the user to choose one of multiple pubsub services
- Use bootstrap's collapse feature to show/hide entity features
1 parent 3a6f71b commit e29a5f7

File tree

26 files changed

+227
-54
lines changed

26 files changed

+227
-54
lines changed

src/headless/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import './plugins/bosh/index.js'; // XEP-0206 BOSH
3030
import './plugins/caps/index.js'; // XEP-0115 Entity Capabilities
3131
export { ChatBox, Message, Messages } from './plugins/chat/index.js'; // RFC-6121 Instant messaging
3232
import './plugins/chatboxes/index.js';
33-
import './plugins/disco/index.js'; // XEP-0030 Service discovery
33+
export { DiscoEntity, DiscoEntities } from './plugins/disco/index.js'; // XEP-0030 Service discovery
3434
import './plugins/adhoc/index.js'; // XEP-0050 Ad Hoc Commands
3535
import './plugins/headlines/index.js'; // Support for headline messages
3636
export { Device, Devices, DeviceList, DeviceLists } from './plugins/omemo/index.js'; // Support for headline messages

src/headless/plugins/disco/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import {
1919

2020
const { Strophe } = converse.env;
2121

22+
export { DiscoEntity, DiscoEntities };
23+
2224
/**
2325
* @typedef {Object} DiscoState
2426
* @property {Array} _identities

src/headless/types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export { Collection, EventEmitter, Model } from "@converse/skeletor";
2121
export { Builder, Stanza } from "strophe.js";
2222
export { Bookmark, Bookmarks } from "./plugins/bookmarks/index.js";
2323
export { ChatBox, Message, Messages } from "./plugins/chat/index.js";
24+
export { DiscoEntity, DiscoEntities } from "./plugins/disco/index.js";
2425
export { Device, Devices, DeviceList, DeviceLists } from "./plugins/omemo/index.js";
2526
export { MUCMessage, MUCMessages, MUC, MUCOccupant, MUCOccupants } from "./plugins/muc/index.js";
2627
export { RosterContact, RosterContacts, RosterFilter, Presence, Presences } from "./plugins/roster/index.js";

src/headless/types/plugins/disco/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ export type DiscoState = {
22
_identities: any[];
33
_features: any[];
44
};
5+
import DiscoEntity from './entity.js';
6+
import DiscoEntities from './entities.js';
7+
export { DiscoEntity, DiscoEntities };
58
//# sourceMappingURL=index.d.ts.map

src/headless/types/plugins/pubsub/api.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ declare namespace _default {
3838
* Creates a PubSub node at a given service
3939
* @param {string} jid - The PubSub service JID
4040
* @param {string} node - The node to create
41-
* @param {PubSubConfigOptions} config The configuration options
41+
* @param {PubSubConfigOptions} [config] The configuration options
4242
* @returns {Promise<void>}
4343
*/
44-
function create(jid: string, node: string, config: import("./types").PubSubConfigOptions): Promise<void>;
44+
function create(jid: string, node: string, config?: import("./types").PubSubConfigOptions): Promise<void>;
4545
/**
4646
* Subscribes the local user to a PubSub node.
4747
*

src/headless/types/shared/_converse.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class ConversePrivateGlobal extends ConversePrivateGlobal_base {
7979
*/
8080
state: any;
8181
initSession(): void;
82-
session: Model;
82+
session: any;
8383
/**
8484
* Translate the given string based on the current locale.
8585
* @method __

src/headless/types/shared/connection/index.d.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ declare const Connection_base: typeof import("strophe.js/src/types/connection").
55
* via BOSH or websocket inside a shared worker).
66
*/
77
export class Connection extends Connection_base {
8-
constructor(service: any, options: any);
8+
/**
9+
* @param {string} service - The BOSH or WebSocket service URL.
10+
* @param {import('strophe.js/src/types/connection').ConnectionOptions} options
11+
*/
12+
constructor(service: string, options: import("strophe.js/src/types/connection").ConnectionOptions);
913
send_initial_presence: boolean;
1014
debouncedReconnect: import("lodash").DebouncedFunc<() => Promise<any>>;
1115
/** @param {Element} body */
@@ -111,11 +115,6 @@ export class Connection extends Connection_base {
111115
* The MockConnection class is used during testing, to mock an XMPP connection.
112116
*/
113117
export class MockConnection extends Connection {
114-
/**
115-
* @param {string} service - The BOSH or WebSocket service URL.
116-
* @param {import('strophe.js/src/types/connection').ConnectionOptions} options - The configuration options
117-
*/
118-
constructor(service: string, options: import("strophe.js/src/types/connection").ConnectionOptions);
119118
sent_stanzas: any[];
120119
IQ_stanzas: any[];
121120
IQ_ids: any[];

src/plugins/roomslist/styles/roomsgroups.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
.conversejs {
2-
32
#chatrooms {
3+
.collapsed {
4+
height: 0 !important;
5+
overflow: hidden !important;
6+
padding: 0 !important;
7+
}
8+
49
.muc-domain-group-toggle {
510
margin: 0.75em 0 0.25em 0;
611
}

src/plugins/rosterview/styles/roster.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
.conversejs {
2-
32
#controlbox {
3+
.collapsed {
4+
height: 0 !important;
5+
overflow: hidden !important;
6+
padding: 0 !important;
7+
}
8+
49
.open-contacts-toggle, .open-contacts-toggle .fa {
510
color: var(--chat-color) !important;
611
&:hover {

src/plugins/todo/PLAN.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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

Comments
 (0)