MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / get_text_part

Function get_text_part

src/core/rfc822/MCMessageBuilder.cpp:161–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161static struct mailmime * get_text_part(MessageBuilder * builder,
162 const char * mime_type, const char * charset, const char * content_id,
163 const char * description,
164 const char * text, size_t length, int encoding_type, clist * contentTypeParameters)
165{
166 struct mailmime_fields * mime_fields;
167 struct mailmime * mime;
168 struct mailmime_content * content;
169 struct mailmime_parameter * param;
170 struct mailmime_disposition * disposition;
171 struct mailmime_mechanism * encoding;
172 char * dup_content_id;
173 char * dup_description;
174
175 encoding = mailmime_mechanism_new(encoding_type, NULL);
176 disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_INLINE,
177 NULL, NULL, NULL, NULL, (size_t) -1);
178 dup_content_id = NULL;
179 if (content_id != NULL)
180 dup_content_id = strdup(content_id);
181 dup_description = NULL;
182 if (dup_description != NULL)
183 dup_description = strdup(description);
184 mime_fields = mailmime_fields_new_with_data(encoding,
185 dup_content_id, dup_description, disposition, NULL);
186
187 content = mailmime_content_new_with_str(mime_type);
188 if (charset == NULL) {
189 param = mailmime_param_new_with_data((char *) "charset", (char *) "utf-8");
190 }
191 else {
192 param = mailmime_param_new_with_data((char *) "charset", (char *) charset);
193 }
194 clist_append(content->ct_parameters, param);
195 if (contentTypeParameters != NULL) {
196 clist_concat(content->ct_parameters, contentTypeParameters);
197 }
198
199 mime = part_new_empty(builder, content, mime_fields, NULL, 1);
200 mailmime_set_body_text(mime, (char *) text, length);
201
202 return mime;
203}
204
205static struct mailmime * get_plain_text_part(MessageBuilder * builder,
206 const char * mime_type, const char * charset, const char * content_id,

Callers 2

get_plain_text_partFunction · 0.85
get_other_text_partFunction · 0.85

Calls 1

part_new_emptyFunction · 0.85

Tested by

no test coverage detected