| 61 | } |
| 62 | |
| 63 | bool mail_attach::save_to(mime_code* coder, string& out) { |
| 64 | if (coder) { |
| 65 | build_header(coder->get_encoding_type(), out); |
| 66 | } else { |
| 67 | build_header(NULL, out); |
| 68 | } |
| 69 | |
| 70 | string buf; |
| 71 | if (!ifstream::load(filepath_.c_str(), &buf)) { |
| 72 | logger_error("load %s error %s", |
| 73 | filepath_.c_str(), last_serror()); |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | if (coder) { |
| 78 | coder->reset(); |
| 79 | coder->encode_update(buf.c_str(), (int) buf.size(), &out); |
| 80 | coder->encode_finish(&out); |
| 81 | } else { |
| 82 | out.append(buf); |
| 83 | } |
| 84 | |
| 85 | return true; |
| 86 | } |
| 87 | |
| 88 | bool mail_attach::save_to(mime_code* coder, ostream& out) { |
| 89 | string header; |
nothing calls this directly
no test coverage detected