1 ;;; acap.el --- An ACAP interface.
3 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
6 ;; Copyright (C) 2001 Yuuichi Teranishi <teranisi@gohome.org>
8 ;; This file is not part of GNU Emacs
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
28 ;; acap.el is an elisp library providing an interface for talking to
29 ;; ACAP (RFC2244) servers.
31 ;; This is a transcript of short interactive session for demonstration
34 ;; (setq proc (acap-open "my.acap.server" "username" "CRAM-MD5"))
37 ;; (acap-search proc "/addressbook/" '((RETURN ("*")))))
38 ;; => ((done-ok nil "search completed")
39 ;; (modtime . "20010828091433000010")
43 ;; ("modtime" "20010824004532000003")
44 ;; ("entry" "user"))))
46 ;; ((("modtime" "20010824004532000002")
48 ;; ("dataset.owner" "anonymous")
49 ;; ("dataset.acl" ("$anyone xrwia")))))
55 ;; * Send literal data for STORE.
59 ;; 27 Aug 2001 Created (Some codes are based on imap.el.).
71 "Low level ACAP issues."
74 (defcustom acap-default-user (user-login-name)
75 "Default username to use."
79 (defcustom acap-default-port 674
80 "Default port for ACAP."
84 (defcustom acap-stock-passphrase nil
85 "Stock passphrase on memory if t."
90 (defconst acap-server-eol "\r\n"
91 "The EOL string sent from the server.")
93 (defconst acap-client-eol "\r\n"
94 "The EOL string sent from the server.")
96 ;; Internal variables.
97 (defvar acap-state 'closed
99 Valid states are `closed', `initial', `auth'.")
101 (defvar acap-capability nil
102 "Capability for server.")
104 (defvar acap-reached-tag 0
105 "Lower limit on command tags that have been parsed.")
108 "Command tag number.")
110 (defvar acap-auth nil
111 "Authenticated mechanism name.")
113 (defvar acap-process nil
114 "Process for the buffer.")
116 (defvar acap-server nil
119 (defvar acap-port nil
122 (defvar acap-response nil
125 (make-variable-buffer-local 'acap-state)
126 (make-variable-buffer-local 'acap-auth)
127 (make-variable-buffer-local 'acap-capability)
128 (make-variable-buffer-local 'acap-reached-tag)
129 (make-variable-buffer-local 'acap-failed-tag)
130 (make-variable-buffer-local 'acap-tag)
131 (make-variable-buffer-local 'acap-server)
132 (make-variable-buffer-local 'acap-port)
133 (make-variable-buffer-local 'acap-response)
135 (defvar acap-network-stream-alist
136 '((default . open-network-stream-as-binary)))
138 (defun acap-network-stream-open (buffer server port &optional type)
139 (let* ((port (or port acap-default-port))
141 (message "Connecting to %s..." server)
142 (funcall (cdr (assq (or type 'default)
143 acap-network-stream-alist))
144 "ACAP" buffer server port))))
146 (with-current-buffer buffer
147 (while (and (memq (process-status process) '(open run))
148 (goto-char (point-min))
149 (not (setq acap-capability (acap-parse-greeting))))
150 (message "Waiting for response from %s..." server)
151 (accept-process-output process 1))
152 (message "Waiting for response from %s...done" server)
153 (when (memq (process-status process) '(open run))
156 (defvar acap-passphrase nil)
157 (defvar acap-rp-user nil)
158 (defvar acap-rp-server nil)
159 (defvar acap-rp-auth nil)
161 (defvar acap-passphrase-alist nil)
164 (autoload 'ange-ftp-read-passwd "ange-ftp"))
166 (defun acap-read-passphrase (prompt)
167 "Prompt is not used."
170 (setq prompt (format "%s passphrase for %s@%s: "
171 acap-rp-auth acap-rp-user acap-rp-server))
172 (if (functionp 'read-passwd)
174 (if (load "passwd" t)
176 (ange-ftp-read-passwd prompt))))))
179 (defvar acap-debug t)
180 (defvar acap-debug-buffer nil)
181 (defun acap-debug (string)
182 "Insert STRING to the debug buffer."
184 (if (or (null acap-debug-buffer)
185 (not (bufferp acap-debug-buffer))
186 (not (buffer-live-p acap-debug-buffer)))
187 (setq acap-debug-buffer (get-buffer-create "*Debug acap*")))
188 (with-current-buffer acap-debug-buffer
189 (goto-char (point-max))
192 ;;; Stock passphrase (Not implemented yet)
193 (defun acap-stock-passphrase (user server auth passphrase)
194 (let ((key (format "%s/%s/%s" user server auth))
196 (when (setq pair (assoc key acap-passphrase-alist))
197 (setq acap-passphrase-alist (delete pair acap-passphrase-alist)))
198 (setq acap-passphrase-alist (cons
199 (cons key passphrase)
200 acap-passphrase-alist))))
202 (defun acap-stocked-passphrase (user server auth)
203 (when acap-stock-passphrase
204 (let ((key (format "%s/%s/%s" user server auth)))
205 (cdr (assoc key acap-passphrase-alist)))))
207 (defun acap-remove-stocked-passphrase (user server auth)
208 (let ((key (format "%s/%s/%s" user server auth)))
209 (setq acap-passphrase-alist
210 (delq (assoc key acap-passphrase-alist)
211 acap-passphrase-alist))))
214 (defun acap-open (server &optional user auth port type)
215 (let* ((user (or user acap-default-user))
216 (buffer (get-buffer-create (concat " *acap on " user " at " server)))
217 process passphrase mechanism tag)
218 (with-current-buffer buffer
221 (delete-process acap-process))
222 (setq process (acap-network-stream-open buffer server port type)
223 acap-process process)
224 (set-buffer-multibyte nil)
225 (buffer-disable-undo)
226 (setq acap-state 'initial)
227 (set-process-filter process 'acap-arrival-filter)
228 (set-process-sentinel process 'acap-sentinel)
229 (while (and (memq (process-status process) '(open run))
230 (not (eq acap-state 'auth)))
237 (cdr (or (assq 'Sasl acap-capability)
238 (assq 'SASL acap-capability))))))
240 (sasl-make-client mechanism user "acap" server))
241 (sasl-read-passphrase 'acap-read-passphrase)
243 (acap-rp-server server)
244 (acap-rp-auth (sasl-mechanism-name mechanism))
245 acap-passphrase step response cont-string)
246 (unless (string= (sasl-mechanism-name mechanism)
248 (setq acap-passphrase (acap-read-passphrase nil)))
249 (setq tag (acap-send-command
252 (format "AUTHENTICATE \"%s\""
253 (sasl-mechanism-name mechanism))
255 (sasl-next-step sclient nil))
256 (sasl-step-data step))
257 (concat " " (prin1-to-string
258 (sasl-step-data step)))))))
259 (when (setq response (acap-wait-for-response process tag))
260 (while (acap-response-cont-p response)
262 step (acap-response-cont-string response))
263 (acap-response-clear process)
264 (if (setq step (sasl-next-step sclient step))
266 (insert (or (sasl-step-data step) ""))
267 (setq response (acap-send-data-wait
268 process (current-buffer) tag)))
269 (setq response nil)))
270 (if (acap-response-ok-p response)
272 (setq acap-state 'auth)
274 (message "Authentication failed.")
278 (message "acap: Connecting to %s...failed" server))
279 (setq acap-server server
283 (defun acap-close (process)
284 (with-current-buffer (process-buffer process)
285 (unless (acap-response-ok-p (acap-send-command-wait process "LOGOUT"))
286 (message "Server %s didn't let me log out" acap-server))
287 (when (memq (process-status process) '(open run))
288 (delete-process process))
294 (defun acap-noop (process)
295 "Execute NOOP command on PROCESS."
296 (acap-send-command-wait process "NOOP"))
298 (defun acap-lang (process lang-list)
299 "Execute LANG command on PROCESS."
300 (acap-send-command-wait process
304 (mapcar 'prin1-to-string lang-list))
307 (defun acap-search (process target &optional modifier criteria)
308 "Execute SEARCH command on PROCESS.
309 TARGET is a string which specifies what is to be searched
310 \(dataset or context name\).
311 MODIFIER is an alist of modifiers. Each element should be a list like
312 \(MODIFIER-NAME DATA1 DATA2...\).
313 CRITERIA is a search criteria string.
314 If CRITERIA is not specified, \"ALL\" is assumed,
315 Modifiers and search criteria are described in section 6.4.1 of RFC2244.
318 \(acap-search process
321 \(RETURN \(\"addressbook.Alias\"
322 \"addressbook.Email\"
323 \"addressbook.List\"\)\)\)
324 \"OR NOT EQUAL \\\"addressbook.Email\\\" \\\"i\;octed\\\" NIL\\
325 NOT EQUAL \\\"addressbook.Email\\\" \\\"i\;octed\\\" NIL\"\)
327 \(acap-search process
328 \"/addressbook/user/fred/\"
329 '\(\(RETURN \(\"*\"\)\)
330 \"EQUAL \\\"entry\\\" \\\"i\;octed\\\" \\\"A0345\\\"\"\)"
331 (acap-send-command-wait process
332 (concat "SEARCH " (prin1-to-string target)
336 (acap-flatten modifier)
339 (or criteria "ALL"))))
341 (defun acap-freecontext (process name)
342 "Execute FREECONTEXT command on PROCESS."
343 (acap-send-command-wait process
344 (concat "FREECONTEXT " name)))
346 (defun acap-updatecontext (process names)
347 "Execute UPDATECONTEXT command on PROCESS."
348 (acap-send-command-wait process
351 (nconc (list "FREECONTEXT") names)
354 (defun acap-store (process entries)
355 "Execute STORE command on PROCESS.
356 ENTRIES is a store-entry list."
358 ;; As far as I know, current implementation of ACAP server
359 ;; (cyrus-smlacapd 0.5) does not accept literal argument for STORE.
360 ;; If literal argument is available, command arguments can be sent using
361 ;; function `acap-send-command-wait'.
362 (set-buffer-multibyte nil)
367 ((stringp (car entries))
369 (insert (car entries))
371 (while (re-search-forward "\\\\" nil t)
372 (replace-match "\\\\\\\\"))
374 (while (re-search-forward "\"" nil t)
375 (replace-match "\\\\\""))
378 (goto-char (point-max))
380 ((symbolp (car entries))
381 (insert (prin1-to-string (car entries)))))
382 (if (cdr entries)(insert " "))
383 (setq entries (cdr entries)))
385 (goto-char (point-min))
386 (insert (with-current-buffer (process-buffer process)
387 (number-to-string (setq tag (setq acap-tag (1+ acap-tag)))))
389 (process-send-region process (point-min) (point-max))
390 (acap-debug (concat (buffer-string) acap-client-eol))
391 (process-send-string process acap-client-eol)
392 (acap-wait-for-response process tag))))
394 (defun acap-deletedsince (process name time)
395 "Execute DELETEDSINCE command on PROCESS."
396 (acap-send-command-wait process
397 (concat "DELETEDSINCE "
398 (prin1-to-string name)
400 (prin1-to-string (acap-encode-time time)))))
402 (defun acap-setacl (process object identifier rights)
403 "Execute SETACL command on PROCESS."
404 (acap-send-command-wait process
406 (prin1-to-string object)
408 (prin1-to-string identifier)
410 (prin1-to-string rights))))
412 (defun acap-deleteacl (process object &optional identifier)
413 "Execute DELETEACL command on PROCESS."
414 (acap-send-command-wait process
417 (prin1-to-string object)
419 (concat " " (prin1-to-string identifier))))))
421 (defun acap-myrights (process object)
422 "Execute MYRIGHTS command on PROCESS."
423 (acap-send-command-wait process
426 (prin1-to-string object))))
428 (defun acap-listrights (process object identifier)
429 "Execute LISTRIGHTS command on PROCESS."
430 (acap-send-command-wait process
433 (prin1-to-string object)
435 (prin1-to-string identifier))))
437 (defun acap-getquota (process dataset)
438 "Execute GETQUOTA command on PROCESS."
439 (acap-send-command-wait process
442 (prin1-to-string dataset))))
444 ;;; response accessor.
445 (defun acap-response-ok-p (response)
446 (assq 'done-ok response))
448 (defun acap-response-cont-p (response)
449 (assq 'cont response))
451 (defun acap-response-cont-string (response)
452 (cdr (assq 'cont response)))
454 (defun acap-response-body (response)
455 (cdr (or (assq 'done-ok response)
456 (assq 'done-no response)
457 (assq 'done-bad response))))
459 (defun acap-response-entries (response)
461 (dolist (ent response)
462 (if (eq (car ent) 'entry)
463 (setq entries (cons ent entries))))
466 (defun acap-response-entry-entry (entry)
469 (defun acap-response-entry-return-data-list (entry)
472 (defun acap-response-return-data-list-get-value (name return-data-list)
473 (nth 1 (assoc name return-data-list)))
475 (defun acap-response-listrights (response)
476 (cdr (assq 'listrights response)))
478 ;;; Send command, data.
479 (defun acap-response-clear (process)
480 (with-current-buffer (process-buffer process)
481 (setq acap-response nil)))
483 (defun acap-send-command-wait (process command)
484 (acap-wait-for-response process (acap-send-command process command)))
486 (defun acap-send-data-wait (process string tag)
487 (cond ((stringp string)
488 (acap-send-command-1 process string))
490 (with-current-buffer string
491 (acap-response-clear process)
492 (acap-send-command-1 process (format "{%d}" (buffer-size)))
493 (if (acap-response-cont-p (acap-wait-for-response process tag))
494 (with-current-buffer string
495 (acap-response-clear process)
496 (process-send-region process (point-min)
498 (process-send-string process acap-client-eol)))
499 (acap-debug (concat (buffer-string) acap-client-eol)))))
500 (acap-wait-for-response process tag))
502 (defun acap-send-command-1 (process cmdstr)
503 (acap-debug (concat "<-" cmdstr acap-client-eol))
504 (process-send-string process (concat cmdstr acap-client-eol)))
506 (defun acap-send-command (process command)
507 (with-current-buffer (process-buffer process)
508 (setq acap-response nil)
509 (if (not (listp command)) (setq command (list command)))
510 (let ((tag (setq acap-tag (1+ acap-tag)))
512 (setq cmdstr (concat (number-to-string acap-tag) " "))
513 (while (setq cmd (pop command))
515 (setq cmdstr (concat cmdstr cmd)))
517 (with-current-buffer cmd
518 (setq cmdstr (concat cmdstr (format "{%d}" (buffer-size)))))
521 (acap-send-command-1 process cmdstr)
523 response (acap-wait-for-response process tag))
524 (if (not (acap-response-cont-p response))
525 (setq command nil) ;; abort command if no cont-req
526 (with-current-buffer cmd
527 (process-send-region process (point-min)
529 (process-send-string process acap-client-eol))))))
530 (t (error "Unknown command type"))))
532 (acap-send-command-1 process cmdstr))
535 (defun acap-wait-for-response (process tag)
536 (with-current-buffer (process-buffer process)
537 (while (and (not (acap-response-cont-p acap-response))
538 (< acap-reached-tag tag))
539 (or (and (not (memq (process-status process) '(open run)))
541 (let ((len (/ (point-max) 1024))
544 (message "acap read: %dk" len))
545 (accept-process-output process 1))))
549 ;;; Sentinel, Filter.
550 (defun acap-sentinel (process string)
551 (delete-process process))
553 (defun acap-find-next-line ()
554 (when (re-search-forward (concat acap-server-eol "\\|{\\([0-9+]+\\)}"
558 (if (< (point-max) (+ (point) (string-to-number (match-string 1))))
560 (goto-char (+ (point) (string-to-number (match-string 1))))
561 (acap-find-next-line))
564 (defun acap-arrival-filter (proc string)
565 "ACAP process filter."
567 (with-current-buffer (process-buffer proc)
568 (goto-char (point-max))
571 (goto-char (point-min))
572 (while (setq end (acap-find-next-line))
574 (narrow-to-region (point-min) end)
575 (delete-backward-char (length acap-server-eol))
576 (goto-char (point-min))
578 (cond ((or (eq acap-state 'auth)
579 (eq acap-state 'initial)
580 (eq acap-state 'nonauth))
581 (acap-parse-response))
583 (message "Unknown state %s in arrival filter"
585 (delete-region (point-min) (point-max))))))))
588 (defsubst acap-forward ()
589 (or (eobp) (forward-char)))
591 (defsubst acap-parse-number ()
592 (when (looking-at "[0-9]+")
594 (string-to-number (match-string 0))
595 (goto-char (match-end 0)))))
597 (defsubst acap-parse-literal ()
598 (when (looking-at "{\\([0-9]+\\)}\r\n")
599 (let ((pos (match-end 0))
600 (len (string-to-number (match-string 1))))
601 (if (< (point-max) (+ pos len))
603 (goto-char (+ pos len))
604 (buffer-substring pos (+ pos len))))))
606 (defun acap-parse-greeting ()
607 (when (looking-at "* ACAP")
608 (goto-char (match-end 0))
611 (while (eq (char-after (point)) ?\()
612 (push (read (current-buffer)) capabilities)
614 (nreverse capabilities))))
616 ;; resp-body = ["(" resp-code ")" SP] quoted
617 (defun acap-parse-resp-body ()
618 (let ((body (read (current-buffer))))
619 (if (listp body) ; resp-code
620 (list body (read (current-buffer)))
621 (list nil body) ; no resp-code.
624 ;; string = quoted / literal
626 ;; quoted = DQUOTE *QUOTED-CHAR DQUOTE
628 ;; QUOTED-CHAR = <any TEXT-CHAR except quoted-specials> /
629 ;; "\" quoted-specials
631 ;; quoted-specials = DQUOTE / "\"
633 ;; TEXT-CHAR = <any CHAR except CR and LF>
635 (defsubst acap-parse-string ()
636 (cond ((eq (char-after) ?\")
638 (let ((p (point)) (name ""))
639 (skip-chars-forward "^\"\\\\")
640 (setq name (buffer-substring p (point)))
641 (while (eq (char-after) ?\\)
642 (setq p (1+ (point)))
644 (skip-chars-forward "^\"\\\\")
645 (setq name (concat name (buffer-substring p (point)))))
648 ((eq (char-after) ?{)
649 (acap-parse-literal))))
653 (defsubst acap-parse-nil ()
654 (if (looking-at "NIL")
655 (goto-char (match-end 0))))
657 ;; entry = entry-name / entry-path
658 ;; entry-name = string-utf8
659 ;; ;; entry name MUST NOT contain slash
660 ;; ;; MUST NOT begin with "."
661 ;; entry-path = string-utf8
662 ;; ;; slash-separated path to entry
663 ;; ;; begins with slash
665 (defsubst acap-parse-quoted ()
666 (if (eq (char-after) ?\")
667 (read (current-buffer))))
669 (defun acap-parse-entry ()
673 (defun acap-parse-value ()
676 ;; value-list = "(" [value *(SP value)] ")"
677 (defun acap-parse-value-list ()
679 (when (eq (char-after (point)) ?\()
681 (while (not (eq (char-after (point)) ?\)))
683 (push (acap-parse-value) values))
688 ;; return-data-list = return-data *(SP return-data)
690 ;; return-data = return-metadata / return-metalist /
693 (defun acap-parse-return-data-list ()
695 (setq rlist (list (acap-parse-return-metadata-or-return-metalist)))
697 (while (setq r (acap-parse-return-metadata-or-return-metalist))
698 (setq rlist (nconc rlist (list r)))
702 (defun acap-parse-return-metadata-or-return-metalist ()
703 (or (acap-parse-string)
704 (acap-parse-value-or-return-metalist)
705 (and (acap-parse-nil) nil)))
707 (defun acap-parse-value-or-return-metalist ()
708 (when (eq (char-after (point)) ?\()
710 (while (not (eq (char-after (point)) ?\)))
712 (push (or (acap-parse-value)
713 (acap-parse-return-metalist))
718 ;; return-metalist = "(" return-metadata *(SP return-metadata) ")"
719 ;; ;; occurs when multiple metadata items requested
721 (defun acap-parse-return-metalist ()
722 (when (eq (char-after (point)) ?\()
724 (while (not (eq (char-after (point)) ?\)))
726 (push (acap-parse-return-metadata) metadatas))
728 (nreverse metadatas))))
730 ;; return-metadata = nil / string / value-list / acl
731 (defun acap-parse-return-metadata ()
732 (or (acap-parse-string)
733 (acap-parse-value-list)
734 (and (acap-parse-nil) nil)
735 ;; (acap-parse-acl) acl is same as value-list.
738 ;; return-attr-list = "(" return-metalist *(SP return-metalist) ")"
739 ;; ;; occurs when "*" in RETURN pattern on SEARCH
740 (defun acap-parse-return-attr-list ()
741 (when (eq (char-after (point)) ?\()
743 (while (not (eq (char-after (point)) ?\)))
745 (push (acap-parse-return-metalist) metalists))
747 (nreverse metalists))))
749 (defun acap-parse-time ()
752 ;; quoted *(SP quoted)
753 (defun acap-parse-quoted-list ()
755 (setq qlist (list (acap-parse-quoted)))
757 (while (setq q (acap-parse-quoted))
758 (setq qlist (nconc qlist (list q)))
762 (defun acap-parse-any ()
763 (read (current-buffer)))
765 (defun acap-parse-extension-data ()
767 (setq elist (list (acap-parse-any)))
769 (while (setq e (acap-parse-any))
770 (setq elist (nconc elist (list e)))
774 (defun acap-parse-response ()
775 "Parse a ACAP command response."
776 (let ((token (read (current-buffer)))
784 (cons 'cont (acap-parse-string)))
786 ;; untagged response.
787 (case (prog1 (setq token (read (current-buffer)))
790 (list (acap-parse-quoted)
799 (acap-parse-return-data-list)))))
800 (ALERT ;(cons 'alert (acap-parse-resp-body))
801 (message (nth 1 (acap-parse-resp-body))))
802 (BYE ;(cons 'bye (acap-parse-resp-body)))
803 ;;(message (nth 1 (acap-parse-resp-body)))
806 (CHANGE (cons 'change
807 (list (acap-parse-quoted)
819 (acap-parse-return-data-list)))))
820 (LANG (cons 'lang (list (acap-parse-quoted-list))))
822 (OK (cons 'stat-ok (acap-parse-resp-body)))
823 (NO (cons 'stat-no (acap-parse-resp-body)))
824 (BAD ;(cons 'stat-bad (acap-parse-resp-body))
825 ;; XXX cyrus-sml-acap does not return tagged bad response?
826 (error (nth 1 (acap-parse-resp-body))))))
830 (case (prog1 (setq token (read (current-buffer)))
832 (DELETED (cons 'deleted (acap-parse-quoted)))
834 ((OK Ok ok) (prog1 (cons 'done-ok (acap-parse-resp-body))
835 (setq acap-reached-tag tag)))
836 ((NO No no) (prog1 (cons 'done-no (acap-parse-resp-body))
837 (setq acap-reached-tag tag)))
838 ((BAD Bad bad) (prog1 (cons 'done-bad (acap-parse-resp-body))
839 (setq acap-reached-tag tag)))
843 (progn (acap-forward)
844 (acap-parse-return-data-list)))))
845 (LISTRIGHTS (cons 'listrights
846 (acap-parse-quoted-list)))
847 (MODTIME (cons 'modtime (acap-parse-time)))
848 (MYRIGHTS (cons 'myrights (acap-parse-quoted)))
850 (list (acap-parse-quoted)
857 (acap-parse-extension-data))))
858 (REFER (cons 'refer (list (acap-parse-quoted)
859 (acap-parse-quoted))))
860 (REMOVEFROM (cons 'removefrom
861 (list (acap-parse-quoted)
867 (acap-parse-number)))))
870 (cons 'extend (list token (acap-parse-extension-data))))))
872 (list 'garbage token)))
876 (defun acap-flatten (l)
877 "Flatten list-of-list."
884 (acap-flatten (cdr l)))))
886 (defun acap-flatten-r (l)
887 "Flatten list-of-list recursively."
891 (append (acap-flatten (car l)) (acap-flatten (cdr l))))
894 (defun acap-encode-time (time)
895 (format-time-string "%Y%m%d%H%M%S" (current-time) t)) ; Universal time.
897 (defun acap-decode-time (acap-time)
898 (when (string-match "^\\([0-9][0-9][0-9][0-9]\\)\\([0-1][0-9]\\)\\([0-3][0-9]\\)\\([0-2][0-9]\\)\\([0-5][0-9]\\)\\([0-5][0-9]\\)" acap-time)
899 (encode-time (string-to-number (match-string 6 acap-time))
900 (string-to-number (match-string 5 acap-time))
901 (string-to-number (match-string 4 acap-time))
902 (string-to-number (match-string 3 acap-time))
903 (string-to-number (match-string 2 acap-time))
904 (string-to-number (match-string 1 acap-time))
909 ;;; acap.el ends here