File: listhandler.c

package info (click to toggle)
purple-plugin-pack 2.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,984 kB
  • sloc: ansic: 18,412; xml: 12; makefile: 5
file content (130 lines) | stat: -rw-r--r-- 3,890 bytes parent folder | download | duplicates (6)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
 * Purple Plugin Pack
 * Copyright (C) 2003-2008
 * See ../AUTHORS for a list of all authors
 *
 * listhandler: Provides importing, exporting, and copying functions
 * 				for accounts' buddy lists.
 *
 * 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 "listhandler.h"
#include "aim_blt_files.h"
#include "alias_xml_files.h"
#include "gen_xml_files.h"
#include "purple_blist_xml.h"
#include "migrate.h"

PurplePlugin *listhandler = NULL; /* the request api prefers this for a plugin */

static GList * /* libpurple's picky and wants a GList of actions for the UI menu */
listhandler_actions(PurplePlugin *plugin, gpointer context)
{
	GList *list = NULL;
	PurplePluginAction *action = NULL;

	action = purple_plugin_action_new(_("Copy Buddies From One Account to Another"),
									lh_migrate_action_cb);
	list = g_list_append(list, action);

	action = purple_plugin_action_new(_("Import Alias List File"),
									lh_alist_import_action_cb);
	list = g_list_append(list, action);

	action = purple_plugin_action_new(_("Import AIM Buddy List File (.blt)"),
									lh_aim_import_action_cb);
	list = g_list_append(list, action);

	action = purple_plugin_action_new(_("Import Generic Buddy List File (.xml)"),
									lh_generic_import_action_cb);
	list = g_list_append(list, action);

	action = purple_plugin_action_new(_("Import A blist.xml From libpurple"),
									lh_pbx_import_action_cb);
	list = g_list_append(list, action);

	action = purple_plugin_action_new(_("Export AIM Buddy List File"),
									lh_aim_export_action_cb);
	list = g_list_append(list, action);

	action = purple_plugin_action_new(_("Export Alias List File"),
									lh_alist_export_action_cb);
	list = g_list_append(list, action);

	action = purple_plugin_action_new(_("Export Generic Buddy List File"),
									lh_generic_export_action_cb);
	list = g_list_append(list, action);

	purple_debug_info("listhandler", "Action list created\n");

	return list;
}

static PurplePluginInfo listhandler_info =
{
	PURPLE_PLUGIN_MAGIC, /* abracadabra */
	PURPLE_MAJOR_VERSION,
	PURPLE_MINOR_VERSION,
	PURPLE_PLUGIN_STANDARD,
	NULL,
	0,
	NULL,
	PURPLE_PRIORITY_DEFAULT,
	"core-plugin_pack-listhandler",
	NULL,
	PP_VERSION,
	NULL,
	NULL,
	"John Bailey <rekkanoryo@rekkanoryo.org>",
	PP_WEBSITE,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	listhandler_actions,
	NULL,
	NULL,
	NULL,
	NULL
};

static void /* purple will call this to initialize the plugin */
init_plugin(PurplePlugin *plugin)
{
#ifdef ENABLE_NLS
	bindtextdomain(GETTEXT_PACKAGE, PP_LOCALEDIR);
	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
#endif /* ENABLE_NLS */

	listhandler_info.name = _("List Handler");
	listhandler_info.summary =
					_("Provides numerous user-requested list-handling "
					"capabilities.");
	listhandler_info.description =
					_("Provides numerous user-requested list-handling "
					"capabilities, such as importing and exporting of AIM "
					".blt files and generic protocol-agnostic XML .blist "
					"files, as well as direct copying of buddies from one "
					"account to another.");

	listhandler = plugin; /* handle needed for request API file selector */

	return;
}

PURPLE_INIT_PLUGIN(listhandler, init_plugin, listhandler_info)