示例#1
0
void atheme_setup(void)
{
#if HAVE_UMASK
	/* file creation mask */
	umask(077);
#endif

	base_eventloop = mowgli_eventloop_create();
        hooks_init();
	db_init();

	init_resolver();

	translation_init();
#ifdef ENABLE_NLS
	language_init();
#endif
	init_nodes();
	init_confprocess();
	init_newconf();
	servtree_init();

	register_email_canonicalizer(canonicalize_email_case, NULL);

	modules_init();
	pcommand_init();

	authcookie_init();
	common_ctcp_init();
}
示例#2
0
文件: sigyn.c 项目: alyx/sigyn
int main(int argc, char *argv[])
{
    me.ev = mowgli_eventloop_create();

    signals_init();

    parse_commandline_options(argc, argv);

    me.config = mowgli_config_file_load(config_file);

    if(me.config == NULL)
        sigyn_fatal("Cannot load configuration file.");
    logger_init(me.config->entries);
    config_check(me.config);

    me.uplink.line = new_conn(me.uplink.hostname, me.uplink.port, me.uplink.ssl, read_irc, NULL);
    if (me.uplink.line == NULL)
        sigyn_fatal("Connection to uplink failed.");
    me.uplink.connected = true;

    loadmodules(me.config->entries);

    sigyn_introduce_client(me.client->nick, me.client->user, NULL);
    if (should_fork)
        daemonise(SYSCONFDIR "/sigyn.pid");
    mowgli_eventloop_run(me.ev);

    sigyn_cleanup();
    return EXIT_SUCCESS;
}
示例#3
0
文件: atheme.c 项目: ballock/atheme
void atheme_setup(void)
{
#if HAVE_UMASK
	/* file creation mask */
	umask(077);
#endif

	base_eventloop = mowgli_eventloop_create();
        hooks_init();
	db_init();

	init_resolver();

	translation_init();
#ifdef ENABLE_NLS
	language_init();
#endif
	init_nodes();
	init_confprocess();
	init_newconf();
	servtree_init();

	hook_add_event("email_canonicalize");
	hook_add_email_canonicalize(canonicalize_email_case);
	/* No need for canonicalize_emails(), no accounts exist yet. */

	modules_init();
	pcommand_init();

	authcookie_init();
	common_ctcp_init();
}
示例#4
0
int main(int argc, const char **argv)
{
    base_eventloop = mowgli_eventloop_create ();
    
    irc_connect(argv[1], argv[2]);
    
    mowgli_eventloop_run (base_eventloop);
    return EXIT_SUCCESS; 
}
示例#5
0
int main(int argc, char *argv[])
{
	mowgli_eventloop_t *base_eventloop;

	/* Bleh this is needed to ensure some systems can set the process title */
	argv = mowgli_proctitle_init(argc, argv);

	base_eventloop = mowgli_eventloop_create();

	helper_spawn(base_eventloop);

	mowgli_eventloop_run(base_eventloop);

	return EXIT_SUCCESS;
}
示例#6
0
int main(int argc, char *argv[])
{
	eventloop = mowgli_eventloop_create();

	mowgli_timer_add(eventloop, "timer_tick", timer_tick, NULL, 1);
	mowgli_timer_add_once(eventloop, "timer_oneshot", timer_oneshot, NULL, 5);

	mowgli_eventloop_run(eventloop);

	printf("eventloop halted\n");

	mowgli_eventloop_destroy(eventloop);

	return EXIT_SUCCESS;
}
示例#7
0
int
main(void)
{
	mowgli_eventloop_t *evloop = mowgli_eventloop_create();
	mowgli_dns_t *dns = mowgli_dns_create(evloop, MOWGLI_DNS_TYPE_ASYNC);
	mowgli_eventloop_pollable_t *stdin_pollable = mowgli_pollable_create(evloop, STDIN_FILENO, dns);

	mowgli_pollable_set_nonblocking(stdin_pollable, true);

	mowgli_pollable_setselect(evloop, stdin_pollable, MOWGLI_EVENTLOOP_IO_READ, read_data);

	mowgli_eventloop_run(evloop);

	mowgli_eventloop_destroy(evloop);

	return 0;
}
示例#8
0
static void
mowgli_helper_trampoline(mowgli_helper_create_req_t *req)
{
	mowgli_eventloop_helper_proc_t *helper;
#ifndef _WIN32
	int i, x;
#endif

	return_if_fail(req != NULL);
	return_if_fail(req->start_fn != NULL);

	helper = mowgli_alloc(sizeof(mowgli_eventloop_helper_proc_t));
	helper->type.type = MOWGLI_EVENTLOOP_TYPE_HELPER;
	helper->fd = req->fd;

#ifndef _WIN32
	for (i = 0; i < 1024; i++)
	{
		if (i != req->fd)
			close(i);
	}

	x = open("/dev/null", O_RDWR);

	for (i = 0; i < 2; i++)
	{
		if (req->fd != i)
			dup2(x, i);
	}

	if (x > 2)
		close(x);
#endif

	helper->eventloop = mowgli_eventloop_create();
	helper->pfd = mowgli_pollable_create(helper->eventloop, helper->fd, helper);
	helper->userdata = req->userdata;

	mowgli_pollable_set_nonblocking(helper->pfd, true);

	req->start_fn(helper, helper->userdata);
}