| 1 |
;;; mew-ext.el --- Message/External-Body support for Mew |
| 2 |
|
| 3 |
;; Author: Kazu Yamamoto <[email protected]> |
| 4 |
;; Created: Nov 13, 1996 |
| 5 |
|
| 6 |
;;; Code: |
| 7 |
|
| 8 |
(require 'mew) |
| 9 |
(eval-when-compile |
| 10 |
(cond |
| 11 |
;; ((mew-which-el "efs") |
| 12 |
;; (require 'efs)) |
| 13 |
((mew-which-el "ange-ftp") |
| 14 |
(require 'ange-ftp)))) |
| 15 |
|
| 16 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 17 |
;;; |
| 18 |
;;; Variables for encoding |
| 19 |
;;; |
| 20 |
|
| 21 |
(defvar mew-ext-default-access-type "anon-ftp") |
| 22 |
|
| 23 |
(defvar mew-ext-ftp-server-list |
| 24 |
'("ftp.example.org" "ftp.example.jp")) |
| 25 |
|
| 26 |
(defvar mew-ext-encode-switch |
| 27 |
'(("ftp" . mew-ext-encode-ftp) |
| 28 |
;; ("tftp" . mew-ext-encode-tftp) |
| 29 |
("anon-ftp" . mew-ext-encode-anon-ftp) |
| 30 |
("local-file" . mew-ext-encode-local-file) |
| 31 |
("mail-server" . mew-ext-encode-mail-server) |
| 32 |
("url" . mew-ext-encode-url))) |
| 33 |
|
| 34 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 35 |
;;; |
| 36 |
;;; Variables for decoding |
| 37 |
;;; |
| 38 |
|
| 39 |
(defvar mew-ext-switch |
| 40 |
'(("ftp" mew-ext-ftp mew-ext-ftp-ext) |
| 41 |
("tftp" mew-ext-tftp nil) |
| 42 |
("anon-ftp" mew-ext-anon-ftp mew-ext-anon-ftp-ext) |
| 43 |
("mail-server" mew-ext-mail-server mew-ext-mail-server-ext) |
| 44 |
("url" mew-ext-url mew-ext-url-ext))) ;; RFC 2017 |
| 45 |
|
| 46 |
(defun mew-ext-get-func (acc-type) |
| 47 |
(nth 1 (mew-assoc-match acc-type mew-ext-switch 0))) |
| 48 |
|
| 49 |
(defun mew-ext-get-func-ext (acc-type) |
| 50 |
(nth 2 (mew-assoc-match acc-type mew-ext-switch 0))) |
| 51 |
|
| 52 |
(defvar mew-ext-include-switch |
| 53 |
'(("local-file" mew-ext-include-local-file))) |
| 54 |
|
| 55 |
(defun mew-ext-include-get-func (acc-type) |
| 56 |
(nth 1 (mew-assoc-case-equal acc-type mew-ext-include-switch 0))) |
| 57 |
|
| 58 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 59 |
;;; |
| 60 |
;;; environment variables |
| 61 |
;;; |
| 62 |
|
| 63 |
(cond |
| 64 |
;; ((mew-which-el "efs") |
| 65 |
;; (defun mew-ext-file-name-completion (file path) |
| 66 |
;; (require 'efs) |
| 67 |
;; (let ((efs-tmp-name-template mew-temp-file)) |
| 68 |
;; (efs-file-name-completion file path))) |
| 69 |
;; (defun mew-ext-file-name-all-completions (file path) |
| 70 |
;; (require 'efs) |
| 71 |
;; (let ((efs-tmp-name-template mew-temp-file)) |
| 72 |
;; (efs-file-name-all-completions file path))) |
| 73 |
;; (defun mew-ext-expand-dir (host user dir) |
| 74 |
;; (require 'efs) |
| 75 |
;; (let ((efs-tmp-name-template mew-temp-file) exp) |
| 76 |
;; (setq exp (efs-expand-file-name (format "/%s@%s:%s" user host dir))) |
| 77 |
;; (if (string-match ".*:\\(.*\\)$" exp) |
| 78 |
;; (match-string 1 exp)))) |
| 79 |
;; (defun mew-ext-copy-file-internal (remote local passwd) |
| 80 |
;; (require 'efs) |
| 81 |
;; (let ((efs-tmp-name-template mew-temp-file) |
| 82 |
;; (efs-generate-anonymous-password passwd) |
| 83 |
;; (parsed (efs-ftp-path remote))) |
| 84 |
;; (efs-copy-file-internal remote parsed local nil |
| 85 |
;; nil nil nil nil t 'image)))) |
| 86 |
((mew-which-el "ange-ftp") |
| 87 |
(defun mew-ext-file-name-completion (file path) |
| 88 |
(require 'ange-ftp) |
| 89 |
(let ((ange-ftp-tmp-name-template mew-temp-file)) |
| 90 |
(ange-ftp-file-name-completion file path))) |
| 91 |
(defun mew-ext-file-name-all-completions (file path) |
| 92 |
(require 'ange-ftp) |
| 93 |
(let ((ange-ftp-tmp-name-template mew-temp-file)) |
| 94 |
(ange-ftp-file-name-all-completions file path))) |
| 95 |
(defun mew-ext-expand-dir (host user dir) |
| 96 |
(require 'ange-ftp) |
| 97 |
(let ((ange-ftp-tmp-name-template mew-temp-file) exp) |
| 98 |
(setq exp (ange-ftp-expand-file-name (format "/%s@%s:%s" user host dir))) |
| 99 |
(if (string-match ".*:\\(.*\\)$" exp) |
| 100 |
(match-string 1 exp)))) |
| 101 |
(defun mew-ext-copy-file-internal (remote local passwd) |
| 102 |
(require 'ange-ftp) |
| 103 |
(let ((ange-ftp-tmp-name-template mew-temp-file) |
| 104 |
(ange-ftp-generate-anonymous-password passwd)) |
| 105 |
(ange-ftp-copy-file-internal remote local t nil nil nil t))))) |
| 106 |
|
| 107 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 108 |
;;; |
| 109 |
;;; Encode |
| 110 |
;;; |
| 111 |
|
| 112 |
(defun mew-attach-external-body () |
| 113 |
"Specify external body." |
| 114 |
(interactive) |
| 115 |
(if (not (mew-attach-not-line012-1)) |
| 116 |
(message "Cannot insert external-body here") |
| 117 |
(let* ((nums (mew-syntax-nums)) |
| 118 |
(subdir (mew-attach-expand-path mew-encode-syntax nums)) |
| 119 |
(attachdir (mew-attachdir)) |
| 120 |
file filepath ct) |
| 121 |
;; attachdir / {subdir/} dir |
| 122 |
(if (not (string= subdir "")) |
| 123 |
(setq attachdir (expand-file-name subdir attachdir))) |
| 124 |
;; attachdir / file |
| 125 |
(setq filepath (mew-random-filename attachdir 1 nil mew-ext-suffix)) |
| 126 |
(if (file-exists-p filepath) |
| 127 |
(message "Cannot make a file for external-body, sorry") |
| 128 |
(setq file (file-name-nondirectory filepath)) |
| 129 |
(setq ct (mew-ext-encode filepath)) |
| 130 |
(setq mew-encode-syntax |
| 131 |
(mew-syntax-insert-entry |
| 132 |
mew-encode-syntax |
| 133 |
nums |
| 134 |
(mew-encode-syntax-single file ct))) |
| 135 |
(mew-encode-syntax-print mew-encode-syntax))))) |
| 136 |
|
| 137 |
(defun mew-create-content-id () |
| 138 |
;; this is not unique if used with very short interval. |
| 139 |
;; but it's ok |
| 140 |
(format "<%s.%s.%s@%s>" (nth 0 (current-time)) (nth 1 (current-time)) |
| 141 |
(emacs-pid) (system-name))) |
| 142 |
|
| 143 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 144 |
|
| 145 |
(defun mew-ext-encode (filename) |
| 146 |
(let (ret access-type ct name) |
| 147 |
(with-temp-buffer |
| 148 |
;;content-header |
| 149 |
(setq access-type (mew-input-general |
| 150 |
"Access type" mew-ext-encode-switch t |
| 151 |
mew-ext-default-access-type)) |
| 152 |
(setq ret (funcall (cdr (assoc access-type mew-ext-encode-switch)))) |
| 153 |
;;message-header |
| 154 |
(cond |
| 155 |
((string= access-type "url") |
| 156 |
(setq name "URL") |
| 157 |
(setq ct "Text/Html")) |
| 158 |
((string= access-type "mail-server") |
| 159 |
(setq name "Mail server's file") |
| 160 |
(setq ct mew-ct-apo)) |
| 161 |
(t |
| 162 |
(setq name (file-name-nondirectory |
| 163 |
(mew-chop (mew-syntax-get-param ret "name")))) |
| 164 |
;; name is quoted |
| 165 |
(if (string= name "") |
| 166 |
(setq ct mew-ct-apo) |
| 167 |
(setq ct (or (mew-ctdb-ct (mew-ctdb-by-file name)) |
| 168 |
(mew-content-type (mew-tinfo-get-case))))))) |
| 169 |
(setq ct (mew-input-type "Type for %s (%s): " name ct |
| 170 |
mew-mime-content-type-list)) |
| 171 |
(mew-header-insert mew-ct: ct) |
| 172 |
(mew-header-insert mew-cid: (mew-create-content-id)) |
| 173 |
(insert "\n") |
| 174 |
(when (string= access-type "mail-server") |
| 175 |
;;message-body |
| 176 |
(insert (read-string "Input message to the mail-server: ")) |
| 177 |
(insert "\n")) |
| 178 |
(write-file filename)) |
| 179 |
(cons mew-ct-ext (cons (list "access-type" access-type) ret)))) |
| 180 |
|
| 181 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 182 |
|
| 183 |
(defun mew-ext-encode-ftp () |
| 184 |
;; "name" "site" "directory" "mode" |
| 185 |
(let ((mew-ext-host (mew-input-general |
| 186 |
"FTP server" |
| 187 |
(if mew-ext-ftp-server-list |
| 188 |
(mapcar 'list mew-ext-ftp-server-list)) |
| 189 |
nil |
| 190 |
(car mew-ext-ftp-server-list))) |
| 191 |
mew-ext-user path dir file ret) |
| 192 |
(setq ret (list (list "site" mew-ext-host))) |
| 193 |
(setq mew-ext-user (read-string (format "User name at %s: " mew-ext-host) |
| 194 |
(mew-user))) |
| 195 |
(setq path (mew-input-rfile "Filename:")) |
| 196 |
(setq file (file-name-nondirectory path)) |
| 197 |
(setq dir (file-name-directory path)) |
| 198 |
(if (and dir (string-match mew-home dir)) |
| 199 |
(setq dir (mew-ext-expand-dir mew-ext-host mew-ext-user dir))) |
| 200 |
(cond |
| 201 |
(dir |
| 202 |
(setq ret (cons (list "directory" dir) ret)) |
| 203 |
(setq ret (cons (list "name" file) ret))) |
| 204 |
(t |
| 205 |
(setq ret (cons (list "name" file) ret)))) |
| 206 |
ret)) |
| 207 |
|
| 208 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 209 |
|
| 210 |
(defun mew-ext-encode-tftp () |
| 211 |
;; xxx not yet |
| 212 |
) |
| 213 |
|
| 214 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 215 |
|
| 216 |
(defun mew-ext-encode-anon-ftp () |
| 217 |
;; "name" "site" "directory" "mode" |
| 218 |
(let ((mew-ext-user "anonymous") |
| 219 |
(mew-ext-host (mew-input-general |
| 220 |
"FTP server" |
| 221 |
(if mew-ext-ftp-server-list |
| 222 |
(mapcar 'list mew-ext-ftp-server-list)) |
| 223 |
nil |
| 224 |
(car mew-ext-ftp-server-list))) |
| 225 |
path dir file ret) |
| 226 |
(setq ret (list (list "site" mew-ext-host))) |
| 227 |
(setq path (mew-input-rfile "Filename:")) |
| 228 |
(setq file (file-name-nondirectory path)) |
| 229 |
(setq dir (file-name-directory path)) |
| 230 |
(if (and dir (string-match mew-home dir)) |
| 231 |
(setq dir (mew-ext-expand-dir mew-ext-host mew-ext-user dir))) |
| 232 |
(cond |
| 233 |
(dir |
| 234 |
(setq ret (cons (list "directory" dir) ret)) |
| 235 |
(setq ret (cons (list "name" file) ret))) |
| 236 |
(t |
| 237 |
(setq ret (cons (list "name" file) ret)))) |
| 238 |
ret)) |
| 239 |
|
| 240 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 241 |
|
| 242 |
(defun mew-ext-encode-local-file () |
| 243 |
;; "name" "site" |
| 244 |
(let ((file (mew-draft-input-file-name "File name: "))) |
| 245 |
(list (list "name" (expand-file-name file))))) |
| 246 |
|
| 247 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 248 |
|
| 249 |
(defun mew-ext-encode-mail-server () |
| 250 |
;; "server" "subject" |
| 251 |
(let (server subject) |
| 252 |
(setq server (car (mew-input-address "Server address: "))) |
| 253 |
(setq subject (read-string (concat mew-subj: " "))) |
| 254 |
(list (list "server" server) |
| 255 |
(list "subject" subject)))) |
| 256 |
|
| 257 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 258 |
|
| 259 |
(defun mew-ext-encode-url () |
| 260 |
;; "url" |
| 261 |
(let ((url (read-string "URL: "))) |
| 262 |
(list (list "url" url)))) |
| 263 |
|
| 264 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 265 |
;;; |
| 266 |
;;; Decode |
| 267 |
;;; |
| 268 |
|
| 269 |
;; |
| 270 |
;; exclude |
| 271 |
;; |
| 272 |
|
| 273 |
(defun mew-mime-external-body (cache begin end &optional params) |
| 274 |
;; message-buffer |
| 275 |
(let* ((access-type (mew-syntax-get-param params "access-type")) |
| 276 |
(func (mew-ext-get-func access-type))) |
| 277 |
(if (and (symbolp func) (fboundp func)) |
| 278 |
(funcall func cache begin end params)))) |
| 279 |
|
| 280 |
(defun mew-mime-external-body-ext (cache begin end &optional params) |
| 281 |
(let* ((access-type (mew-syntax-get-param params "access-type")) |
| 282 |
(func (mew-ext-get-func-ext access-type))) |
| 283 |
(if (and (symbolp func) (fboundp func)) |
| 284 |
(funcall func cache begin end params)))) |
| 285 |
|
| 286 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 287 |
|
| 288 |
(defun mew-ext-ftp (_cache _begin _end &optional params) |
| 289 |
(mew-elet |
| 290 |
(let* ((site (mew-syntax-get-param params "site")) |
| 291 |
(directory (mew-syntax-get-param params "directory")) |
| 292 |
(name (mew-syntax-get-param params "name")) |
| 293 |
(size (mew-syntax-get-param params "size")) |
| 294 |
filepath) |
| 295 |
(if directory |
| 296 |
(setq filepath (mew-concat-folder directory name)) |
| 297 |
(setq filepath name)) |
| 298 |
(setq filepath (mew-remove-drive-letter filepath)) |
| 299 |
(mew-erase-buffer) |
| 300 |
(insert " ####### ####### ###### \n" |
| 301 |
" # # # # \n" |
| 302 |
" # # # # \n" |
| 303 |
" ##### # ###### \n" |
| 304 |
" # # # \n" |
| 305 |
" # # # \n" |
| 306 |
" # # # \n" |
| 307 |
"\n\n") |
| 308 |
(insert "You can get the message content by FTP\n\n") |
| 309 |
(mew-insert "Site:\t%s\n" site) |
| 310 |
(mew-insert "File:\t%s\n" filepath) |
| 311 |
(mew-insert "Size:\t%s bytes\n" size) |
| 312 |
(insert "\n") |
| 313 |
(mew-insert-manual |
| 314 |
"To get this file, type " |
| 315 |
"'\\<mew-summary-mode-map>\\[mew-summary-execute-external]'.\n")))) |
| 316 |
|
| 317 |
(defun mew-ext-ftp-ext (_cache _begin _end &optional params) |
| 318 |
(let* ((site (mew-syntax-get-param params "site")) |
| 319 |
(directory (mew-syntax-get-param params "directory")) |
| 320 |
(name (mew-syntax-get-param params "name")) |
| 321 |
(getit t) (username "") |
| 322 |
filepath localfile lfname remotefile) |
| 323 |
(if directory |
| 324 |
(setq filepath (mew-concat-folder directory name)) |
| 325 |
(setq filepath name)) |
| 326 |
(setq filepath (mew-remove-drive-letter filepath)) |
| 327 |
(setq username (read-string (format "User name at %s: " site) (mew-user))) |
| 328 |
(setq remotefile (format "/%s@%s:%s" username site filepath)) |
| 329 |
(setq localfile (mew-summary-input-file-name "Save to: " name)) |
| 330 |
(setq lfname (file-name-nondirectory localfile)) |
| 331 |
(if (file-exists-p localfile) |
| 332 |
(if (y-or-n-p (format "%s exists. Overwrite? " lfname)) |
| 333 |
(mew-delete-file localfile) |
| 334 |
(setq getit nil) |
| 335 |
(message "The file was not retrieved"))) |
| 336 |
(if getit (mew-ext-copy-file-internal remotefile localfile nil)))) |
| 337 |
|
| 338 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 339 |
|
| 340 |
(defun mew-ext-tftp (_cache _begin _end &optional _params) |
| 341 |
(message "Access-type TFTP is not supported yet")) |
| 342 |
|
| 343 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 344 |
|
| 345 |
(defun mew-ext-anon-ftp (_cache _begin _end &optional params) |
| 346 |
(mew-elet |
| 347 |
(let* ((site (mew-syntax-get-param params "site")) |
| 348 |
(directory (mew-syntax-get-param params "directory")) |
| 349 |
(name (mew-syntax-get-param params "name")) |
| 350 |
(size (mew-syntax-get-param params "size")) |
| 351 |
filepath) |
| 352 |
(if directory |
| 353 |
(setq filepath (mew-concat-folder directory name)) |
| 354 |
(setq filepath name)) |
| 355 |
(setq filepath (mew-remove-drive-letter filepath)) |
| 356 |
(mew-erase-buffer) |
| 357 |
(insert " Anonymous \n" |
| 358 |
" ####### ####### ###### \n" |
| 359 |
" # # # # \n" |
| 360 |
" # # # # \n" |
| 361 |
" ##### # ###### \n" |
| 362 |
" # # # \n" |
| 363 |
" # # # \n" |
| 364 |
" # # # \n" |
| 365 |
"\n\n") |
| 366 |
(insert "You can get the message content by FTP\n\n") |
| 367 |
(mew-insert "Site:\t%s\n" site) |
| 368 |
(mew-insert "File:\t%s\n" filepath) |
| 369 |
(mew-insert "Size:\t%s bytes\n" size) |
| 370 |
(insert "\n") |
| 371 |
(mew-insert-manual |
| 372 |
"To get this file, type " |
| 373 |
"'\\<mew-summary-mode-map>\\[mew-summary-execute-external]'.\n")))) |
| 374 |
|
| 375 |
(defun mew-ext-anon-ftp-ext (_cache _begin _end &optional params) |
| 376 |
(let* ((site (mew-syntax-get-param params "site")) |
| 377 |
(directory (mew-syntax-get-param params "directory")) |
| 378 |
(name (mew-syntax-get-param params "name")) |
| 379 |
(getit t) |
| 380 |
filepath localfile lfname remotefile) |
| 381 |
(if directory |
| 382 |
(setq filepath (mew-concat-folder directory name)) |
| 383 |
(setq filepath name)) |
| 384 |
(setq filepath (mew-remove-drive-letter filepath)) |
| 385 |
(setq remotefile (format "/%s@%s:%s" "anonymous" site filepath)) |
| 386 |
(setq localfile (mew-summary-input-file-name "Save to: " name)) |
| 387 |
(setq lfname (file-name-nondirectory localfile)) |
| 388 |
(if (file-exists-p localfile) |
| 389 |
(if (y-or-n-p (format "%s exists. Overwrite? " lfname)) |
| 390 |
(mew-delete-file localfile) |
| 391 |
(setq getit nil) |
| 392 |
(message "The file was not retrieved"))) |
| 393 |
(if getit (mew-ext-copy-file-internal remotefile localfile (mew-mail-address))))) |
| 394 |
|
| 395 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 396 |
|
| 397 |
(defun mew-ext-mail-server (_cache _begin _end &optional params) |
| 398 |
(mew-elet |
| 399 |
(let* ((server (mew-syntax-get-param params "server")) |
| 400 |
(size (mew-syntax-get-param params "size"))) |
| 401 |
(mew-erase-buffer) |
| 402 |
(insert " # # # ### #\n" |
| 403 |
" ## ## # # # #\n" |
| 404 |
" # # # # # # # #\n" |
| 405 |
" # # # # # # #\n" |
| 406 |
" # # ####### # #\n" |
| 407 |
" # # # # # #\n" |
| 408 |
" # # # # ### #######\n" |
| 409 |
"\n\n") |
| 410 |
(insert "You can get the message by e-mail\n\n") |
| 411 |
(mew-insert "Server:\t\t%s\n" server) |
| 412 |
(mew-insert "Size:\t%s bytes\n" size) |
| 413 |
(insert "\n") |
| 414 |
;; picked up source from 'mew-send |
| 415 |
(mew-insert-manual |
| 416 |
"To send this mail, type " |
| 417 |
"'\\<mew-summary-mode-map>\\[mew-summary-execute-external]'.\n")))) |
| 418 |
|
| 419 |
(defun mew-ext-mail-server-ext (cache begin end &optional params) |
| 420 |
(let* ((server (mew-syntax-get-param params "server")) |
| 421 |
(subject (mew-syntax-get-param params "subject")) |
| 422 |
(syntax (mew-ext-decode-message-header cache begin end)) |
| 423 |
(start (mew-syntax-get-begin syntax))) |
| 424 |
(mew-summary-send server nil subject) |
| 425 |
(goto-char (point-max)) |
| 426 |
(mew-insert-buffer-substring cache start end) |
| 427 |
(mew-draft-make-message))) |
| 428 |
|
| 429 |
(defun mew-ext-decode-message-header (cache begin end) |
| 430 |
(let (syntax start) |
| 431 |
(with-current-buffer cache |
| 432 |
(save-restriction |
| 433 |
(narrow-to-region begin end) |
| 434 |
(goto-char (point-min)) |
| 435 |
(setq syntax (mew-decode-mime-header)) |
| 436 |
(setq start (point))) |
| 437 |
(mew-syntax-set-key syntax 'phantom) |
| 438 |
(mew-syntax-set-begin syntax start) |
| 439 |
(mew-syntax-set-end syntax end) |
| 440 |
syntax))) |
| 441 |
|
| 442 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 443 |
|
| 444 |
(defun mew-ext-url (cache begin end &optional params) |
| 445 |
(mew-elet |
| 446 |
(let* ((url (mew-syntax-get-param params "url")) |
| 447 |
(size (mew-syntax-get-param params "size")) |
| 448 |
(process-connection-type mew-connection-type1) |
| 449 |
(syntax (mew-ext-decode-message-header cache begin end)) |
| 450 |
(mct (car (mew-syntax-get-ct syntax))) |
| 451 |
(spec mew-prog-text/html-ext) |
| 452 |
(prog (mew-progspec-get-prog spec))) |
| 453 |
(mew-erase-buffer) |
| 454 |
(insert "# # ###### #\n" |
| 455 |
"# # # # #\n" |
| 456 |
"# # # # #\n" |
| 457 |
"# # ###### #\n" |
| 458 |
"# # # # #\n" |
| 459 |
"# # # # #\n" |
| 460 |
" ##### # # #######\n" |
| 461 |
"\n\n") |
| 462 |
(mew-insert "URL:\t\t%s\n" url) |
| 463 |
(mew-insert "Content-Type:\t%s\n" mct) |
| 464 |
(mew-insert "Size:\t%s bytes\n" size) |
| 465 |
(mew-insert "Operation:\t%s\n" (or prog "not defined")) |
| 466 |
(insert "\n") |
| 467 |
(mew-insert-manual |
| 468 |
"To operate this URL, type " |
| 469 |
"'\\<mew-summary-mode-map>\\[mew-summary-execute-external]'.\n")))) |
| 470 |
|
| 471 |
(defun mew-ext-url-ext (_cache _begin _end &optional params) |
| 472 |
(let* ((url (mew-syntax-get-param params "url")) |
| 473 |
(process-connection-type mew-connection-type1) |
| 474 |
(spec mew-prog-text/html-ext) |
| 475 |
(prog (mew-progspec-get-prog spec)) |
| 476 |
(args (mew-progsec-args-convert (mew-progspec-get-args spec) url))) |
| 477 |
(apply 'call-process prog nil nil nil args))) |
| 478 |
|
| 479 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 480 |
|
| 481 |
;; |
| 482 |
;; include |
| 483 |
;; |
| 484 |
|
| 485 |
(defun mew-ext-include-local-file (params) |
| 486 |
(mew-flet |
| 487 |
(let* ((file (mew-syntax-get-param params "name"))) |
| 488 |
(if (file-exists-p file) |
| 489 |
(mew-insert-file-contents file))))) |
| 490 |
|
| 491 |
(provide 'mew-ext) |
| 492 |
|
| 493 |
;;; Copyright Notice: |
| 494 |
|
| 495 |
;; Copyright (C) 1996-2015 Mew developing team. |
| 496 |
;; All rights reserved. |
| 497 |
|
| 498 |
;; Redistribution and use in source and binary forms, with or without |
| 499 |
;; modification, are permitted provided that the following conditions |
| 500 |
;; are met: |
| 501 |
;; |
| 502 |
;; 1. Redistributions of source code must retain the above copyright |
| 503 |
;; notice, this list of conditions and the following disclaimer. |
| 504 |
;; 2. Redistributions in binary form must reproduce the above copyright |
| 505 |
;; notice, this list of conditions and the following disclaimer in the |
| 506 |
;; documentation and/or other materials provided with the distribution. |
| 507 |
;; 3. Neither the name of the team nor the names of its contributors |
| 508 |
;; may be used to endorse or promote products derived from this software |
| 509 |
;; without specific prior written permission. |
| 510 |
;; |
| 511 |
;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND |
| 512 |
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 513 |
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 514 |
;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE |
| 515 |
;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 516 |
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 517 |
;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 518 |
;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 519 |
;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 520 |
;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 521 |
;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 522 |
|
| 523 |
;;; mew-ext.el ends here |