Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | mime::initialize - make multipart/mixed the default type when -parts is provided. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | pooryorick |
Files: | files | file ages | folders |
SHA3-256: |
c55b8ef304a279256ad2bd17fe2731a2 |
User & Date: | pooryorick 2018-08-30 05:57:43.436 |
Context
2021-05-01
| ||
08:11 | mime::initialize - make multipart/mixed the default type when -parts is provided. check-in: 5a8fbe56cb user: pooryorick tags: mime | |
2018-08-30
| ||
12:00 | ::mime::initialize no longer parses the message. Instead, parsing is performed later as needed. check-in: 16a1a9ac6e user: pooryorick tags: pooryorick | |
05:57 | mime::initialize - make multipart/mixed the default type when -parts is provided. check-in: c55b8ef304 user: pooryorick tags: pooryorick | |
2018-08-29
| ||
19:49 | -headers and -parts options to mime::initialize now take a dictionary. Fix for [492563ffff] "hostname" option for parseaddress. check-in: 39e8f7dbb4 user: yorick tags: pooryorick | |
Changes
Changes to modules/mime/mime.man.
︙ | ︙ | |||
34 35 36 37 38 39 40 | Creates a MIME part and returns a token representing it. [list_begin itemized] [item] | | > | > > | > > > > > | > | > | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | Creates a MIME part and returns a token representing it. [list_begin itemized] [item] If the [option -canonical] option is present the body is already well-formed according to the provided [arg type/subtype]. If [option -file] is provided, the body of the message is read from the specified file. If [option -string] is provided, the accompanying value is the body of the message. If [option -parts] is provided, the media type is [const multipart] and the tokens in the provided list, which were retuned from previous calls to [call [cmd ::mime::initialize]], are used to produce the message body. If [option -canonical] is not provided, the default value of [const multipart/mixed] is used. [option -headers] is a dictionary of headers, with possibly redundant keys that might specify for example, [const Content-Type]. [option -params] is a dictionary of parameters, with possibly redundant keys that might specify, for example [const Content-Disposition]. [para] Also, [option -encoding], if present, specifies the [const Content-Transfer-Encoding] when copying the body. [item] If the [option -canonical] option is not present, the MIME part contained in either the [option -file] or the [option -string] option is parsed, dynamically generating subordinates as appropriate. [list_end] [call [cmd ::mime::finalize] [arg token] [opt "[option -subordinates] [const all] | [const dynamic] | [const none]"]] |
︙ | ︙ | |||
74 75 76 77 78 79 80 | [const dynamic], destroying all subordinates which were created by [cmd ::mime::initialize] together with the containing body part. [call [cmd ::mime::getproperty] [arg token] [opt "[arg property] | [option -names]"]] Returns a string or a list of strings containing the properties of a MIME part. If the command is invoked with the name of | | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | [const dynamic], destroying all subordinates which were created by [cmd ::mime::initialize] together with the containing body part. [call [cmd ::mime::getproperty] [arg token] [opt "[arg property] | [option -names]"]] Returns a string or a list of strings containing the properties of a MIME part. If the command is invoked with the name of a specific property, the corresponding value is returned; instead, if [option -names] is specified, a list of all properties is returned; otherwise, a serialized array of properties and values is returned. [para] The possible properties are: |
︙ | ︙ | |||
113 114 115 116 117 118 119 | [call [cmd ::mime::getheader] [arg token] [opt "[arg key] | [option -names]"]] Returns the header of a MIME part as a dictionary with possibly-redundant keys. [para] | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | [call [cmd ::mime::getheader] [arg token] [opt "[arg key] | [option -names]"]] Returns the header of a MIME part as a dictionary with possibly-redundant keys. [para] If [arg key] is provided, a list of values of matching names, without regard to case, is returned. [para] If [option -names] is provided, a list of all keys is returned. |
︙ | ︙ | |||
164 165 166 167 168 169 170 | [call [cmd ::mime::getbody] [arg token] [opt [option -decode]] [opt "[option -command] [arg callback] [opt "[option -blocksize] [arg octets]"]"]] Returns a string containing the body of the leaf MIME part represented by [arg token] in canonical form. [para] | | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | [call [cmd ::mime::getbody] [arg token] [opt [option -decode]] [opt "[option -command] [arg callback] [opt "[option -blocksize] [arg octets]"]"]] Returns a string containing the body of the leaf MIME part represented by [arg token] in canonical form. [para] If the [option -command] option is present, it is repeatedly invoked with a fragment of the body as this: [example { uplevel #0 $callback [list "data" $fragment] }] [para] |
︙ | ︙ | |||
199 200 201 202 203 204 205 | [para] Regardless, the return value of the final invocation of the callback is propagated upwards by [cmd ::mime::getbody]. [para] | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | [para] Regardless, the return value of the final invocation of the callback is propagated upwards by [cmd ::mime::getbody]. [para] If the [option -command] option is absent, the return value of [cmd ::mime::getbody] is a string containing the MIME part's entire body. [para] If the option [option -decode] is absent the return value computed above is returned as is. This means that it will be in the charset |
︙ | ︙ |
Changes to modules/mime/mime.tcl.
︙ | ︙ | |||
556 557 558 559 560 561 562 | incr valueN } } if {$valueN != 1 && ![info exists state(lines)]} { error "specify exactly one of -file, -parts, or -string" } | | > > > > | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | incr valueN } } if {$valueN != 1 && ![info exists state(lines)]} { error "specify exactly one of -file, -parts, or -string" } if {[set state(canonicalP) [info exists state(content)]] || [info exists state(parts)]} { if {![info exists state(content)]} { set state(content) multipart/mixed } switch -- $state(value) { file { set state(offset) 0 } parts { switch -glob -- $state(content) { |
︙ | ︙ | |||
606 607 608 609 610 611 612 | } if {$state(encoding) ne {}} { error "-encoding requires -canonical" } if {$userheader} { error "-header requires -canonical" } | < < < | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | } if {$state(encoding) ne {}} { error "-encoding requires -canonical" } if {$userheader} { error "-header requires -canonical" } if {[set fileP [info exists state(file)]]} { if {[set openP [info exists state(root)]]} { # FRINK: nocheck variable $state(root) upvar 0 $state(root) root |
︙ | ︙ |
Changes to modules/mime/mime.test.
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 | list [regexp "MIME-Version: 1.0\r Content-Description: Test Multipart\r Content-ID: \[^\n]+\r Content-Type: multipart/mytype;\r \[^\n]+;\r \[^\n]+\r \r --bndry\r MIME-Version: 1.0\r Content-ID: \[^\n]+\r Content-Type: text/plain\r \r jack and jill\r --bndry\r | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | list [regexp "MIME-Version: 1.0\r Content-Description: Test Multipart\r Content-ID: \[^\n]+\r Content-Type: multipart/mytype;\r \[^\n]+;\r \[^\n]+\r \r --bndry\r MIME-Version: 1.0\r Content-ID: \[^\n]+\r Content-Type: text/plain\r \r jack and jill\r --bndry\r MIME-Version: 1.0\r Content-ID: \[^\n]+\r Content-Type: text/plain\r \r james\r --bndry--\r " $msg] [regexp "boundary=\"bndry\"" $msg] [regexp "myparam=\"foo\"" $msg] } {1 1 1} test mime-2.3 {Generate a multi-part MIME message} { set tok1 [initialize -canonical "Text/plain" -string "jack and jill"] set tok2 [initialize -canonical "Text/plain" -string "james"] set bigTok [mime::initialize \ -params [list MyParam foo boundary bndry] \ -headers [list Content-Description "Test Multipart"] \ -parts [list $tok1 $tok2]] set msg [mime::buildmessage $bigTok] # The generated message is predictable except for the Content-ID list [regexp "MIME-Version: 1.0\r Content-Description: Test Multipart\r Content-ID: \[^\n]+\r Content-Type: multipart/mixed;\r \[^\n]+;\r \[^\n]+\r \r --bndry\r MIME-Version: 1.0\r Content-ID: \[^\n]+\r Content-Type: text/plain\r \r jack and jill\r --bndry\r |
︙ | ︙ |