~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/plugins/fts-solr/fts-solr-plugin.c

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2015-05-24 15:01:19 UTC
  • mto: (4.1.53 sid)
  • mto: This revision was merged to the branch mainline in revision 102.
  • Revision ID: package-import@ubuntu.com-20150524150119-hsh6cbr1fqseapga
Tags: upstream-2.2.18
ImportĀ upstreamĀ versionĀ 2.2.18

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
#include "mail-user.h"
7
7
#include "mail-storage-hooks.h"
8
8
#include "solr-connection.h"
 
9
#include "fts-user.h"
9
10
#include "fts-solr-plugin.h"
10
11
 
11
12
#include <stdlib.h>
30
31
                        set->url = p_strdup(user->pool, *tmp + 4);
31
32
                } else if (strcmp(*tmp, "debug") == 0) {
32
33
                        set->debug = TRUE;
 
34
                } else if (strcmp(*tmp, "use_libfts") == 0) {
 
35
                        set->use_libfts = TRUE;
33
36
                } else if (strcmp(*tmp, "break-imap-search") == 0) {
34
37
                        /* for backwards compatibility */
35
38
                } else if (strcmp(*tmp, "default_ns=") == 0) {
47
50
        return 0;
48
51
}
49
52
 
 
53
static void fts_solr_mail_user_deinit(struct mail_user *user)
 
54
{
 
55
        struct fts_solr_user *fuser = FTS_SOLR_USER_CONTEXT(user);
 
56
 
 
57
        fts_mail_user_deinit(user);
 
58
        fuser->module_ctx.super.deinit(user);
 
59
}
 
60
 
50
61
static void fts_solr_mail_user_create(struct mail_user *user, const char *env)
51
62
{
 
63
        struct mail_user_vfuncs *v = user->vlast;
52
64
        struct fts_solr_user *fuser;
 
65
        const char *error;
53
66
 
54
67
        fuser = p_new(user->pool, struct fts_solr_user, 1);
55
68
        if (fts_solr_plugin_init_settings(user, &fuser->set, env) < 0) {
56
69
                /* invalid settings, disabling */
57
70
                return;
58
71
        }
 
72
        if (fuser->set.use_libfts) {
 
73
                if (fts_mail_user_init(user, &error) < 0) {
 
74
                        i_error("fts-solr: %s", error);
 
75
                        return;
 
76
                }
 
77
        }
59
78
 
 
79
        fuser->module_ctx.super = *v;
 
80
        user->vlast = &fuser->module_ctx.super;
 
81
        v->deinit = fts_solr_mail_user_deinit;
60
82
        MODULE_CONTEXT_SET(user, fts_solr_user_module, fuser);
61
83
}
62
84