]>
Commit | Line | Data |
---|---|---|
53e6db90 DC |
1 | ;ELC\1c\0\0\0 |
2 | ;;; Compiled | |
3 | ;;; in Emacs version 28.2 | |
4 | ;;; with all optimizations. | |
5 | ||
6 | ||
7 | ||
8 | (byte-code "\300\301!\210\300\302!\207" [require jabber-disco jabber-widget] 2) | |
9 | #@39 Session ID of Ad-Hoc Command session.\1f | |
10 | (defvar jabber-ahc-sessionid nil (#$ . 164)) | |
11 | #@27 Node to send commands to.\1f | |
12 | (defvar jabber-ahc-node nil (#$ . 253)) | |
13 | #@533 Alist of ad-hoc commands provided. | |
14 | ||
15 | The keys are node names as strings (which means that they must | |
16 | not conflict). The values are plists having the following properties - | |
17 | ||
18 | acl - function taking connection object and JID of requester, | |
19 | returning non-nil for access allowed. No function means | |
20 | open for everyone. | |
21 | name - name of command | |
22 | func - function taking connection object and entire IQ stanza as | |
23 | arguments and returning a <command/> node | |
24 | ||
25 | Use the function `jabber-ahc-add' to add a command to this list.\1f | |
26 | (defvar jabber-ahc-commands nil (#$ . 326)) | |
27 | (byte-code "\300\301\302\303D\"\207" [add-to-list jabber-disco-info-nodes "http://jabber.org/protocol/commands" ((identity ((category . "automation") (type . "command-list") (name . "Ad-Hoc Command list"))) (feature ((var . "http://jabber.org/protocol/commands"))) (feature ((var . "http://jabber.org/protocol/disco#items"))) (feature ((var . "http://jabber.org/protocol/disco#info"))))] 4) | |
28 | #@407 Add a command to internal lists. | |
29 | NODE is the node name to be used. It must be unique. | |
30 | NAME is the natural-language name of the command. | |
31 | FUNC is a function taking the entire IQ stanza as single argument when | |
32 | this command is invoked, and returns a <command/> node. | |
33 | ACL is a function taking JID as single argument, returning non-nil for | |
34 | access allowed. nil means open for everyone. | |
35 | ||
36 | (fn NODE NAME FUNC ACL)\1f | |
37 | (defalias 'jabber-ahc-add #[1028 "\300\301\ 5\302\ 6\ 6\303\ 6\a\304\ 6\b\257\ 6B\"\210\300\305\ 5\306\307\310\302\ 6 BED\311BD\"\207" [add-to-list jabber-ahc-commands name func acl jabber-disco-info-nodes identity (category . "automation") (type . "command-node") ((feature ((var . "http://jabber.org/protocol/commands"))) (feature ((var . "http://jabber.org/protocol/disco#info"))) (feature ((var . "jabber:x:data"))))] 13 (#$ . 1300)]) | |
38 | (byte-code "\300\301!\210\302\303\301\304\305E\"\207" [jabber-disco-advertise-feature "http://jabber.org/protocol/commands" add-to-list jabber-disco-items-nodes jabber-ahc-disco-items nil] 5) | |
39 | #@194 Return commands in response to disco#items request. | |
40 | ||
41 | JC is the Jabber connection. | |
42 | XML-DATA is the parsed tree data from the stream (stanzas) | |
43 | obtained from `xml-parse-region'. | |
44 | ||
45 | (fn JC XML-DATA)\1f | |
46 | (defalias 'jabber-ahc-disco-items #[514 "\211\301\ 1:\205\v\0\302\ 2\ 2\"\266\202\303\304\305\ 5\ 4#\b\"\207" [jabber-ahc-commands from xml-get-attribute-or-nil mapcar make-closure #[257 "\211@\ 1A\302\ 1\303\"\302\ 2\304\"\302\ 3\305\"\210\306\307\ 3!\203\1f\0\ 2\300\301\"\205.\0\310\304\ 3B\311\312\300!B\313\ 6\bBED\207" [V0 V1 plist-get acl name func nil functionp item jid jabber-connection-jid node] 11 "\n\n(fn COMMAND)"]] 8 (#$ . 2326)]) | |
47 | (byte-code "\300\301\302\303B\"\207" [add-to-list jabber-iq-set-xmlns-alist "http://jabber.org/protocol/commands" jabber-ahc-process] 4) | |
48 | #@20 | |
49 | ||
50 | (fn JC XML-DATA)\1f | |
51 | (defalias 'jabber-ahc-process #[514 "\211\301\ 1:\205\v\0\302\ 2\ 2\"\266\202\ 1\303\ 1:\205\18\0\302\ 2\ 2\"\266\202\304\ 3!\305\ 1:\205'\0\302\ 2\ 2\"\266\202\306\ 1\b\"A\307\ 1\310\"\307\ 2\311\"\ 2\203c\0\312\ 2!\203I\0\ 1\ 6\b\ 6\a\"\203^\0\313\ 6\b\ 6\a\314\ 4\ 6\f\ 6\f\"\315\211\211\211\ 6\r& \207\316\317\320\"\207\316\317\321\"\207" [jabber-ahc-commands from xml-get-attribute-or-nil id jabber-iq-query node assoc plist-get acl func functionp jabber-send-iq "result" nil jabber-signal-error "Cancel" not-allowed item-not-found] 18 (#$ . 3075)]) | |
52 | (byte-code "\300\301\302\303B\"\207" [add-to-list jabber-jid-service-menu "Request command list" jabber-ahc-get-list] 4) | |
53 | #@90 Request list of ad-hoc commands. | |
54 | ||
55 | See XEP-0050. | |
56 | JC is the Jabber connection. | |
57 | ||
58 | (fn JC TO)\1f | |
59 | (defalias 'jabber-ahc-get-list #[514 "\300\ 2\ 2\301#\207" [jabber-get-disco-items "http://jabber.org/protocol/commands"] 6 (#$ . 3711) (byte-code "\300 \301\302\303\211\211\211\211&\ 6D\207" [jabber-read-account jabber-read-jid-completing "Request command list from: " nil] 8)]) | |
60 | (byte-code "\300\301\302\303B\"\207" [add-to-list jabber-jid-service-menu "Execute command" jabber-ahc-execute-command] 4) | |
61 | #@86 Execute ad-hoc command. | |
62 | ||
63 | See XEP-0050. | |
64 | JC is the Jabber connection. | |
65 | ||
66 | (fn JC TO NODE)\1f | |
67 | (defalias 'jabber-ahc-execute-command #[771 "\300\ 3\ 3\301\302\303\304\ 6\aB\305BBD\306\307\306\310&\b\207" [jabber-send-iq "set" command (xmlns . "http://jabber.org/protocol/commands") node ((action . "execute")) jabber-process-data jabber-ahc-display "Command execution failed"] 12 (#$ . 4203) (byte-code "\300 \301\302\303\211\211\211\211&\ 6\304\305!E\207" [jabber-read-account jabber-read-jid-completing "Execute command of: " nil jabber-read-node "Node of command: "] 8)]) | |
68 | #@20 | |
69 | ||
70 | (fn JC XML-DATA)\1f | |
71 | (defalias 'jabber-ahc-display #[514 "\211\304\ 1:\205\v\0\305\ 2\ 2\"\266\202\306\ 2!\211\307\ 1:\205\e\0\305\ 2\ 2\"\266\202\310\ 2\311\"\ 2\312\ 1:\205,\0\305\ 2\ 2\"\266\202\ 3\313\ 1:\2059\0\305\ 2\ 2\"\266\202\310\ 5\314\"@\315\316\18\317\301!\210\ 3\11\317\302!\210\ 5\12\317\303!\210\ 6 \13\310\ 6\a\320\"\211\203}\0\211@\211\321\ 1:\205l\0\305\ 2\ 2\"\266\202\322\230\203v\0\211\262\ 3\ 1A\266\202\202[\0\210\ 2\323\230\203\212\0\324c\210\202\237\0\ 2\325\230\203\226\0\326c\210\202\237\0\ 2\327\230\203\237\0\330c\210\ 4\211\203\343\0\211@\211\331\ 1:\205\261\0\305\ 2\ 2\"\266\202\211\332\230\203\277\0\333c\210\202\310\0\211\334\230\203\310\0\335c\210\ 1\211AA\211\336\232?\205\324\0\211\266\202@\337\261\ 2\266\ 2\ 1A\266\202\202\240\0\210\337c\210\211\205\204\ 1\340\ 6\b!\210\211\331\ 1:\205\373\0\305\ 2\ 2\"\266\202\211\341\230\203\v\ 1\342\ 2!\266\ 2\202~\ 1\343\ 2!\210\ 3\323\230\203}\ 1\ 2\204\1d\ 1\344\202T\ 1\345\346\ 4\211AA\211\336\232?\205+\ 1\211\266\202\"\ 3\347\ 1:\2059\ 1\305\ 2\ 2\"\266\202\211\203G\ 1\350\ 1!\ 2>\203M\ 1\ 1\266\202\202T\ 1\350\ 1!\ 2B\266\202\211\211\203w\ 1\211@\351\352\353\354\355\356\357\ 6\aDDE\360\ 5!$\210\361\362!\210\ 1A\266\202\202U\ 1\266\ 2\361\337!\210\210\363 \210\364\365!)\207" [inhibit-read-only jabber-ahc-sessionid jabber-ahc-node jabber-buffer-connection from xml-get-attribute-or-nil jabber-iq-query node jabber-xml-get-children note sessionid status actions nil t make-local-variable x xmlns "jabber:x:data" "executing" "Executing command\n\n" "completed" "Command completed\n\n" "canceled" "Command canceled\n\n" type "warn" "Warning: " "error" "Error: " (("")) "\n" jabber-init-widget-buffer "result" jabber-render-xdata-search-results jabber-render-xdata-form (complete cancel) mapcar jabber-xml-node-name execute intern widget-create push-button :notify lambda (&rest ignore) jabber-ahc-submit quote symbol-name widget-insert " " widget-setup widget-minor-mode 1] 22 (#$ . 4764)]) | |
72 | #@37 Submit Ad-Hoc Command. | |
73 | ||
74 | (fn ACTION)\1f | |
75 | (defalias 'jabber-ahc-submit #[257 "\305\b \306\307\310\311\nB\312\vB\313\314\ 6\n!BF\ 6\ 6\315=?\205#\0\f\316=\205#\0\317 E\320\321\320\322&\b\207" [jabber-buffer-connection jabber-submit-to jabber-ahc-sessionid jabber-ahc-node jabber-form-type jabber-send-iq "set" command (xmlns . "http://jabber.org/protocol/commands") sessionid node action symbol-name cancel xdata jabber-parse-xdata-form jabber-process-data jabber-ahc-display "Command execution failed"] 12 (#$ . 6564)]) | |
76 | (provide 'jabber-ahc) |