| 157 | } |
| 158 | |
| 159 | mailcore::HashMap * HTMLRendererTemplateCallback::templateValuesForPart(mailcore::AbstractPart * part) |
| 160 | { |
| 161 | mailcore::HashMap * result = mailcore::HashMap::hashMap(); |
| 162 | mailcore::String * filename = NULL; |
| 163 | |
| 164 | if (part->filename() != NULL) { |
| 165 | filename = part->filename()->lastPathComponent(); |
| 166 | } |
| 167 | |
| 168 | if (filename != NULL) { |
| 169 | result->setObjectForKey(MCSTR("FILENAME"), filename->htmlEncodedString()); |
| 170 | result->setObjectForKey(MCSTR("HASFILENAME"), mailcore::HashMap::hashMap()); |
| 171 | } |
| 172 | else { |
| 173 | result->setObjectForKey(MCSTR("NOFILENAME"), mailcore::HashMap::hashMap()); |
| 174 | } |
| 175 | |
| 176 | if (part->className()->isEqual(MCSTR("mailcore::IMAPPart"))) { |
| 177 | mailcore::IMAPPart * imapPart = (mailcore::IMAPPart *) part; |
| 178 | mailcore::String * value = mailcore::SizeFormatter::stringWithSize(imapPart->decodedSize()); |
| 179 | result->setObjectForKey(MCSTR("SIZE"), value); |
| 180 | result->setObjectForKey(MCSTR("HASSIZE"), mailcore::HashMap::hashMap()); |
| 181 | } |
| 182 | else if (part->className()->isEqual(MCSTR("mailcore::Attachment"))) { |
| 183 | mailcore::Attachment * attachment = (mailcore::Attachment *) part; |
| 184 | if (attachment->data() != NULL) { |
| 185 | mailcore::String * value = mailcore::SizeFormatter::stringWithSize(attachment->data()->length()); |
| 186 | result->setObjectForKey(MCSTR("SIZE"), value); |
| 187 | result->setObjectForKey(MCSTR("HASSIZE"), mailcore::HashMap::hashMap()); |
| 188 | } |
| 189 | } |
| 190 | else { |
| 191 | result->setObjectForKey(MCSTR("NOSIZE"), mailcore::HashMap::hashMap()); |
| 192 | } |
| 193 | |
| 194 | if (part->contentID() != NULL) { |
| 195 | result->setObjectForKey(MCSTR("CONTENTID"), part->contentID()); |
| 196 | } |
| 197 | if (part->uniqueID() != NULL) { |
| 198 | result->setObjectForKey(MCSTR("UNIQUEID"), part->uniqueID()); |
| 199 | } |
| 200 | |
| 201 | return result; |
| 202 | } |
| 203 | |
| 204 | mailcore::String * HTMLRendererTemplateCallback::templateForMainHeader(MessageHeader * header) |
| 205 | { |
nothing calls this directly
no test coverage detected