bool CWizApiBase::callAttachmentsGetInfo(const CWizStdStringArray& arrayAttachmentGUID) { CWizApiTokenParam param(*this); param.AddStringArray("attachment_guids", arrayAttachmentGUID); return callXmlRpc(SyncMethod_GetAttachmentsInfo, ¶m); }
bool CWizApi::callDocumentsGetInfo(const CWizStdStringArray& arrayDocumentGUID) { CWizApiTokenParam param(*this); param.AddStringArray("document_guids", arrayDocumentGUID); return callXmlRpc(SyncMethod_GetDocumentsInfo, ¶m); }
bool CWizApiBase::callClientKeepAlive() { CWizApiParamBase param; param.AddString("token", WizGlobal()->token()); return callXmlRpc(SyncMethod_ClientKeepAlive, ¶m); }
bool CWizApiBase::callClientLogout() { Q_ASSERT(!m_user.strToken.isEmpty()); CWizApiTokenParam param(*this); return callXmlRpc(SyncMethod_ClientLogout, ¶m); }
bool CWizApiBase::callGetUserCert(const QString& strUserId, const QString& strPassword) { CWizApiParamBase param; param.AddString("user_id", MakeXmlRpcUserId(strUserId)); param.AddString("password", MakeXmlRpcPassword(strPassword)); return callXmlRpc(SyncMethod_GetUserCert, ¶m); }
bool CWizApiBase::callGetList(const QString& strMethodName, __int64 nVersion) { CWizApiTokenParam param(*this); param.AddInt(_T("count"), WIZAPI_PAGE_MAX); param.AddString(_T("version"), WizInt64ToStr(nVersion)); return callXmlRpc(strMethodName, ¶m); }
bool CWizApi::callGetList(const QString& strMethodName, __int64 nVersion) { CWizApiTokenParam param(*this); param.AddInt(_T("count"), getCountPerPage()); param.AddString(_T("version"), WizInt64ToStr(nVersion)); return callXmlRpc(strMethodName, ¶m); }
bool CWizApiBase::callClientLogin(const QString& strUserId, const QString& strPassword) { m_user = WIZUSERINFO(); CWizApiParamBase param; param.AddString("user_id", MakeXmlRpcUserId(strUserId)); param.AddString("password", MakeXmlRpcPassword(strPassword)); return callXmlRpc(SyncMethod_ClientLogin, ¶m); }
bool CWizApiBase::callAttachmentPostData(const WIZDOCUMENTATTACHMENTDATAEX& data) { m_currentAttachment = data; int nParts = data.nObjectPart; Q_ASSERT(0 != nParts); QString info = data.strName; Q_EMIT processLog(tr("upload attachment info: ") + info); CWizApiTokenParam param(*this); CWizXmlRpcStructValue* pAttachmentStruct = new CWizXmlRpcStructValue(); param.AddStruct(_T("attachment"), pAttachmentStruct); bool bInfo = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_INFO) ? true : false; bool bData = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA) ? true : false; pAttachmentStruct->AddString(_T("attachment_guid"), data.strGUID); pAttachmentStruct->AddBool(_T("attachment_info"), bInfo ? true : false); pAttachmentStruct->AddBool(_T("attachment_data"), bData ? true : false); bool bDataInfoAdded = false; const WIZDOCUMENTATTACHMENTDATAEX& infodata = data; if (bInfo) { pAttachmentStruct->AddString(_T("attachment_document_guid"), infodata.strDocumentGUID); pAttachmentStruct->AddString(_T("attachment_name"), infodata.strName); pAttachmentStruct->AddString(_T("attachment_url"), infodata.strURL); pAttachmentStruct->AddString(_T("attachment_description"), infodata.strDescription); pAttachmentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified); pAttachmentStruct->AddString(_T("info_md5"), infodata.strInfoMD5); pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5); bDataInfoAdded = true; } if (bData) { if (!bDataInfoAdded) { pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5); bDataInfoAdded = true; } pAttachmentStruct->AddString(_T("attachment_zip_md5"), WizMd5StringNoSpaceJava(infodata.arrayData)); } return callXmlRpc(SyncMethod_PostAttachmentData, ¶m); }
inline bool CWizApiBase::callPostList(const QString& strMethodName, const CString& strArrayName, const std::deque<TData>& arrayData) { if (arrayData.empty()) return true; CWizApiTokenParam param(*this); param.AddArray<TData>(strArrayName, arrayData); return callXmlRpc(strMethodName, ¶m); }
bool CWizApiBase::callClientLogin(const QString& strUserId, const QString& strPassword) { if (WizGlobal()->token().isEmpty()) { CWizApiParamBase param; param.AddString("user_id", MakeXmlRpcUserId(strUserId)); param.AddString("password", MakeXmlRpcPassword(strPassword)); return callXmlRpc(SyncMethod_ClientLogin, ¶m); } else { m_strUserId = strUserId; m_strPasswd = strPassword; return callClientKeepAlive(); } }
bool CWizApiBase::callDocumentGetData(const WIZDOCUMENTDATABASE& data) { //QString info = data.strTitle; //Q_EMIT processLog(tr("downloading note info: ") + info); int nPart = data.nObjectPart; Q_ASSERT(nPart != 0); CWizApiTokenParam param(*this); param.AddString("document_guid", data.strGUID); param.AddBool("document_info", (nPart & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? true : false); param.AddBool("document_param", (nPart & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? true : false); return callXmlRpc(SyncMethod_GetDocumentData, ¶m); }
bool CWizApi::callUploadDataPart(const CString& strObjectGUID, const CString& strObjectType, const CString& strObjectMD5, int allSize, int partCount, int partIndex, int partSize, const QByteArray& arrayData) { Q_UNUSED(allSize); Q_ASSERT(partSize == arrayData.size()); CWizApiTokenParam param(*this); param.AddString(_T("obj_guid"), strObjectGUID); param.AddString(_T("obj_type"), strObjectType); param.AddString(_T("obj_md5"), strObjectMD5); param.AddInt(_T("part_count"), partCount); param.AddInt(_T("part_sn"), partIndex); param.AddInt64(_T("part_size"), partSize); param.AddString(_T("part_md5"), ::WizMd5StringNoSpaceJava(arrayData)); param.AddBase64(_T("data"), arrayData); return callXmlRpc(SyncMethod_UploadObjectPart, ¶m); }
bool CWizApiBase::callCreateAccount(const CString& strUserId, const CString& strPassword) { CWizApiParamBase param; param.AddString("user_id", MakeXmlRpcUserId(strUserId)); param.AddString("password", MakeXmlRpcPassword(strPassword)); #if defined Q_OS_MAC param.AddString("invite_code", "129ce11c"); param.AddString("product_name", "qtMac"); #elif defined Q_OS_LINUX param.AddString("invite_code", "7abd8f4a"); param.AddString("product_name", "qtLinux"); #else param.AddString("invite_code", "8480c6d7"); param.AddString("product_name", "qtWindows"); #endif return callXmlRpc(SyncMethod_CreateAccount, ¶m); }
bool CWizApiBase::callDownloadDataPart(const CString& strObjectGUID, const CString& strObjectType, int pos) { m_bDownloadingObject = true; unsigned int size = WIZAPI_TRUNK_SIZE; m_currentObjectPartData.strObjectGUID = strObjectGUID; m_currentObjectPartData.strObjectType = strObjectType; m_currentObjectPartData.nStartPos = pos; m_currentObjectPartData.nQuerySize = size; CWizApiTokenParam param(*this); param.AddString(_T("obj_guid"), strObjectGUID); param.AddString(_T("obj_type"), strObjectType); param.AddInt64(_T("start_pos"), pos); param.AddInt64(_T("part_size"), size); return callXmlRpc(SyncMethod_DownloadObjectPart, ¶m); }
bool CWizApiBase::callClientLogout() { CWizApiTokenParam param(*this); return callXmlRpc(SyncMethod_ClientLogout, ¶m); }
bool CWizApiBase::callDocumentPostData(const WIZDOCUMENTDATAEX& data) { m_currentDocument = data; int nParts = m_currentDocument.nObjectPart; Q_ASSERT(0 != nParts); bool bInfo = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? true : false; bool bParam = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? true : false; bool bData = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? true : false; QString info = data.strTitle; Q_EMIT processLog(tr("upload document info:") + info); CWizApiTokenParam param(*this); CWizXmlRpcStructValue* pDocumentStruct = new CWizXmlRpcStructValue(); param.AddStruct(_T("document"), pDocumentStruct); pDocumentStruct->AddString(_T("document_guid"), data.strGUID); pDocumentStruct->AddBool(_T("document_info"), bInfo ? true : false); pDocumentStruct->AddBool(_T("document_data"), bData ? true : false); pDocumentStruct->AddBool(_T("document_param"), bParam ? true : false); bool bParamInfoAdded = false; bool bDataInfoAdded = false; const WIZDOCUMENTDATAEX& infodata = data; //m_currentDocument; if (bInfo) { pDocumentStruct->AddString(_T("document_title"), infodata.strTitle); pDocumentStruct->AddString(_T("document_category"), infodata.strLocation); pDocumentStruct->AddString(_T("document_filename"), infodata.strName); pDocumentStruct->AddString(_T("document_seo"), infodata.strSEO); pDocumentStruct->AddString(_T("document_url"), infodata.strURL); pDocumentStruct->AddString(_T("document_author"), infodata.strAuthor); pDocumentStruct->AddString(_T("document_keywords"), infodata.strKeywords); pDocumentStruct->AddString(_T("document_type"), infodata.strType); pDocumentStruct->AddString(_T("document_owner"), infodata.strOwner); pDocumentStruct->AddString(_T("document_filetype"), infodata.strFileType); pDocumentStruct->AddString(_T("document_styleguid"), infodata.strStyleGUID); pDocumentStruct->AddTime(_T("dt_created"), infodata.tCreated); pDocumentStruct->AddTime(_T("dt_modified"), infodata.tModified); pDocumentStruct->AddTime(_T("dt_accessed"), infodata.tAccessed); pDocumentStruct->AddInt(_T("document_iconindex"), infodata.nIconIndex); pDocumentStruct->AddInt(_T("document_protected"), infodata.nProtected); pDocumentStruct->AddInt(_T("document_readcount"), infodata.nReadCount); pDocumentStruct->AddInt(_T("document_attachment_count"), infodata.nAttachmentCount); pDocumentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified); pDocumentStruct->AddString(_T("info_md5"), infodata.strInfoMD5); pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5); pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified); pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5); pDocumentStruct->AddString(_T("system_tags"), infodata.strSystemTags); pDocumentStruct->AddInt(_T("document_share"), infodata.nShareFlags); //m_db->GetDocumentTags(infodata.strGUID, infodata.arrayTagGUID); pDocumentStruct->AddStringArray(_T("document_tags"), infodata.arrayTagGUID); bParamInfoAdded = true; bDataInfoAdded = true; } if (bParam) { //m_db->GetDocumentParams(infodata.strGUID, infodata.arrayParam); if (!bParamInfoAdded) { pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified); pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5); bParamInfoAdded = true; } pDocumentStruct->AddArray(_T("document_params"), infodata.arrayParam); } if (bData) { //if (!m_db->LoadDocumentData(m_currentDocument.strGUID, m_currentDocument.arrayData)) //{ // //skip this document // QString info2 = data.strTitle; // Q_EMIT processErrorLog(tr("Can not load document data: ") + info2); // onUploadObjectDataCompleted(data); // return false; //} if (!bDataInfoAdded) { pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified); pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5); bDataInfoAdded = true; } pDocumentStruct->AddString(_T("document_zip_md5"), WizMd5StringNoSpaceJava(infodata.arrayData)); } return callXmlRpc(SyncMethod_PostDocumentData, ¶m); }
bool CWizApiBase::callGetGroupList() { CWizApiTokenParam param(*this); return callXmlRpc(SyncMethod_GetGroupList, ¶m); }