summaryrefslogtreecommitdiff
path: root/src/fe-none
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-04-26 08:03:38 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-04-26 08:03:38 +0000
commitc95034c6de1bf72536595e1e3431d8ec64b9880e (patch)
treee51aa4528257ed8aa9d53640649519f299aaf0c7 /src/fe-none
parentd01b094151705d433bc43cae9eeb304e6f110a17 (diff)
downloadirssi-c95034c6de1bf72536595e1e3431d8ec64b9880e.zip
..adding new files..
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@171 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-none')
-rw-r--r--src/fe-none/Makefile.am24
-rw-r--r--src/fe-none/irssi.c94
-rw-r--r--src/fe-none/module.h3
3 files changed, 121 insertions, 0 deletions
diff --git a/src/fe-none/Makefile.am b/src/fe-none/Makefile.am
new file mode 100644
index 00000000..b61f4dd2
--- /dev/null
+++ b/src/fe-none/Makefile.am
@@ -0,0 +1,24 @@
+bin_PROGRAMS = irssi-bot
+
+INCLUDES = $(GLIB_CFLAGS)
+
+INCLUDES = \
+ $(GLIB_CFLAGS) \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/src/core/ \
+ -I$(top_srcdir)/src/irc/core/
+
+irssi_bot_DEPENDENCIES = @IRC_LIBS@ @CORE_LIBS@
+
+irssi_bot_LDADD = \
+ @IRC_LIBS@ \
+ @CORE_LIBS@ \
+ $(PROG_LIBS) \
+ $(INTLLIBS) \
+ $(PERL_LDFLAGS)
+
+irssi_bot_SOURCES = \
+ irssi.c
+
+noinst_HEADERS = \
+ module.h
diff --git a/src/fe-none/irssi.c b/src/fe-none/irssi.c
new file mode 100644
index 00000000..1ec3ca84
--- /dev/null
+++ b/src/fe-none/irssi.c
@@ -0,0 +1,94 @@
+/*
+ irssi.c : irssi
+
+ Copyright (C) 1999-2000 Timo Sirainen
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "module.h"
+#include "args.h"
+#include "signals.h"
+#include "core.h"
+#include "irc-core.h"
+
+void irc_init(void);
+void irc_deinit(void);
+
+static GMainLoop *main_loop;
+static char *autoload_module;
+static int reload;
+
+static void sig_exit(void)
+{
+ g_main_quit(main_loop);
+}
+
+static void sig_reload(void)
+{
+ reload = TRUE;
+}
+
+void noui_init(void)
+{
+ static struct poptOption options[] = {
+ POPT_AUTOHELP
+ { "load", 'l', POPT_ARG_STRING, &autoload_module, 0, "Module to load (default = bot)", "MODULE" },
+ { NULL, '\0', 0, NULL }
+ };
+
+ autoload_module = NULL;
+ args_register(options);
+
+ irssi_gui = IRSSI_GUI_NONE;
+ core_init();
+ irc_init();
+
+ signal_add("reload", (SIGNAL_FUNC) sig_reload);
+ signal_add("gui exit", (SIGNAL_FUNC) sig_exit);
+ signal_emit("irssi init finished", 0);
+}
+
+void noui_deinit(void)
+{
+ signal_remove("reload", (SIGNAL_FUNC) sig_reload);
+ signal_remove("gui exit", (SIGNAL_FUNC) sig_exit);
+ irc_deinit();
+ core_deinit();
+}
+
+int main(int argc, char **argv)
+{
+#ifdef HAVE_SOCKS
+ SOCKSinit(argv[0]);
+#endif
+ noui_init();
+ args_execute(argc, argv);
+
+ if (autoload_module == NULL)
+ autoload_module = "bot";
+
+ do {
+ reload = FALSE;
+ module_load(autoload_module, "");
+ main_loop = g_main_new(TRUE);
+ g_main_run(main_loop);
+ g_main_destroy(main_loop);
+ }
+ while (reload);
+ noui_deinit();
+
+ return 0;
+}
diff --git a/src/fe-none/module.h b/src/fe-none/module.h
new file mode 100644
index 00000000..1bb9e252
--- /dev/null
+++ b/src/fe-none/module.h
@@ -0,0 +1,3 @@
+#include "common.h"
+
+#define MODULE_NAME "fe-none"