~ubuntu-branches/debian/sid/claws-mail/sid

« back to all changes in this revision

Viewing changes to src/plugins/managesieve/sieve_plugin.c

  • Committer: Package Import Robot
  • Author(s): Ricardo Mones
  • Date: 2015-08-18 16:37:25 UTC
  • mfrom: (1.3.7)
  • Revision ID: package-import@ubuntu.com-20150818163725-1it32n9mzqkwy2ef
Tags: 3.12.0-1
* New upstream release:
- 'cannot reorganize mailboxes' (Closes: #777208)
- 'dropdown menu bar has disappeared…'(Closes: #778886)
- 'depends on plugins libraries'  (Closes: #779824)
- 'new upstream version (3.12.0)…' (Closes: #793665)
* 14CVE_2010_5109.patch, 15fix_crash_open_folder.patch,
  13desktop_file_categories.patch
- Remove patches applied upstream
* debian/control, debian/copyright, debian/claws-mail-managesieve*
- Add managesieve plugin (new in this release)
* debian/rules
- Set perl-plugin manpage release version automatically
* 12fix_manpage_header.patch
- Update patch to cope with upstream changes
* debian/control, debian/watch
- Update VCS-* and watch URLs (thanks Julian Wollrath)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 
3
 * Copyright (C) 1999-2015 the Claws Mail Team
 
4
 * Copyright (C) 2014-2015 Charles Lehner
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 3 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 
18
 * 
 
19
 */
 
20
 
 
21
#include <glib.h>
 
22
#include <glib/gi18n.h>
 
23
 
 
24
#include "version.h"
 
25
#include "claws.h"
 
26
#include "plugin.h"
 
27
#include "utils.h"
 
28
#include "hooks.h"
 
29
#include "menu.h"
 
30
#include "mainwindow.h"
 
31
#include "log.h"
 
32
#include "sieve_prefs.h"
 
33
#include "sieve_manager.h"
 
34
 
 
35
#define PLUGIN_NAME (_("ManageSieve"))
 
36
 
 
37
static gint main_menu_id = 0;
 
38
 
 
39
static void manage_cb(GtkAction *action, gpointer data) {
 
40
        sieve_manager_show();
 
41
}
 
42
 
 
43
static GtkActionEntry sieve_main_menu[] = {{
 
44
        "Tools/ManageSieveFilters",
 
45
        NULL, N_("Manage Sieve Filters..."), NULL, NULL, G_CALLBACK(manage_cb)
 
46
}};
 
47
 
 
48
/**
 
49
 * Initialize plugin.
 
50
 *
 
51
 * @param error  For storing the returned error message.
 
52
 *
 
53
 * @return 0 if initialization succeeds, -1 on failure.
 
54
 */
 
55
gint plugin_init(gchar **error)
 
56
{
 
57
        MainWindow *mainwin = mainwindow_get_mainwindow();
 
58
 
 
59
        if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72),
 
60
                                VERSION_NUMERIC, PLUGIN_NAME, error))
 
61
                return -1;
 
62
 
 
63
        gtk_action_group_add_actions(mainwin->action_group, sieve_main_menu, 1,
 
64
                        (gpointer)mainwin);
 
65
        MENUITEM_ADDUI_ID_MANAGER(mainwin->ui_manager,
 
66
                        "/Menu/Tools", "ManageSieveFilters", "Tools/ManageSieveFilters",
 
67
                        GTK_UI_MANAGER_MENUITEM, main_menu_id)
 
68
 
 
69
        sieve_prefs_init();
 
70
 
 
71
        debug_print("ManageSieve plugin loaded\n");
 
72
 
 
73
        return 0;
 
74
}
 
75
 
 
76
/**
 
77
 * Destructor for the plugin.
 
78
 * Unregister callback functions and free stuff.
 
79
 *
 
80
 * @return Always TRUE.
 
81
 */
 
82
gboolean plugin_done(void)
 
83
{
 
84
        MainWindow *mainwin = mainwindow_get_mainwindow();
 
85
 
 
86
        sieve_prefs_done();
 
87
        sieve_sessions_close();
 
88
 
 
89
        if (mainwin)
 
90
                MENUITEM_REMUI_MANAGER(mainwin->ui_manager,
 
91
                                mainwin->action_group,
 
92
                                "Tools/ManageSieveFilters", main_menu_id);
 
93
 
 
94
        debug_print("ManageSieve plugin unloaded\n");
 
95
 
 
96
        return TRUE;
 
97
}
 
98
 
 
99
const gchar *plugin_name(void)
 
100
{
 
101
        return PLUGIN_NAME;
 
102
}
 
103
 
 
104
/**
 
105
 * Get the description of the plugin.
 
106
 *
 
107
 * @return The plugin's description, maybe translated.
 
108
 */
 
109
const gchar *plugin_desc(void)
 
110
{
 
111
        return _("Manage sieve filters on a server using the ManageSieve protocol.");
 
112
}
 
113
 
 
114
/**
 
115
 * Get the kind of plugin.
 
116
 *
 
117
 * @return The "GTK2" constant.
 
118
 */
 
119
const gchar *plugin_type(void)
 
120
{
 
121
        return "GTK2";
 
122
}
 
123
/**
 
124
 * Get the license acronym the plugin is released under.
 
125
 *
 
126
 * @return The "GPL3+" constant.
 
127
 */
 
128
const gchar *plugin_licence(void)
 
129
{
 
130
        return "GPL3+";
 
131
}
 
132
 
 
133
/**
 
134
 * Get the version of the plugin.
 
135
 *
 
136
 * @return The current version string.
 
137
 */
 
138
const gchar *plugin_version(void)
 
139
{
 
140
        return VERSION;
 
141
}
 
142
 
 
143
/**
 
144
 * Get the features implemented by the plugin.
 
145
 *
 
146
 * @return A constant PluginFeature structure with the features.
 
147
 */
 
148
struct PluginFeature *plugin_provides(void)
 
149
{
 
150
        static struct PluginFeature features[] =
 
151
                { {PLUGIN_UTILITY, N_("ManageSieve")},
 
152
                  {PLUGIN_NOTHING, NULL}};
 
153
 
 
154
        return features;
 
155
}