SimpleServerWrapper::~SimpleServerWrapper() { if (m_VmHandle != PRL_INVALID_HANDLE && m_bIsVmWasCreatedByThisInstance) DELETE_VM(m_VmHandle) Logoff(); }
CMapiMail::~CMapiMail() { Logoff(); if (m_hLibMail) { FreeLibrary (m_hLibMail); m_hLibMail = 0; } }
MapiConnector2::~MapiConnector2() { delete m_notifier; // TODO The calls to tidy up m_nspiStore seem to break things. if (m_session) { //Logoff(m_nspiStore); Logoff(m_store); } //mapi_object_release(m_nspiStore); //mapi_object_release(m_store); }
/* * LoginReset: We've gotten an error from the server in LOGIN state; * bring up appropriate dialog. */ void LoginReset(void) { /* If login failed here, bring up dialog again */ config.quickstart = FALSE; if (!logged_in) { if (connection != CON_NONE) if (GetLogin()) LoginSendInfo(); else Logoff(); return; } EnterGame(); }
void CALLBACK StartupTimerProc(HWND hwnd, UINT msg, UINT timer, DWORD dwTime) { /* See if we've timed out */ timeout += BEACON_INTERVAL; debug(("In timer proc\n")); if (timeout >= BEACON_TIMEOUT) { Logoff(); ClientError(hInst, hMain, IDS_CONNECTERROR); return; } /* Spew at server again */ WriteServer((char *) client_string1, INITSTR_LENGTH); }
void TestDspCmdDirVmClone::cleanup() { if (m_pVmConfig.isValid()) { CALL_CMD(m_pPveControl->DspCmdDirVmDelete(m_pVmConfig->getVmIdentification()->getVmUuid().toUtf8().data(),QStringList()), PVE::DspCmdDirVmDelete) m_pVmConfig = SmartPtr<CVmConfiguration>() ; } if (m_pVmCloneConfig.isValid()) { CALL_CMD(m_pPveControl->DspCmdDirVmDelete(m_pVmCloneConfig->getVmIdentification()->getVmUuid().toUtf8().data(),QStringList()), PVE::DspCmdDirVmDelete) m_pVmCloneConfig = SmartPtr<CVmConfiguration>() ; } Logoff(); m_pPveControl->deleteLater(); m_pPveControl = NULL; }
void CISEMultiSession ::Logon(const char* szAddr, const char* szPort, vector<CAccount>& vecAccounts, const char* szProgID, const char* szNewPassword) throw (CISEException) { CISESessionBase::SetID(++m_dwSessionID); try { m_nSessions = vecAccounts.size(); CISESession0::Logon(true, szAddr, szPort, vecAccounts[0].m_sUser.c_str(), vecAccounts[0].m_sPassword.c_str(), szProgID, szNewPassword); if(m_nSessions > 1) { // 5 sec should be between each logon IseTrace(enInfo, "Waiting 5 seconds..."); if(LogonSleep(5000) == false) throw CISEException(0, 0, (CISESession1*)this, "Operation cancelled."); CISESession1::Logon(false, szAddr, szPort, vecAccounts[1].m_sUser.c_str(), vecAccounts[1].m_sPassword.c_str(), szProgID, szNewPassword); } if(m_nSessions > 2) { IseTrace(enInfo, "Waiting 5 seconds..."); if(LogonSleep(5000) == false) throw CISEException(0, 0, (CISESession2*)this, "Operation cancelled."); CISESession2::Logon(false, szAddr, szPort, vecAccounts[2].m_sUser.c_str(), vecAccounts[2].m_sPassword.c_str(), szProgID, szNewPassword); } } catch(const CISEException& e) { Logoff(); throw e; } CAutoLock Lock(&m_MultiSessionLock); m_bMultiSessionLoggedOn = true; };
/* * LoginErrorMessage: Bring up an error message box with given login error message. */ void LoginErrorMessage(char *message, BYTE action) { HWND hParent = GetMessageBoxParent(); config.quickstart = FALSE; ClientMessageBox(hParent, message, szAppName, MB_APPLMODAL | MB_ICONEXCLAMATION); switch (action) { case LA_NOTHING: EnterGame(); break; case LA_LOGOFF: Logoff(); break; default: debug(("LoginErrorMessage got unknown action type %d\n", action)); break; } }
/* * DownloadFiles: Bring up download dialog. */ void DownloadFiles(DownloadInfo *params) { int retval, dialog, i; info = params; info->current_file = 0; MainSetState(STATE_DOWNLOAD); debug(("machine = %s\n", info->machine)); debug(("path = %s\n", info->path)); for (i = 0; i < info->num_files; i++) debug(("file = %s, time = %d, flags = %d\n", info->files[i].filename, info->files[i].time, info->files[i].flags)); // If downloading only advertisements, show a different dialog to avoid the appearance // of a "real" download. dialog = IDD_DOWNLOADAD; for (i = 0; i < info->num_files; i++) if (DownloadLocation(info->files[i].flags) != DF_ADVERTISEMENT) { dialog = IDD_DOWNLOAD; break; } advert = (IDD_DOWNLOADAD == dialog); if (!advert && !config.avoidDownloadAskDialog) { retval = DialogBox(hInst, MAKEINTRESOURCE(IDD_ASKDOWNLOAD), NULL, AskDownloadDialogProc); switch (retval) { case 3: // do the demo button WebLaunchBrowser(info->demoPath); SendMessage(hMain,WM_SYSCOMMAND,SC_CLOSE,0); return; case IDOK: // proceed with download retval = DialogBox(hInst, MAKEINTRESOURCE(dialog), NULL, DownloadDialogProc); advert = FALSE; if (retval == IDOK) { MainSetState(STATE_LOGIN); i = (((MAJOR_REV * 100) + MINOR_REV) * P_CATCH) + P_CATCH; RequestGame(config.download_time,i,config.comm.hostname); return; } break; case IDCANCEL: // cancel default: break; } } abort_download = True; config.quickstart = FALSE; //MainSetState(STATE_OFFLINE); Logoff(); ShowWindow(hMain, SW_SHOW); UpdateWindow(hMain); #if 0 // If we were hung up, just leave if (state != STATE_DOWNLOAD) return; MainSetState(STATE_LOGIN); switch (retval) { case IDOK: RequestGame(config.download_time); break; case IDCANCEL: Logoff(); break; } #endif }
void TestDspCmdDirGetVmList::cleanup() { Logoff(); m_pPveControl->deleteLater(); m_pPveControl=0; }
int init (int argc, char *argv[]) { char *p; int rc = 0, oldmode, i; url_t u; int x0=-1, y0=-1, r=-1, c=-1; struct hostent *remote; char buffer[MAX_PATH]; if (action == ACTION_TESTONLY) exit (0); if (action == ACTION_BADARGS) { usage (); exit (1); } if (options.keep_winsize) { r = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "rows"); c = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "cols"); if (r == 0 && c == 0) r = -1, c = -1; } if (options.keep_winpos) { x0 = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "x0"); y0 = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "y0"); if (x0 == 0 || y0 == 0) x0 = -1, y0 = -1; } p = cfg_get_string (CONFIG_NFTP, fl_opt.platform_nick, "font"); if (p[0] == '\0') p = NULL; fly_init (x0, y0, r, c, p); fly_mouse (options.mouse); wintitle = get_window_name (); if (fl_opt.platform == PLATFORM_OS2_VIO) { strcpy (buffer, paths.system_libpath); str_cats (buffer, "nftp.ico"); if (access (buffer, R_OK) == 0) set_icon (buffer); } if (main_menu != NULL) { menu_activate (main_menu); } display.rshift = 0; display.lshift = 0; display.tabsize = 8; display.view[V_LEFT] = -1; display.view[V_RIGHT] = -1; display.cursor = V_LEFT; display.parsed = TRUE; for (i=0; i<MAX_SITE; i++) { site[i].set_up = FALSE; site[i].CC.na = 0; site[i].CC.n = 0; } // ignore "broken PIPE" signals signal (SIGPIPE, SIG_IGN); set_window_name ("NFTP%s(C) Copyright Sergey Ayukov", NFTP_VERSION); lcache.lda = 0; lcache.ld = 0; lcache.L = NULL; local[V_LEFT].dir.name = NULL; local[V_LEFT].dir.files = NULL; local[V_LEFT].dir.nfiles = 0; local[V_LEFT].sortmode = abs (options.default_localsort); if (options.default_localsort >= 0) local[V_LEFT].sortdirection = 1; else local[V_LEFT].sortdirection = -1; l_chdir (V_LEFT, NULL); local[V_RIGHT].dir.name = NULL; local[V_RIGHT].dir.files = NULL; local[V_RIGHT].dir.nfiles = 0; local[V_RIGHT].sortmode = abs (options.default_localsort); if (options.default_localsort >= 0) local[V_RIGHT].sortdirection = 1; else local[V_RIGHT].sortdirection = -1; l_chdir (V_RIGHT, NULL); PutLineIntoResp (RT_COMM, 0, "NFTP Version%s(%s, %s) -- %s", NFTP_VERSION, __DATE__, __TIME__, fl_opt.platform_name); PutLineIntoResp (RT_RESP, 0, "Copyright (C) 1994--2000 Sergey Ayukov <*****@*****.**>"); PutLineIntoResp (RT_RESP, 0, "Portions Copyright (C) Eric Young <*****@*****.**>"); status.usage_interval = 0; if (!fl_opt.has_osmenu) PutLineIntoResp (RT_RESP, 0, MSG(M_RESP_F9_FOR_MENU)); update (1); if (options.firewall_type != 0) { if (options.fire_server[0] == '\0') { fly_ask_ok (ASK_WARN, MSG(M_PROXY_ISNT_SPECIFIED)); options.firewall_type = 0; } else { if (strspn (options.fire_server, " .0123456789") == strlen (options.fire_server)) { firewall.fwip = inet_addr (options.fire_server); } else { PutLineIntoResp (RT_COMM, 0, MSG(M_RESP_LOOKING_UP), options.fire_server); remote = gethostbyname (options.fire_server); if (remote == NULL) { PutLineIntoResp (RT_COMM, 0, MSG(M_RESP_CANNOT_RESOLVE), options.fire_server); options.firewall_type = 0; } else { firewall.fwip = *((unsigned long *)(remote->h_addr)); PutLineIntoResp (RT_COMM,0, MSG(M_RESP_FOUND), remote->h_name); } } } } // read password cache psw_read (); // analyze arguments switch (action) { case ACTION_NONE: if (options.download_path != NULL) { l_chdir (V_RIGHT, options.download_path); } else { p = cfg_get_string (CONFIG_NFTP, "", "local-directory-left"); if (p[0] != '\0') { l_chdir (V_LEFT, p); } p = cfg_get_string (CONFIG_NFTP, "", "local-directory-right"); if (p[0] != '\0') { l_chdir (V_RIGHT, p); } } switch (options.start_prompt) { case 1: return FMSG_BASE_MENU + KEY_GEN_LOGIN; case 2: return FMSG_BASE_MENU + KEY_GEN_BOOKMARKS; case 3: return FMSG_BASE_MENU + KEY_GEN_HISTORY; case 5: return FMSG_BASE_MENU + KEY_MENU; } return 0; case ACTION_DOWNLOAD: case ACTION_UPLOAD: oldmode = status.batch_mode; status.batch_mode = TRUE; if (action == ACTION_DOWNLOAD) rc = do_get (optarg1); if (action == ACTION_UPLOAD) rc = do_put (optarg1); //set_view_mode (VIEW_CONTROL); //update (1); if (rc && !cmdline.batchmode) fly_ask_ok (0, MSG(M_TRANSFER_FAILED), optarg1); if ((disc_after && rc == 0) || cmdline.batchmode) { Logoff (0); terminate (); exit (0); } status.batch_mode = oldmode; return 0; //case ACTION_CMDLIST: // rc = runscript (optarg1); // return 0; case ACTION_NICK_BOOK: case ACTION_NICK_HIST: if (action == ACTION_NICK_BOOK && bookmark_nickname (optarg1, &u) == 0) return 0; if (action == ACTION_NICK_HIST && history_nickname (optarg1, &u) == 0) return 0; rc = Login (-1, &u, V_LEFT); if (rc) return 0; if ((action == ACTION_NICK_BOOK && MAX_SITE > 1 && optarg2 != NULL && bookmark_nickname (optarg2, &u) == 1) || (action == ACTION_NICK_HIST && MAX_SITE > 1 && optarg2 != NULL && history_nickname (optarg2, &u) == 1)) { rc = Login (-1, &u, V_RIGHT); } if (options.login_bell) Bell (3); return 0; case ACTION_OPEN_BOOKMARKS: return FMSG_BASE_MENU + KEY_GEN_BOOKMARKS; case ACTION_OPEN_HISTORY: return FMSG_BASE_MENU + KEY_GEN_HISTORY; case ACTION_LOGIN: // if download_path was specified in nftp.ini, set it now if (options.download_path != NULL) { l_chdir (V_LEFT, options.download_path); l_chdir (V_RIGHT, options.download_path); } dmsg ("optarg1 is [%s]\n", optarg1); parse_url (optarg1, &u); rc = Login (-1, &u, V_LEFT); if (MAX_SITE > 1 && optarg2 != NULL) { parse_url (optarg2, &u); rc = Login (-1, &u, V_RIGHT); } // attempt to download file if chdir failed /*if (site.set_up && strcmp (site.u.pathname, RCURDIR.name) != 0) { rc = do_get (optarg1); } if (rc) return 0; */ if (options.login_bell) Bell (3); return 0; case ACTION_TESTONLY: terminate (); exit (0); } fly_error ("internal error in init()"); return 0; }
bool nglMail::Send(const char* pStrSubject, const char* pStrMessage, const char* pStrAttachmentFilePath, const char* pStrRecipient, const char* pStrEmailAdress) { ULONG unlResult = 1; MapiMessage oMapiMessage; MapiFileDesc oAttachment; ZeroMemory ( &oMapiMessage, sizeof ( MapiMessage ) ); ZeroMemory ( &oAttachment, sizeof ( MapiFileDesc ) ); lpMapiRecipDesc pRecips = NULL; //MapiRecipDesc arMailRecipients[1], *tempRecip[1]; MapiRecipDesc arMailRecipients[1]; if (!Logon()) return false; std::string bstrAddress; bstrAddress = "SMTP:"; bstrAddress += pStrEmailAdress; std::string bstrRec, bstrAdd, bstrAttFile, bstrAttPath, bstrSubj, bstrMesg; arMailRecipients[0].ulReserved = 0; arMailRecipients[0].ulRecipClass = MAPI_TO; // recipient name bstrRec = pStrRecipient; arMailRecipients[0].lpszName = (char*)bstrRec.c_str(); // email address bstrAdd = bstrAddress; arMailRecipients[0].lpszAddress = (char*)bstrAdd.c_str(); arMailRecipients[0].ulEIDSize = 0; arMailRecipients[0].lpEntryID = NULL; //std::string bstrFullPath = pStrAttachmentFilePath; //bstrFullPath += pStrAttachmentFile; //oAttachment.lpszFileName = pStrAttachmentFile; oAttachment.lpszPathName = (LPSTR)pStrAttachmentFilePath; oMapiMessage.nRecipCount = 1; // Must be set to the correct number of recipients. oMapiMessage.lpRecips = arMailRecipients; // Address of list of names returned from MAPIAddress. oMapiMessage.ulReserved = 0L; bstrSubj = pStrSubject; oMapiMessage.lpszSubject = (char *)bstrSubj.c_str(); bstrMesg = pStrMessage; oMapiMessage.lpszNoteText = (char *)bstrMesg.c_str(); oMapiMessage.lpOriginator = NULL; if (pStrAttachmentFilePath) { oMapiMessage.nFileCount = 1; oMapiMessage.lpFiles = &oAttachment; } else { oMapiMessage.nFileCount = 0L; oMapiMessage.lpFiles = NULL; } unlResult = mMAPISendMail ( mlhSession, // Global session handle. 0L, // Parent window. Set to 0 since console app. &oMapiMessage, // Address of Message structure MAPI_DIALOG, 0L // Reserved. Must be 0L. ); if (unlResult != SUCCESS_SUCCESS) return false; //mMAPIFreeBuffer(tempRecip); // release the recipient descriptors if (!Logoff()) return false; return true; }
int main(int argc, char *argv[]) { enum MAPISTATUS retval; struct mapi_context *mapi_ctx; TALLOC_CTX *mem_ctx; struct mapi_session *session = NULL; mapi_object_t obj_store; mapi_object_t obj_folder; mapi_object_t obj_table; mapi_object_t obj_message; struct mapi_SPropValue_array props_all; struct SRowSet rowset; struct SPropTagArray *SPropTagArray; mapi_id_t id_inbox; mapi_id_t *fid, *mid; char *profname; char *profdb; uint32_t Numerator; uint32_t Denominator; uint32_t i; mem_ctx = talloc_named(NULL, 0, "fetchmail"); /* Initialize MAPI */ profdb = talloc_asprintf(mem_ctx, DEFAULT_PROFDB, getenv("HOME")); retval = MAPIInitialize(&mapi_ctx, profdb); MAPI_RETVAL_IF(retval, retval, mem_ctx); /* Find Default Profile */ retval = GetDefaultProfile(mapi_ctx, &profname); MAPI_RETVAL_IF(retval, retval, mem_ctx); /* Log on EMSMDB and NSPI */ retval = MapiLogonEx(mapi_ctx, &session, profname, NULL); MAPI_RETVAL_IF(retval, retval, mem_ctx); /* Open Message Store */ mapi_object_init(&obj_store); retval = OpenMsgStore(session, &obj_store); MAPI_RETVAL_IF(retval, retval, mem_ctx); /* Find Inbox default folder */ retval = GetDefaultFolder(&obj_store, &id_inbox, olFolderInbox); MAPI_RETVAL_IF(retval, retval, mem_ctx); /* Open Inbox folder */ mapi_object_init(&obj_folder); retval = OpenFolder(&obj_store, id_inbox, &obj_folder); MAPI_RETVAL_IF(retval, retval, mem_ctx); /* Retrieve Inbox content table */ mapi_object_init(&obj_table); retval = GetContentsTable(&obj_folder, &obj_table, 0x0, NULL); MAPI_RETVAL_IF(retval, retval, mem_ctx); /* Create the MAPI table view */ SPropTagArray = set_SPropTagArray(mem_ctx, 0x2, PR_FID, PR_MID); retval = SetColumns(&obj_table, SPropTagArray); MAPIFreeBuffer(SPropTagArray); MAPI_RETVAL_IF(retval, retval, mem_ctx); talloc_free(mem_ctx); /* Get current cursor position */ retval = QueryPosition(&obj_table, &Numerator, &Denominator); MAPI_RETVAL_IF(retval, retval, mem_ctx); /* Iterate through rows */ while ((retval = QueryRows(&obj_table, Denominator, TBL_ADVANCE, &rowset)) != -1 && rowset.cRows) { for (i = 0; i < rowset.cRows; i++) { fid = (mapi_id_t *)find_SPropValue_data(&(rowset.aRow[i]), PR_FID); mid = (mapi_id_t *)find_SPropValue_data(&(rowset.aRow[i]), PR_MID); mapi_object_init(&obj_message); retval = OpenMessage(&obj_store, *fid, *mid, &obj_message, 0x0); if (retval != MAPI_E_NOT_FOUND) { retval = GetPropsAll(&obj_message, MAPI_UNICODE, &props_all); mapidump_message(&props_all, NULL, &obj_message); mapi_object_release(&obj_message); } } } /* Release MAPI objects */ mapi_object_release(&obj_table); mapi_object_release(&obj_folder); Logoff(&obj_store); /* Uninitialize MAPI */ MAPIUninitialize(mapi_ctx); return (0); }
BOOL CALLBACK PickCharDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { static HWND hList; int index, i; Character *c; switch (message) { case WM_INITDIALOG: CenterWindow(hDlg, GetParent(hDlg)); hList = GetDlgItem(hDlg, IDC_CHARLIST); info = (PickCharStruct *) lParam; /* Display characters in list */ for (i=0; i < info->num_characters; i++) { // For new characters, show a special string if (info->characters[i].flags == 1) index = ListBox_AddString(hList, GetString(hInst, IDS_NEWCHARACTER)); else index = ListBox_AddString(hList, info->characters[i].name); ListBox_SetItemData(hList, index, i); } /* Select first char */ ListBox_SetCurSel(hList, 0); // Show message of the day Edit_SetText(GetDlgItem(hDlg, IDC_MOTD), info->motd); // Display advertisements for (i=0; i < info->num_ads; i++) { char filename[MAX_PATH + FILENAME_MAX]; sprintf(filename, "%s\\%s", ad_directory, info->ads[i].filename); Animate_Open(GetDlgItem(hDlg, animation_controls[i]), filename); } hPickCharDialog = hDlg; return TRUE; case WM_COMPAREITEM: return ItemListCompareItem(hDlg, (const COMPAREITEMSTRUCT *) lParam); case WM_MEASUREITEM: ItemListMeasureItem(hDlg, (MEASUREITEMSTRUCT *) lParam); return TRUE; case WM_DRAWITEM: return ItemListDrawItem(hDlg, (const DRAWITEMSTRUCT *) lParam); HANDLE_MSG(hDlg, WM_LBUTTONDOWN, CharPickLButtonDown); HANDLE_MSG(hDlg, WM_CTLCOLOREDIT, DialogCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORLISTBOX, DialogCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORSTATIC, DialogCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORDLG, DialogCtlColor); case WM_COMMAND: switch(GET_WM_COMMAND_ID(wParam, lParam)) { case IDC_RESET: /* Get currently chosen character's name */ if ((index = ListBox_GetCurSel(hList)) == LB_ERR) return TRUE; index = ListBox_GetItemData(hList, index); c = &info->characters[index]; if (!AreYouSure(hInst, hDlg, NO_BUTTON, IDS_DELETECHAR, c->name)) return TRUE; char_to_use = c->id; strcpy(name_to_use, c->name); EndDialog(hDlg, IDC_RESET); return TRUE; case IDOK: /* Tell server that we want to use selected character */ if ((index = ListBox_GetCurSel(hList)) == LB_ERR) return TRUE; index = ListBox_GetItemData(hList, index); c = &info->characters[index]; char_to_use = c->id; strcpy(name_to_use, c->name); // If this character hasn't been used before, go to char creation if (c->flags == 1) EndDialog(hDlg, IDC_RESET); else EndDialog(hDlg, IDOK); return TRUE; case IDCANCEL: /* If user verifies, ask to leave game */ if (!AreYouSure(cinfo->hInst, hDlg, NO_BUTTON, IDS_LOGOFF)) break; Logoff(); EndDialog(hDlg, IDCANCEL); return TRUE; } break; case WM_DESTROY: hPickCharDialog = NULL; if (exiting) PostMessage(cinfo->hMain, BK_MODULEUNLOAD, 0, MODULE_ID); break; } return FALSE; }
/* * MenuCommand: A menu item has been selected. */ void MenuCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { // Set last action time to now, to prevent keypress from being interpreted as a game action. KeySetLastNorepeatTime(); // See if module wants to handle menu selection if (ModuleEvent(EVENT_MENUITEM, id) == False) return; /* Handle menu selections */ switch (id) { case ID_GAME_EXIT: if (connection != CON_NONE && !AreYouSure(hInst, hMain, NO_BUTTON, IDS_LOGOFF)) break; MainQuit(hwnd); break; case ID_GAME_PRINTMAP: if (state == STATE_GAME) PrintMap(FALSE); break; case ID_GAME_CONNECT: OfflineConnect(); break; case ID_GAME_DISCONNECT: if (!AreYouSure(hInst, hMain, NO_BUTTON, IDS_LOGOFF)) break; Logoff(); MainSetState(STATE_OFFLINE); break; case ID_GAME_SETTINGS: if (DialogBox(hInst, MAKEINTRESOURCE(IDD_SETTINGS), hMain, PreferencesDialogProc) == IDOK) { ModuleEvent(EVENT_CONFIGCHANGED); MenuDisplaySettings(hMain); } break; case ID_CONFIGMENU: ConfigMenuLaunch(); break; case ID_GAME_PASSWORD: PerformAction(A_CHANGEPASSWORD, NULL); break; case ID_OPTIONS_TIMEOUT: UserSetTimeout(); break; case ID_OPTIONS_MUSIC: config.play_music = !config.play_music; CheckMenuItem(menu, ID_OPTIONS_MUSIC, config.play_music ? MF_CHECKED : MF_UNCHECKED); UserToggleMusic(config.play_music); break; case ID_OPTIONS_SOUND: config.play_sound = !config.play_sound; CheckMenuItem(menu, ID_OPTIONS_SOUND, config.play_sound ? MF_CHECKED : MF_UNCHECKED); if (!config.play_sound) SoundStopAll(); break; case ID_OPTIONS_SAVENOW: SaveSettings(); break; case ID_OPTIONS_SAVEEXIT: config.save_settings = !config.save_settings; CheckMenuItem(menu, ID_OPTIONS_SAVEEXIT, config.save_settings ? MF_CHECKED : MF_UNCHECKED); break; case ID_OPTIONS_AREA: // due to issues with certain D3D drivers, this no longer immediately updates the config // it now sets a temporary variable that will update the config on shutdown // this means a shutdown and restart are necessary for window size changes MessageBox(hMain, "You must shutdown and restart Meridian 59 for these changes to take effect", "Direct3D", MB_OK); // config.large_area = !config.large_area; gLargeArea = !gLargeArea; CheckMenuItem(menu, ID_OPTIONS_AREA, gLargeArea ? MF_CHECKED : MF_UNCHECKED); /* if (state == STATE_GAME) // Send ourselves a resize message ResizeAll(); RedrawAll();*/ break; case ID_OPTIONS_FONT_MAP_TITLE: UserSelectFont(FONT_MAP_TITLE); break; case ID_OPTIONS_FONT_MAP_LABEL: UserSelectFont(FONT_MAP_LABEL); break; case ID_OPTIONS_FONT_MAP_TEXT: UserSelectFont(FONT_MAP_TEXT); break; case ID_FONT_GAMETEXT: UserSelectFont(FONT_EDIT); break; case ID_FONT_LIST: UserSelectFont(FONT_LIST); break; case ID_FONT_MAIL: UserSelectFont(FONT_MAIL); break; case ID_FONT_TITLES: UserSelectFont(FONT_TITLES); break; case ID_FONT_STATISTICS: UserSelectFont(FONT_STATS); break; case ID_FONT_INPUT: UserSelectFont(FONT_INPUT); break; case ID_FONT_LABELS: UserSelectFont(FONT_LABELS); break; case ID_FONT_DEFAULTS: FontsRestoreDefaults(); break; case ID_COLOR_MAIN: UserSelectColors(COLOR_FGD, COLOR_BGD); break; case ID_COLOR_LIST: UserSelectColors(COLOR_LISTFGD, COLOR_LISTBGD); break; case ID_COLOR_LISTSEL: UserSelectColors(COLOR_LISTSELFGD, COLOR_LISTSELBGD); break; case ID_COLOR_MAGIC: UserSelectColor(COLOR_ITEM_MAGIC_FG); break; case ID_COLOR_HIGHLIGHT: UserSelectColor(COLOR_HIGHLITE); break; case ID_COLOR_MAIL: UserSelectColors(COLOR_MAILFGD, COLOR_MAILBGD); break; case ID_COLOR_TEXT: UserSelectColors(COLOR_MAINEDITFGD, COLOR_MAINEDITBGD); break; case ID_COLOR_EDIT: UserSelectColors(COLOR_EDITFGD, COLOR_EDITBGD); break; case ID_COLOR_SYSMSG: UserSelectColor(COLOR_SYSMSGFGD); case ID_COLOR_QUESTHEADER: UserSelectColor(COLOR_QUEST_HEADER); break; break; case ID_COLOR_STATS: UserSelectColors(COLOR_STATSFGD, COLOR_STATSBGD); break; case ID_COLOR_BAR1: UserSelectColor(COLOR_BAR1); break; case ID_COLOR_BAR2: UserSelectColor(COLOR_BAR2); break; case ID_COLOR_BAR3: UserSelectColor(COLOR_BAR3); break; case ID_COLOR_BAR4: UserSelectColor(COLOR_BAR4); break; case ID_COLOR_INVNUM: UserSelectColors(COLOR_INVNUMFGD, COLOR_INVNUMBGD); break; case ID_COLOR_DEFAULTS: ColorsRestoreDefaults(); break; case ID_HELP_CONTENTS: StartHelp(); break; case ID_HOMEPAGE: WebLaunchBrowser(GetString(hInst, IDS_HOMEPAGEURL)); break; case ID_FORUM: WebLaunchBrowser(GetString(hInst, IDS_FORUMURL)); break; case ID_WIKI: WebLaunchBrowser(GetString(hInst, IDS_WIKIURL)); break; case ID_HELP_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), hMain, AboutDialogProc); break; } }
int init (int argc, char *argv[]) { char *p; int rc = 0, oldmode; url_t u; int x0=-1, y0=-1, r=-1, c=-1; struct hostent *remote; char buffer[MAX_PATH]; if (action == ACTION_TESTONLY) exit (0); if (action == ACTION_BADAGS) { usage (); exit (1); } if (options.keep_winsize) { r = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "rows"); c = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "cols"); if (r == 0 && c == 0) r = -1, c = -1; } if (options.keep_winpos) { x0 = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "x0"); y0 = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "y0"); if (x0 == 0 || y0 == 0) x0 = -1, y0 = -1; } p = cfg_get_string (CONFIG_NFTP, fl_opt.platform_nick, "font"); if (p[0] == '\0') p = NULL; fly_init (x0, y0, r, c, p); if (options.show_hw_cursor) video_cursor_state (1); fly_mouse (options.mouse); wintitle = get_window_name (); if (fl_opt.platform == PLATFORM_OS2_VIO) { strcpy (buffer, paths.system_libpath); str_cats (buffer, "nftp.ico"); if (access (buffer, R_OK) == 0) set_icon (buffer); } if (main_menu != NULL) { menu_activate (main_menu); adjust_menu_status (); } display.dir_mode = options.defaultdirmode; display.view_mode = VIEW_CONTROL; display.rshift = 0; display.lshift = 0; display.tabsize = 8; if (options.slowlink) set_view_mode (VIEW_REMOTE); else set_view_mode (VIEW_CONTROL); site.maxndir = 1024; site.dir = malloc (sizeof(directory)*site.maxndir); // ignore "broken PIPE" signals signal (SIGPIPE, SIG_IGN); set_window_name ("NFTP%s(C) Copyright Sergey Ayukov", NFTP_VERSION); local.dir.files = NULL; local.sortmode = abs (options.default_localsort); if (options.default_localsort >= 0) local.sortdirection = 1; else local.sortdirection = -1; build_local_filelist (NULL); site.batch_mode = FALSE; site.chunks = NULL; PutLineIntoResp2 ("NFTP Version%s(%s, %s) -- %s", NFTP_VERSION, __DATE__, __TIME__, fl_opt.platform_name); PutLineIntoResp1 ("Copyright (C) 1994-2003 Sergey Ayukov <*****@*****.**>"); PutLineIntoResp1 ("Portions Copyright (C) Eric Young <*****@*****.**>"); //PutLineIntoResp1 ("Portions Copyright (C) Martin Nicolay <*****@*****.**>"); status.usage_interval = 0; if (!fl_opt.has_osmenu) PutLineIntoResp1 (M("Press F9 or Ctrl-F for menu")); update (1); if (options.firewall_type != 0) { if (options.fire_server[0] == '\0') { fly_ask_ok (ASK_WARN, M("Firewall proxy host isn't specified in NFTP.INI")); options.firewall_type = 0; } else { if (strspn (options.fire_server, " .0123456789") == strlen (options.fire_server)) { firewall.fwip = inet_addr (options.fire_server); } else { PutLineIntoResp2 (M("Looking up '%s'"), options.fire_server); remote = gethostbyname (options.fire_server); if (remote == NULL) { PutLineIntoResp2 (M("Cannot find '%s'"), options.fire_server); options.firewall_type = 0; } else { firewall.fwip = *((unsigned long *)(remote->h_addr)); PutLineIntoResp2 (M("Found '%s'"), remote->h_name); } } } } // read password cache psw_read (); // analyze arguments switch (action) { case 0: if (options.download_path != NULL) { set_local_path (options.download_path); } else { p = cfg_get_string (CONFIG_NFTP, "", "local-directory"); if (p[0] != '\0') set_local_path (p); } build_local_filelist (NULL); switch (options.start_prompt) { case 1: return FMSG_BASE_MENU + KEY_GEN_LOGIN; case 2: return FMSG_BASE_MENU + KEY_GEN_BOOKMARKS; case 3: return FMSG_BASE_MENU + KEY_GEN_HISTORY; case 5: return FMSG_BASE_MENU + KEY_MENU; } return 0; case ACTION_DOWNLOAD: case ACTION_UPLOAD: oldmode = site.batch_mode; site.batch_mode = TRUE; if (action == ACTION_DOWNLOAD) rc = do_get (optarg1); if (action == ACTION_UPLOAD) rc = do_put (optarg1); //set_view_mode (VIEW_CONTROL); //update (1); if (rc && !cmdline.batchmode) fly_ask_ok (0, M("Transfer of '%s' has failed"), optarg1); if ((disc_after && rc == 0) || cmdline.batchmode) { Logoff (); terminate (); exit (0); } site.batch_mode = oldmode; return 0; case ACTION_CMDLIST: rc = runscript (optarg1); return 0; case ACTION_NICK_BOOK: case ACTION_NICK_HIST: if (action == ACTION_NICK_BOOK && bookmark_nickname (optarg1, &u) == 0) return 0; if (action == ACTION_NICK_HIST && history_nickname (optarg1, &u) == 0) return 0; rc = Login (&u); if (rc) return 0; if (options.login_bell) Bell (3); return 0; case ACTION_OPEN_BOOKMARKS: return FMSG_BASE_MENU + KEY_GEN_BOOKMARKS; case ACTION_OPEN_HISTORY: return FMSG_BASE_MENU + KEY_GEN_HISTORY; case ACTION_LOGIN: // if download_path was specified in nftp.ini, set it now if (options.download_path != NULL) set_local_path (options.download_path); build_local_filelist (NULL); parse_url (optarg1, &u); rc = Login (&u); // attempt to download file if chdir failed /*if (site.set_up && strcmp (site.u.pathname, RCURDIR.name) != 0) { rc = do_get (optarg1); } if (rc) return 0; */ if (options.login_bell) Bell (3); return 0; case ACTION_TESTONLY: terminate (); exit (0); } fly_error ("internal error in init()"); return 0; }