]>
Commit | Line | Data |
---|---|---|
1 | ;;; jabber-private.el --- jabber:iq:private API by JEP-0049 -*- lexical-binding: t; -*- | |
2 | ||
3 | ;; Copyright (C) 2005 Magnus Henoch | |
4 | ||
5 | ;; Author: Magnus Henoch <mange@freemail.hu> | |
6 | ||
7 | ;; This file is free software; you can redistribute it and/or modify | |
8 | ;; it under the terms of the GNU General Public License as published by | |
9 | ;; the Free Software Foundation; either version 2, or (at your option) | |
10 | ;; any later version. | |
11 | ||
12 | ;; This file is distributed in the hope that it will be useful, | |
13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;; GNU General Public License for more details. | |
16 | ||
17 | ;; You should have received a copy of the GNU General Public License | |
18 | ;; along with GNU Emacs; see the file COPYING. If not, write to | |
19 | ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 | ;; Boston, MA 02111-1307, USA. | |
21 | ||
22 | ;;;###autoload | |
23 | (defun jabber-private-get (jc node-name namespace success-callback error-callback) | |
24 | "Retrieve an item from private XML storage. | |
25 | The item to retrieve is identified by NODE-NAME (a symbol) and | |
26 | NAMESPACE (a string). | |
27 | ||
28 | On success, SUCCESS-CALLBACK is called with JC and the retrieved | |
29 | XML fragment. | |
30 | ||
31 | On error, ERROR-CALLBACK is called with JC and the entire IQ | |
32 | result." | |
33 | (jabber-send-iq jc nil "get" | |
34 | `(query ((xmlns . "jabber:iq:private")) | |
35 | (,node-name ((xmlns . ,namespace)))) | |
36 | #'jabber-private-get-1 success-callback | |
37 | #'(lambda (jc xml-data error-callback) | |
38 | (funcall error-callback jc xml-data)) | |
39 | error-callback)) | |
40 | ||
41 | (defun jabber-private-get-1 (jc xml-data success-callback) | |
42 | (funcall success-callback jc | |
43 | (car (jabber-xml-node-children | |
44 | (jabber-iq-query xml-data))))) | |
45 | ||
46 | ;;;###autoload | |
47 | (defun jabber-private-set (jc fragment &optional | |
48 | success-callback success-closure-data | |
49 | error-callback error-closure-data) | |
50 | "Store FRAGMENT in private XML storage. | |
51 | SUCCESS-CALLBACK, SUCCESS-CLOSURE-DATA, ERROR-CALLBACK and | |
52 | ERROR-CLOSURE-DATA are used as in `jabber-send-iq'. | |
53 | ||
54 | JC is the Jabber connection." | |
55 | (jabber-send-iq jc nil "set" | |
56 | `(query ((xmlns . "jabber:iq:private")) | |
57 | ,fragment) | |
58 | success-callback success-closure-data | |
59 | error-callback error-closure-data)) | |
60 | ||
61 | (provide 'jabber-private) | |
62 | ||
63 | ;; arch-tag: 065bd03e-40fa-11da-ab48-000a95c2fcd0 |