void SkypeWinClient::skypeAttachStatus (bool bOk) { MainApp *theApp = (MainApp *)qApp; bool bInWork = false; do // Begin cleanup block (not a loop) { if (!bOk) { theApp->clearSkypeHandle (); break; } QMutexLocker locker (&mutex); if (SW_Connect != workCurrent.whatwork) { qWarning ("SkypeWinClient: We're not in connection phase."); break; } bInWork = true; bOk = SkypeClient::ensureConnected (); } while (0); // End cleanup block (not a loop) }//SkypeWinClient::skypeAttachStatus
bool SkypeWinClient::invoke (const QString &strCommand) { MainApp *theApp = (MainApp *)qApp; LRESULT lRet = FALSE; do // Begin cleanup block (not a loop) { qDebug () << "SkypeWinClient: Sending command" << strCommand; QMutexLocker locker (&mutex); bInvokeInProgress = true; COPYDATASTRUCT cds; memset (&cds, 0, sizeof (cds)); QByteArray ba = strCommand.toUtf8(); cds.cbData = ba.size () + 1; cds.lpData = ba.data (); lRet = SendMessage (theApp->getSkypeHandle (), WM_COPYDATA, (WPARAM) mainwin.winId (), (LPARAM) &cds); if (FALSE == lRet) { DWORD dw = GetLastError (); bInvokeInProgress = false; if (ERROR_INVALID_WINDOW_HANDLE == dw) { theApp->clearSkypeHandle (); } QString m = QString("Failed to Invoke. GetLastError = %1").arg(dw); emit internalCompleted (-1, m); break; } } while (0); // End cleanup block (not a loop) return (TRUE == lRet); }//SkypeWinClient::invoke