void YahooConnection::cbLoginResponse(int succ, const char* url) { printf("YahooConnection::cbLoginResponse %s\n", url); if(succ == YAHOO_LOGIN_OK) { fStatus = yahoo_current_status(fID); fManager->LoggedIn(); return; } else if(succ == YAHOO_LOGIN_UNAME) { fManager->Error("Could not log into Yahoo service - username not recognised. Please verify that your username is correctly typed.", NULL); } else if(succ == YAHOO_LOGIN_PASSWD) { fManager->Error("Could not log into Yahoo service - password incorrect. Please verify that your password is correctly typed.", NULL); } else if(succ == YAHOO_LOGIN_LOCK) { fManager->Error("Could not log into Yahoo service. Your account has been locked.\nVisit [url] to reactivate it.\n", NULL); } else if(succ == YAHOO_LOGIN_DUPL) { fManager->Error("You have been logged out of the yahoo service, possibly due to a duplicate login.", NULL); } else if(succ == YAHOO_LOGIN_SOCK) { fManager->Error("The server closed the socket.", NULL); } else { fManager->Error("Could not log in, unknown reason.", NULL); } fStatus = YAHOO_STATUS_OFFLINE; LogOff(); }
void YahooConnection::cbYahooError( const char* err, int fatal) { fManager->Error( err, NULL ); if (fatal) { LogOff(); } }
YahooConnection::~YahooConnection() { LogOff(); fAlive = false; int32 thread_res=0; wait_for_thread(fThread, &thread_res); free(fYahooID); free(fPassword); }
status_t GoogleTalk::Shutdown() { LogOff(); fLaterBuddyList->clear(); delete fLaterBuddyList; thread_id plug = fPlug->Thread(); BMessenger(fPlug).SendMessage( B_QUIT_REQUESTED ); fPlug = NULL; int32 res=0; wait_for_thread( plug, &res ); return B_OK; }
//================================================================================================ //-----------------------------------------------------+++--> T-Clock Menu Command Message Handler: LRESULT OnTClockCommand(HWND hwnd, WPARAM wParam) //----------------------------------+++--> { WORD wID = LOWORD(wParam); switch(wID) { case IDM_REFRESHTCLOCK: RefreshUs(); break; case IDM_SHOWPROP: MyPropertySheet(-1); break; case IDM_PROP_ALARM: MyPropertySheet(1); break; case IDM_EXIT: SendMessage(hwnd,WM_CLOSE,0,0); break; case IDM_SHOWCALENDER: ToggleCalendar(1); // 1=own calendar break; case IDM_DISPLAYPROP: if(api.OS >= TOS_VISTA) api.Exec(L"::{26EE0668-A00A-44D7-9371-BEB064C98683}\\1\\::{C555438B-3C23-4769-A71F-B6D3D9B6053A}", NULL, NULL); else api.Exec(L"control", L"desk.cpl, display,1", NULL); break; case IDM_VOLUMECONTROL: //-------------------------------+++--> Volume Controls #ifndef _WIN64 # define OPEN_VOLUME L"SndVol32" #else # define OPEN_VOLUME L"SndVol" #endif // _WIN64 api.Exec(OPEN_VOLUME, NULL, NULL); break; case IDM_AUDIOPROP: //----------------------------------+++--> Audio settings / devices api.Exec(L"control", L"mmsys.cpl", NULL); break; case IDM_RECYCLEBIN: api.Exec(L"::{645FF040-5081-101B-9F08-00AA002F954E}", NULL, NULL); break; case IDM_RECYCLEBIN_PURGE:{ SHQUERYRBINFO info = {sizeof(info)}; // Windows seriously asks : SHQueryRecycleBin(NULL, &info); // "are you sure to delete all items" if(info.i64NumItems > 0 || api.OS == TOS_2000) // when the recycle bin is actually empty... SHEmptyRecycleBin(g_hwndTClockMain, NULL, 0); break;} case IDM_MAPDRIVE: //----------------------------------+++--> Map Network Drive WNetConnectionDialog(hwnd, RESOURCETYPE_DISK); break; case IDM_DISCONNECT: //-------------------------+++--> Disconnect Network Drive WNetDisconnectDialog(hwnd, RESOURCETYPE_DISK); break; case IDM_TOGGLE_DT: //---------------------------+++--> Show / Hide the Desktop ToggleDesk(); break; case IDM_QUICKY_WINEXP: { //-----------------//--+++--> Windows Explorer Opened api.Exec(L"Explorer", L"/e, ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", hwnd); break;} case IDM_QUICKY_DOS: { // Command Prompt api.Exec(L"cmd", L"/f:on /t:0a", hwnd); break;} case IDM_QUICKY_EMPTYRB: SHEmptyRecycleBin(0, NULL, SHERB_NOCONFIRMATION); break; case IDM_SHUTDOWN: if(!ShutDown()) MessageBox(0, L"Shutdown Request Failed!", L"ERROR", MB_OK|MB_ICONERROR|MB_SETFOREGROUND); break; case IDM_REBOOT: if(!ReBoot()) MessageBox(0, L"Reboot Request Failed!", L"ERROR", MB_OK|MB_ICONERROR|MB_SETFOREGROUND); break; case IDM_LOGOFF: if(!LogOff()) MessageBox(0, L"Logoff Request Failed!", L"ERROR", MB_OK|MB_ICONERROR|MB_SETFOREGROUND); break; case IDM_FWD_CASCADE: case IDM_FWD_SIDEBYSIDE: case IDM_FWD_STACKED: case IDM_FWD_SHOWDESKTOP: case IDM_FWD_MINALL: case IDM_FWD_UNDO: g_undo=(wID!=IDM_FWD_UNDO); /* fall through */ case IDM_FWD_DATETIME: case IDM_FWD_CUSTOMNOTIFYICONS: case IDM_FWD_TASKMAN: case IDM_FWD_LOCKTASKBAR: case IDM_FWD_LOCKALLTASKBAR: case IDM_FWD_TASKBARPROP: case IDM_FWD_RUNAPP: case IDM_FWD_EXITEXPLORER:{ HWND hwndTray = FindWindowA("Shell_TrayWnd", NULL); if(hwndTray) PostMessage(hwndTray, WM_COMMAND, wID, 0); break;} case IDM_DATETIME_EX:{ HWND hwnd1, hwnd2; int wait = 40; api.Exec(L"timedate.cpl", L"", 0); while((hwnd2=FindWindowA((char*)(uintptr_t)32770,"Date and Time"))==0 && wait--) Sleep(50); if(hwnd2){ SetActiveWindow(hwnd2); wait = 10; while((hwnd1=FindWindowExA(hwnd2,NULL,(char*)(uintptr_t)32770,"Date and Time"))==0 && wait--) Sleep(50); if(hwnd1){ hwnd2 = GetDlgItem(hwnd1,116); if(hwnd2) PostMessage(hwnd2,BM_CLICK,0,0); } } break;} case IDM_CHIME: /// Alarms AlarmChimeEnable(-1); break; case IDM_STOPWATCH: /// Timers DialogStopWatch(); break; case IDM_STOPWATCH_START: case IDM_STOPWATCH_RESUME: if(!IsWindow(g_hDlgStopWatch)) DialogStopWatch(); StopWatch_Resume(g_hDlgStopWatch); break; case IDM_STOPWATCH_STOP: case IDM_STOPWATCH_PAUSE: if(IsWindow(g_hDlgStopWatch)) StopWatch_Pause(g_hDlgStopWatch); break; case IDM_STOPWATCH_RESET: if(IsWindow(g_hDlgStopWatch)) StopWatch_Reset(g_hDlgStopWatch); break; case IDM_STOPWATCH_LAP: if(IsWindow(g_hDlgStopWatch)) StopWatch_Lap(g_hDlgStopWatch,0); break; case IDM_TIMER: DialogTimer(0); break; case IDM_TIMEWATCH: WatchTimer(0); // Shelter All the Homeless Timers. break; case IDM_TIMEWATCHRESET: WatchTimer(1); // Shelter All the Homeless Timers. break; case IDM_SNTP:{ short just_elevated = HIWORD(wParam); if(!just_elevated || HaveSetTimePermissions()) { ReplyMessage(1); NetTimeConfigDialog(0); return 1; // handled } else { if(IsWindow(g_hDlgSNTP)) SendMessage(g_hDlgSNTP, WM_CLOSE, 1, 0); // close window but safe changes } return 0;} case IDM_SYNCTIME: case IDM_SNTP_SYNC:{ short just_elevated = HIWORD(wParam); int can_sync = HaveSetTimePermissions(); if(!just_elevated || can_sync) { ReplyMessage(1); if(can_sync) { SyncTimeNow(); } else { if(api.ExecElevated(GetClockExe(),L"/UAC /Sync",NULL) != 0) { MessageBox(0, L"T-Clock must be elevated to set your system time,\nbut elevation was canceled", L"Time Sync Failed", MB_OK|MB_ICONERROR|MB_SETFOREGROUND); } } return 1; // handled } return 0;} default: #ifdef _DEBUG DBGOUT("%s: unknown ID: %.5i(0x%.4x) (hwnd:%p)", __FUNCTION__, wID, wID, hwnd); #endif // _DEBUG break; } return 0; }
bool CPkiCard::PinCmd(tPinOperation operation, const tPin & Pin, const std::string & csPin1, const std::string & csPin2, unsigned long & ulRemaining, const tPrivKey *pKey) { // No standard for Logoff, so each card has to implement // it's own command here. if (operation == PIN_OP_LOGOFF ) return LogOff(Pin); bool bRet = false; std::string csReadPin1, csReadPin2; const std::string *pcsPin1 = &csPin1; const std::string *pcsPin2 = &csPin2; bool bAskPIN = csPin1.empty(); bool bUsePinpad = bAskPIN ? m_poPinpad->UsePinpad(operation) : false; bad_pin: //If no Pin(s) provided and it's no Pinpad reader -> ask Pins if (bAskPIN && !bUsePinpad) { showPinDialog(operation, Pin, csReadPin1, csReadPin2, pKey); pcsPin1 = &csReadPin1; pcsPin2 = &csReadPin2; } CByteArray oPinBuf = MakePinBuf(Pin, *pcsPin1, bUsePinpad); if (operation != PIN_OP_VERIFY) oPinBuf.Append(MakePinBuf(Pin, *pcsPin2, bUsePinpad)); CByteArray oAPDU = MakePinCmd(operation, Pin); // add CLA, INS, P1, P2 oAPDU.Append((unsigned char) oPinBuf.Size()); // add P3 oAPDU.Append(oPinBuf); CByteArray oResp; bool bSelected = false; // Don't remove these brackets!! { CAutoLock autolock(this); // Select the path where the Pin is, if necessary if (!Pin.csPath.empty() && !bSelected && Pin.csPath != "3F00") { SelectFile(Pin.csPath); bSelected = true; } // Send the command if (csPin1.empty() && bUsePinpad) oResp = m_poPinpad->PinCmd(operation, Pin, PinUsage2Pinpad(Pin, pKey), oAPDU, ulRemaining); else oResp = SendAPDU(oAPDU); } unsigned long ulSW12 = getSW12(oResp); if (ulSW12 == 0x9000) bRet = true; else if (ulSW12 == 0x6983) ulRemaining = 0; else if (ulSW12 / 16 == 0x63C) ulRemaining = ulSW12 % 16; else throw CMWEXCEPTION(m_poContext->m_oPCSC.SW12ToErr(ulSW12)); #ifndef NO_DIALOGS // Bad PIN: show a dialog to ask the user to try again // PIN blocked: show a dialog to tell the user if (bAskPIN && !bRet) { DlgPinUsage usage = PinUsage2Dlg(Pin, pKey); DlgRet dlgret = DlgBadPin(usage, utilStringWiden(Pin.csLabel).c_str(), ulRemaining); if (0 != ulRemaining && DLG_RETRY == dlgret) goto bad_pin; } #endif // If PIN command OK and no SSO, then state that we have now // verified this PIN, this info is needed in the Sign() method if (bRet && !m_poContext->m_bSSO) { bool bFound = false; for (size_t i = 0; i < m_verifiedPINs.size() && !bFound; i++) bFound = (m_verifiedPINs[i] == Pin.ulID); if (!bFound) m_verifiedPINs.push_back(Pin.ulID); } return bRet; }
status_t AIMProtocol::Process(BMessage* msg) { switch (msg->what) { case IM_MESSAGE: { int32 im_what = 0; msg->FindInt32("im_what", &im_what); switch (im_what) { case IM_SET_OWN_STATUS: { int32 status = msg->FindInt32("status"); BString status_msg(""); msg->FindString("message", &status_msg); char* smsg = strdup(status_msg.String()); switch (status) { case CAYA_ONLINE: if (!fOnline) A_LogOn(); else imcomm_set_unaway(fIMCommHandle); break; case CAYA_AWAY: imcomm_set_away(fIMCommHandle, smsg); break; case CAYA_CUSTOM_STATUS: //imcomm_set_away(fIMCommHandle, smsg); //UnsupportedOperation(); ? break; case CAYA_DO_NOT_DISTURB: imcomm_set_away(fIMCommHandle, smsg); //UnsupportedOperation(); ? break; case CAYA_OFFLINE: LogOff(); break; default: break; } free(smsg); BMessage msg(IM_MESSAGE); msg.AddInt32("im_what", IM_STATUS_SET); msg.AddString("protocol", kProtocolSignature); msg.AddInt32("status", status); gServerMsgr->SendMessage(&msg); break; } case IM_SET_NICKNAME: UnsupportedOperation(); break; case IM_SEND_MESSAGE: { const char* buddy = msg->FindString("id"); const char* sms = msg->FindString("body"); imcomm_im_send_message(fIMCommHandle, buddy, sms, 0); // XXX send a message to let caya know we did it BMessage msg(IM_MESSAGE); msg.AddInt32("im_what", IM_MESSAGE_SENT); msg.AddString("protocol", kProtocolSignature); msg.AddString("id", buddy); msg.AddString("body", sms); gServerMsgr->SendMessage(&msg); break; } case IM_REGISTER_CONTACTS: { const char* buddy = NULL; char *buddy_copy; for (int32 i = 0; msg->FindString("id", i, &buddy) == B_OK; i++) { buddy_copy = strdup(buddy); imcomm_im_add_buddy(fIMCommHandle, buddy_copy); free(buddy_copy); } break; } case IM_UNREGISTER_CONTACTS: { const char* buddy = NULL; for (int32 i = 0; msg->FindString("id", i, &buddy) == B_OK; i++) imcomm_im_remove_buddy(fIMCommHandle, buddy); break; } case IM_USER_STARTED_TYPING: //UnsupportedOperation(); break; case IM_USER_STOPPED_TYPING: //UnsupportedOperation(); break; case IM_GET_CONTACT_INFO: UnsupportedOperation(); break; case IM_ASK_AUTHORIZATION: case IM_AUTHORIZATION_RECEIVED: case IM_AUTHORIZATION_REQUEST: case IM_AUTHORIZATION_RESPONSE: case IM_CONTACT_AUTHORIZED: UnsupportedOperation(); break; case IM_SPECIAL_TO_PROTOCOL: UnsupportedOperation(); break; default: return B_ERROR; } break; } default: // We don't handle this what code return B_ERROR; } return B_OK; }
status_t AIMProtocol::Shutdown() { LogOff(); return B_OK; }
MSNManager::~MSNManager(void) { LogOff(); }