-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathotrng-plugin.c
110 lines (90 loc) · 3.58 KB
/
otrng-plugin.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
* Off-the-Record Messaging plugin for pidgin
* Copyright (C) 2004-2018 Ian Goldberg, Rob Smits,
* Chris Alexander, Willy Lew,
* Nikita Borisov
* <otr@cypherpunks.ca>
* The pidgin-otrng contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "otrng-plugin.h"
#include "dialogs.h"
#include "i18n.h"
#include "ui.h"
#ifdef USING_GTK
/* purple GTK headers */
#include <gtkplugin.h>
#include <gtk-dialog.h>
#include <gtk-ui.h>
static PidginPluginUiInfo ui_info = {otrng_gtk_ui_make_widget};
#define UI_INFO &ui_info
#define PLUGIN_TYPE PIDGIN_PLUGIN_TYPE
#else
#define UI_INFO NULL
#define PLUGIN_TYPE ""
#endif
static PurplePluginInfo otrng_plugin_info = {
PURPLE_PLUGIN_MAGIC,
/* Use the 2.0.x API */
2, /* major version */
0, /* minor version */
PURPLE_PLUGIN_STANDARD, /* type */
PLUGIN_TYPE, /* ui_requirement */ // perhaps we cannot have ui?
0, /* flags */
NULL, /* dependencies */
PURPLE_PRIORITY_DEFAULT, /* priority */
"otrng", /* id */ // TODO: this should change:
// check: https://developer.pidgin.im/wiki/CHowTo/ChoosingPluginIds
NULL, /* name */
PIDGIN_OTR_VERSION, /* version */
NULL, /* summary */
NULL, /* description */
/* author */
"Ian Goldberg, Rob Smits,\n"
"\t\t\tChris Alexander, Willy Lew, Lisa Du,\n"
"\t\t\tNikita Borisov <otr@cypherpunks.ca>",
"https://otr.cypherpunks.ca/", /* homepage */
otrng_plugin_load, /* load */
otrng_plugin_unload, /* unload */
NULL, /* destroy */
UI_INFO, /* ui_info */
NULL, /* extra_info */
NULL, /* prefs_info */ // maybe this?
NULL /* actions */
};
static void __otrng_init_plugin(PurplePlugin *plugin) {
/* Set up the UI ops */
#ifdef USING_GTK
otrng_ui_set_ui_ops(otrng_gtk_ui_get_ui_ops());
otrng_dialog_set_ui_ops(otrng_gtk_dialog_get_ui_ops());
#endif
#ifndef WIN32
/* Make key generation use /dev/urandom instead of /dev/random */
gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0);
#endif
/* Initialize the OTR library */
OTRNG_INIT;
#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
#endif
otrng_plugin_info.name = _("Off-the-Record Messaging nextgen");
otrng_plugin_info.summary = _("Provides private and secure conversations");
otrng_plugin_info.description =
_("Preserves the privacy of IM communications "
"by providing encryption, authentication, "
"deniability, and perfect forward secrecy.");
}
PURPLE_INIT_PLUGIN(otrng, __otrng_init_plugin, otrng_plugin_info)