AIM_RESULT OnRspGetMemo(AMVoid *pvArg, AIM_RSP_GET_MEMO *pRspGetMemo) { IAIM *pIM = (IAIM*)(((AMPVoid*)pvArg)[1]); IAIMessage *pMsg = AMNULL; AMChar *pBuf = AMNULL; AMInt32 iLen = 0; AMAssert(AMNULL != pIM && AMNULL != pRspGetMemo); DPRINT("IASessionModel_OnGetCntMemo.........................Entering!\n"); pMsg = IAIMessage_Create(); if(pRspGetMemo->szContactId) IAIMessage_SetCntID(pMsg, pRspGetMemo->szContactId, AMStrlen(pRspGetMemo->szContactId)); if(0 == pRspGetMemo->iRetCode)//成功 { pMsg->eType = (AIM_MSG_TYPE)GET_CNTMEMO_OK; IAIMessage_SetContent(pMsg, pRspGetMemo->szMemo, AMStrlen(pRspGetMemo->szMemo)); } else//失败 { pMsg->eType = (AIM_MSG_TYPE)GET_CNTMEMO_FAIL; } DPRINT("IASessionModel_OnGetCntMemo.......................%s\n", pMsg->szContent); Adapter_OnIncomingSysMsg(pIM->pSesModel, pMsg, pvArg); IAIMessage_Destroy(pMsg); DPRINT("IASessionModel_OnGetCntMemo.........................OK!\n"); return eAIM_RESULT_OK; }
AIM_RESULT OnRspChgSignature(AMVoid *pvArg, AIM_RSP_CHG_SIGNATURE *pRspChgSignature) { IAIM *pIM = (IAIM*)(((AMPVoid*)pvArg)[1]); IAIMessage *pMsg = 0; AMAssert(AMNULL != pIM && AMNULL != pIM->pAcnt); pMsg = IAIMessage_Create(); pMsg->bUnread = AMTRUE; if(!pRspChgSignature->iRetCode) { pMsg->eType = (AIM_MSG_TYPE)CHG_SIGNATURE_OK; IAIMessage_SetContent(pMsg, pIM->pAcnt->szSignature, AMStrlen(pIM->pAcnt->szSignature)); DPRINT("IAIM_OnChgSignature..............%s\n", pIM->pAcnt->szSignature); } else { pMsg->eType = (AIM_MSG_TYPE)CHG_SIGNATURE_FAIL; DPRINT("IAIM_OnChgSignature...................Faile!\n"); } Adapter_OnIncomingSysMsg(pIM->pSesModel, pMsg, pvArg); IAIMessage_Destroy(pMsg); return eAIM_RESULT_OK; }
AIM_RESULT OnNtfHelpLogin(AMVoid *pvArg, AIM_NTF_HELP_LOGIN *pNtfHelpLogin) { IAIMessage *pMsg = AMNULL; IAIM *pIM = (IAIM*)(((AMPVoid*)pvArg)[1]); AMAssert(AMNULL != pIM && AMNULL != pNtfHelpLogin); pMsg = IAIMessage_Create(); if(!pNtfHelpLogin->iRetCode) { pMsg->eType = (AIM_MSG_TYPE)HELP_LOGIN_OK; IAIMessage_SetCntID(pMsg, pNtfHelpLogin->szParentId, AMStrlen(pNtfHelpLogin->szParentId)); IAIMessage_SetContent(pMsg, " ", 1); pMsg->szContent[0] = '0' + pNtfHelpLogin->uiMulStatus; DPRINT("OnNtfHelpLogin................HELP_LOGIN_OK %s, %s!\n", pMsg->szContactID, pMsg->szContent); } else { pMsg->eType = (AIM_MSG_TYPE)HELP_LOGIN_FAIL; DPRINT("OnNtfHelpLogin................HELP_LOGIN_FAIL! %d\n", pNtfHelpLogin->iRetCode); } Adapter_OnIncomingSysMsg(pIM->pSesModel, pMsg, pvArg); IAIMessage_Destroy(pMsg); DPRINT("OnNtfHelpLogin.........................OK!\n"); return eAIM_RESULT_OK; }
IAIMessage* IAIMessage_Dup(const IAIMessage *pMsg) { IAIMessage *pRet = 0; AMAssert(0 != pMsg); pRet = IAIMessage_Create(); if(pMsg->szContactID) { IAIMessage_SetCntID(pRet, pMsg->szContactID, AMStrlen(pMsg->szContactID)); } if(pMsg->szContent) { IAIMessage_SetContent(pRet, pMsg->szContent, AMStrlen(pMsg->szContent)); } pRet->_iRid = pMsg->_iRid; pRet->iServerTime = pMsg->iServerTime; pRet->eType = pMsg->eType; return pRet; }
static AMInt32 AIMSession_OnSelMsgs(void* pvArg, int iCnt, char **pszValue, char**pszName) { AMPVoid *pvArgs = (AMPVoid *)pvArg; AMHandle **pphMsgArray = (AMHandle**)pvArgs[0]; AMInt32 *piCount = (AMInt32*)pvArgs[1]; IAIMessage *pMsg = IAIMessage_Create(); AMAssert(pphMsgArray && *pphMsgArray && piCount && pMsg); pMsg->_iRid = AMAtoi64(pszValue[0]); IAIMessage_SetCntID(pMsg, pszValue[1], AMStrlen(pszValue[1])); pMsg->eType = AMAtoi(pszValue[2]); pMsg->iServerTime = AMAtoi(pszValue[3]); IAIMessage_SetContent(pMsg, pszValue[4], AMStrlen(pszValue[4])); pMsg->bUnread = AMAtoi(pszValue[5]); (*pphMsgArray)[(*piCount)++] = pMsg; return 0; }
AIM_RESULT OnRspGetVerify(AMVoid *pvArg, AIM_RSP_GET_VERIFY *pRspGetVerify) { IAIM *pIM = (IAIM*)(((AMPVoid*)pvArg)[1]); IAIMessage *pMsg = 0; AMChar szBuf[20] = {0}; AMAssert(NULL != pIM && NULL != pIM->pAcnt); pMsg = IAIMessage_Create(); pMsg->bUnread = AMTRUE; pMsg->eType = (AIM_MSG_TYPE)GET_PEER_ADD_VERIFY; IAIMessage_SetCntID(pMsg, pRspGetVerify->szContactId, AMStrlen(pRspGetVerify->szContactId)); _AIMItoa(pRspGetVerify->iRetCode, szBuf); IAIMessage_SetContent(pMsg, szBuf, AMStrlen(szBuf)); DPRINT("IASessionModel_OnPeerVerifyConfig..............%s\n", pMsg->szContent); Adapter_OnIncomingSysMsg(pIM->pSesModel, pMsg, pvArg); IAIMessage_Destroy(pMsg); return eAIM_RESULT_OK; }
AIM_RESULT OnRspChgVerify(AMVoid *pvArg, AIM_RSP_CHG_VERIFY *pRspChgVerify) { IAIMessage *pMsg = AMNULL; IAIM *pIM = (IAIM*)(((AMPVoid*)pvArg)[1]); pMsg = IAIMessage_Create(); pMsg->bUnread = AMTRUE; if(0 == pRspChgVerify->iRetCode) { pMsg->eType = (AIM_MSG_TYPE)CHG_VERIFY_OK; } else { pMsg->eType = (AIM_MSG_TYPE)CHG_VERIFY_FAILE; } IAIMessage_SetContent(pMsg, "0", 1); pMsg->szContent[0] = '0' + pIM->pAcnt->iVerifyType; Adapter_OnIncomingSysMsg(pIM->pSesModel, pMsg, pvArg); IAIMessage_Destroy(pMsg); return eAIM_RESULT_OK; }