Пример #1
0
/**
 * Implementation of OM_NEW
 *
 * @param cl the class
 * @param obj the object
 * @param msg the parameter of the method
 * @return
 */
STATIC ULONG AddressGroupList_New(struct IClass *cl,Object *obj,struct opSet *msg)
{
	struct AddressGroupList_Data *data;

	if (!(obj=(Object *)DoSuperNew(cl,obj,
					TAG_MORE,msg->ops_AttrList)))
		return 0;

	data = (struct AddressGroupList_Data*)INST_DATA(cl,obj);

	init_hook(&data->construct_hook,(HOOKFUNC)addressgroup_construct);
	init_hook(&data->compare_hook,(HOOKFUNC)addressgroup_compare);
	init_hook(&data->destruct_hook,(HOOKFUNC)addressgroup_destruct);
	init_hook_with_data(&data->display_hook,(HOOKFUNC)addressgroup_display, data);

	SetAttrs(obj,
						MUIA_NList_ConstructHook2, &data->construct_hook,
						MUIA_NList_CompareHook2, &data->compare_hook,
						MUIA_NList_DestructHook2, &data->destruct_hook,
						MUIA_NList_DisplayHook2, &data->display_hook,
						MUIA_NList_Title, TRUE,
						MUIA_NList_Format, ",",
						TAG_DONE);

	return (ULONG)obj;
}
Пример #2
0
/**************************************************************************
 Init the filter window
**************************************************************************/
static void init_filter(void)
{
#if 0
	Object *ok_button, *cancel_button;

	init_hook(&filter_construct_hook,(HOOKFUNC)filter_construct);
	init_hook(&filter_destruct_hook,(HOOKFUNC)filter_destruct);
	init_hook(&filter_display_hook,(HOOKFUNC)filter_display);

	filter_wnd = WindowObject,
		MUIA_Window_ID, MAKE_ID('F','I','L','T'),
		MUIA_Window_Title, "SimpleMail - Edit Filter",
		WindowContents, VGroup,
			Child, VGroup,
				Child, VGroup,
					MUIA_Group_Spacing, 0,
					Child, filter_listview = NListviewObject,
						MUIA_NListview_NList, NListObject,
							MUIA_NList_ConstructHook, &filter_construct_hook,
							MUIA_NList_DestructHook, &filter_destruct_hook,
							MUIA_NList_DisplayHook, &filter_display_hook,
							End,
						End,
					Child, filter_name_string = BetterStringObject,
						StringFrame,
						End,
					End,
				Child, HGroup,
					Child, filter_new_button = MakeButton("_New"),
					Child, filter_remove_button = MakeButton("_Remove"),
					End,
				End,
			Child, HorizLineObject,
			Child, HGroup,
				Child, ok_button = MakeButton("_Ok"),
				Child, cancel_button = MakeButton("_Cancel"),
				End,
			End,
		End;

	if (filter_wnd)
	{
		DoMethod(App, OM_ADDMEMBER, filter_wnd);
		DoMethod(filter_wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, filter_wnd, 3, MUIM_Set, MUIA_Window_Open, FALSE);
		DoMethod(ok_button, MUIM_Notify, MUIA_Pressed, FALSE, filter_wnd, 3, MUIM_CallHook, &hook_standard, filter_ok);
		DoMethod(cancel_button, MUIM_Notify, MUIA_Pressed, FALSE, filter_wnd, 3, MUIM_Set, MUIA_Window_Open, FALSE);
		DoMethod(filter_new_button, MUIM_Notify, MUIA_Pressed, FALSE, filter_wnd, 3, MUIM_CallHook, &hook_standard, filter_new);
		DoMethod(filter_remove_button, MUIM_Notify, MUIA_Pressed, FALSE, filter_listview, 2, MUIM_NList_Remove, MUIV_NList_Remove_Active);

		set(filter_name_string,MUIA_String_AttachedList,filter_listview);
	}
#endif
}
Пример #3
0
void ntpshm_link_activate(struct gps_device_t *session)
/* set up ntpshm storage for a session */
{
    /* allocate a shared-memory segment for "NMEA" time data */
    session->shmIndex = ntpshm_alloc(session->context);

    if (0 > session->shmIndex) {
	gpsd_report(&session->context->errout, LOG_INF, 
                    "NTPD ntpshm_alloc() failed\n");
#if defined(PPS_ENABLE)
    } else if (session->sourcetype == source_usb || session->sourcetype == source_rs232) {
	/* We also have the 1pps capability, allocate a shared-memory segment
	 * for the 1pps time data and launch a thread to capture the 1pps
	 * transitions
	 */
	if ((session->shmIndexPPS = ntpshm_alloc(session->context)) < 0) {
	    gpsd_report(&session->context->errout, LOG_INF, 
                        "NTPD ntpshm_alloc(1) failed\n");
	} else {
	    init_hook(session);
	    session->thread_report_hook = report_hook;
	    session->thread_wrap_hook = wrap_hook;
	    pps_thread_activate(session);
	}
#endif /* PPS_ENABLE */
    }
}
Пример #4
0
/**************************************************************************
 Init rules
**************************************************************************/
static void init_rules(void)
{
#if 0
	Object *ok_button, *cancel_button, *rule_add_button;
	static struct Hook rules_display_hook;
	int i;

	init_hook(&rules_display_hook,(HOOKFUNC)rules_display);

	for (i=0;i<sizeof(rules)/sizeof(struct rule);i++)
	{
		rule_cycle_array[i] = rules[i].name;
		if (rules[i].create) rules[i].create(&rules[i]);
	}

	rules_wnd = WindowObject,
		MUIA_Window_ID, MAKE_ID('R','U','L','S'),
		MUIA_Window_Title, "SimpleMail - Edit Rule",
		WindowContents, VGroup,
			Child, HGroup,
				Child, VGroup,
					Child, rules_page_listview = NListviewObject,
						MUIA_NListview_NList, NListObject,
							MUIA_NList_DisplayHook, &rules_display_hook,
							End,
						End,
					Child, HGroup,
						Child, rules_page_cycle = MakeCycle(NULL,rule_cycle_array),
						Child, rule_add_button = MakeButton("Add"),
						Child, MakeButton("Remove"),
						End,
					End,
				Child, rules_page_group = HGroup,
					Child, rules_page_space = HVSpace,
					End,
				End,
			Child, HorizLineObject,
			Child, HGroup,
				Child, ok_button = MakeButton("_Ok"),
				Child, cancel_button = MakeButton("_Cancel"),
				End,
			End,
		End;

	if (rules_wnd)
	{
		for (i=0;i<sizeof(rules)/sizeof(struct rule);i++)
			DoMethod(App, OM_ADDMEMBER, rules[i].page);

		DoMethod(App, OM_ADDMEMBER, rules_wnd);
		DoMethod(rules_wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, rules_wnd, 3, MUIM_Set, MUIA_Window_Open, FALSE);
		DoMethod(ok_button, MUIM_Notify, MUIA_Pressed, FALSE, rules_wnd, 3, MUIM_CallHook, &hook_standard, rules_ok);
		DoMethod(cancel_button, MUIM_Notify, MUIA_Pressed, FALSE, rules_wnd, 3, MUIM_Set, MUIA_Window_Open, FALSE);
		DoMethod(rule_add_button, MUIM_Notify, MUIA_Pressed, FALSE, rules_wnd, 3, MUIM_CallHook, &hook_standard, rules_new);
	}
#endif
}
Пример #5
0
static DWORD WINAPI main_capture_thread(HANDLE thread_handle)
{
	if (!init_hook(thread_handle)) {
		DbgOut("Failed to init hook\n");
		free_hook();
		return 0;
	}

	capture_loop();
	return 0;
}
Пример #6
0
Файл: init.c Проект: y0ja/Wolf3D
void	init_struct(t_mega *all)
{
    all->e.refresh = 1;
    init_hook(&all->hook);
    init_cam(&all->cam, (int)START_X, (int)START_Y);
    init_player(&all->player);
    init_textures(all);
    all->sprites = init_sprites(all);
    init_minimap(&all->e, &all->hook.minimap);
    stock_minimap(all);
    all->door.x = 0;
}
Пример #7
0
STATIC ULONG PGPList_New(struct IClass *cl,Object *obj,struct opSet *msg)
{
	struct PGPList_Data *data;

	if (!(obj=(Object *)DoSuperNew(cl,obj,
					TAG_MORE,msg->ops_AttrList)))
		return 0;

	data = (struct PGPList_Data*)INST_DATA(cl,obj);
	init_hook(&data->construct_hook,(HOOKFUNC)pgp_construct);
	init_hook(&data->destruct_hook,(HOOKFUNC)pgp_destruct);
	init_hook(&data->display_hook,(HOOKFUNC)pgp_display);

	SetAttrs(obj,
						MUIA_NList_ConstructHook2, &data->construct_hook,
						MUIA_NList_DestructHook2, &data->destruct_hook,
						MUIA_NList_DisplayHook2, &data->display_hook,
						MUIA_NList_Format, ",",
						TAG_DONE);

	return (ULONG)obj;
}
Пример #8
0
void ntpshm_link_activate(struct gps_device_t *session)
/* set up ntpshm storage for a session */
{
    /* don't talk to NTP when we're running inside the test harness */
    if (session->sourcetype == source_pty)
	return;

    if (session->sourcetype != source_pps ) {
	/* allocate a shared-memory segment for "NMEA" time data */
	session->shm_clock = ntpshm_alloc(session->context);

	if (session->shm_clock == NULL) {
	    gpsd_log(&session->context->errout, LOG_WARN,
		     "NTP: ntpshm_alloc() failed\n");
	    return;
        }
    }

#if defined(PPS_ENABLE)
    if (session->sourcetype == source_usb
            || session->sourcetype == source_rs232
            || session->sourcetype == source_pps) {
	/* We also have the 1pps capability, allocate a shared-memory segment
	 * for the 1pps time data and launch a thread to capture the 1pps
	 * transitions
	 */
	if ((session->shm_pps = ntpshm_alloc(session->context)) == NULL) {
	    gpsd_log(&session->context->errout, LOG_WARN,
		     "PPS: ntpshm_alloc(1) failed\n");
	} else {
	    init_hook(session);
	    session->pps_thread.report_hook = report_hook;
	    /*
	     * The HAT kludge. If we're using the HAT GPS on a
	     * Raspberry Pi or a workalike like the ODROIDC2, and
	     * there is a static /dev/pps0, and we have access because
	     * we're root, assume we want to use KPPS.
	     */
	    if ((strcmp(session->pps_thread.devicename, MAGIC_HAT_GPS) == 0
		 || strcmp(session->pps_thread.devicename, MAGIC_LINK_GPS) == 0)
		&& access("/dev/pps0", R_OK | W_OK) == 0)
		session->pps_thread.devicename = "/dev/pps0";
	    pps_thread_activate(&session->pps_thread);
	}
    }
#endif /* PPS_ENABLE */
}
Пример #9
0
// Reset all stepper parameters, setup clocks, and make sure
// there is no power to steppers.
void initialize_stepper_state(void){
  // Clock up all of the PITs
  SIM_SCGC6 |= SIM_SCGC6_PIT;
  PIT_MCR = 0x00;
  // Configure PIT 0 - main interrupt timer - as running at minimum steps/minute, but not
  // interrupting.
  set_step_events_per_minute(MINIMUM_STEPS_PER_MINUTE);
  // Configure PIT 1 and 2 - reset timer and sync timer
  PIT_TCTRL1 = TIE;
  PIT_TCTRL2 = TIE;
  // Zero all parameters, and go into idle
  vmemset(&st, 0, sizeof(st));
  current_block = NULL;
  st.state =  STATE_IDLE;
  if(init_hook_set)
    init_hook();
}
Пример #10
0
/**
 * Initialize the filter window.
 */
static void init_filter(void)
{
	static struct Hook filter_construct_hook;
	static struct Hook filter_destruct_hook;
	static struct Hook filter_display_hook;
	static struct Hook move_objstr_hook, move_strobj_hook;
	Object *ok_button, *cancel_button, *save_button;
	Object *filter_move_popobject, *filter_remote_label;

	init_hook(&filter_construct_hook,(HOOKFUNC)filter_construct);
	init_hook(&filter_destruct_hook,(HOOKFUNC)filter_destruct);
	init_hook(&filter_display_hook,(HOOKFUNC)filter_display);
	init_hook(&move_objstr_hook, (HOOKFUNC)move_objstr);
	init_hook(&move_strobj_hook, (HOOKFUNC)move_strobj);

	filter_wnd = WindowObject,
		MUIA_Window_ID, MAKE_ID('F','I','L','T'),
		MUIA_Window_Title, _("SimpleMail - Edit Filter"),
		WindowContents, VGroup,
			Child, VGroup,
				Child, HGroup,
					Child, VGroup,
						MUIA_HorizWeight,40,
						Child, VGroup,
							MUIA_Group_Spacing, 0,
							Child, NListviewObject,
								MUIA_NListview_NList, filter_list = FilterListObject,
									MUIA_NList_AutoVisible, 1, /* keep the active filter visible */
									MUIA_NList_ConstructHook, &filter_construct_hook,
									MUIA_NList_DestructHook, &filter_destruct_hook,
									MUIA_NList_DisplayHook, &filter_display_hook,
									End,
								End,
							Child, HGroup,
								Child, filter_name_string = UTF8StringObject,
									StringFrame,
									End,
								End,
							End,
						Child, ColGroup(2),
							Child, filter_new_button = MakeButton(_("_New")),
							Child, filter_remove_button = MakeButton(_("_Remove")),
							Child, filter_moveup_button = MakeButton(_("Move up")),
							Child, filter_movedown_button = MakeButton(_("Move Down")),
							End,
						End,
					Child, BalanceObject, End,
					Child, VGroup,
						Child, HorizLineTextObject(_("Activity")),
						Child, HGroup,
							Child, RectangleObject,MUIA_Weight,25,End,
							Child, ColGroup(5),
								Child, MakeLabel(_("On request")),
								Child, filter_request_check = MakeCheck(NULL,FALSE),
								Child, RectangleObject,MUIA_Weight,200,End,
								Child, MakeLabel(_("On sent mails")),
								Child, filter_sent_check = MakeCheck(NULL,FALSE),

								Child, filter_remote_label = MakeLabel(_("Remotly on POP3 server")),
								Child, filter_remote_check = MakeCheck(NULL,FALSE),
								Child, RectangleObject,MUIA_Weight,200,End,
								Child, MakeLabel(_("On new mails")),
								Child, filter_new_check = MakeCheck(NULL,FALSE),
								End,
							Child, RectangleObject,MUIA_Weight,25,End,
							End,
						Child, HorizLineTextObject(_("Rules")),
						Child, VGroupV,
							Child, filter_rule_group = ColGroup(2),
								Child, HVSpace,
								Child, HVSpace,
								End,
							End,
						Child, HGroup,
							Child, filter_add_rule_button = MakeButton(_("Add new rule")),
							Child, filter_apply_now_button = MakeButton(_("Apply now")),
							End,
						Child, HorizLineTextObject(_("Action")),
						Child, VGroup,
							Child, ColGroup(3),
								Child, MakeLabel(_("Move to Folder")),
								Child, filter_move_check = MakeCheck(_("Move to Folder"),FALSE),
								Child, filter_move_popobject = PopobjectObject,
									MUIA_Disabled, TRUE,
									MUIA_Popstring_Button, PopButton(MUII_PopUp),
									MUIA_Popstring_String, filter_move_text = TextObject, TextFrame, MUIA_Background, MUII_TextBack, End,
									MUIA_Popobject_ObjStrHook, &move_objstr_hook,
									MUIA_Popobject_StrObjHook, &move_strobj_hook,
									MUIA_Popobject_Object, NListviewObject,
										MUIA_NListview_NList, filter_folder_list = FolderTreelistObject,
											End,
										End,
									End,

								Child, MakeLabel(_("Execute ARexx Script")),
								Child, filter_arexx_check = MakeCheck(_("Execute ARexx Script"),FALSE),
								Child, filter_arexx_popasl = PopaslObject,
									MUIA_Disabled, TRUE,
									MUIA_Popstring_Button, PopButton(MUII_PopFile),
									MUIA_Popstring_String, filter_arexx_string = BetterStringObject,
										StringFrame,
										MUIA_CycleChain,1,
										MUIA_String_Acknowledge, TRUE,
										End,
									End,

								Child, MakeLabel(_("Play Sound")),
								Child, filter_sound_check = MakeCheck(_("Play Sound"),FALSE),
								Child, filter_sound_string = AudioSelectGroupObject, MUIA_Disabled, TRUE, End,

								End,
							End,
						End,
					End,
				End,
			Child, HorizLineObject,
			Child, HGroup,
				Child, save_button = MakeButton(Q_("?filter:_Save")),
				Child, ok_button = MakeButton(_("_Use")),
				Child, cancel_button = MakeButton(_("_Cancel")),
				End,
			End,
		End;

	if (filter_wnd)
	{
		char *short_help_txt = _("If activated the filter will be used remotly on POP3 servers\n"
                             "which support the TOP command. Mails which matches the filter\n"
														 "are presented to the user and automatically marked as to be ignored.");

		set(filter_remote_label, MUIA_ShortHelp, short_help_txt);
		set(filter_remote_check, MUIA_ShortHelp, short_help_txt);

		DoMethod(App, OM_ADDMEMBER, (ULONG)filter_wnd);
		DoMethod(filter_wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_cancel);
		DoMethod(ok_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_ok);
		DoMethod(save_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_ok);
		DoMethod(save_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)save_filter);
		DoMethod(cancel_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_cancel);

		DoMethod(filter_new_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_new);
		DoMethod(filter_remove_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_remove);
		DoMethod(filter_moveup_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_list, 3, MUIM_NList_Move, MUIV_NList_Move_Active, MUIV_NList_Move_Previous);
		DoMethod(filter_movedown_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_list, 3, MUIM_NList_Move, MUIV_NList_Move_Active, MUIV_NList_Move_Next);

		set(filter_name_string, MUIA_String_AttachedList, (ULONG)filter_list);
		DoMethod(filter_list, MUIM_Notify, MUIA_NList_Active, MUIV_EveryTime, (ULONG)filter_list, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_active);
		DoMethod(filter_name_string, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime, (ULONG)filter_list, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_name);

		DoMethod(filter_add_rule_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_add_rule_gui);
		DoMethod(filter_apply_now_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_apply);
		DoMethod(filter_move_check, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, (ULONG)filter_move_popobject, 3, MUIM_Set, MUIA_Disabled, MUIV_NotTriggerValue);
		DoMethod(filter_sound_check, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, (ULONG)filter_sound_string, 3, MUIM_Set, MUIA_Disabled, MUIV_NotTriggerValue);
		DoMethod(filter_arexx_check, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, (ULONG)filter_arexx_popasl, 3, MUIM_Set, MUIA_Disabled, MUIV_NotTriggerValue);
		DoMethod(filter_folder_list, MUIM_Notify, MUIA_NList_DoubleClick, TRUE, (ULONG)filter_move_popobject, 2, MUIM_Popstring_Close, 1);

		filter_update_folder_list();
	}
}
Пример #11
0
static int
init(void)
{
    init_hook();
    return inited;
}
Пример #12
0
int
main(int argc, char *argv[])
{
	/* Check to see if the user is running us as root, which is a nono */
	if(geteuid() == 0)
	{
		fprintf(stderr, "Don't run ircd as root!!!\n");
		return -1;
	}

	/*
	 * save server boot time right away, so getrusage works correctly
	 */
	set_time();
	/*
	 * Setup corefile size immediately after boot -kre
	 */
	setup_corefile();

	/*
	 * set initialVMTop before we allocate any memory
	 */
	initialVMTop = get_vm_top();

	ServerRunning = 0;
	/* It ain't random, but it ought to be a little harder to guess */
	srand(SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid() << 20)));
	memset(&me, 0, sizeof(me));
	memset(&meLocalUser, 0, sizeof(meLocalUser));
	me.localClient = &meLocalUser;

	/* Make sure all lists are zeroed */
	memset(&unknown_list, 0, sizeof(unknown_list));
	memset(&lclient_list, 0, sizeof(lclient_list));
	memset(&serv_list, 0, sizeof(serv_list));
	memset(&global_serv_list, 0, sizeof(global_serv_list));
	memset(&oper_list, 0, sizeof(oper_list));

	dlinkAddTail(&me, &me.node, &global_client_list);

	memset((void *) &Count, 0, sizeof(Count));
	memset((void *) &ServerInfo, 0, sizeof(ServerInfo));
	memset((void *) &AdminInfo, 0, sizeof(AdminInfo));

	/* Initialise the channel capability usage counts... */
	init_chcap_usage_counts();

	ConfigFileEntry.dpath = DPATH;
	ConfigFileEntry.configfile = CPATH;	/* Server configuration file */
	ConfigFileEntry.klinefile = KPATH;	/* Server kline file */
	ConfigFileEntry.dlinefile = DLPATH;	/* dline file */
	ConfigFileEntry.xlinefile = XPATH;
	ConfigFileEntry.resvfile = RESVPATH;
	ConfigFileEntry.connect_timeout = 30;	/* Default to 30 */
	myargv = argv;
	umask(077);		/* better safe than sorry --SRB */

	parseargs(&argc, &argv, myopts);

	if(printVersion)
	{
		printf("ircd: version %s\n", ircd_version);
		exit(EXIT_SUCCESS);
	}

	if(chdir(ConfigFileEntry.dpath))
	{
		fprintf(stderr, "Unable to chdir to %s: %s\n", ConfigFileEntry.dpath, strerror(errno));
		exit(EXIT_FAILURE);
	}

	setup_signals();

#ifdef __CYGWIN__
	server_state_foreground = 1;
#endif

	if (testing_conf)
		server_state_foreground = 1;

	/* We need this to initialise the fd array before anything else */
	fdlist_init();
	if(!server_state_foreground)
	{
		comm_close_all();
	}


	/* Check if there is pidfile and daemon already running */
	if(!testing_conf)
	{
		check_pidfile(pidFileName);

		if(!server_state_foreground)
			make_daemon();
		else
			print_startup(getpid());
	}

	init_netio();		/* This needs to be setup early ! -- adrian */

	/* Init the event subsystem */
	eventInit();
	init_sys();

	init_main_logfile();
	initBlockHeap();
	init_dlink_nodes();
	init_patricia();
	newconf_init();
	init_s_conf();
	init_s_newconf();
	linebuf_init();		/* set up some linebuf stuff to control paging */
	init_hash();
	clear_scache_hash_table();	/* server cache name table */
	init_host_hash();
	clear_hash_parse();
	init_client();
	initUser();
	init_channels();
	initclass();
	initwhowas();
	init_stats();
	init_hook();
	init_reject();
	init_cache();
	init_monitor();
	load_all_modules(1);
#ifndef STATIC_MODULES
	load_core_modules(1);
#endif
	init_auth();		/* Initialise the auth code */
	init_resolver();	/* Needs to be setup before the io loop */

	if (testing_conf)
		fprintf(stderr, "\nBeginning config test\n");
	read_conf_files(YES);	/* cold start init conf files */
	rehash_bans(0);
#ifndef STATIC_MODULES

	mod_add_path(MODULE_DIR); 
	mod_add_path(MODULE_DIR "/autoload"); 
#endif

	initialize_server_capabs();	/* Set up default_server_capabs */
	initialize_global_set_options();

	if(ServerInfo.name == NULL)
	{
		fprintf(stderr, "ERROR: No server name specified in serverinfo block.\n");
		ilog(L_MAIN, "No server name specified in serverinfo block.");
		exit(EXIT_FAILURE);
	}
	strlcpy(me.name, ServerInfo.name, sizeof(me.name));

	if(ServerInfo.sid[0] == '\0')
	{
		fprintf(stderr, "ERROR: No server sid specified in serverinfo block.\n");
		ilog(L_MAIN, "No server sid specified in serverinfo block.");
		exit(EXIT_FAILURE);
	}
	strcpy(me.id, ServerInfo.sid);
	init_uid();

	/* serverinfo{} description must exist.  If not, error out. */
	if(ServerInfo.description == NULL)
	{
		fprintf(stderr, "ERROR: No server description specified in serverinfo block.\n");
		ilog(L_MAIN, "ERROR: No server description specified in serverinfo block.");
		exit(EXIT_FAILURE);
	}
	strlcpy(me.info, ServerInfo.description, sizeof(me.info));

	if (testing_conf)
	{
		fprintf(stderr, "\nConfig testing complete.\n");
		fflush(stderr);
		exit(EXIT_SUCCESS);
	}

	me.from = &me;
	me.servptr = &me;
	SetMe(&me);
	make_server(&me);
	me.serv->up = me.name;
	startup_time = CurrentTime;
	add_to_client_hash(me.name, &me);
	add_to_id_hash(me.id, &me);

	dlinkAddAlloc(&me, &global_serv_list);

	check_class();
	write_pidfile(pidFileName);
	load_help();
	open_logfiles();

	ilog(L_MAIN, "Server Ready");

	eventAddIsh("cleanup_glines", cleanup_glines, NULL, CLEANUP_GLINES_TIME);

	/* We want try_connections to be called as soon as possible now! -- adrian */
	/* No, 'cause after a restart it would cause all sorts of nick collides */
	/* um.  by waiting even longer, that just means we have even *more*
	 * nick collisions.  what a stupid idea. set an event for the IO loop --fl
	 */
	eventAddIsh("try_connections", try_connections, NULL, STARTUP_CONNECTIONS_TIME);
	eventAddOnce("try_connections_startup", try_connections, NULL, 0);

	eventAddIsh("collect_zipstats", collect_zipstats, NULL, ZIPSTATS_TIME);

	/* Setup the timeout check. I'll shift it later :)  -- adrian */
	eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1);

	if(ConfigServerHide.links_delay > 0)
		eventAddIsh("cache_links", cache_links, NULL,
			    ConfigServerHide.links_delay);
	else
		ConfigServerHide.links_disabled = 1;

	if(splitmode)
		eventAdd("check_splitmode", check_splitmode, NULL, 2);

	ServerRunning = 1;

	io_loop();
	return 0;
}
Пример #13
0
/******************************************************************
 Initialzes the addressbook window
*******************************************************************/
static void addressbook_init(void)
{
	Object *new_person_button, *change_button, *new_group_button, *save_button, *delete_button;
	Object *to_button;

	init_hook(&address_construct_hook, (HOOKFUNC)address_construct);
	init_hook(&address_destruct_hook, (HOOKFUNC)address_destruct);
	init_hook(&address_display_hook, (HOOKFUNC)address_display);

	address_wnd = WindowObject,
		MUIA_Window_ID, MAKE_ID('A','D','B','K'),
    MUIA_Window_Title, "SimpleMail - Addressbook",
        
		WindowContents, VGroup,
			Child, HGroup,
				Child, VGroup,
					MUIA_Weight,0,
					Child, to_button = MakeButton("_To:"),
					Child, MakeButton("_CC:"),
					Child, MakeButton("_BCC:"),
					End,
				Child, HGroup,
					Child, save_button = MakePictureButton("_Save","PROGDIR:Images/Save"),
/*					Child, MakeButton("Search"),*/
					Child, new_person_button = MakePictureButton("_Person","PROGDIR:Images/User"),
/*					Child, MakeButton("New List"),*/
					Child, new_group_button = MakePictureButton("_Group","PROGDIR:Images/Group"),
					Child, change_button = MakePictureButton("_Edit","PROGDIR:Images/Edit"),
					Child, delete_button = MakePictureButton("_Delete","PROGDIR:Images/Delete"),
					End,
				End,
			Child, HGroup,
				Child, NListviewObject,
					MUIA_CycleChain, 1,
					MUIA_NListview_NList, address_tree = NListtreeObject,
						MUIA_NListtree_ConstructHook, &address_construct_hook,
						MUIA_NListtree_DestructHook, &address_destruct_hook,
						MUIA_NListtree_DisplayHook, &address_display_hook,
						MUIA_NListtree_Title, TRUE,
						MUIA_NListtree_Format,",,,",
						MUIA_NListtree_DoubleClick, MUIV_NListtree_DoubleClick_Tree,
						End,
					End,
				End,
			End,
		End;

	if (!address_wnd) return;
	DoMethod(App,OM_ADDMEMBER,address_wnd);
	DoMethod(address_wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, address_wnd, 3, MUIM_Set, MUIA_Window_Open, FALSE);
	DoMethod(save_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 3, MUIM_CallHook, &hook_standard, addressbook_save_pressed);
	DoMethod(new_person_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 3, MUIM_CallHook, &hook_standard, addressbook_add_person);
	DoMethod(new_group_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 3, MUIM_CallHook, &hook_standard, addressbook_add_group);
	DoMethod(change_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 3, MUIM_CallHook, &hook_standard, addressbook_change);
	DoMethod(delete_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 3, MUIM_CallHook, &hook_standard, addressbook_delete);
	DoMethod(to_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 3, MUIM_CallHook, &hook_standard, addressbook_to);
	DoMethod(address_tree, MUIM_Notify, MUIA_NListtree_DoubleClick, MUIV_EveryTime, App, 3, MUIM_CallHook, &hook_standard, addressbook_change);

	set(address_tree, MUIA_UserData, 1); /* used in addresstringclass.c */

}
Пример #14
0
int main(void) {
    init_hook();

    /* Start User Application ============================================ */
    *DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    while(*DP!=0) {
    DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    while(*DP!=0) {
    DP += 1;
    *DP += 1;
    *DP += 1;
    DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    DP += 1;
    *DP += 1;
    DP -= 1;
    DP -= 1;
    DP -= 1;
    DP -= 1;
    *DP -= 1;
    }
    DP += 1;
    *DP += 1;
    DP += 1;
    *DP += 1;
    DP += 1;
    *DP -= 1;
    DP += 1;
    DP += 1;
    *DP += 1;
    while(*DP!=0) {
    DP -= 1;
    }
    DP -= 1;
    *DP -= 1;
    }
    *DP ^= *(DP+1);
    DP += 1;
    DP += 1;
    putchar(*DP);
    DP += 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    putchar(*DP);
    *DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    *DP += 1;
    putchar(*DP);
    putchar(*DP);
    *DP += 1;
    *DP += 1;
    *DP += 1;
    putchar(*DP);
    DP += 1;
    DP += 1;
    putchar(*DP);
    DP -= 1;
    *DP -= 1;
    putchar(*DP);
    DP -= 1;
    putchar(*DP);
    *DP += 1;
    *DP += 1;
    *DP += 1;
    putchar(*DP);
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    putchar(*DP);
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    putchar(*DP);
    DP += 1;
    DP += 1;
    *DP += 1;
    putchar(*DP);
    DP += 1;
    *DP += 1;
    *DP += 1;
    putchar(*DP);
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    *DP -= 1;
    /* End User Application ============================================== */

    return *DP;
}