gint plugin_init(gchar **error)
{
  /* Version check */
  if(!check_plugin_version(MAKE_NUMERIC_VERSION(3,9,3,0),
                           VERSION_NUMERIC, "Gnome", error))
    return -1;

  hook_address_completion = hooks_register_hook(ADDDRESS_COMPLETION_BUILD_ADDRESS_LIST_HOOKLIST,
                                                my_address_completion_build_list_hook, NULL);

  if(hook_address_completion == (guint) -1) {
    *error = g_strdup("Failed to register address completion hook in the Gnome plugin");
    return -1;
  }

  hook_password = hooks_register_hook(PASSWORD_GET_HOOKLIST, &password_get_hook, NULL);
  if(hook_password == (guint) -1) {
    *error = g_strdup("Failed to register password hook in the Gnome plugin");
    return -1;
  }

  debug_print("Gnome plugin loaded\n");

  return 0;
}
Пример #2
0
gint plugin_init(gchar **error)
{
    gchar *rcpath;

    /* Version check */
    if(!check_plugin_version(MAKE_NUMERIC_VERSION(3,13,2,39),
                             VERSION_NUMERIC, _("GData"), error))
        return -1;

    hook_address_completion = hooks_register_hook(ADDDRESS_COMPLETION_BUILD_ADDRESS_LIST_HOOKLIST,
                              my_address_completion_build_list_hook, NULL);
    if(hook_address_completion == (guint) -1) {
        *error = g_strdup(_("Failed to register address completion hook in the GData plugin"));
        return -1;
    }

    hook_offline_switch = hooks_register_hook(OFFLINE_SWITCH_HOOKLIST, my_offline_switch_hook, NULL);
    if(hook_offline_switch == (guint) -1) {
        hooks_unregister_hook(ADDDRESS_COMPLETION_BUILD_ADDRESS_LIST_HOOKLIST, hook_address_completion);
        *error = g_strdup(_("Failed to register offline switch hook in the GData plugin"));
        return -1;
    }

    /* Configuration */
    prefs_set_default(cm_gdata_param);
    rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
    prefs_read_config(cm_gdata_param, "GDataPlugin", rcpath, NULL);
    g_free(rcpath);

    /* If the refresh token is still stored in config, save it to
     * password store. */
    if(cm_gdata_config.oauth2_refresh_token != NULL) {
        passwd_store_set(PWS_PLUGIN, "GData", GDATA_TOKEN_PWD_STRING,
                         cm_gdata_config.oauth2_refresh_token, TRUE);
        passwd_store_write_config();
    }

    cm_gdata_prefs_init();

    debug_print("GData plugin loaded\n");

    /* contacts cache */
    cm_gdata_load_contacts_cache_from_file();
    cm_gdata_update_contacts_update_timer();
    cm_gdata_update_contacts_cache();

    return 0;
}
Пример #3
0
gint plugin_init(gchar **error)
{
	gchar *rcpath;

	if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72),
				VERSION_NUMERIC, _("Fetchinfo"), error))
		return -1;

	mail_receive_hook_id = hooks_register_hook(MAIL_RECEIVE_HOOKLIST, mail_receive_hook, NULL);
	if (mail_receive_hook_id == (guint)-1) {
		/* i18n: Possible error message during plugin load */
		*error = g_strdup(_("Failed to register mail receive hook"));
		return -1;
	}

	prefs_set_default(param);
	rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
	prefs_read_config(param, "Fetchinfo", rcpath, NULL);
	g_free(rcpath);

	fetchinfo_gtk_init();

	debug_print("Fetchinfo plugin loaded\n");

	return 0;
}
Пример #4
0
void bogofilter_register_hook(void)
{
	if (hook_id == HOOK_NONE)
		hook_id = hooks_register_hook(MAIL_LISTFILTERING_HOOKLIST, mail_filtering_hook, NULL);
	if (hook_id == HOOK_NONE) {
		g_warning("Failed to register mail filtering hook");
		config.process_emails = FALSE;
	}
}
Пример #5
0
void spamassassin_register_hook(void)
{
	if (hook_id == -1)
		hook_id = hooks_register_hook(MAIL_FILTERING_HOOKLIST, mail_filtering_hook, NULL);
	if (hook_id == -1) {
		g_warning("Failed to register mail filtering hook");
		config.process_emails = FALSE;
	}
}
Пример #6
0
void addressbook_install_hooks(GError** error) {
	if ((guint)-1 == hooks_register_hook(
			COMPOSE_CREATED_HOOKLIST, my_compose_create_hook, NULL)) {
		g_warning("Could not register hook for adding vCards");
		if (error) {
			g_set_error(error, client_object_error_quark(), 1,
				"Could not register hook for adding vCards");
		}
	}
}
Пример #7
0
void statusbar_verbosity_set(gboolean verbose)
{
	if (verbose && (statusbar_puts_all_hook_id == HOOK_NONE)) {
		statusbar_puts_all_hook_id =
			hooks_register_hook(LOG_APPEND_TEXT_HOOKLIST, statusbar_puts_all_hook, NULL);
	} else if (!verbose && (statusbar_puts_all_hook_id != HOOK_NONE)) {
		hooks_unregister_hook(LOG_APPEND_TEXT_HOOKLIST, statusbar_puts_all_hook_id);
		statusbar_puts_all_hook_id = HOOK_NONE;
		statusbar_pop_all();
	}
}
Пример #8
0
/* Creates an entry in the specific_folder_array, and fills it with a new
 * SpecificFolderArrayEntry*. If specific_folder_array already has an entry
 * with the same name, return its ID. (The ID is the index in the array.) */
guint notification_register_folder_specific_list(gchar *node_name)
{
  SpecificFolderArrayEntry *entry;
  gint ii = 0;

  /* If array does not yet exist, create it. */
  if(!specific_folder_array) {
    specific_folder_array = g_array_new(FALSE, FALSE,
					sizeof(SpecificFolderArrayEntry*));
    specific_folder_array_size = 0;

    /* Register hook for folder update */
    /* "The hook is registered" is bound to "the array is allocated" */
    hook_folder_update = hooks_register_hook(FOLDER_UPDATE_HOOKLIST,
					     my_folder_update_hook, NULL);
    if(hook_folder_update == (guint) -1) {
      debug_print("Warning: Failed to register hook to folder update "
		  "hooklist. "
		  "Strange things can occur when deleting folders.\n");
    }
  }

  /* Check if we already have such a name. If so, return its id. */
  while(ii < specific_folder_array_size) {
    entry = g_array_index(specific_folder_array,SpecificFolderArrayEntry*,ii);
    if(entry) {
      if(!strcmp2(entry->name,node_name))
	return ii;
    }
    ii++;
  }

  /* Create an entry with the corresponding node name. */
  entry = g_new(SpecificFolderArrayEntry, 1);
  entry->name = g_strdup(node_name);
  entry->list = NULL;
  entry->window = NULL;
  entry->treeview = NULL;
  entry->cancelled = FALSE;
  entry->finished  = FALSE;
  entry->recursive = FALSE;
  entry->tree_store = gtk_tree_store_new(N_FOLDERCHECK_COLUMNS,
					 G_TYPE_STRING,
					 G_TYPE_POINTER,
					 GDK_TYPE_PIXBUF,
					 GDK_TYPE_PIXBUF,
					 G_TYPE_BOOLEAN);
  gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(entry->tree_store),
				  FOLDERCHECK_FOLDERNAME,
				  foldercheck_folder_name_compare,
				  NULL, NULL);
  specific_folder_array = g_array_append_val(specific_folder_array, entry);
  return specific_folder_array_size++;
}
Пример #9
0
gint plugin_init(gchar **error)
{
	if (!check_plugin_version(MAKE_NUMERIC_VERSION(3,9,3,29),
				VERSION_NUMERIC, _("QR-Avatar"), error))
		return -1;

	if ((update_hook_id = hooks_register_hook(AVATAR_HEADER_UPDATE_HOOKLIST, qr_avatar_update_hook, NULL)) == -1)
	{
		*error = g_strdup(_("Failed to register QR-Avatar update hook"));
		return -1;
	}

	if ((render_hook_id = hooks_register_hook(AVATAR_IMAGE_RENDER_HOOKLIST, qr_avatar_render_hook, NULL)) == -1)
	{
		*error = g_strdup(_("Failed to register QR-Avatar render hook"));
		return -1;
	}

	debug_print("QR-Avatar plugin loaded\n");

	return EXIT_SUCCESS;
}
Пример #10
0
/**
 * Initialize plugin.
 *
 * @param error  For storing the returned error message.
 *
 * @return 0 if initialization succeeds, -1 on failure.
 */
gint plugin_init(gchar **error)
{
	if (!check_plugin_version(MAKE_NUMERIC_VERSION(3,9,3,29),
				  VERSION_NUMERIC, _("Libravatar"), error))
		return -1;
	/* get info from headers */
	update_hook_id = hooks_register_hook(AVATAR_HEADER_UPDATE_HOOKLIST,
					     libravatar_header_update_hook,
					     NULL);
	if (update_hook_id == -1) {
		*error = g_strdup(_("Failed to register avatar header update hook"));
		return -1;
	}
	/* get image for displaying */
	render_hook_id = hooks_register_hook(AVATAR_IMAGE_RENDER_HOOKLIST,
					     libravatar_image_render_hook,
					     NULL);
	if (render_hook_id == -1) {
		*error = g_strdup(_("Failed to register avatar image render hook"));
		return -1;
	}
	/* cache dir */
	if (cache_dir_init() == -1) {
		*error = g_strdup(_("Failed to create avatar image cache directory"));
		return -1;
	}
	/* preferences page */
	libravatar_prefs_init();
	/* curl library */
	curl_global_init(CURL_GLOBAL_DEFAULT);
	/* missing cache */
	if (missing_cache_init() == -1) {
		*error = g_strdup(_("Failed to load missing items cache"));
		return -1;
	}
	debug_print("Libravatar plugin loaded\n");

	return 0;
}
Пример #11
0
gint plugin_init (gchar **error)
{
	if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72),
				VERSION_NUMERIC, _("NewMail"), error))
		return -1;

	hook_id = hooks_register_hook (MAIL_POSTFILTERING_HOOKLIST, newmail_hook, NULL);
	if (hook_id == -1) {
		*error = g_strdup (_("Failed to register newmail hook"));
		return (-1);
	}

	if (!NewLog) {
		auto char *mode = truncLog ? "w" : "a";
		if (!LogName) {
			LogName = g_strconcat(getenv ("HOME"), G_DIR_SEPARATOR_S, DEFAULT_DIR,
					G_DIR_SEPARATOR_S, LOG_NAME, NULL);
		}
		if (!(NewLog = fopen (LogName, mode))) {
			debug_print ("Failed to open default log %s\n", LogName);
			/* try fallback location */
			g_free(LogName);
			LogName = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, LOG_NAME, NULL);
			if (!(NewLog = fopen (LogName, mode))) {
				char buf[BUFSIZE];

				debug_print ("Failed to open fallback log %s\n", LogName);
#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE
				strerror_r(errno, buf, BUFSIZE);
				*error = g_strdup_printf(_("Could not open log file %s: %s\n"),
						LogName, buf);
#else /* use GNU version */
				*error = g_strdup_printf(_("Could not open log file %s: %s\n"),
						LogName, strerror_r(errno, buf, BUFSIZE));
#endif
				plugin_done ();
				return (-1);
			}
		}
		setbuf (NewLog, NULL);
	}

	debug_print ("Newmail plugin loaded\n"
              "Message header summaries written to %s\n", LogName);
	if (pluginDesc == NULL)
		pluginDesc = g_strdup_printf(
			_("This plugin writes a header summary to a log file for each "
			"mail received after sorting.\n\n"
			"Default is ~/Mail/NewLog\n\nCurrent log is %s"), LogName);
	return (0);
} /* plugin_init */
Пример #12
0
gint plugin_init(gchar **error)
{
	if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72),
		VERSION_NUMERIC, _("ExtmailHeaderFixer"), error))
		return -1;

	mail_receive_hook_id = hooks_register_hook(MAIL_RECEIVE_HOOKLIST, mail_receive_hook, NULL);
	if (mail_receive_hook_id == (guint)-1) {
		*error = g_strdup("Failed to register mail receive hook");
		return -1;
	}

	debug_print("ExtmailHeaderFixer plugin loaded\n");

	return 0;
}
Пример #13
0
gint plugin_init(gchar **error)
{
    gchar *rcpath;

    if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72),
                              VERSION_NUMERIC, PLUGIN_NAME, error))
        return -1;

    hook_id = hooks_register_hook(MAIL_FILTERING_HOOKLIST, mail_filtering_hook, NULL);
    if (hook_id == -1) {
        *error = g_strdup(_("Failed to register mail filtering hook"));
        return -1;
    }

    prefs_set_default(param);
    rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
    prefs_read_config(param, "ClamAV", rcpath, NULL);
    g_free(rcpath);

    clamav_gtk_init();

    if (config.clamav_enable) {
        debug_print("Creating socket\n");
        config.alert_ack = TRUE;
        Clamd_Stat status = clamd_prepare();
        switch (status) {
        case NO_SOCKET:
            g_warning("[init] No socket information");
            alertpanel_error(_("Init\nNo socket information.\nAntivirus disabled."));
            break;
        case NO_CONNECTION:
            g_warning("[init] Clamd does not respond to ping");
            alertpanel_warning(_("Init\nClamd does not respond to ping.\nIs clamd running?"));
            break;
        default:
            break;
        }
    }

    debug_print("Clamd plugin loaded\n");

    return 0;

}
Пример #14
0
/**
 * Initialize plugin.
 *
 * @param error  For storing the returned error message.
 *
 * @return 0 if initialization succeeds, -1 on failure.
 */
gint plugin_init(gchar **error)
{
	if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72),
				  VERSION_NUMERIC, _("Attach warner"), error))
		return -1;

	hook_id = hooks_register_hook(COMPOSE_CHECK_BEFORE_SEND_HOOKLIST, 
				      attwarn_before_send_hook, NULL);
	
	if (hook_id == -1) {
		*error = g_strdup(_("Failed to register check before send hook"));
		return -1;
	}

	attachwarner_prefs_init();

	debug_print("Attachment warner plugin loaded\n");

	return 0;
}
Пример #15
0
LogWindow *log_window_create(LogInstance instance)
{
	LogWindow *logwin;
	GtkWidget *window;
	GtkWidget *scrolledwin;
	GtkWidget *text;
	GtkTextBuffer *buffer;
	GtkTextIter iter;
	static GdkGeometry geometry;
	gint *prefs_logwin_width = NULL;
	gint *prefs_logwin_height = NULL;

	debug_print("Creating log window...\n");

	get_log_prefs(instance, &prefs_logwin_width, &prefs_logwin_height);
	cm_return_val_if_fail(prefs_logwin_width != NULL, NULL);
	cm_return_val_if_fail(prefs_logwin_height != NULL, NULL);

	logwin = g_new0(LogWindow, 1);

	window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "logwindow");
	gtk_window_set_title(GTK_WINDOW(window), get_log_title(instance));
	gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
	g_signal_connect(G_OBJECT(window), "delete_event",
			 G_CALLBACK(gtk_widget_hide_on_delete), NULL);
	g_signal_connect(G_OBJECT(window), "key_press_event",
			 G_CALLBACK(key_pressed), logwin);
	g_signal_connect_after(G_OBJECT(window), "hide",
			 G_CALLBACK(hide_cb), logwin);
	gtk_widget_realize(window);

	scrolledwin = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
				       GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwin),
					    GTK_SHADOW_IN);
	gtk_container_add(GTK_CONTAINER(window), scrolledwin);
	gtk_widget_show(scrolledwin);

	text = gtk_text_view_new();
	gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
	logwin->buffer = buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));

	g_object_ref(G_OBJECT(logwin->buffer));
	gtk_text_view_set_buffer(GTK_TEXT_VIEW(text), NULL);
	logwin->hidden = TRUE;
	logwin->never_shown = TRUE;

	gtk_text_buffer_get_start_iter(buffer, &iter);
	logwin->end_mark = gtk_text_buffer_create_mark(buffer, "end", &iter, FALSE);

	g_signal_connect(G_OBJECT(text), "populate-popup",
			 G_CALLBACK(log_window_popup_menu_extend), logwin);
	gtk_container_add(GTK_CONTAINER(scrolledwin), text);
	gtk_widget_show(text);

	g_signal_connect(G_OBJECT(window), "size_allocate",
			 G_CALLBACK(size_allocate_cb), GINT_TO_POINTER(instance));

	if (!geometry.min_height) {
		geometry.min_width = 520;
		geometry.min_height = 400;
	}

	gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
				      GDK_HINT_MIN_SIZE);
	gtk_widget_set_size_request(window, *prefs_logwin_width,
				    *prefs_logwin_height);

	logwin->window = window;
	logwin->scrolledwin = scrolledwin;
	logwin->text = text;
	logwin->hook_id = hooks_register_hook(get_log_hook(instance), log_window_append, logwin);

	return logwin;
}
Пример #16
0
gint plugin_init(gchar **error)
{
  gchar *rcpath;

  /* Version check */
  /* No be able to test against new-contacts */
  if(!check_plugin_version(MAKE_NUMERIC_VERSION(3,8,1,46),
			   VERSION_NUMERIC, _("Notification"), error))
    return -1;

  /* Check if threading is enabled */
  if(!g_thread_supported()) {
    *error = g_strdup(_("The Notification plugin needs threading support."));
    return -1;
  }

  hook_f_item = hooks_register_hook(FOLDER_ITEM_UPDATE_HOOKLIST,
				    my_folder_item_update_hook, NULL);
  if(hook_f_item == (guint) -1) {
    *error = g_strdup(_("Failed to register folder item update hook in the "
			"Notification plugin"));
    return -1;
  }

  hook_f = hooks_register_hook(FOLDER_UPDATE_HOOKLIST,
			       my_folder_update_hook, NULL);
  if(hook_f == (guint) -1) {
    *error = g_strdup(_("Failed to register folder update hook in the "
			"Notification plugin"));
    hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_f_item);
    return -1;
  }


  hook_m_info = hooks_register_hook(MSGINFO_UPDATE_HOOKLIST,
				    my_msginfo_update_hook, NULL);
  if(hook_m_info == (guint) -1) {
    *error = g_strdup(_("Failed to register msginfo update hook in the "
			"Notification plugin"));
    hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_f_item);
    hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, hook_f);
    return -1;
  }

  hook_offline = hooks_register_hook(OFFLINE_SWITCH_HOOKLIST,
				     my_offline_switch_hook, NULL);
  if(hook_offline == (guint) -1) {
    *error = g_strdup(_("Failed to register offline switch hook in the "
			"Notification plugin"));
    hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_f_item);
    hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, hook_f);
    hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST, hook_m_info);
    return -1;
  }

  hook_mw_close = hooks_register_hook(MAIN_WINDOW_CLOSE,
				      my_main_window_close_hook, NULL);
  if(hook_mw_close == (guint) -1) {
    *error = g_strdup(_("Failed to register main window close hook in the "
			"Notification plugin"));
    hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_f_item);
    hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, hook_f);
    hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST, hook_m_info);
    hooks_unregister_hook(OFFLINE_SWITCH_HOOKLIST, hook_offline);
    return -1;
  }

  hook_got_iconified = hooks_register_hook(MAIN_WINDOW_GOT_ICONIFIED,
					   my_main_window_got_iconified_hook,
					   NULL);
  if(hook_got_iconified == (guint) -1) {
    *error = g_strdup(_("Failed to register got iconified hook in the "
			"Notification plugin"));
    hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_f_item);
    hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, hook_f);
    hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST, hook_m_info);
    hooks_unregister_hook(OFFLINE_SWITCH_HOOKLIST, hook_offline);
    hooks_unregister_hook(MAIN_WINDOW_CLOSE, hook_mw_close);
    return -1;
  }

  hook_account = hooks_register_hook(ACCOUNT_LIST_CHANGED_HOOKLIST,
				     my_account_list_changed_hook, NULL);
  if (hook_account == (guint) -1) {
    *error = g_strdup(_("Failed to register account list changed hook in the "
			"Notification plugin"));
    hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_f_item);
    hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, hook_f);
    hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST, hook_m_info);
    hooks_unregister_hook(OFFLINE_SWITCH_HOOKLIST, hook_offline);
    hooks_unregister_hook(MAIN_WINDOW_CLOSE, hook_mw_close);
    hooks_unregister_hook(MAIN_WINDOW_GOT_ICONIFIED, hook_got_iconified);
    return -1;
  }

  hook_theme_changed = hooks_register_hook(THEME_CHANGED_HOOKLIST, my_update_theme_hook, NULL);
  if(hook_theme_changed == (guint)-1) {
    *error = g_strdup(_("Failed to register theme change hook int the "
      "Notification plugin"));
    hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_f_item);
    hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, hook_f);
    hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST, hook_m_info);
    hooks_unregister_hook(OFFLINE_SWITCH_HOOKLIST, hook_offline);
    hooks_unregister_hook(MAIN_WINDOW_CLOSE, hook_mw_close);
    hooks_unregister_hook(MAIN_WINDOW_GOT_ICONIFIED, hook_got_iconified);
    hooks_unregister_hook(ACCOUNT_LIST_CHANGED_HOOKLIST, hook_account);
    return -1;
  }

  /* Configuration */
  prefs_set_default(notify_param);
  rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
  prefs_read_config(notify_param, "NotificationPlugin", rcpath, NULL);
  g_free(rcpath);

  /* Folder specific stuff */
  notification_foldercheck_read_array();

  notification_notified_hash_startup_init();

  notify_gtk_init();

#ifdef NOTIFICATION_BANNER
  notification_update_banner();
#endif
#ifdef NOTIFICATION_LCDPROC
  notification_lcdproc_connect();
#endif
#ifdef NOTIFICATION_TRAYICON
  if(notify_config.trayicon_enabled &&
		 notify_config.trayicon_hide_at_startup && claws_is_starting()) {
    MainWindow *mainwin = mainwindow_get_mainwindow();

		g_idle_add(trayicon_startup_idle,NULL);
    if(mainwin && gtk_widget_get_visible(GTK_WIDGET(mainwin->window)))
      main_window_hide(mainwin);
    main_set_show_at_startup(FALSE);
  }
#endif
  my_account_list_changed_hook(NULL,NULL);

  if(notify_config.urgency_hint_new || notify_config.urgency_hint_unread)
	notification_update_msg_counts(NULL);

#ifdef NOTIFICATION_HOTKEYS
  notification_hotkeys_update_bindings();
#endif

  debug_print("Notification plugin loaded\n");

  return 0;
}
Пример #17
0
void sslcertwindow_register_hook(void)
{
	hooks_register_hook(SSLCERT_ASK_HOOKLIST, sslcert_ask_hook, NULL);
}
Пример #18
0
gint plugin_init(gchar **error)
{
  PyObject *inst_StringIO = NULL;

  /* Version check */
  if(!check_plugin_version(MAKE_NUMERIC_VERSION(3,7,6,9), VERSION_NUMERIC, _("Python"), error))
    return -1;

  /* load hooks */
  hook_compose_create = hooks_register_hook(COMPOSE_CREATED_HOOKLIST, my_compose_create_hook, NULL);
  if(hook_compose_create == (guint)-1) {
    *error = g_strdup(_("Failed to register \"compose create hook\" in the Python plugin"));
    return -1;
  }

  /* script directories */
  if(!make_sure_directories_exist(error))
    goto err;

  /* initialize python interpreter */
  Py_Initialize();

  /* The Python C API only offers to print an exception to sys.stderr. In order to catch it
   * in a string, a StringIO object is created, to which sys.stderr can be redirected in case
   * an error occured. */
  inst_StringIO = get_StringIO_instance();

  /* initialize Claws Mail Python module */
  initclawsmail();
  if(PyErr_Occurred()) {
    *error = get_exception_information(inst_StringIO);
    goto err;
  }

  if(PyRun_SimpleString("import clawsmail") == -1) {
    *error = g_strdup("Error importing the clawsmail module");
    goto err;
  }

  /* initialize python interactive shell */
  if(!parasite_python_init(error)) {
    goto err;
  }

  /* load menu options */
  if(!python_menu_init(error)) {
    goto err;
  }

  /* problems here are not fatal */
  run_auto_script_file_if_it_exists(PYTHON_SCRIPTS_AUTO_STARTUP, NULL);

  debug_print("Python plugin loaded\n");

  return 0;

err:
  hooks_unregister_hook(COMPOSE_CREATED_HOOKLIST, hook_compose_create);
  Py_XDECREF(inst_StringIO);
  return -1;
}