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

« back to all changes in this revision

Viewing changes to src/doveadm/doveadm-print.c

  • 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
 
/* Copyright (c) 2010-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2010-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "array.h"
14
14
 
15
15
struct doveadm_print_context {
16
16
        pool_t pool;
17
 
        ARRAY_DEFINE(headers, struct doveadm_print_header_context);
 
17
        ARRAY(struct doveadm_print_header_context) headers;
18
18
        const struct doveadm_print_vfuncs *v;
19
19
 
20
20
        unsigned int header_idx;
 
21
        bool print_stream_open;
21
22
};
22
23
 
23
24
static struct doveadm_print_context *ctx;
52
53
        doveadm_print_header(key_title, key_title, 0);
53
54
}
54
55
 
55
 
void doveadm_print(const char *value)
 
56
static void doveadm_print_sticky_headers(void)
56
57
{
57
58
        const struct doveadm_print_header_context *headers;
58
59
        unsigned int count;
59
60
 
60
61
        headers = array_get(&ctx->headers, &count);
 
62
        i_assert(count > 0);
61
63
        for (;;) {
62
64
                if (ctx->header_idx == count)
63
65
                        ctx->header_idx = 0;
68
70
                        break;
69
71
                }
70
72
        }
71
 
 
 
73
}
 
74
 
 
75
void doveadm_print(const char *value)
 
76
{
 
77
        i_assert(!ctx->print_stream_open);
 
78
 
 
79
        doveadm_print_sticky_headers();
72
80
        ctx->v->print(value);
73
81
        ctx->header_idx++;
74
82
}
82
90
 
83
91
void doveadm_print_stream(const void *value, size_t size)
84
92
{
 
93
        if (!ctx->print_stream_open) {
 
94
                doveadm_print_sticky_headers();
 
95
                ctx->print_stream_open = TRUE;
 
96
        }
85
97
        ctx->v->print_stream(value, size);
86
 
        if (size == 0)
 
98
        if (size == 0) {
87
99
                ctx->header_idx++;
 
100
                ctx->print_stream_open = FALSE;
 
101
        }
88
102
}
89
103
 
90
104
void doveadm_print_sticky(const char *key, const char *value)