void fe_init (void) { GConfClient *client; client = gconf_client_get_default (); gconf_client_add_dir (client, "/apps/xchat", GCONF_CLIENT_PRELOAD_NONE, NULL); g_object_unref (client); u = userlist_new (); gui.quit = FALSE; palette_init (); run_migrations (); initialize_gui_1 (); if (!preferences_exist ()) { run_setup_dialog (); } else { set_version (); } servlist_init (); initialize_gui_2 (); load_preferences (); run_main_window (opt_fullscreen); /* Force various window-related options to match our interaction model */ prefs.use_server_tab = TRUE; prefs.notices_tabs = FALSE; prefs.servernotice = TRUE; prefs.slist_skip = FALSE; /* If we don't have a specific DCC IP address, force get-from-server */ if (strlen (prefs.dcc_ip_str) == 0) { prefs.ip_from_server = TRUE; } /* Don't allow the core to autoload plugins. We use our own * method for autoloading. */ arg_skip_plugins = 1; if (not_autoconnect ()) { ConnectDialog *cd; cd = connect_dialog_new (); gtk_widget_show_all (GTK_WIDGET (cd)); } #ifdef USE_PLUGIN plugins_initialize (); #endif }
static void xchat_init (void) { char buf[2048]; const char *cs = NULL; #ifdef WIN32 WSADATA wsadata; #ifdef USE_IPV6 if (WSAStartup(0x0202, &wsadata) != 0) { MessageBox (NULL, "Cannot find winsock 2.2+", "Error", MB_OK); exit (0); } #else WSAStartup(0x0101, &wsadata); #endif /* !USE_IPV6 */ #endif /* !WIN32 */ #ifdef USE_SIGACTION struct sigaction act; /* ignore SIGPIPE's */ act.sa_handler = SIG_IGN; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigaction (SIGPIPE, &act, NULL); /* Deal with SIGUSR1's & SIGUSR2's */ act.sa_sigaction = sigusr1_handler; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigaction (SIGUSR1, &act, NULL); act.sa_sigaction = sigusr2_handler; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigaction (SIGUSR2, &act, NULL); #else #ifndef WIN32 /* good enough for these old systems */ signal (SIGPIPE, SIG_IGN); #endif #endif if (g_get_charset (&cs)) prefs.utf8_locale = TRUE; load_text_events (); notify_load (); ignore_load (); snprintf (buf, sizeof (buf), "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD dcc send %%s\n\n"\ "NAME %s\n" "CMD dcc chat %%s\n\n"\ "NAME %s\n" "CMD dcc close chat %%s\n\n"\ "NAME ENDSUB\n" "CMD \n\n"\ "NAME SUB\n" "CMD CTCP\n\n"\ "NAME %s\n" "CMD ctcp %%s VERSION\n\n"\ "NAME %s\n" "CMD ctcp %%s USERINFO\n\n"\ "NAME %s\n" "CMD ctcp %%s CLIENTINFO\n\n"\ "NAME %s\n" "CMD ping %%s\n\n"\ "NAME %s\n" "CMD ctcp %%s TIME\n\n"\ "NAME %s\n" "CMD ctcp %%s FINGER\n\n"\ "NAME XDCC List\n" "CMD ctcp %%s XDCC LIST\n\n"\ "NAME CDCC List\n" "CMD ctcp %%s CDCC LIST\n\n"\ "NAME ENDSUB\n" "CMD \n\n"\ "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD quote KILL %%s :die!\n\n"\ "NAME ENDSUB\n" "CMD \n\n"\ "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD voice %%a\n\n"\ "NAME %s\n" "CMD devoice %%a\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME %s\n" "CMD op %%a\n\n"\ "NAME %s\n" "CMD deop %%a\n\n"\ "NAME ENDSUB\n" "CMD \n\n"\ "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD ignore %%s!*@* ALL\n\n"\ "NAME %s\n" "CMD unignore %%s!*@*\n\n"\ "NAME ENDSUB\n" "CMD \n\n"\ "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD kick %%s\n\n"\ "NAME %s\n" "CMD ban %%s\n\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME %s *!*@*.host\n""CMD ban %%s 0\n\n"\ "NAME %s *!*@domain\n""CMD ban %%s 1\n\n"\ "NAME %s *!*user@*.host\n""CMD ban %%s 2\n\n"\ "NAME %s *!*user@domain\n""CMD ban %%s 3\n\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME %s *!*@*.host\n""CMD kickban %%s 0\n\n"\ "NAME %s *!*@domain\n""CMD kickban %%s 1\n\n"\ "NAME %s *!*user@*.host\n""CMD kickban %%s 2\n\n"\ "NAME %s *!*user@domain\n""CMD kickban %%s 3\n\n"\ "NAME ENDSUB\n" "CMD \n\n"\ "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD quote WHO %%s\n\n"\ "NAME %s\n" "CMD quote WHOIS %%s %%s\n\n"\ "NAME %s\n" "CMD dns %%s\n\n"\ "NAME %s\n" "CMD quote TRACE %%s\n\n"\ "NAME %s\n" "CMD quote USERHOST %%s\n\n"\ "NAME ENDSUB\n" "CMD \n\n"\ "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD !"XTERM"/usr/sbin/traceroute %%h\n\n"\ "NAME %s\n" "CMD !"XTERM"ping -c 4 %%h\n\n"\ "NAME %s\n" "CMD !"XTERM"telnet %%h\n\n"\ "NAME ENDSUB\n" "CMD \n\n"\ "NAME %s\n" "CMD query %%s\n\n", _("Direct client-to-client"), _("Send File"), _("Offer Chat"), _("Abort Chat"), _("Version"), _("Userinfo"), _("Clientinfo"), _("Ping"), _("Time"), _("Finger"), _("Oper"), _("Kill this user"), _("Mode"), _("Give Voice"), _("Take Voice"), _("Give Ops"), _("Take Ops"), _("Ignore"), _("Ignore User"), _("UnIgnore User"), _("Kick/Ban"), _("Kick"), _("Ban"), _("Ban"), _("Ban"), _("Ban"), _("Ban"), _("KickBan"), _("KickBan"), _("KickBan"), _("KickBan"), _("Info"), _("Who"), _("WhoIs"), _("DNS Lookup"), _("Trace"), _("UserHost"), _("External"), _("Traceroute"), _("Ping"), _("Telnet"), _("Open Dialog Window") ); list_loadconf ("popup.conf", &popup_list, buf); snprintf (buf, sizeof (buf), "NAME %s\n" "CMD discon\n\n" "NAME %s\n" "CMD reconnect\n\n" "NAME %s\n" "CMD part\n\n" "NAME %s\n" "CMD getstr # join \"%s\"\n\n" "NAME %s\n" "CMD quote LINKS\n\n" "NAME %s\n" "CMD ping\n\n" "NAME TOGGLE %s\n" "CMD irc_hide_version\n\n", _("Disconnect"), _("Reconnect"), _("Leave Channel"), _("Join Channel..."), _("Enter Channel to Join:"), _("Server Links"), _("Ping Server"), _("Hide Version")); list_loadconf ("usermenu.conf", &usermenu_list, buf); snprintf (buf, sizeof (buf), "NAME %s\n" "CMD op %%a\n\n" "NAME %s\n" "CMD deop %%a\n\n" "NAME %s\n" "CMD ban %%s\n\n" "NAME %s\n" "CMD getstr %s \"kick %%s\" \"%s\"\n\n" "NAME %s\n" "CMD dcc send %%s\n\n" "NAME %s\n" "CMD query %%s\n\n", _("Op"), _("DeOp"), _("Ban"), _("Kick"), _("bye"), _("Enter reason to kick %s:"), _("Sendfile"), _("Dialog")); list_loadconf ("buttons.conf", &button_list, buf); snprintf (buf, sizeof (buf), "NAME %s\n" "CMD whois %%s %%s\n\n" "NAME %s\n" "CMD dcc send %%s\n\n" "NAME %s\n" "CMD dcc chat %%s\n\n" "NAME %s\n" "CMD ping %%s\n\n" "NAME %s\n" "CMD clear\n\n", _("WhoIs"), _("Send"), _("Chat"), _("Ping"), _("Clear")); list_loadconf ("dlgbuttons.conf", &dlgbutton_list, buf); list_loadconf ("ctcpreply.conf", &ctcp_list, defaultconf_ctcp); list_loadconf ("commands.conf", &command_list, defaultconf_commands); list_loadconf ("replace.conf", &replace_list, defaultconf_replace); list_loadconf ("urlhandlers.conf", &urlhandler_list, defaultconf_urlhandlers); servlist_init (); /* load server list */ if (!prefs.slist_skip) fe_serverlist_open (NULL); /* turned OFF via -a arg */ if (auto_connect) { /* do any auto connects */ if (!servlist_have_auto ()) /* if no new windows open .. */ { /* and no serverlist gui ... */ if (prefs.slist_skip || connect_url) /* we'll have to open one. */ new_ircwindow (NULL, NULL, SESS_SERVER); } else { fe_idle_add (xchat_auto_connect, NULL); } } else { if (prefs.slist_skip) new_ircwindow (NULL, NULL, SESS_SERVER); } }
static void xchat_init (void) { char buf[3068]; const char *cs = NULL; #ifdef WIN32 WSADATA wsadata; #ifdef USE_IPV6 if (WSAStartup(0x0202, &wsadata) != 0) { MessageBox (NULL, "Cannot find winsock 2.2+", "Error", MB_OK); exit (0); } #else WSAStartup(0x0101, &wsadata); #endif /* !USE_IPV6 */ #endif /* !WIN32 */ #ifdef USE_SIGACTION struct sigaction act; /* ignore SIGPIPE's */ act.sa_handler = SIG_IGN; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigaction (SIGPIPE, &act, NULL); /* Deal with SIGUSR1's & SIGUSR2's */ act.sa_sigaction = sigusr1_handler; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigaction (SIGUSR1, &act, NULL); act.sa_sigaction = sigusr2_handler; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigaction (SIGUSR2, &act, NULL); #else #ifndef WIN32 /* good enough for these old systems */ signal (SIGPIPE, SIG_IGN); #endif #endif if (g_get_charset (&cs)) prefs.utf8_locale = TRUE; load_text_events (); sound_load (); notify_load (); ignore_load (); snprintf (buf, sizeof (buf), "NAME %s~%s~\n" "CMD query %%s\n\n"\ "NAME %s~%s~\n" "CMD send %%s\n\n"\ "NAME %s~%s~\n" "CMD whois %%s %%s\n\n"\ "NAME %s~%s~\n" "CMD notify -n ASK %%s\n\n"\ "NAME %s~%s~\n" "CMD ignore %%s!*@* ALL\n\n"\ "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD op %%a\n\n"\ "NAME %s\n" "CMD deop %%a\n\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME %s\n" "CMD voice %%a\n\n"\ "NAME %s\n" "CMD devoice %%a\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD kick %%s\n\n"\ "NAME %s\n" "CMD ban %%s\n\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME %s *!*@*.host\n""CMD ban %%s 0\n\n"\ "NAME %s *!*@domain\n""CMD ban %%s 1\n\n"\ "NAME %s *!*user@*.host\n""CMD ban %%s 2\n\n"\ "NAME %s *!*user@domain\n""CMD ban %%s 3\n\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME %s *!*@*.host\n""CMD kickban %%s 0\n\n"\ "NAME %s *!*@domain\n""CMD kickban %%s 1\n\n"\ "NAME %s *!*user@*.host\n""CMD kickban %%s 2\n\n"\ "NAME %s *!*user@domain\n""CMD kickban %%s 3\n\n"\ "NAME ENDSUB\n" "CMD \n\n"\ "NAME ENDSUB\n" "CMD \n\n", _("_Open Dialog Window"), "gtk-go-up", _("_Send a File"), "gtk-floppy", _("_User Info (WhoIs)"), "gtk-info", _("_Add to Friends List"), "gtk-add", _("_Ignore"), "gtk-stop", _("O_perator Actions"), _("Give Ops"), _("Take Ops"), _("Give Voice"), _("Take Voice"), _("Kick/Ban"), _("Kick"), _("Ban"), _("Ban"), _("Ban"), _("Ban"), _("Ban"), _("KickBan"), _("KickBan"), _("KickBan"), _("KickBan")); list_loadconf ("popup.conf", &popup_list, buf); snprintf (buf, sizeof (buf), "NAME %s\n" "CMD part\n\n" "NAME %s\n" "CMD getstr # join \"%s\"\n\n" "NAME %s\n" "CMD quote LINKS\n\n" "NAME %s\n" "CMD ping\n\n" "NAME TOGGLE %s\n" "CMD irc_hide_version\n\n", _("Leave Channel"), _("Join Channel..."), _("Enter Channel to Join:"), _("Server Links"), _("Ping Server"), _("Hide Version")); list_loadconf ("usermenu.conf", &usermenu_list, buf); snprintf (buf, sizeof (buf), "NAME %s\n" "CMD op %%a\n\n" "NAME %s\n" "CMD deop %%a\n\n" "NAME %s\n" "CMD ban %%s\n\n" "NAME %s\n" "CMD getstr \"%s\" \"kick %%s\" \"%s\"\n\n" "NAME %s\n" "CMD send %%s\n\n" "NAME %s\n" "CMD query %%s\n\n", _("Op"), _("DeOp"), _("Ban"), _("Kick"), _("bye"), _("Enter reason to kick %s:"), _("Sendfile"), _("Dialog")); list_loadconf ("buttons.conf", &button_list, buf); snprintf (buf, sizeof (buf), "NAME %s\n" "CMD whois %%s %%s\n\n" "NAME %s\n" "CMD send %%s\n\n" "NAME %s\n" "CMD dcc chat %%s\n\n" "NAME %s\n" "CMD clear\n\n" "NAME %s\n" "CMD ping %%s\n\n", _("WhoIs"), _("Send"), _("Chat"), _("Clear"), _("Ping")); list_loadconf ("dlgbuttons.conf", &dlgbutton_list, buf); list_loadconf ("tabmenu.conf", &tabmenu_list, NULL); list_loadconf ("ctcpreply.conf", &ctcp_list, defaultconf_ctcp); list_loadconf ("commands.conf", &command_list, defaultconf_commands); list_loadconf ("replace.conf", &replace_list, defaultconf_replace); list_loadconf ("urlhandlers.conf", &urlhandler_list, defaultconf_urlhandlers); servlist_init (); /* load server list */ /* if we got a URL, don't open the server list GUI */ if (!prefs.hex_gui_slist_skip && !arg_url && !arg_urls) fe_serverlist_open (NULL); /* turned OFF via -a arg or by passing urls */ if (!arg_dont_autoconnect && !arg_urls) { /* do any auto connects */ if (!servlist_have_auto ()) /* if no new windows open .. */ { /* and no serverlist gui ... */ if (prefs.hex_gui_slist_skip || arg_url || arg_urls) /* we'll have to open one. */ new_ircwindow (NULL, NULL, SESS_SERVER, 0); } else { fe_idle_add (xchat_auto_connect, NULL); } } else { if (prefs.hex_gui_slist_skip || arg_url || arg_urls) new_ircwindow (NULL, NULL, SESS_SERVER, 0); } }
static void xchat_init (void) { char buf[3068]; const char *cs = NULL; #ifdef USE_SIGACTION struct sigaction act; /* ignore SIGPIPE's */ act.sa_handler = SIG_IGN; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigaction (SIGPIPE, &act, NULL); /* Deal with SIGUSR1's & SIGUSR2's */ act.sa_sigaction = sigusr1_handler; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigaction (SIGUSR1, &act, NULL); act.sa_sigaction = sigusr2_handler; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigaction (SIGUSR2, &act, NULL); #else /* good enough for these old systems */ signal (SIGPIPE, SIG_IGN); #endif if (g_get_charset (&cs)) prefs.utf8_locale = TRUE; command_init (); load_text_events (); notify_load (); ignore_load (); signal_printer_init(); proto_irc_init(); upnp_init(); sasl_init(); snprintf (buf, sizeof (buf), "NAME %s\n" "CMD query %%s\n\n"\ "NAME %s\n" "CMD send %%s\n\n"\ "NAME %s\n" "CMD whois %%s %%s\n\n"\ "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD op %%a\n\n"\ "NAME %s\n" "CMD deop %%a\n\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME %s\n" "CMD voice %%a\n\n"\ "NAME %s\n" "CMD devoice %%a\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME SUB\n" "CMD %s\n\n"\ "NAME %s\n" "CMD kick %%s\n\n"\ "NAME %s\n" "CMD ban %%s\n\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME %s *!*@*.host\n" "CMD ban %%s 0\n\n"\ "NAME %s *!*@domain\n" "CMD ban %%s 1\n\n"\ "NAME %s *!*user@*.host\n" "CMD ban %%s 2\n\n"\ "NAME %s *!*user@domain\n" "CMD ban %%s 3\n\n"\ "NAME SEP\n" "CMD \n\n"\ "NAME %s *!*@*.host\n" "CMD kickban %%s 0\n\n"\ "NAME %s *!*@domain\n" "CMD kickban %%s 1\n\n"\ "NAME %s *!*user@*.host\n" "CMD kickban %%s 2\n\n"\ "NAME %s *!*user@domain\n" "CMD kickban %%s 3\n\n"\ "NAME ENDSUB\n" "CMD \n\n"\ "NAME ENDSUB\n" "CMD \n\n", _("Open Query"), _("Send a File"), _("User Info (WHOIS)"), _("Operator Actions"), _("Give Ops"), _("Take Ops"), _("Give Voice"), _("Take Voice"), _("Kick/Ban"), _("Kick"), _("Ban"), _("Ban"), _("Ban"), _("Ban"), _("Ban"), _("KickBan"), _("KickBan"), _("KickBan"), _("KickBan")); list_loadconf ("popup.conf", &popup_list, buf); snprintf (buf, sizeof (buf), "NAME %s\n" "CMD part\n\n" "NAME %s\n" "CMD getstr # join \"%s\"\n\n" "NAME %s\n" "CMD quote LINKS\n\n" "NAME %s\n" "CMD ping\n\n" "NAME TOGGLE %s\n" "CMD irc_hide_version\n\n", _("Leave Channel"), _("Join Channel..."), _("Enter Channel to Join:"), _("Server Links"), _("Ping Server"), _("Hide Version")); list_loadconf ("usermenu.conf", &usermenu_list, buf); snprintf (buf, sizeof (buf), "NAME %s\n" "CMD op %%a\n\n" "NAME %s\n" "CMD deop %%a\n\n" "NAME %s\n" "CMD ban %%s\n\n" "NAME %s\n" "CMD getstr \"%s\" \"kick %%s\" \"%s\"\n\n" "NAME %s\n" "CMD send %%s\n\n" "NAME %s\n" "CMD query %%s\n\n", _("Op"), _("DeOp"), _("Ban"), _("Kick"), _("bye"), _("Enter reason to kick %s:"), _("Sendfile"), _("Query")); list_loadconf ("buttons.conf", &button_list, buf); snprintf (buf, sizeof (buf), "NAME %s\n" "CMD whois %%s %%s\n\n" "NAME %s\n" "CMD send %%s\n\n" "NAME %s\n" "CMD dcc chat %%s\n\n" "NAME %s\n" "CMD clear\n\n" "NAME %s\n" "CMD ping %%s\n\n", _("WhoIs"), _("Send"), _("Chat"), _("Clear"), _("Ping")); list_loadconf ("dlgbuttons.conf", &dlgbutton_list, buf); list_loadconf ("tabmenu.conf", &tabmenu_list, NULL); list_loadconf ("ctcpreply.conf", &ctcp_list, defaultconf_ctcp); list_loadconf ("commands.conf", &command_list, defaultconf_commands); list_loadconf ("replace.conf", &replace_list, defaultconf_replace); #ifdef REGEX_SUBSTITUTION regex_list_loadconf("regex_replace.conf", ®ex_replace_list, defaultconf_regex_replace); #endif list_loadconf ("urlhandlers.conf", &urlhandler_list, defaultconf_urlhandlers); servlist_init (); /* load server list */ main_sess = new_ircwindow_fake (NULL, _(DISPLAY_NAME), SESS_SERVER, 0); main_sess->immutable = TRUE; /* turned OFF via -a arg */ if (!arg_dont_autoconnect && servlist_have_auto()) g_idle_add ((GSourceFunc) servlist_auto_connect, NULL); /* if we got a URL, don't open the server list GUI */ if (!prefs.skip_serverlist && !servlist_have_auto() && !arg_url) fe_serverlist_open (NULL); }