示例#1
0
void* xchat_plugingui_add(xchat_plugin *ph, const char *filename,
							const char *name, const char *desc,
							const char *version, char *reserved)
{
#ifdef USE_PLUGIN
	ph = plugin_list_add(nullptr, strdup(filename), strdup(name), strdup(desc),
								strdup(version), nullptr, nullptr, TRUE, TRUE);
	fe_pluginlist_update();
#endif

	return ph;
}
示例#2
0
void
plugin_add (session *sess, char *filename, void *handle, void *init_func,
				void *deinit_func, char *arg, int fake)
{
	hexchat_plugin *pl;
	char *file;

	file = g_strdup (filename);

	pl = plugin_list_add (sess, file, file, NULL, NULL, handle, deinit_func,
								 fake, FALSE);

	if (!fake)
	{
		/* win32 uses these because it doesn't have --export-dynamic! */
		pl->hexchat_hook_command = hexchat_hook_command;
		pl->hexchat_hook_server = hexchat_hook_server;
		pl->hexchat_hook_print = hexchat_hook_print;
		pl->hexchat_hook_timer = hexchat_hook_timer;
		pl->hexchat_hook_fd = hexchat_hook_fd;
		pl->hexchat_unhook = hexchat_unhook;
		pl->hexchat_print = hexchat_print;
		pl->hexchat_printf = hexchat_printf;
		pl->hexchat_command = hexchat_command;
		pl->hexchat_commandf = hexchat_commandf;
		pl->hexchat_nickcmp = hexchat_nickcmp;
		pl->hexchat_set_context = hexchat_set_context;
		pl->hexchat_find_context = hexchat_find_context;
		pl->hexchat_get_context = hexchat_get_context;
		pl->hexchat_get_info = hexchat_get_info;
		pl->hexchat_get_prefs = hexchat_get_prefs;
		pl->hexchat_list_get = hexchat_list_get;
		pl->hexchat_list_free = hexchat_list_free;
		pl->hexchat_list_fields = hexchat_list_fields;
		pl->hexchat_list_str = hexchat_list_str;
		pl->hexchat_list_next = hexchat_list_next;
		pl->hexchat_list_int = hexchat_list_int;
		pl->hexchat_plugingui_add = hexchat_plugingui_add;
		pl->hexchat_plugingui_remove = hexchat_plugingui_remove;
		pl->hexchat_emit_print = hexchat_emit_print;
#ifdef WIN32
		pl->hexchat_read_fd = (void *) hexchat_read_fd;
#else
		pl->hexchat_read_fd = hexchat_dummy;
#endif
		pl->hexchat_list_time = hexchat_list_time;
		pl->hexchat_gettext = hexchat_gettext;
		pl->hexchat_send_modes = hexchat_send_modes;
		pl->hexchat_strip = hexchat_strip;
		pl->hexchat_free = hexchat_free;
		pl->hexchat_pluginpref_set_str = hexchat_pluginpref_set_str;
		pl->hexchat_pluginpref_get_str = hexchat_pluginpref_get_str;
		pl->hexchat_pluginpref_set_int = hexchat_pluginpref_set_int;
		pl->hexchat_pluginpref_get_int = hexchat_pluginpref_get_int;
		pl->hexchat_pluginpref_delete = hexchat_pluginpref_delete;
		pl->hexchat_pluginpref_list = hexchat_pluginpref_list;
		pl->hexchat_hook_server_attrs = hexchat_hook_server_attrs;
		pl->hexchat_hook_print_attrs = hexchat_hook_print_attrs;
		pl->hexchat_emit_print_attrs = hexchat_emit_print_attrs;
		pl->hexchat_event_attrs_create = hexchat_event_attrs_create;
		pl->hexchat_event_attrs_free = hexchat_event_attrs_free;

		/* run hexchat_plugin_init, if it returns 0, close the plugin */
		if (((hexchat_init_func *)init_func) (pl, &pl->name, &pl->desc, &pl->version, arg) == 0)
		{
			plugin_free (pl, FALSE, FALSE);
			return;
		}
	}

#ifdef USE_PLUGIN
	fe_pluginlist_update ();
#endif
}
示例#3
0
文件: plugin.c 项目: n2i/xvnkb
void
plugin_add (session *sess, char *filename, void *handle, void *init_func,
				void *deinit_func, char *arg, int fake)
{
	xchat_plugin *pl;
	char *file;

	file = NULL;
	if (filename)
		file = strdup (filename);

	pl = plugin_list_add (sess, file, file, NULL, NULL, handle, deinit_func,
								 fake, FALSE);

	if (!fake)
	{
		/* win32 uses these because it doesn't have --export-dynamic! */
		pl->xchat_hook_command = xchat_hook_command;
		pl->xchat_hook_server = xchat_hook_server;
		pl->xchat_hook_print = xchat_hook_print;
		pl->xchat_hook_timer = xchat_hook_timer;
		pl->xchat_hook_fd = xchat_hook_fd;
		pl->xchat_unhook = xchat_unhook;
		pl->xchat_print = xchat_print;
		pl->xchat_printf = xchat_printf;
		pl->xchat_command = xchat_command;
		pl->xchat_commandf = xchat_commandf;
		pl->xchat_nickcmp = xchat_nickcmp;
		pl->xchat_set_context = xchat_set_context;
		pl->xchat_find_context = xchat_find_context;
		pl->xchat_get_context = xchat_get_context;
		pl->xchat_get_info = xchat_get_info;
		pl->xchat_get_prefs = xchat_get_prefs;
		pl->xchat_list_get = xchat_list_get;
		pl->xchat_list_free = xchat_list_free;
		pl->xchat_list_fields = xchat_list_fields;
		pl->xchat_list_str = xchat_list_str;
		pl->xchat_list_next = xchat_list_next;
		pl->xchat_list_int = xchat_list_int;
		pl->xchat_plugingui_add = xchat_plugingui_add;
		pl->xchat_plugingui_remove = xchat_plugingui_remove;
		pl->xchat_emit_print = xchat_emit_print;
		pl->xchat_read_fd = (void *) xchat_read_fd;
		pl->xchat_list_time = xchat_list_time;
		pl->xchat_gettext = xchat_gettext;
		pl->xchat_send_modes = xchat_send_modes;
		pl->xchat_strip = xchat_strip;
		pl->xchat_free = xchat_free;

		/* incase new plugins are loaded on older xchat */
		pl->xchat_dummy4 = xchat_dummy;
		pl->xchat_dummy3 = xchat_dummy;
		pl->xchat_dummy2 = xchat_dummy;
		pl->xchat_dummy1 = xchat_dummy;

		/* run xchat_plugin_init, if it returns 0, close the plugin */
		if (((xchat_init_func *)init_func) (pl, &pl->name, &pl->desc, &pl->version, arg) == 0)
		{
			plugin_free (pl, FALSE, FALSE);
			return;
		}
	}

#ifdef USE_PLUGIN
	fe_pluginlist_update ();
#endif
}