static void
init_plugin(PurplePlugin *plugin)
{
	notify_plus = plugin;

	#if ENABLE_NLS
		bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
		bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
	#endif

	info.summary = _("Displays popups via libnotify.");
	info.description = _("Displays popups via libnotify.");
	info.dependencies = g_list_prepend(info.dependencies, (gpointer) purple_events_get_plugin_id());

	gint timeout = -1;

	if ( purple_prefs_exists("/plugins/gtk/libnotify+") )
	{
		timeout = purple_prefs_get_int("/plugins/gtk/libnotify+/expire-timeout");
		purple_prefs_remove("/plugins/gtk/libnotify+");
	}

	if ( purple_prefs_exists("/plugins/core/libnotify+/new-msg") )
	{
		purple_prefs_remove("/plugins/core/libnotify+/new-msg");
		purple_prefs_remove("/plugins/core/libnotify+/signed-on");
		purple_prefs_remove("/plugins/core/libnotify+/signed-off");
		purple_prefs_remove("/plugins/core/libnotify+/away");
		purple_prefs_remove("/plugins/core/libnotify+/idle");
		purple_prefs_remove("/plugins/core/libnotify+/back");
		purple_prefs_remove("/plugins/core/libnotify+/status-message");
		purple_prefs_remove("/plugins/core/libnotify+/blocked");
		purple_prefs_remove("/plugins/core/libnotify+/new-conv-only");
		purple_prefs_remove("/plugins/core/libnotify+/only-available");
		purple_prefs_remove("/plugins/core/libnotify+/stack-notifications");
	}

	purple_prefs_add_none("/plugins/core/libnotify+");
	purple_prefs_add_int("/plugins/core/libnotify+/expire-timeout", timeout);
	purple_prefs_add_int("/plugins/core/libnotify+/overlay-scale", 50);
	purple_prefs_add_bool("/plugins/core/libnotify+/no-transcient", FALSE);
}
Exemple #2
0
static void
_purple_eventc_init(PurplePlugin *plugin)
{
#if ENABLE_NLS
    bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
#endif /* ENABLE_NLS */

    _purple_eventc_info.name = _("Client for eventd");
    _purple_eventc_info.summary = _("Propagate events to eventd");
    _purple_eventc_info.description = _("Use eventd to inform the user of events");

    _purple_eventc_info.dependencies = g_list_prepend(_purple_eventc_info.dependencies, (gpointer) purple_events_get_plugin_id());

    purple_prefs_add_none("/plugins/core/eventc");

    purple_prefs_add_none("/plugins/core/eventc/connection");
    purple_prefs_add_string("/plugins/core/eventc/connection/uri", "");
    purple_prefs_add_int("/plugins/core/eventc/connection/max-tries", 3);
    purple_prefs_add_int("/plugins/core/eventc/connection/retry-delay", 10);

    purple_prefs_add_none("/plugins/core/eventc/restrictions");
    purple_prefs_add_bool("/plugins/core/eventc/restrictions/no-buddy-icon", FALSE);
    purple_prefs_add_bool("/plugins/core/eventc/restrictions/no-protocol-icon", FALSE);
}
static gboolean
plugin_unload(PurplePlugin *plugin)
{
	gpointer handle;

	handle = purple_plugins_find_with_id(purple_events_get_plugin_id());
	g_return_val_if_fail(handle != NULL, FALSE);

	purple_signal_disconnect(
		handle, "user_presence-online", plugin,
		(PurpleCallback)_purple_notify_plus_signed_on
	);
	purple_signal_disconnect(
		handle, "user_presence-offline", plugin,
		(PurpleCallback)_purple_notify_plus_signed_off
	);
	purple_signal_disconnect(
		handle, "user_presence-away", plugin,
		(PurpleCallback)_purple_notify_plus_away
	);
	purple_signal_disconnect(
		handle, "user_presence-back", plugin,
		(PurpleCallback)_purple_notify_plus_back
	);
	purple_signal_disconnect(
		handle, "user_presence-idle", plugin,
		(PurpleCallback)_purple_notify_plus_idle
	);
	purple_signal_disconnect(
		handle, "user_presence-idle-back", plugin,
		(PurpleCallback)_purple_notify_plus_idle_back
	);
	purple_signal_disconnect(
		handle, "user_presence-message", plugin,
		(PurpleCallback)_purple_notify_plus_status
	);

	purple_signal_disconnect(
		handle, "user_im-received", plugin,
		(PurpleCallback)_purple_notify_plus_im_message
	);
	purple_signal_disconnect(
		handle, "user_im-highlight", plugin,
		(PurpleCallback)_purple_notify_plus_im_highlight
	);
	purple_signal_disconnect(
		handle, "user_chat-received", plugin,
		(PurpleCallback)_purple_notify_plus_chat_message
	);
	purple_signal_disconnect(
		handle, "user_chat-highlight", plugin,
		(PurpleCallback)_purple_notify_plus_chat_highlight
	);

	purple_signal_disconnect(
		handle, "user_email-arrived", plugin,
		(PurpleCallback)_purple_notify_plus_email
	);

	notify_uninit();

	return TRUE;
}
static gboolean
plugin_load(PurplePlugin *plugin)
{
	if ( ( ! notify_is_initted() ) && ( ! notify_init("libpurple") ) )
	{
		purple_debug_error(PACKAGE_NAME, "libnotify not running!\n");
		return FALSE;
	}
	notify_plus_adapt_to_server_capabilities();

	gpointer handle;

	handle = purple_plugins_find_with_id(purple_events_get_plugin_id());
	g_return_val_if_fail(handle != NULL, FALSE);

	purple_signal_connect(
		handle, "user_presence-online", plugin,
		(PurpleCallback)_purple_notify_plus_signed_on, plugin
	);
	purple_signal_connect(
		handle, "user_presence-offline", plugin,
		(PurpleCallback)_purple_notify_plus_signed_off, plugin
	);
	purple_signal_connect(
		handle, "user_presence-away", plugin,
		(PurpleCallback)_purple_notify_plus_away, plugin
	);
	purple_signal_connect(
		handle, "user_presence-back", plugin,
		(PurpleCallback)_purple_notify_plus_back, plugin
	);
	purple_signal_connect(
		handle, "user_presence-idle", plugin,
		(PurpleCallback)_purple_notify_plus_idle, plugin
	);
	purple_signal_connect(
		handle, "user_presence-idle-back", plugin,
		(PurpleCallback)_purple_notify_plus_idle_back, plugin
	);
	purple_signal_connect(
		handle, "user_presence-message", plugin,
		(PurpleCallback)_purple_notify_plus_status, plugin
	);

	purple_signal_connect(
		handle, "user_im-received", plugin,
		(PurpleCallback)_purple_notify_plus_im_message, plugin
	);
	purple_signal_connect(
		handle, "user_im-highlight", plugin,
		(PurpleCallback)_purple_notify_plus_im_highlight, plugin
	);
	purple_signal_connect(
		handle, "user_chat-received", plugin,
		(PurpleCallback)_purple_notify_plus_chat_message, plugin
	);
	purple_signal_connect(
		handle, "user_chat-highlight", plugin,
		(PurpleCallback)_purple_notify_plus_chat_highlight, plugin
	);

	purple_signal_connect(
		handle, "user_email-arrived", plugin,
		(PurpleCallback)_purple_notify_plus_email, plugin
	);

	return TRUE;
}