~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/lib-mail/istream-attachment-extractor.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef ISTREAM_ATTACHMENT_H
 
2
#define ISTREAM_ATTACHMENT_H
 
3
 
 
4
struct istream_attachment_header {
 
5
        struct message_part *part;
 
6
        const char *content_type, *content_disposition;
 
7
};
 
8
 
 
9
struct istream_attachment_info {
 
10
        const char *hash;
 
11
        /* offset within input stream where the attachment starts */
 
12
        uoff_t start_offset;
 
13
        /* original (base64-encoded) size of the attachment */
 
14
        uoff_t encoded_size;
 
15
 
 
16
        unsigned int base64_blocks_per_line;
 
17
        bool base64_have_crlf;
 
18
 
 
19
        const struct message_part *part;
 
20
};
 
21
 
 
22
struct istream_attachment_settings {
 
23
        /* Minimum size of of a MIME part to be saved separately. */
 
24
        uoff_t min_size;
 
25
        /* Format to use when calculating attachment's hash. */
 
26
        struct hash_format *hash_format;
 
27
        /* Set this to TRUE if parent stream can be read from as long as
 
28
           wanted. This is useful when parsing attachments, which the extractor
 
29
           hides from read() output, so they would return a lot of 0.
 
30
           On the other hand if you have a tee-istream, it's not a good idea
 
31
           to let it get to "buffer full" state. */
 
32
        bool drain_parent_input;
 
33
 
 
34
        /* Returns TRUE if message part is wanted to be stored as separate
 
35
           attachment. If NULL, assume we want the attachment. */
 
36
        bool (*want_attachment)(const struct istream_attachment_header *hdr,
 
37
                                void *context);
 
38
        /* Create a temporary file. */
 
39
        int (*open_temp_fd)(void *context);
 
40
        /* Create output stream for attachment */
 
41
        int (*open_attachment_ostream)(struct istream_attachment_info *info,
 
42
                                       struct ostream **output_r,
 
43
                                       const char **error_r, void *context);
 
44
        /* Finish output stream */
 
45
        int (*close_attachment_ostream)(struct ostream *output, bool success,
 
46
                                        const char **error_r, void *context);
 
47
};
 
48
 
 
49
struct istream *
 
50
i_stream_create_attachment_extractor(struct istream *input,
 
51
                                     struct istream_attachment_settings *set,
 
52
                                     void *context) ATTR_NULL(3);
 
53
 
 
54
/* Returns TRUE if the last read returned 0 only because
 
55
   drain_parent_input=FALSE and we didn't have anything to return, but
 
56
   retrying a read from parent stream could give something the next time. */
 
57
bool i_stream_attachment_extractor_can_retry(struct istream *input);
 
58
 
 
59
#endif