/*
 * main.c: The core of the mail component
 *
 * Author:
 *   Miguel de Icaza (miguel@ximian.com)
 *
 * (C) 2000 Ximian, Inc.
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <signal.h>

#include <libgnome/gnome-defs.h>
#include <libgnomeui/gnome-init.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object-directory.h>
#include <glade/glade.h>
#include <liboaf/liboaf.h>
#include <libgnomevfs/gnome-vfs.h>

#ifdef GTKHTML_HAVE_GCONF
#include <gconf/gconf.h>
#endif

#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-cursors.h>
#include <gal/widgets/e-unicode.h>

#include "component-factory.h"
#include "composer/evolution-composer.h"
#include "mail.h"
#include "mail-mt.h"

/*#define DO_MCHECK*/

#ifdef DO_MCHECK
static int blowup(int status)
{
	switch(status) {
	case 1:
		printf("Double free failure\n");
		break;
	case 2:
		printf("Memory clobbered before block\n");
		break;
	case 3:
		printf("Memory clobbered after block\n");
		break;
	}
	abort();
	return status;
}
#endif

/* The GNOME SEGV handler will lose if it's not run from the main Gtk
 * thread. So if we crash in another thread, redirect the signal.
 */
static void (*gnome_segv_handler) (int);

static void
segv_redirect (int sig)
{
	if (pthread_self () == mail_gui_thread)
		gnome_segv_handler (sig);
	else {
		pthread_kill (mail_gui_thread, sig);
		pthread_exit (NULL);
	}
}

int
main (int argc, char *argv [])
{
	CORBA_ORB orb;
	struct sigaction sa, osa;

#ifdef DO_MCHECK
	/* used to make elfence work */
#if 0
	free (malloc (10));
#else
	/*mtrace();*/
	mcheck(blowup);
#endif
#endif
	bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR);
	textdomain (PACKAGE);

	g_thread_init (NULL);

	gnome_init_with_popt_table ("evolution-mail-component", VERSION,
				    argc, argv, oaf_popt_options, 0, NULL);

	sigaction (SIGSEGV, NULL, &osa);
	if (osa.sa_handler != SIG_DFL) {
		sa.sa_flags = 0;
		sigemptyset (&sa.sa_mask);
		sa.sa_handler = segv_redirect;
		sigaction (SIGSEGV, &sa, NULL);
		sigaction (SIGBUS, &sa, NULL);
		sigaction (SIGFPE, &sa, NULL);
		gnome_segv_handler = osa.sa_handler;
	}

	orb = oaf_init (argc, argv);

	if (bonobo_init (orb, CORBA_OBJECT_NIL,
			 CORBA_OBJECT_NIL) == FALSE) {
		g_error ("Mail component could not initialize Bonobo.\n"
			 "If there was a warning message about the "
			 "RootPOA, it probably means\nyou compiled "
			 "Bonobo against GOAD instead of OAF.");
	}

#ifdef GTKHTML_HAVE_GCONF
	gconf_init (argc, argv, NULL);
#endif

	glade_gnome_init ();

	gnome_vfs_init ();
	
	e_cursors_init ();

	mail_config_init ();
	mail_msg_init ();
	
	component_factory_init ();
	evolution_composer_factory_init (composer_send_cb,
					 composer_postpone_cb);

	if (gdk_threads_mutex) {
		g_mutex_free (gdk_threads_mutex);
		gdk_threads_mutex = NULL;
	}

	GDK_THREADS_ENTER ();
	bonobo_main ();
	GDK_THREADS_LEAVE ();
	
	mail_config_write_on_exit ();

	return 0;
}
dabot/npm_and_yarn/devel/electron4/files/serve-10.1.2</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/y18n-3.2.2'>dependabot/npm_and_yarn/devel/electron4/files/y18n-3.2.2</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/elliptic-6.5.3'>dependabot/npm_and_yarn/devel/electron6/files/elliptic-6.5.3</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/elliptic-6.5.4'>dependabot/npm_and_yarn/devel/electron6/files/elliptic-6.5.4</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/ini-1.3.8'>dependabot/npm_and_yarn/devel/electron6/files/ini-1.3.8</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/lodash-4.17.19'>dependabot/npm_and_yarn/devel/electron6/files/lodash-4.17.19</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/lodash.merge-4.6.2'>dependabot/npm_and_yarn/devel/electron6/files/lodash.merge-4.6.2</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/node-fetch-2.6.1'>dependabot/npm_and_yarn/devel/electron6/files/node-fetch-2.6.1</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/serve-10.1.2'>dependabot/npm_and_yarn/devel/electron6/files/serve-10.1.2</option>
<option value='gnome-3.22'>gnome-3.22</option>
<option value='gnome-3.24' selected='selected'>gnome-3.24</option>
<option value='gnome-3.26'>gnome-3.26</option>
<option value='gnome-3.28'>gnome-3.28</option>
<option value='gnome-3.32'>gnome-3.32</option>
<option value='gnome-3.36'>gnome-3.36</option>
<option value='gstreamer'>gstreamer</option>
<option value='gstreamer-1.16'>gstreamer-1.16</option>
<option value='gstreamer0.10-removal'>gstreamer0.10-removal</option>
<option value='main'>main</option>
<option value='master'>master</option>
<option value='mate-1.16'>mate-1.16</option>
<option value='mate-1.18'>mate-1.18</option>
<option value='mate-1.20'>mate-1.20</option>
<option value='mate-1.22'>mate-1.22</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/about/?h=gnome-3.24'>about</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/?h=gnome-3.24'>summary</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/refs/?h=gnome-3.24&amp;id=4fa9169beda8dc318968896eac6a2be7efbc143c'>refs</a><a class='active' href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/mail/p5-Net-QMTP?h=gnome-3.24'>log</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/tree/mail/p5-Net-QMTP?h=gnome-3.24&amp;id=4fa9169beda8dc318968896eac6a2be7efbc143c'>tree</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/mail/p5-Net-QMTP?h=gnome-3.24&amp;id=4fa9169beda8dc318968896eac6a2be7efbc143c'>commit</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/diff/mail/p5-Net-QMTP?h=gnome-3.24&amp;id=4fa9169beda8dc318968896eac6a2be7efbc143c'>diff</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/stats/mail/p5-Net-QMTP?h=gnome-3.24'>stats</a></td><td class='form'><form class='right' method='get' action='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/mail/p5-Net-QMTP'>
<input type='hidden' name='h' value='gnome-3.24'/><input type='hidden' name='id' value='4fa9169beda8dc318968896eac6a2be7efbc143c'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/?h=gnome-3.24&amp;id=4fa9169beda8dc318968896eac6a2be7efbc143c'>root</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/mail?h=gnome-3.24&amp;id=4fa9169beda8dc318968896eac6a2be7efbc143c'>mail</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/mail/p5-Net-QMTP?h=gnome-3.24&amp;id=4fa9169beda8dc318968896eac6a2be7efbc143c'>p5-Net-QMTP</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th></th><th class='left'>Commit message (<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/mail/p5-Net-QMTP?h=gnome-3.24&amp;id=4fa9169beda8dc318968896eac6a2be7efbc143c&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Age</th><th class='left'>Files</th><th class='left'>Lines</th></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/mail/p5-Net-QMTP?h=gnome-3.24&amp;id=c6325f63eae960aea108b46ffa92b29b6345c6b3'>SHA256ify</a></td><td>edwin</td><td><span title='2006-01-22 20:50:54 +0800'>2006-01-22</span></td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/mail/p5-Net-QMTP?h=gnome-3.24&amp;id=ebc5bca756295b951b934e4388c169ccec8ea36c'>Fix a problem with the pkg-plist which failed to remove some directories</a></td><td>sem</td><td><span title='2004-12-10 02:13:01 +0800'>2004-12-10</span></td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+2</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/mail/p5-Net-QMTP?h=gnome-3.24&amp;id=eafecace856c9e738ba90b8e742dbd3b5a26e108'>Update to 0.06</a></td><td>arved</td><td><span title='2004-11-05 03:13:30 +0800'>2004-11-05</span></td><td>2</td><td><span class='deletions'>-3</span>/<span class='insertions'>+4</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/mail/p5-Net-QMTP?h=gnome-3.24&amp;id=67c8f46fa1d85cc2949db3c27dbffb4352914cd3'>Add size data, approved by maintainers.</a></td><td>trevor</td><td><span title='2004-03-25 07:14:13 +0800'>2004-03-25</span></td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+1</span></td></tr>