Exemple #1
0
static void textui_finish_init(void)
{
	quitting = FALSE;

	if (dummy)
		term_dummy_init();
	else {
		term_refresh_freeze();
	        textbuffer_init();
	        textbuffer_view_init();
		textbuffer_commands_init();
		gui_expandos_init();
		gui_printtext_init();
		gui_readline_init();
	        lastlog_init();
		mainwindows_init();
		mainwindow_activity_init();
		mainwindows_layout_init();
		gui_windows_init();
		statusbar_init();
		term_refresh_thaw();

		/* don't check settings with dummy mode */
		settings_check();
	}

	module_register("core", "fe-text");

#ifdef HAVE_STATIC_PERL
	perl_core_init();
	fe_perl_init();
#endif

	dirty_check();

	fe_common_core_finish_init();
	signal_emit("irssi init finished", 0);
	statusbar_redraw(NULL, TRUE);

	if (servers == NULL && lookup_servers == NULL) {
		printtext(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT,
			  "%s", banner_text);
	}

	if (display_firsttimer) {
		printtext(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT,
			  "%s", firsttimer_text);
	}
}
Exemple #2
0
void textbuffer_view_remove_lines_by_level(TEXT_BUFFER_VIEW_REC *view, int level)
{
	LINE_REC *line, *next;
	
	term_refresh_freeze();
	line = textbuffer_view_get_lines(view);

	while (line != NULL) {
		next = line->next;

		if (line->info.level & level)
			textbuffer_view_remove_line(view, line);
		line = next;
	}
	textbuffer_view_redraw(view);
	term_refresh_thaw();
}
Exemple #3
0
static void textui_deinit(void)
{
	signal(SIGINT, SIG_DFL);

        term_refresh_freeze();
	while (modules != NULL)
		module_unload(modules->data);

#ifdef HAVE_STATIC_PERL
	perl_core_deinit();
	fe_perl_deinit();
#endif

#ifdef HAVE_STATIC_OTR
	otr_core_deinit();
#endif

	dirty_check(); /* one last time to print any quit messages */
	signal_remove("settings userinfo changed", (SIGNAL_FUNC) sig_settings_userinfo_changed);
	signal_remove("gui exit", (SIGNAL_FUNC) sig_exit);

	lastlog_deinit();
	statusbar_deinit();
	gui_entry_deinit();
	gui_printtext_deinit();
	gui_readline_deinit();
	gui_windows_deinit();
	mainwindows_layout_deinit();
	mainwindow_activity_deinit();
	mainwindows_deinit();
	gui_expandos_deinit();
	textbuffer_commands_deinit();
	textbuffer_view_deinit();
	textbuffer_deinit();

	term_refresh_thaw();
	term_deinit();

	theme_unregister();

	fe_common_irc_deinit();
	fe_common_core_deinit();
	irc_deinit();
	core_deinit();
}
/* SYNTAX: SCROLLBACK REDRAW */
static void cmd_scrollback_redraw(void)
{
	GUI_WINDOW_REC *gui;
	LINE_REC *line, *next;

	gui = WINDOW_GUI(active_win);

	term_refresh_freeze();
	line = textbuffer_view_get_lines(gui->view);
	while (line != NULL) {
		next = line->next;
		textbuffer_reformat_line(active_win, line);
                line = next;
	}

	gui_window_redraw(active_win);
	term_refresh_thaw();
}
Exemple #5
0
static void window_lastlog_clear(WINDOW_REC *window)
{
	TEXT_BUFFER_VIEW_REC *view;
        LINE_REC *line, *next;

        term_refresh_freeze();
	view = WINDOW_GUI(window)->view;
	line = textbuffer_view_get_lines(view);

	while (line != NULL) {
                next = line->next;

		if (line->info.level & MSGLEVEL_LASTLOG)
			textbuffer_view_remove_line(view, line);
                line = next;
	}
        textbuffer_view_redraw(view);
        term_refresh_thaw();
}
Exemple #6
0
static void textui_finish_init(void)
{
	quitting = FALSE;

	if (dummy)
		term_dummy_init();
	else {
		term_refresh_freeze();
	        textbuffer_init();
	        textbuffer_view_init();
		textbuffer_commands_init();
		textbuffer_reformat_init();
		gui_expandos_init();
		gui_printtext_init();
		gui_readline_init();
	        lastlog_init();
		mainwindows_init();
		mainwindow_activity_init();
		mainwindows_layout_init();
		gui_windows_init();
		statusbar_init();
		term_refresh_thaw();
	}

	settings_check();
	module_register("core", "fe-text");

#ifdef HAVE_STATIC_PERL
	perl_core_init();
	fe_perl_init();
#endif

	dirty_check();

	fe_common_core_finish_init();
	signal_emit("irssi init finished", 0);

	if (display_firsttimer) {
		printtext_window(active_win, MSGLEVEL_CLIENTNOTICE,
				 "%s", firsttimer_text);
	}
}
Exemple #7
0
static void textui_finish_init(void)
{
	quitting = FALSE;

	if (dummy)
		term_dummy_init();
	else {
		term_refresh_freeze();
	        textbuffer_init();
	        textbuffer_view_init();
		textbuffer_commands_init();
		textbuffer_reformat_init();
		gui_expandos_init();
		gui_printtext_init();
		gui_readline_init();
	        lastlog_init();
		mainwindows_init();
		mainwindow_activity_init();
		mainwindows_layout_init();
		gui_windows_init();
		statusbar_init();
		term_refresh_thaw();

		/* don't check settings with dummy mode */
		settings_check();
	}

	module_register("core", "fe-text");

#ifdef HAVE_STATIC_PERL
	perl_core_init();
	fe_perl_init();
#endif

	dirty_check();

	fe_common_core_finish_init();
	signal_emit("irssi init finished", 0);
}
Exemple #8
0
int main(int argc, char **argv)
{
	static int version = 0;
	static GOptionEntry options[] = {
		{ "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, "Use the dummy terminal mode", NULL },
		{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display irssi version", NULL },
		{ NULL }
	};

#ifdef USE_GC
	g_mem_set_vtable(&gc_mem_table);
#endif

	core_register_options();
	fe_common_core_register_options();
	args_register(options);
	args_execute(argc, argv);

 	if (version) {
		printf(PACKAGE_TARNAME" " PACKAGE_VERSION" (%d %04d)\n",
		       IRSSI_VERSION_DATE, IRSSI_VERSION_TIME);
		return 0;
	}

	srand(time(NULL));

	dummy = FALSE;
	quitting = FALSE;
	core_preinit(argv[0]);

	check_files();

#ifdef WIN32
        winsock_init();
#endif
#ifdef HAVE_SOCKS
	SOCKSinit(argv[0]);
#endif

	/* setlocale() must be called at the beginning before any calls that
	   affect it, especially regexps seem to break if they're generated
	   before this call.

	   locales aren't actually used for anything else than autodetection
	   of UTF-8 currently..  

	   furthermore to get the users's charset with g_get_charset() properly 
	   you have to call setlocale(LC_ALL, "") */
	setlocale(LC_ALL, "");

	textui_init();

	if (!dummy && !term_init()) {
		fprintf(stderr, "Can't initialize screen handling, quitting.\n");
		fprintf(stderr, "You can still use the dummy mode with -d parameter\n");
		return 1;
	}

	textui_finish_init();
	main_loop = g_main_new(TRUE);

	/* Does the same as g_main_run(main_loop), except we
	   can call our dirty-checker after each iteration */
	while (!quitting) {
#ifdef USE_GC
		GC_collect_a_little();
#endif
		if (!dummy) term_refresh_freeze();
		g_main_iteration(TRUE);
                if (!dummy) term_refresh_thaw();

		if (reload_config) {
                        /* SIGHUP received, do /RELOAD */
			reload_config = FALSE;
                        signal_emit("command reload", 1, "");
		}

		dirty_check();
	}

	g_main_destroy(main_loop);
	textui_deinit();

        session_upgrade(); /* if we /UPGRADEd, start the new process */
	return 0;
}
Exemple #9
0
int main(int argc, char **argv)
{
	static int version = 0;
	static GOptionEntry options[] = {
		{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display Irssi version", NULL },
		{ NULL }
	};
	int loglev;

	core_register_options();
	fe_common_core_register_options();
	args_register(options);
	args_execute(argc, argv);

 	if (version) {
		printf(PACKAGE_TARNAME" " PACKAGE_VERSION" (%d %04d)\n",
		       IRSSI_VERSION_DATE, IRSSI_VERSION_TIME);
		return 0;
	}

	srand(time(NULL));

	quitting = FALSE;
	core_preinit(argv[0]);

	check_files();

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

	/* setlocale() must be called at the beginning before any calls that
	   affect it, especially regexps seem to break if they're generated
	   before this call.

	   locales aren't actually used for anything else than autodetection
	   of UTF-8 currently..

	   furthermore to get the users's charset with g_get_charset() properly
	   you have to call setlocale(LC_ALL, "") */
	setlocale(LC_ALL, "");

	/* Temporarily raise the fatal level to abort on config errors. */
	loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL);
	textui_init();

	if (!term_init()) {
		fprintf(stderr, "Can't initialize screen handling.\n");
		return 1;
	}

	g_log_set_always_fatal(loglev);
	textui_finish_init();
	main_loop = g_main_new(TRUE);

	/* Does the same as g_main_run(main_loop), except we
	   can call our dirty-checker after each iteration */
	while (!quitting) {
		if (reload_config) {
			/* SIGHUP received, do /RELOAD */
			reload_config = FALSE;
			signal_emit("command reload", 1, "");
		}

		dirty_check();

		term_refresh_freeze();
		g_main_iteration(TRUE);
		term_refresh_thaw();
	}

	g_main_destroy(main_loop);
	textui_deinit();

	session_upgrade(); /* if we /UPGRADEd, start the new process */
	return 0;
}
Exemple #10
0
static void textui_finish_init(void)
{
	int loglev;
	quitting = FALSE;

	term_refresh_freeze();
	textbuffer_init();
	textbuffer_view_init();
	textbuffer_commands_init();
	gui_expandos_init();
	gui_printtext_init();
	gui_readline_init();
	gui_entry_init();
	lastlog_init();
	mainwindows_init();
	mainwindow_activity_init();
	mainwindows_layout_init();
	gui_windows_init();
	/* Temporarily raise the fatal level to abort on config errors. */
	loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL);
	statusbar_init();
	g_log_set_always_fatal(loglev);
	term_refresh_thaw();

	settings_check();

	module_register("core", "fe-text");

#ifdef HAVE_STATIC_PERL
	perl_core_init();
	fe_perl_init();
#endif

#ifdef HAVE_STATIC_OTR
	otr_core_init();
#endif

	dirty_check();

	fe_common_core_finish_init();
	signal_emit("irssi init finished", 0);
	statusbar_redraw(NULL, TRUE);

	if (servers == NULL && lookup_servers == NULL) {
		printformat(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, TXT_IRSSI_BANNER);
	}

	if (display_firsttimer) {
		printformat(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, TXT_WELCOME_FIRSTTIME);
	}

	/* see irc-servers-setup.c:init_userinfo */
	if (user_settings_changed)
		printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_WELCOME_INIT_SETTINGS);
	if (user_settings_changed & USER_SETTINGS_REAL_NAME)
		fe_settings_set_print("real_name");
	if (user_settings_changed & USER_SETTINGS_USER_NAME)
		fe_settings_set_print("user_name");
	if (user_settings_changed & USER_SETTINGS_NICK)
		fe_settings_set_print("nick");
	if (user_settings_changed & USER_SETTINGS_HOSTNAME)
		fe_settings_set_print("hostname");

	term_environment_check();
}
Exemple #11
0
int main(int argc, char **argv)
{
	static struct poptOption options[] = {
		{ "dummy", 'd', POPT_ARG_NONE, &dummy, 0, "Use the dummy terminal mode", NULL },
		{ NULL, '\0', 0, NULL }
	};

	dummy = FALSE;
	quitting = FALSE;
	core_init_paths(argc, argv);

	check_files();

#ifdef WIN32
        winsock_init();
#endif
#ifdef HAVE_SOCKS
	SOCKSinit(argv[0]);
#endif
#ifdef ENABLE_NLS
	/* initialize the i18n stuff */
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);
#endif

	/* setlocale() must be called at the beginning before any calls that
	   affect it, especially regexps seem to break if they're generated
	   before t his call.

	   locales aren't actually used for anything else than autodetection
	   of UTF-8 currently.. */
	setlocale(LC_CTYPE, "");

	textui_init();
	args_register(options);
	args_execute(argc, argv);

	if (!dummy && !term_init()) {
		fprintf(stderr, "Can't initialize screen handling, quitting.\n");
		fprintf(stderr, "You can still use the dummy mode with -d parameter\n");
		return 1;
	}

	textui_finish_init();
	main_loop = g_main_new(TRUE);

	/* Does the same as g_main_run(main_loop), except we
	   can call our dirty-checker after each iteration */
	while (!quitting) {
                if (!dummy) term_refresh_freeze();
		g_main_iteration(TRUE);
                if (!dummy) term_refresh_thaw();

		if (reload_config) {
                        /* SIGHUP received, do /RELOAD */
			reload_config = FALSE;
                        signal_emit("command reload", 1, "");
		}

		dirty_check();
	}

	g_main_destroy(main_loop);
	textui_deinit();

        session_upgrade(); /* if we /UPGRADEd, start the new process */
	return 0;
}