-
Notifications
You must be signed in to change notification settings - Fork 0
/
hide_chat.c
112 lines (89 loc) · 3.41 KB
/
hide_chat.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
111
112
/*
* Pidgin Hide Chat on Join
* Copyright (C) 2010-2017 Konrad Gräfe <konradgraefe@aol.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* 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 02111-1301, USA.
*/
#include "config.h"
#include "internal.h"
#ifndef PURPLE_PLUGINS
#define PURPLE_PLUGINS
#endif
#include <plugin.h>
#include <version.h>
#include <gtkdebug.h>
#include <util.h>
#include "conversation_handler.h"
#include "context_menu.h"
PurplePlugin *plugin;
static gboolean plugin_load(PurplePlugin *_plugin) {
plugin = _plugin;
context_menu_init(plugin);
conversation_handler_init(plugin);
info("Plugin loaded.\n");
return TRUE;
}
static gboolean plugin_unload(PurplePlugin *plugin) {
context_menu_uninit(plugin);
conversation_handler_uninit(plugin);
info("Plugin unloaded.\n");
return TRUE;
}
static PurplePluginInfo info = {
PURPLE_PLUGIN_MAGIC,
PURPLE_MAJOR_VERSION,
PURPLE_MINOR_VERSION,
PURPLE_PLUGIN_STANDARD, /**< type */
NULL, /**< ui_requirement */
0, /**< flags */
NULL, /**< dependencies */
PURPLE_PRIORITY_DEFAULT, /**< priority */
PLUGIN_ID, /**< id */
NULL, /**< name */
PLUGIN_VERSION, /**< version */
NULL, /** summary */
NULL, /** description */
PLUGIN_AUTHOR, /**< author */
PLUGIN_WEBSITE, /**< homepage */
plugin_load, /**< load */
plugin_unload, /**< unload */
NULL, /**< destroy */
NULL, /**< ui_info */
NULL, /**< extra_info */
NULL, /**< prefs_info */
NULL, /**< actions */
/* padding */
NULL,
NULL,
NULL,
NULL
};
static void init_plugin(PurplePlugin *plugin) {
#ifdef ENABLE_NLS
const char *str = "Hide Chat on Join";
gchar *plugins_locale_dir;
plugins_locale_dir = g_build_filename(purple_user_dir(), "locale", NULL);
bindtextdomain(GETTEXT_PACKAGE, plugins_locale_dir);
if(str == _(str)) {
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
}
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
g_free(plugins_locale_dir);
#endif /* ENABLE_NLS */
info.name = _("Hide Chat on Join");
info.summary = _("This plugin enables you to hide some chats while auto-joining them.");
info.description = _("This plugin adds an entry in the context menu of every channel you have in your buddy list to allow you to hide the chat window when you join the channel. (This is usefull when you have a huge amount of channels in your buddy list and don't want to have all of these poping up each time you start Pidgin.)");
}
PURPLE_INIT_PLUGIN(plugin, init_plugin, info)