// Поиск контакта по EMail HANDLE CMraProto::MraWPRequestByEMail(MCONTACT hContact, DWORD dwAckType, CMStringA &szEmail) { if (szEmail.GetLength() <= 4) return 0; int iStart = 0; CMStringA szUser = szEmail.Tokenize("@", iStart); CMStringA szDomain = szEmail.Tokenize("@", iStart); DWORD dwRequestFlags = 0; SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_USER); SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_DOMAIN); return MraWPRequestW(hContact, dwAckType, dwRequestFlags, szUser, szDomain, _T(""), _T(""), _T(""), 0, 0, 0, 0, 0, 0, 0, 0, 0); }
void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) { if (!IsStatusConnecting(m_iStatus)) return; m_iStatus++; if (response == NULL) { debugLogA(__FUNCTION__ ": failed to get create endpoint"); ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; } for (int i = 0; i < response->headersCount; i++) { if (!mir_strcmpi(response->headers[i].szName, "Set-RegistrationToken")) { CMStringA szValue = response->headers[i].szValue, szCookieName, szCookieVal; int iStart = 0; while (true) { CMStringA szToken = szValue.Tokenize(";", iStart).Trim(); if (iStart == -1) break; int iStart2 = 0; szCookieName = szToken.Tokenize("=", iStart2); szCookieVal = szToken.Mid(iStart2); setString(szCookieName, szCookieVal); } } else if (!mir_strcmpi(response->headers[i].szName, "Location")) { CMStringA szValue = response->headers[i].szValue; li.endpoint.szServer = GetServerFromUrl(szValue).Detach(); setString("Server", li.endpoint.szServer); } } if (m_iStatus++ > SKYPE_MAX_CONNECT_RETRIES) { debugLogA(__FUNCTION__ ": failed to create endpoint (too many connect retries)"); ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; } if (response->resultCode != 201) { if (response->resultCode == 401) { delSetting("TokenExpiresIn"); SendRequest(new LoginOAuthRequest(li.szSkypename, ptrA(getStringA(SKYPE_SETTINGS_PASSWORD))), &CSkypeProto::OnLoginOAuth); return; } else //it should be rewritten { SendRequest(new CreateEndpointRequest(li), &CSkypeProto::OnEndpointCreated); return; } } li.endpoint.szToken = getStringA("registrationToken"); li.endpoint.szId = getStringA("endpointId"); SendRequest(new CreateSubscriptionsRequest(li), &CSkypeProto::OnSubscriptionsCreated); }