~ubuntu-branches/ubuntu/saucy/evolution-data-server/saucy

« back to all changes in this revision

Viewing changes to camel/camel-mime-message.c

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-10-08 12:58:16 UTC
  • mfrom: (181.1.7 quantal)
  • Revision ID: package-import@ubuntu.com-20121008125816-i3n76e8c0m64e7xp
Tags: 3.6.0-0ubuntu2
* Fix LP: #1038047 part 1 - Don't abort in e_source_registry_new* when a
  problem occurs connecting to the Dbus service
  - add debian/patches/dont-abort-in-e_source_registry_new.patch
  - update debian/patches/series
* Fix LP: #1038047 part 2 - libedataserver depends on
  evolution-data-server-common to ensure that the GSettings schemas are
  present
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
228
228
        if (mm->from == NULL) {
229
229
                /* FIXME: should we just abort?  Should we make one up? */
230
230
                g_warning ("No from set for message");
231
 
                camel_medium_set_header ((CamelMedium *)mm, "From", "");
 
231
                camel_medium_set_header ((CamelMedium *) mm, "From", "");
232
232
        }
233
 
        if (!camel_medium_get_header ((CamelMedium *)mm, "Date"))
 
233
        if (!camel_medium_get_header ((CamelMedium *) mm, "Date"))
234
234
                camel_mime_message_set_date (mm, CAMEL_MESSAGE_DATE_CURRENT, 0);
235
235
 
236
236
        if (mm->subject == NULL)
241
241
 
242
242
        /* FIXME: "To" header needs to be set explicitly as well ... */
243
243
 
244
 
        if (!camel_medium_get_header ((CamelMedium *)mm, "Mime-Version"))
245
 
                camel_medium_set_header ((CamelMedium *)mm, "Mime-Version", "1.0");
 
244
        if (!camel_medium_get_header ((CamelMedium *) mm, "Mime-Version"))
 
245
                camel_medium_set_header ((CamelMedium *) mm, "Mime-Version", "1.0");
246
246
 
247
247
        /* Chain up to parent's write_to_stream_sync() method. */
248
248
        data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (
439
439
        message->date_offset = offset;
440
440
 
441
441
        datestr = camel_header_format_date (date, offset);
442
 
        CAMEL_MEDIUM_CLASS (camel_mime_message_parent_class)->set_header ((CamelMedium *)message, "Date", datestr);
 
442
        CAMEL_MEDIUM_CLASS (camel_mime_message_parent_class)->set_header ((CamelMedium *) message, "Date", datestr);
443
443
        g_free (datestr);
444
444
}
445
445
 
478
478
        if (msg->date_received == CAMEL_MESSAGE_DATE_CURRENT) {
479
479
                const gchar *received;
480
480
 
481
 
                received = camel_medium_get_header ((CamelMedium *)msg, "received");
 
481
                received = camel_medium_get_header ((CamelMedium *) msg, "received");
482
482
                if (received)
483
483
                        received = strrchr (received, ';');
484
484
                if (received)
663
663
        }
664
664
 
665
665
        if (from == NULL || camel_address_length ((CamelAddress *) from) == 0) {
666
 
                CAMEL_MEDIUM_CLASS(camel_mime_message_parent_class)->remove_header(CAMEL_MEDIUM(msg), "From");
 
666
                CAMEL_MEDIUM_CLASS (camel_mime_message_parent_class)->remove_header (CAMEL_MEDIUM (msg), "From");
667
667
                return;
668
668
        }
669
669
 
670
670
        msg->from = (CamelInternetAddress *) camel_address_new_clone ((CamelAddress *) from);
671
671
        addr = camel_address_encode ((CamelAddress *) msg->from);
672
 
        CAMEL_MEDIUM_CLASS (camel_mime_message_parent_class)->set_header(CAMEL_MEDIUM(msg), "From", addr);
 
672
        CAMEL_MEDIUM_CLASS (camel_mime_message_parent_class)->set_header (CAMEL_MEDIUM (msg), "From", addr);
673
673
        g_free (addr);
674
674
}
675
675
 
898
898
         * not have to read the whole lot into memory - although i have a feeling
899
899
         * it would make things a fair bit simpler to do so ... */
900
900
 
901
 
        d(printf("starting to check part\n"));
 
901
        d (printf ("starting to check part\n"));
902
902
 
903
903
        content = camel_medium_get_content ((CamelMedium *) part);
904
904
        if (content == NULL) {
939
939
        bestenc = camel_mime_filter_bestenc_new (flags);
940
940
        idb = camel_stream_filter_add (
941
941
                CAMEL_STREAM_FILTER (filter), bestenc);
942
 
        d(printf("writing to checking stream\n"));
 
942
        d (printf ("writing to checking stream\n"));
943
943
        camel_data_wrapper_decode_to_stream_sync (content, filter, NULL, NULL);
944
944
        camel_stream_filter_remove (CAMEL_STREAM_FILTER (filter), idb);
945
945
        if (idc != -1) {
951
951
        if (istext && (required & CAMEL_BESTENC_GET_CHARSET) != 0) {
952
952
                charsetin = camel_mime_filter_bestenc_get_best_charset (
953
953
                        CAMEL_MIME_FILTER_BESTENC (bestenc));
954
 
                d(printf("best charset = %s\n", charsetin ? charsetin : "(null)"));
 
954
                d (printf ("best charset = %s\n", charsetin ? charsetin : "(null)"));
955
955
                charset = g_strdup (charsetin);
956
956
 
957
957
                charsetin = camel_content_type_param (content->mime_type, "charset");
961
961
 
962
962
        /* if we have US-ASCII, or we're not doing text, we dont need to bother with the rest */
963
963
        if (istext && charsetin && charset && (required & CAMEL_BESTENC_GET_CHARSET) != 0) {
964
 
                d(printf("have charset, trying conversion/etc\n"));
 
964
                d (printf ("have charset, trying conversion/etc\n"));
965
965
 
966
966
                /* now that 'bestenc' has told us what the best encoding is, we can use that to create
967
967
                 * a charset conversion filter as well, and then re-add the bestenc to filter the
997
997
        g_object_unref (bestenc);
998
998
        g_object_unref (null);
999
999
 
1000
 
        d(printf("done, best encoding = %d\n", encoding));
 
1000
        d (printf ("done, best encoding = %d\n", encoding));
1001
1001
 
1002
1002
        if (charsetp)
1003
1003
                *charsetp = charset;
1038
1038
                                gchar *newct;
1039
1039
 
1040
1040
                                /* FIXME: ick, the part content_type interface needs fixing bigtime */
1041
 
                                camel_content_type_set_param (((CamelDataWrapper *) part)->mime_type, "charset",
1042
 
                                                               charset ? charset : "us-ascii");
 
1041
                                camel_content_type_set_param (
 
1042
                                        ((CamelDataWrapper *) part)->mime_type, "charset",
 
1043
                                        charset ? charset : "us-ascii");
1043
1044
                                newct = camel_content_type_format (((CamelDataWrapper *) part)->mime_type);
1044
1045
                                if (newct) {
1045
 
                                        d(printf("Setting content-type to %s\n", newct));
 
1046
                                        d (printf ("Setting content-type to %s\n", newct));
1046
1047
 
1047
1048
                                        camel_mime_part_set_content_type (part, newct);
1048
1049
                                        g_free (newct);
1170
1171
camel_mime_message_build_mbox_from (CamelMimeMessage *message)
1171
1172
{
1172
1173
        struct _camel_header_raw *header = ((CamelMimePart *) message)->headers;
1173
 
        GString *out = g_string_new("From ");
 
1174
        GString *out = g_string_new ("From ");
1174
1175
        gchar *ret;
1175
1176
        const gchar *tmp;
1176
1177
        time_t thetime;
1211
1212
        thetime = camel_header_decode_date (tmp, &offset);
1212
1213
        thetime += ((offset / 100) * (60 * 60)) + (offset % 100) * 60;
1213
1214
        gmtime_r (&thetime, &tm);
1214
 
        g_string_append_printf (out, " %s %s %2d %02d:%02d:%02d %4d\n",
1215
 
                                tz_days[tm.tm_wday], tz_months[tm.tm_mon],
1216
 
                                tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
1217
 
                                tm.tm_year + 1900);
 
1215
        g_string_append_printf (
 
1216
                out, " %s %s %2d %02d:%02d:%02d %4d\n",
 
1217
                tz_days[tm.tm_wday],
 
1218
                tz_months[tm.tm_mon],
 
1219
                tm.tm_mday,
 
1220
                tm.tm_hour,
 
1221
                tm.tm_min,
 
1222
                tm.tm_sec,
 
1223
                tm.tm_year + 1900);
1218
1224
 
1219
1225
        ret = out->str;
1220
1226
        g_string_free (out, FALSE);
1283
1289
        memset (s, ' ', depth);
1284
1290
        s[depth] = 0;
1285
1291
        /* yes this leaks, so what its only debug stuff */
1286
 
        printf("%sclass: %s\n", s, G_OBJECT_TYPE_NAME (part));
1287
 
        printf("%smime-type: %s\n", s, camel_content_type_format(((CamelDataWrapper *)part)->mime_type));
 
1292
        printf ("%sclass: %s\n", s, G_OBJECT_TYPE_NAME (part));
 
1293
        printf ("%smime-type: %s\n", s, camel_content_type_format (((CamelDataWrapper *) part)->mime_type));
1288
1294
 
1289
1295
        containee = camel_medium_get_content ((CamelMedium *) part);
1290
1296
 
1291
1297
        if (containee == NULL)
1292
1298
                return;
1293
1299
 
1294
 
        printf("%scontent class: %s\n", s, G_OBJECT_TYPE_NAME (containee));
1295
 
        printf("%scontent mime-type: %s\n", s, camel_content_type_format(((CamelDataWrapper *)containee)->mime_type));
 
1300
        printf ("%scontent class: %s\n", s, G_OBJECT_TYPE_NAME (containee));
 
1301
        printf ("%scontent mime-type: %s\n", s, camel_content_type_format (((CamelDataWrapper *) containee)->mime_type));
1296
1302
 
1297
1303
        /* using the object types is more accurate than using the mime/types */
1298
1304
        if (CAMEL_IS_MULTIPART (containee)) {