Mercurial > emacs
annotate lisp/url/url-imap.el @ 108348:65d3d6eb6e3a
HELLO: Adjust Burmese for Unicode 5.2 encoding.
author | Kenichi Handa <handa@etlken> |
---|---|
date | Fri, 23 Apr 2010 11:17:55 +0900 |
parents | 1d1d5d9bd884 |
children | 376148b31b5e |
rev | line source |
---|---|
54695 | 1 ;;; url-imap.el --- IMAP retrieval routines |
57612 | 2 |
106815 | 3 ;; Copyright (C) 1999, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
57612 | 4 |
54695 | 5 ;; Author: Simon Josefsson <jas@pdc.kth.se> |
6 ;; Keywords: comm, data, processes | |
7 | |
57612 | 8 ;; This file is part of GNU Emacs. |
9 | |
94668
8259d0d8e107
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
57612 | 11 ;; it under the terms of the GNU General Public License as published by |
94668
8259d0d8e107
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
8259d0d8e107
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; (at your option) any later version. |
57612 | 14 |
15 ;; GNU Emacs 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. | |
54695 | 19 |
57612 | 20 ;; You should have received a copy of the GNU General Public License |
94668
8259d0d8e107
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
57612 | 22 |
23 ;;; Commentary: | |
54695 | 24 |
57612 | 25 ;; Anyway, here's a teaser. It's quite broken in lots of regards, but at |
26 ;; least it seem to work. At least a little. At least when called | |
27 ;; manually like this (I've no idea how it's supposed to be called): | |
28 | |
29 ;; (url-imap (url-generic-parse-url "imap://cyrus.andrew.cmu.edu/archive.c-client;UID=1021")) | |
30 | |
31 ;;; Code: | |
54695 | 32 |
33 (require 'url-util) | |
34 (require 'url-parse) | |
35 (require 'nnimap) | |
36 (require 'mm-util) | |
37 | |
96486
7369ded3b436
Typo and docstring fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94668
diff
changeset
|
38 (defconst url-imap-default-port 143 "Default IMAP port.") |
54695 | 39 |
40 (defun url-imap-open-host (host port user pass) | |
41 ;; xxx use user and password | |
42 (if (fboundp 'nnheader-init-server-buffer) | |
43 (nnheader-init-server-buffer)) | |
44 (let ((imap-username user) | |
45 (imap-password pass) | |
46 (authenticator (if user 'login 'anonymous))) | |
47 (nnimap-open-server host | |
48 `((nnimap-server-port ,port) | |
49 (nnimap-stream 'network) | |
50 (nnimap-authenticator ,authenticator))))) | |
51 | |
52 (defun url-imap (url) | |
86950
fed682f20285
(top-level): Don't require cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
78222
diff
changeset
|
53 (unless (vectorp url) |
fed682f20285
(top-level): Don't require cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
78222
diff
changeset
|
54 (signal 'wrong-type-error (list "Need a pre-parsed URL." url))) |
105829
328150f0cf76
* url-util.el (url-insert-entities-in-string):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
55 (with-current-buffer (generate-new-buffer " *url-imap*") |
54695 | 56 (mm-disable-multibyte) |
57 (let* ((host (url-host url)) | |
58 (port (url-port url)) | |
59 ;; xxx decode mailbox (see rfc2192) | |
60 (mailbox (url-filename url)) | |
61 (coding-system-for-read 'binary)) | |
62 (and (eq (string-to-char mailbox) ?/) | |
63 (setq mailbox (substring mailbox 1))) | |
64 (url-imap-open-host host port (url-user url) (url-password url)) | |
65 (cond ((assoc "TYPE" (url-attributes url)) | |
66 ;; xxx list mailboxes (start gnus?) | |
67 ) | |
68 ((assoc "UID" (url-attributes url)) | |
69 ;; fetch message part | |
70 ;; xxx handle partial fetches | |
71 (insert "Content-type: message/rfc822\n\n") | |
96486
7369ded3b436
Typo and docstring fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
94668
diff
changeset
|
72 (nnimap-request-article (cdr (assoc "UID" (url-attributes url))) |
54695 | 73 mailbox host (current-buffer))) |
74 (t | |
75 ;; xxx list messages in mailbox (start gnus?) | |
76 ))) | |
77 (current-buffer))) | |
54699 | 78 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
79 ;; arch-tag: 034991ff-5425-48ea-b911-c96c90e6f47d |
57612 | 80 ;;; url-imap.el ends here |