]>
Commit | Line | Data |
---|---|---|
1 | ;;; jabber-carbons.el --- Support for XEP-0280: Message Carbons -*- lexical-binding: t; -*- | |
2 | ||
3 | ;;; Commentary: | |
4 | ;; | |
5 | ||
6 | ;;; Code: | |
7 | ||
8 | (defun jabber-carbon-success (jc xml-data context) | |
9 | (when (equal "result" (jabber-xml-get-attribute xml-data 'type)) | |
10 | (message "Carbons feature successfully enabled for %s" | |
11 | (jabber-connection-jid jc)))) | |
12 | ||
13 | (defun jabber-carbon-failure (jc xml-data context) | |
14 | (message "Carbons feature could not be enabled: %S" xml-data)) | |
15 | ||
16 | (add-to-list 'jabber-jid-service-menu | |
17 | (cons "Enable Carbons" 'jabber-enable-carbons)) | |
18 | ||
19 | ;;;###autoload | |
20 | (defun jabber-enable-carbons (jc) | |
21 | "Send request to enable XEP-0280 Message Carbons. | |
22 | ||
23 | JC is the Jabber connection." | |
24 | (interactive (list (jabber-read-account))) | |
25 | (jabber-send-iq jc | |
26 | nil | |
27 | "set" | |
28 | `(enable ((xmlns . "urn:xmpp:carbons:2"))) | |
29 | #'jabber-carbon-success "Carbons feature enablement" | |
30 | #'jabber-carbon-failure "Carbons feature enablement")) | |
31 | ||
32 | (jabber-disco-advertise-feature "urn:xmpp:carbons:2") | |
33 | ||
34 | (provide 'jabber-carbons) | |
35 | ||
36 | ;;; jabber-carbons.el ends here |