本文整理汇总了C++中GMIME_IS_PART函数的典型用法代码示例。如果您正苦于以下问题:C++ GMIME_IS_PART函数的具体用法?C++ GMIME_IS_PART怎么用?C++ GMIME_IS_PART使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GMIME_IS_PART函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mime_part_get_filename
static char*
mime_part_get_filename (GMimeObject *mobj, unsigned index,
gboolean construct_if_needed)
{
gchar *fname;
fname = NULL;
if (GMIME_IS_PART (mobj)) {
/* the easy case: the part has a filename */
fname = (gchar*)g_mime_part_get_filename (GMIME_PART(mobj));
if (fname) /* don't include directory components */
fname = g_path_get_basename (fname);
}
if (!fname && !construct_if_needed)
return NULL;
if (GMIME_IS_MESSAGE_PART(mobj)) {
GMimeMessage *msg;
const char *subj;
msg = g_mime_message_part_get_message
(GMIME_MESSAGE_PART(mobj));
subj = g_mime_message_get_subject (msg);
fname = g_strdup_printf ("%s.eml", subj ? subj : "message");
}
if (!fname)
fname = g_strdup_printf ("%u.part", index);
/* remove slashes, spaces, colons... */
cleanup_filename (fname);
return fname;
}
开发者ID:otfrom,项目名称:mu,代码行数:34,代码来源:mu-msg-part.c
示例2: get_mime_stream
static GMimeStream*
get_mime_stream (GMimeObject *obj, GError **err)
{
GMimeStream *mstream;
GMimeDataWrapper *wrapper;
if (!GMIME_IS_PART(obj)) {
char *str;
GByteArray *ar;
str = g_mime_object_to_string (obj);
ar = g_byte_array_new_take ((guchar*)str, strlen(str));
mstream = g_mime_stream_mem_new_with_byte_array (ar);
g_mime_stream_mem_set_owner (
GMIME_STREAM_MEM(mstream), TRUE);
return mstream;
}
wrapper = get_data_wrapper (obj, err);
if (!wrapper)
return NULL;
mstream = g_mime_data_wrapper_get_stream (wrapper);
if (!mstream || g_mime_stream_reset (mstream) != 0) {
g_set_error (err, G_IO_ERROR, G_IO_ERROR_FAILED,
"invalid mime-stream");
return NULL;
}
return mstream;
}
开发者ID:djcb,项目名称:mux,代码行数:33,代码来源:mux-message-part.c
示例3: mu_msg_part_save
gboolean
mu_msg_part_save (MuMsg *msg, MuMsgOptions opts,
const char *fullpath, guint partidx, GError **err)
{
GMimeObject *part;
g_return_val_if_fail (msg, FALSE);
g_return_val_if_fail (fullpath, FALSE);
g_return_val_if_fail (!((opts & MU_MSG_OPTION_OVERWRITE) &&
(opts & MU_MSG_OPTION_USE_EXISTING)), FALSE);
if (!mu_msg_load_msg_file (msg, err))
return FALSE;
part = get_mime_object_at_index (msg, opts, partidx);
if (!GMIME_IS_PART(part) || GMIME_IS_MESSAGE_PART(part)) {
g_set_error (err, MU_ERROR_DOMAIN, MU_ERROR_GMIME,
"unexpected type %s for part %u",
G_OBJECT_TYPE_NAME((GObject*)part),
partidx);
return FALSE;
}
return save_object (part, opts, fullpath, err);
}
开发者ID:otfrom,项目名称:mu,代码行数:25,代码来源:mu-msg-part.c
示例4: g_mime_part_get_content_id
/**
* g_mime_part_get_content_id:
* @mime_part: a #GMimePart object
*
* Gets the content-id of the specified mime part if it exists, or
* %NULL otherwise.
*
* Returns: the content id for the specified mime part.
**/
const char *
g_mime_part_get_content_id (GMimePart *mime_part)
{
g_return_val_if_fail (GMIME_IS_PART (mime_part), NULL);
return g_mime_object_get_content_id (GMIME_OBJECT (mime_part));
}
开发者ID:CMogilko,项目名称:gmime,代码行数:16,代码来源:gmime-part.c
示例5: g_mime_part_set_content_id
/**
* g_mime_part_set_content_id:
* @mime_part: a #GMimePart object
* @content_id: content id
*
* Set the content id for the specified mime part.
**/
void
g_mime_part_set_content_id (GMimePart *mime_part, const char *content_id)
{
g_return_if_fail (GMIME_IS_PART (mime_part));
g_mime_object_set_content_id (GMIME_OBJECT (mime_part), content_id);
}
开发者ID:CMogilko,项目名称:gmime,代码行数:14,代码来源:gmime-part.c
示例6: part_extractor_foreach_callback
static void part_extractor_foreach_callback(GMimeObject *parent, GMimeObject *part, gpointer user_data) {
PartExtractorData *a_data = (PartExtractorData *) user_data;
if (GMIME_IS_MESSAGE_PART(part)) {
if (a_data->recursion_depth < RECURSION_LIMIT) {
GMimeMessage *message = g_mime_message_part_get_message((GMimeMessagePart *) part); // transfer none
if (message)
g_mime_message_foreach(message, part_extractor_foreach_callback, a_data);
} else {
g_printerr("endless recursion detected: %d\r\n", a_data->recursion_depth);
return;
}
} else if (GMIME_IS_MESSAGE_PARTIAL (part)) {
// Save into an array ? Todo: Look into the specs
} else if (GMIME_IS_MULTIPART (part)) {
// Nothing special needed on multipart, let descend further
} else if (GMIME_IS_PART (part)) {
// We are interested only in the part 0 (counting down by same logic)
if (a_data->part_id == 0)
extract_part(part, a_data);
a_data->part_id--;
} else {
g_assert_not_reached();
}
}
开发者ID:swerter,项目名称:gmimex,代码行数:31,代码来源:gmimex.c
示例7: g_mime_part_get_content_location
/**
* g_mime_part_get_content_location:
* @mime_part: a #GMimePart object
*
* Gets the value of the Content-Location header if it exists, or
* %NULL otherwise.
*
* Returns: the content location for the specified mime part.
**/
const char *
g_mime_part_get_content_location (GMimePart *mime_part)
{
g_return_val_if_fail (GMIME_IS_PART (mime_part), NULL);
return mime_part->content_location;
}
开发者ID:CMogilko,项目名称:gmime,代码行数:16,代码来源:gmime-part.c
示例8: g_mime_part_get_content_encoding
/**
* g_mime_part_get_content_encoding:
* @mime_part: a #GMimePart object
*
* Gets the content encoding of the mime part.
*
* Returns: the content encoding for the specified mime part.
**/
GMimeContentEncoding
g_mime_part_get_content_encoding (GMimePart *mime_part)
{
g_return_val_if_fail (GMIME_IS_PART (mime_part), GMIME_CONTENT_ENCODING_DEFAULT);
return mime_part->encoding;
}
开发者ID:CMogilko,项目名称:gmime,代码行数:15,代码来源:gmime-part.c
示例9: g_mime_object_get_content_type
QNetworkReply*
MailNetworkManager::makeReply(const QNetworkRequest& req, GMimeObject* content)
{
auto ctype = g_mime_object_get_content_type(content);
char *mtstr = g_mime_content_type_to_string(ctype);
QString mediaType = QString::fromUtf8(mtstr);
g_free(mtstr);
const char *enc = g_mime_content_type_get_parameter(ctype, "charset");
if (enc != NULL) {
mediaType += "; charset=\"";
mediaType += QString::fromUtf8(enc);
mediaType += "\"";
}
g_return_val_if_fail(GMIME_IS_PART(content), NULL);
GMimeStream *stream = g_mime_stream_mem_new();
GMimeDataWrapper *wrapper = g_mime_part_get_content_object(GMIME_PART(content));
g_mime_data_wrapper_write_to_stream(wrapper, stream);
GByteArray *bytes = g_mime_stream_mem_get_byte_array(GMIME_STREAM_MEM(stream));
QByteArray buffer((const char*) bytes->data, bytes->len);
g_object_unref(stream);
qDebug() <<"making reply of length" <<buffer.size() <<"and type" <<mediaType;
return StaticHTTPReply::ok(req, buffer, mediaType);
}
开发者ID:mdekstrand,项目名称:mailtools,代码行数:28,代码来源:mailnetworkmanager.cpp
示例10: format_part_content_raw
static void
format_part_content_raw (GMimeObject *part)
{
if (! GMIME_IS_PART (part))
return;
GMimeStream *stream_stdout;
GMimeStream *stream_filter = NULL;
GMimeDataWrapper *wrapper;
stream_stdout = g_mime_stream_file_new (stdout);
g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
stream_filter = g_mime_stream_filter_new (stream_stdout);
wrapper = g_mime_part_get_content_object (GMIME_PART (part));
if (wrapper && stream_filter)
g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);
if (stream_filter)
g_object_unref (stream_filter);
if (stream_stdout)
g_object_unref(stream_stdout);
}
开发者ID:dme,项目名称:notmuch,代码行数:26,代码来源:notmuch-show.c
示例11: process_message_callback
static void process_message_callback(GMimeObject *part, gpointer user_data)
{
struct mime_cbinfo *cbinfo = user_data;
cbinfo->count++;
/* We strip off the headers before we get here, so should only see GMIME_IS_PART */
if (GMIME_IS_MESSAGE_PART(part)) {
ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MESSAGE_PART\n");
return;
} else if (GMIME_IS_MESSAGE_PARTIAL(part)) {
ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MESSAGE_PARTIAL\n");
return;
} else if (GMIME_IS_MULTIPART(part)) {
GList *l;
ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MULTIPART, trying to process subparts\n");
l = GMIME_MULTIPART(part)->subparts;
while (l) {
process_message_callback(l->data, cbinfo);
l = l->next;
}
} else if (GMIME_IS_PART(part)) {
const char *filename;
if (ast_strlen_zero(filename = g_mime_part_get_filename(GMIME_PART(part)))) {
ast_debug(1, "Skipping part with no filename\n");
return;
}
post_raw(GMIME_PART(part), cbinfo->post_dir, filename);
} else {
ast_log(LOG_ERROR, "Encountered unknown MIME part. This should never happen!\n");
}
}
开发者ID:n02018222,项目名称:asterisk,代码行数:35,代码来源:res_http_post.c
示例12: g_mime_part_get_content_object
/**
* g_mime_part_get_content_object:
* @mime_part: a #GMimePart object
*
* Gets the internal data-wrapper of the specified mime part, or %NULL
* on error.
*
* Returns: (transfer none): the data-wrapper for the mime part's
* contents.
**/
GMimeDataWrapper *
g_mime_part_get_content_object (GMimePart *mime_part)
{
g_return_val_if_fail (GMIME_IS_PART (mime_part), NULL);
return mime_part->content;
}
开发者ID:CMogilko,项目名称:gmime,代码行数:17,代码来源:gmime-part.c
示例13: collector_foreach_callback
static void collector_foreach_callback(GMimeObject *parent, GMimeObject *part, gpointer user_data) {
g_return_if_fail(user_data != NULL);
PartCollectorData *fdata = (PartCollectorData *) user_data;
if (GMIME_IS_MESSAGE_PART(part)) {
if (fdata->recursion_depth++ < RECURSION_LIMIT) {
GMimeMessage *message = g_mime_message_part_get_message((GMimeMessagePart *) part); // transfer none
if (message)
g_mime_message_foreach(message, collector_foreach_callback, user_data);
} else {
g_printerr("endless recursion detected: %d\r\n", fdata->recursion_depth);
return;
}
} else if (GMIME_IS_MESSAGE_PARTIAL(part)) {
// Save into an array ? Todo: Look into the specs
} else if (GMIME_IS_MULTIPART(part)) {
// Nothing special needed on multipart, let descend further
} else if (GMIME_IS_PART(part)) {
collect_part(part, fdata, GMIME_IS_MULTIPART(parent));
fdata->part_id++;
} else {
g_assert_not_reached();
}
}
开发者ID:swerter,项目名称:gmimex,代码行数:28,代码来源:gmimex.c
示例14: g_mime_part_get_best_content_encoding
/**
* g_mime_part_get_best_content_encoding:
* @mime_part: a #GMimePart object
* @constraint: a #GMimeEncodingConstraint
*
* Calculates the most efficient content encoding for the @mime_part
* given the @constraint.
*
* Returns: the best content encoding for the specified mime part.
**/
GMimeContentEncoding
g_mime_part_get_best_content_encoding (GMimePart *mime_part, GMimeEncodingConstraint constraint)
{
GMimeStream *filtered, *stream;
GMimeContentEncoding encoding;
GMimeFilterBest *best;
GMimeFilter *filter;
g_return_val_if_fail (GMIME_IS_PART (mime_part), GMIME_CONTENT_ENCODING_DEFAULT);
stream = g_mime_stream_null_new ();
filtered = g_mime_stream_filter_new (stream);
g_object_unref (stream);
filter = g_mime_filter_best_new (GMIME_FILTER_BEST_ENCODING);
g_mime_stream_filter_add ((GMimeStreamFilter *) filtered, filter);
best = (GMimeFilterBest *) filter;
g_mime_data_wrapper_write_to_stream (mime_part->content, filtered);
g_mime_stream_flush (filtered);
g_object_unref (filtered);
encoding = g_mime_filter_best_encoding (best, constraint);
g_object_unref (best);
return encoding;
}
开发者ID:CMogilko,项目名称:gmime,代码行数:37,代码来源:gmime-part.c
示例15: accumulate_body
static void
accumulate_body (MuMsg *msg, MuMsgPart *mpart, BodyData *bdata)
{
char *txt;
gboolean err;
/* if it looks like an attachment, skip it */
if (mpart->part_type & MU_MSG_PART_TYPE_ATTACHMENT)
return;
if (!GMIME_IS_PART(mpart->data))
return;
txt = NULL;
err = TRUE;
if (!bdata->want_html &&
(mpart->part_type & MU_MSG_PART_TYPE_TEXT_PLAIN))
txt = mu_msg_mime_part_to_string (
(GMimePart*)mpart->data, &err);
else if (bdata->want_html &&
(mpart->part_type & MU_MSG_PART_TYPE_TEXT_HTML))
txt = mu_msg_mime_part_to_string (
(GMimePart*)mpart->data, &err);
if (!err && txt)
bdata->gstr = g_string_append (bdata->gstr, txt);
g_free (txt);
}
开发者ID:akonring,项目名称:mu,代码行数:29,代码来源:mu-msg.c
示例16: accumulate_text
static void
accumulate_text (MuMsg *msg, MuMsgPart *part, GString **gstrp)
{
if (GMIME_IS_MESSAGE(part->data))
accumulate_text_message (msg, part, gstrp);
else if (GMIME_IS_PART (part->data))
accumulate_text_part (msg, part, gstrp);
}
开发者ID:otfrom,项目名称:mu,代码行数:8,代码来源:mu-msg-part.c
示例17: g_mime_part_set_content_encoding
/**
* g_mime_part_set_content_encoding:
* @mime_part: a #GMimePart object
* @encoding: a #GMimeContentEncoding
*
* Set the content encoding for the specified mime part.
**/
void
g_mime_part_set_content_encoding (GMimePart *mime_part, GMimeContentEncoding encoding)
{
g_return_if_fail (GMIME_IS_PART (mime_part));
mime_part->encoding = encoding;
g_mime_header_list_set (GMIME_OBJECT (mime_part)->headers, "Content-Transfer-Encoding",
g_mime_content_encoding_to_string (encoding));
}
开发者ID:CMogilko,项目名称:gmime,代码行数:16,代码来源:gmime-part.c
示例18: format_part_reply
static void
format_part_reply (mime_node_t *node)
{
int i;
if (node->envelope_file) {
printf ("On %s, %s wrote:\n",
notmuch_message_get_header (node->envelope_file, "date"),
notmuch_message_get_header (node->envelope_file, "from"));
} else if (GMIME_IS_MESSAGE (node->part)) {
GMimeMessage *message = GMIME_MESSAGE (node->part);
InternetAddressList *recipients;
const char *recipients_string;
printf ("> From: %s\n", g_mime_message_get_sender (message));
recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
recipients_string = internet_address_list_to_string (recipients, 0);
if (recipients_string)
printf ("> To: %s\n",
recipients_string);
recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_CC);
recipients_string = internet_address_list_to_string (recipients, 0);
if (recipients_string)
printf ("> Cc: %s\n",
recipients_string);
printf ("> Subject: %s\n", g_mime_message_get_subject (message));
printf ("> Date: %s\n", g_mime_message_get_date_as_string (message));
printf (">\n");
} else if (GMIME_IS_PART (node->part)) {
GMimeContentType *content_type = g_mime_object_get_content_type (node->part);
GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (node->part);
if (g_mime_content_type_is_type (content_type, "application", "pgp-encrypted") ||
g_mime_content_type_is_type (content_type, "application", "pgp-signature")) {
/* Ignore PGP/MIME cruft parts */
} else if (g_mime_content_type_is_type (content_type, "text", "*") &&
!g_mime_content_type_is_type (content_type, "text", "html")) {
GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
show_text_part_content (node->part, stream_stdout, NOTMUCH_SHOW_TEXT_PART_REPLY);
g_object_unref(stream_stdout);
} else if (disposition &&
strcasecmp (g_mime_content_disposition_get_disposition (disposition),
GMIME_DISPOSITION_ATTACHMENT) == 0) {
const char *filename = g_mime_part_get_filename (GMIME_PART (node->part));
printf ("Attachment: %s (%s)\n", filename,
g_mime_content_type_to_string (content_type));
} else {
printf ("Non-text part: %s\n",
g_mime_content_type_to_string (content_type));
}
}
for (i = 0; i < node->nchildren; i++)
format_part_reply (mime_node_child (node, i));
}
开发者ID:avdv,项目名称:notmuch-w32,代码行数:56,代码来源:notmuch-reply.c
示例19: g_mime_part_set_filename
/**
* g_mime_part_set_filename:
* @mime_part: a #GMimePart object
* @filename: the file name
*
* Sets the "filename" parameter on the Content-Disposition and also sets the
* "name" parameter on the Content-Type.
*
* Note: The @filename string should be in UTF-8.
**/
void
g_mime_part_set_filename (GMimePart *mime_part, const char *filename)
{
GMimeObject *object = (GMimeObject *) mime_part;
g_return_if_fail (GMIME_IS_PART (mime_part));
g_mime_object_set_content_disposition_parameter (object, "filename", filename);
g_mime_object_set_content_type_parameter (object, "name", filename);
}
开发者ID:CMogilko,项目名称:gmime,代码行数:20,代码来源:gmime-part.c
示例20: g_mime_part_set_content_object
/**
* g_mime_part_set_content_object:
* @mime_part: a #GMimePart object
* @content: a #GMimeDataWrapper content object
*
* Sets the content object on the mime part.
**/
void
g_mime_part_set_content_object (GMimePart *mime_part, GMimeDataWrapper *content)
{
g_return_if_fail (GMIME_IS_PART (mime_part));
if (mime_part->content == content)
return;
GMIME_PART_GET_CLASS (mime_part)->set_content_object (mime_part, content);
}
开发者ID:CMogilko,项目名称:gmime,代码行数:17,代码来源:gmime-part.c
注:本文中的GMIME_IS_PART函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论