Changeset 316

Show
Ignore:
Timestamp:
05/15/06 21:35:28
Author:
pvanhoof
Message:

Decoding attachments

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymail-camel/tny-msg-mime-part.c

    r315 r316  
    117117camel_stream_format_text (CamelDataWrapper *dw, CamelStream *stream) 
    118118{ 
     119        /* Stolen from evolution, evil evil me!! moehahah */ 
     120 
    119121        CamelStreamFilter *filter_stream; 
    120122        CamelMimeFilterCharset *filter; 
    121         const char *charset = "UTF-8"; 
     123        const char *charset = "UTF-8"; /* I default to UTF-8, like it or not */ 
    122124        CamelMimeFilterWindows *windows = NULL; 
    123125 
     
    162164        if (windows) 
    163165                camel_object_unref(windows); 
     166 
     167        return; 
    164168} 
    165169 
     
    168172tny_msg_mime_part_decode_to_stream (TnyMsgMimePartIface *self, TnyStreamIface *stream) 
    169173{ 
    170         /* TODO: Add a filter (decoder) here */ 
    171174 
    172175        TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 
     
    193196        } 
    194197 
    195         /* camel_stream_reset (wrapper->stream); 
    196         camel_stream_write_to_stream (wrapper->stream, cstream); */ 
    197  
    198198        if (camel_content_type_is (wrapper->mime_type, "text", "*")) 
    199199                camel_stream_format_text (wrapper, cstream); 
    200200        else 
    201201                camel_data_wrapper_decode_to_stream (wrapper, cstream); 
    202  
    203         /* This should work but doesn't . . . 
    204         camel_data_wrapper_write_to_stream (wrapper, cstream); */ 
    205202 
    206203        camel_object_unref (CAMEL_OBJECT (cstream)); 
  • trunk/libtinymail-gnome-desktop/tny-moz-embed-msg-view.c

    r314 r316  
    216216 
    217217        /* TODO: Add a filter (decoder) here (depends on encoding) */ 
    218  
    219218        tny_msg_mime_part_iface_decode_to_stream (part, TNY_STREAM_IFACE (stream)); 
    220219 
     
    233232        GtkTreeIter iter; 
    234233 
    235         if (G_LIKELY (gtk_tree_model_get_iter(model, &iter, path))) 
     234        if (G_LIKELY (gtk_tree_model_get_iter (model, &iter, path))) 
    236235        { 
    237236                TnyMsgMimePartIface *part; 
  • trunk/libtinymail-gnomevfs/tny-vfs-stream.c

    r212 r316  
    5656{ 
    5757        GnomeVFSHandle *handle; 
     58        gboolean eos; 
    5859}; 
    5960 
     
    198199        if (G_LIKELY (res == GNOME_VFS_OK)) 
    199200        { 
     201                priv->eos = FALSE; 
    200202                return (ssize_t)count; 
    201203 
    202204        } else if (G_LIKELY (res == GNOME_VFS_ERROR_EOF)) 
    203205        { 
    204                 /*TODO: stream->eos = TRUE; Handle this */ 
    205                 return 0
     206                priv->eos = TRUE; 
     207                return (ssize_t)count
    206208        } 
    207209 
     
    225227 
    226228        res = gnome_vfs_write (priv->handle, buffer, n, &count); 
    227  
    228229        if (G_LIKELY (res == GNOME_VFS_OK)) 
    229230                return (ssize_t)count; 
     
    366367        TnyVfsStreamPriv *priv = TNY_VFS_STREAM_GET_PRIVATE (self); 
    367368 
     369        priv->eos = FALSE; 
    368370        priv->handle = NULL; 
    369371 
     
    385387} 
    386388 
     389static gint  
     390tny_vfs_flush (TnyStreamIface *self) 
     391{ 
     392        return 0; 
     393} 
     394 
     395static gboolean  
     396tny_vfs_eos (TnyStreamIface *self) 
     397{ 
     398        TnyVfsStreamPriv *priv = TNY_VFS_STREAM_GET_PRIVATE (self); 
     399 
     400        return priv->eos; 
     401} 
     402 
     403static gint  
     404tny_vfs_reset (TnyStreamIface *self) 
     405{ 
     406        TnyVfsStreamPriv *priv = TNY_VFS_STREAM_GET_PRIVATE (self); 
     407        gint retval = -1; 
     408        GnomeVFSResult res; 
     409 
     410        if (priv->handle == NULL)  
     411        { 
     412                errno = EINVAL; 
     413                return -1; 
     414        } 
     415 
     416        res = gnome_vfs_seek (priv->handle, GNOME_VFS_SEEK_START, 0); 
     417 
     418        if (res != GNOME_VFS_OK) 
     419        { 
     420                tny_vfs_stream_set_errno (res); 
     421                retval = -1; 
     422        } 
     423 
     424        return retval; 
     425} 
     426 
    387427static void 
    388428tny_stream_iface_init (gpointer g_iface, gpointer iface_data) 
    389429{ 
    390430        TnyStreamIfaceClass *klass = (TnyStreamIfaceClass *)g_iface; 
     431 
     432        klass->reset_func = tny_vfs_reset; 
     433        klass->flush_func = tny_vfs_flush; 
     434        klass->eos_func = tny_vfs_eos; 
    391435 
    392436        klass->read_func = tny_vfs_stream_read;