~emersion/gamja

cca12d0b957986b3aca3116441814064c16557f6 — Simon Ser 2 years ago e3c2d85 search
wip: use soju.im/search

Closes: https://todo.sr.ht/~emersion/gamja/139
2 files changed, 16 insertions(+), 0 deletions(-)

M components/app.js
M lib/client.js
M components/app.js => components/app.js +5 -0
@@ 1101,6 1101,11 @@ export default class App extends Component {
					from = receiptFromMessage(lastMsg);
				}

				if (client.caps.enabled.has("soju.im/search")) {
					// TODO:
					return;
				}

				client.fetchHistoryBetween(target.name, from, to, CHATHISTORY_MAX_SIZE).then((result) => {
					for (let msg of result.messages) {
						let destBuffers = this.routeMessage(serverID, msg);

M lib/client.js => lib/client.js +11 -0
@@ 24,6 24,7 @@ const permanentCaps = [

	"soju.im/bouncer-networks",
	"soju.im/read",
	"soju.im/search",
];

const RECONNECT_MIN_DELAY_MSEC = 10 * 1000; // 10s


@@ 926,6 927,16 @@ export default class Client extends EventTarget {
		});
	}

	search(attrs) {
		let msg = {
			command: "SEARCH",
			params: [irc.formatTags(attrs)],
		};
		return this.fetchBatch(msg, "soju.im/search").then((batch) => {
			return batch.messages;
		});
	}

	listBouncerNetworks() {
		let req = { command: "BOUNCER", params: ["LISTNETWORKS"] };
		return this.fetchBatch(req, "soju.im/bouncer-networks").then((batch) => {