Exemplo n.º 1
0
int
main (int argc, char *argv[])
{

#ifdef SOCKS
	SOCKSinit (argv[0]);
#endif

	if (!fe_args (argc, argv))
		return 0;

	load_config ();

	fe_init ();

	xchat_init ();

	fe_main ();

#ifdef USE_OPENSSL
	if (ctx)
		_SSL_context_free (ctx);
#endif

#ifdef USE_DEBUG
	xchat_mem_list ();
#endif

#ifdef WIN32
	WSACleanup ();
#endif

	return 0;
}
Exemplo n.º 2
0
Arquivo: xchat.c Projeto: ArdaXi/XChat
int
main (int argc, char *argv[])
{
	int ret;
	
	srand (time (0));	/* CL: do this only once! */

#ifdef SOCKS
	SOCKSinit (argv[0]);
#endif

	ret = fe_args (argc, argv);
	if (ret != -1)
		return ret;
	
#ifdef USE_DBUS
	xchat_remote ();
#endif

	load_config ();

#ifdef USE_LIBPROXY
	libproxy_factory = px_proxy_factory_new();
#endif

	fe_init ();

	xchat_init ();

	fe_main ();

#ifdef USE_LIBPROXY
	px_proxy_factory_free(libproxy_factory);
#endif

#ifdef USE_OPENSSL
	if (ctx)
		_SSL_context_free (ctx);
#endif

#ifdef USE_DEBUG
	xchat_mem_list ();
#endif

#ifdef WIN32
	WSACleanup ();
#endif

	return 0;
}
Exemplo n.º 3
0
int
main (int argc, char *argv[])
{
	int ret;

	g_thread_init(NULL);
	mowgli_init();

#ifdef _WIN32
	conspire_init_winsock();
#endif

#ifdef GNUTLS
	gnutls_global_init ();
#endif

	srand (time (0));	/* CL: do this only once! */

#ifdef SOCKS
	SOCKSinit (argv[0]);
#endif

	ret = fe_args (argc, argv);
	if (ret != -1)
		return ret;

	load_config ();

	fe_init ();

	xchat_init ();

	fe_main ();

#ifdef GNUTLS
	gnutls_global_deinit ();
#endif

#ifdef USE_DEBUG
	xchat_mem_list ();
#endif

	return 0;
}
Exemplo n.º 4
0
int
main (int argc, char *argv[])
{
    int ret;

    srand (time (0));           /* CL: do this only once! */

#ifdef SOCKS
    SOCKSinit (argv[0]);
#endif

    ret = fe_args (argc, argv);
    if (ret != -1)
        return ret;

#ifdef USE_DBUS
    xchat_remote ();
#endif

    load_config ();

    fe_init ();

    xchat_init ();

    fe_main ();

#ifdef USE_OPENSSL
    if (ctx)
        _SSL_context_free (ctx);
#endif

#ifdef USE_DEBUG
    xchat_mem_list ();
#endif

    return 0;
}
Exemplo n.º 5
0
int
main (int argc, char *argv[])
{
	int ret;

	srand (time (0));	/* CL: do this only once! */

	/* We must check for the config dir parameter, otherwise load_config() will behave incorrectly.
	 * load_config() must come before fe_args() because fe_args() calls gtk_init() which needs to
	 * know the language which is set in the config. The code below is copy-pasted from fe_args()
	 * for the most part. */
	if (argc >= 3)
	{
		int i;
		for (i = 1; i < argc - 1; i++)
		{
			if (strcmp (argv[i], "-d") == 0)
			{
				if (xdir)
				{
					g_free (xdir);
				}

				xdir = strdup (argv[i + 1]);

				if (xdir[strlen (xdir) - 1] == G_DIR_SEPARATOR)
				{
					xdir[strlen (xdir) - 1] = 0;
				}
			}
		}
	}

#if ! GLIB_CHECK_VERSION (2, 36, 0)
	g_type_init ();
#endif

	if (check_config_dir () == 0)
	{
		if (load_config () != 0)
			load_default_config ();
	} else
	{
		/* this is probably the first run */
		load_default_config ();
		make_config_dirs ();
		make_dcc_dirs ();
	}

	/* we MUST do this after load_config () AND before fe_init (thus gtk_init) otherwise it will fail */
	set_locale ();

#ifdef SOCKS
	SOCKSinit (argv[0]);
#endif

	ret = fe_args (argc, argv);
	if (ret != -1)
		return ret;

#ifdef USE_DBUS
	xchat_remote ();
#endif

#ifdef USE_LIBPROXY
	libproxy_factory = px_proxy_factory_new();
#endif

	fe_init ();

	/* This is done here because cfgfiles.c is too early in
	* the startup process to use gtk functions. */
	if (g_access (get_xdir (), W_OK) != 0)
	{
		char buf[2048];

		g_snprintf (buf, sizeof(buf),
			_("You do not have write access to %s. Nothing from this session can be saved."),
			get_xdir ());
		fe_message (buf, FE_MSG_ERROR);
	}

#ifndef _WIN32
#ifndef __EMX__
	/* OS/2 uses UID 0 all the time */
	if (getuid () == 0)
		fe_message (_("* Running IRC as root is stupid! You should\n"
			      "  create a User Account and use that to login.\n"), FE_MSG_WARN|FE_MSG_WAIT);
#endif
#endif /* !_WIN32 */

	xchat_init ();

	fe_main ();

#ifdef USE_LIBPROXY
	px_proxy_factory_free(libproxy_factory);
#endif

#ifdef USE_OPENSSL
	if (ctx)
		_SSL_context_free (ctx);
#endif

#ifdef USE_DEBUG
	xchat_mem_list ();
#endif

#ifdef _WIN32
	WSACleanup ();
#endif

	return 0;
}
Exemplo n.º 6
0
int
main (int argc, char *argv[])
{
	int ret;

#ifdef WIN32
	char hexchat_lang[13];	/* LC_ALL= plus 5 chars of gui_lang and trailing \0 */
	HANDLE mutex;
#endif

	srand (time (0));	/* CL: do this only once! */

	load_config ();

#ifdef WIN32
	/* we MUST do this after load_config () AND before fe_init (thus gtk_init) otherwise it will fail */
	strcpy (hexchat_lang, "LC_ALL=");

	switch (prefs.gui_lang)
	{
		case 0:
			strcat (hexchat_lang, "sq");
			break;
		case 1:
			strcat (hexchat_lang, "am");
			break;
		case 2:
			strcat (hexchat_lang, "az");
			break;
		case 3:
			strcat (hexchat_lang, "eu");
			break;
		case 4:
			strcat (hexchat_lang, "be");
			break;
		case 5:
			strcat (hexchat_lang, "bg");
			break;
		case 6:
			strcat (hexchat_lang, "ca");
			break;
		case 7:
			strcat (hexchat_lang, "zh_CN");
			break;
		case 8:
			strcat (hexchat_lang, "zh_TW");
			break;
		case 9:
			strcat (hexchat_lang, "cs");
			break;
		case 10:
			strcat (hexchat_lang, "nl");
			break;
		case 11:
			strcat (hexchat_lang, "en_GB");
			break;
		case 12:
			strcat (hexchat_lang, "en_US");
			break;
		case 13:
			strcat (hexchat_lang, "et");
			break;
		case 14:
			strcat (hexchat_lang, "fi");
			break;
		case 15:
			strcat (hexchat_lang, "fr");
			break;
		case 16:
			strcat (hexchat_lang, "gl");
			break;
		case 17:
			strcat (hexchat_lang, "de");
			break;
		case 18:
			strcat (hexchat_lang, "el");
			break;
		case 19:
			strcat (hexchat_lang, "hi");
			break;
		case 20:
			strcat (hexchat_lang, "hu_HU");
			break;
		case 21:
			strcat (hexchat_lang, "it");
			break;
		case 22:
			strcat (hexchat_lang, "ja");
			break;
		case 23:
			strcat (hexchat_lang, "kn");
			break;
		case 24:
			strcat (hexchat_lang, "ko");
			break;
		case 25:
			strcat (hexchat_lang, "lv");
			break;
		case 26:
			strcat (hexchat_lang, "lt");
			break;
		case 27:
			strcat (hexchat_lang, "mk");
			break;
		case 28:
			strcat (hexchat_lang, "ms");
			break;
		case 29:
			strcat (hexchat_lang, "nb");
			break;
		case 30:
			strcat (hexchat_lang, "no");
			break;
		case 31:
			strcat (hexchat_lang, "pl");
			break;
		case 32:
			strcat (hexchat_lang, "pt");
			break;
		case 33:
			strcat (hexchat_lang, "pt_BR");
			break;
		case 34:
			strcat (hexchat_lang, "pa");
			break;
		case 35:
			strcat (hexchat_lang, "ru");
			break;
		case 36:
			strcat (hexchat_lang, "sr");
			break;
		case 37:
			strcat (hexchat_lang, "sk");
			break;
		case 38:
			strcat (hexchat_lang, "sl");
			break;
		case 39:
			strcat (hexchat_lang, "es");
			break;
		case 40:
			strcat (hexchat_lang, "sv");
			break;
		case 41:
			strcat (hexchat_lang, "th");
			break;
		case 42:
			strcat (hexchat_lang, "uk");
			break;
		case 43:
			strcat (hexchat_lang, "vi");
			break;
		case 44:
			strcat (hexchat_lang, "wa");
			break;
		default:
			strcat (hexchat_lang, "en_US");
			break;
	}

	putenv (hexchat_lang);

	if (prefs.gui_one_instance && !portable_mode ())
	{
		DWORD error;

		mutex = CreateMutex (NULL, TRUE, "Local\\hexchat");
		error = GetLastError ();

		if (error == ERROR_ALREADY_EXISTS || mutex == NULL)
		{
			/* restoring the XChat window from the tray via the taskbar icon
			 * only works correctly when X-Tray is used, but it's not a big deal
			 * since you can only minimize XChat to tray via the taskbar if you
			 * use X-Tray*/
			if (hextray_mode ())
			{
				/* FindWindow() doesn't support wildcards so we check all the open windows */
				EnumWindows (enum_windows_impl, NULL);
				return 0;
			}
			else
			{
				return 1;
			}
		}
	}
#endif

#ifdef SOCKS
	SOCKSinit (argv[0]);
#endif

	ret = fe_args (argc, argv);
	if (ret != -1)
		return ret;
	
#ifdef USE_DBUS
	xchat_remote ();
#endif

#ifdef USE_LIBPROXY
	libproxy_factory = px_proxy_factory_new();
#endif

	fe_init ();

	xchat_init ();

	fe_main ();

#ifdef USE_LIBPROXY
	px_proxy_factory_free(libproxy_factory);
#endif

#ifdef USE_OPENSSL
	if (ctx)
		_SSL_context_free (ctx);
#endif

#ifdef USE_DEBUG
	xchat_mem_list ();
#endif

#ifdef WIN32
	WSACleanup ();

	if (prefs.gui_one_instance && !portable_mode ())
	{
		ReleaseMutex (mutex);
		CloseHandle (mutex);
	}
#endif

	return 0;
}