Example #1
0
void coreInit(PLUG_INITSTRUCT* initStruct)
{
	// register commands
	_plugin_logprintf("[sync] pluginHandle: %d\n", pluginHandle);

	if (!_plugin_registercommand(pluginHandle, "!sync", cbSyncCommand, false))
		_plugin_logputs("[sync] error registering the \"!sync\" command!");

	if (!_plugin_registercommand(pluginHandle, "!syncoff", cbSyncoffCommand, true))
		_plugin_logputs("[sync] error registering the \"!syncoff\" command!");

	// initialize globals
	g_Synchronized = FALSE;

	g_hPollCompleteEvent = CreateEvent(NULL, true, false, NULL);
	if (g_hPollCompleteEvent == NULL)
	{
		_plugin_logputs("[sync] Command polling feature init failed\n");
		return;
	}

	InitializeCriticalSection(&g_CritSectPollRelease);

	if (SUCCEEDED(LoadConfigurationFile())){
		_plugin_logprintf("[sync] Configuration file loaded\n       -> set HOST to %s:%s\n", g_DefaultHost, g_DefaultPort);
	}

}
extern "C" __declspec(dllexport) void plugsetup(PLUG_SETUPSTRUCT* setupStruct)
{
    hwndDlg = setupStruct->hwndDlg;
    hMenu = setupStruct->hMenu;
    _plugin_menuaddentry(hMenu, 1, LoadUTF8String(IDS_PLUGMENUENTRY).c_str());
    _plugin_menuaddentry(hMenu, 2, LoadUTF8String(IDS_PLUGMENUENTRY2).c_str());
    _plugin_menuaddentry(hMenu, 3, LoadUTF8String(IDS_PLUGMENUENTRYABOUT).c_str());
    _plugin_registercallback(pluginHandle, CB_MENUENTRY, menu);
    _plugin_registercommand(pluginHandle, "ExportPatch", command, true);
    _plugin_registercommand(pluginHandle, "ExportPatchWithLastTemplate", command, true);
}