예제 #1
0
AMVoid			IAccount_SetNameType(AIMAccount *pAcnt, const AMChar *szName, AMUInt32 uiNameLen, AIM_ACCOUNT_TYPE eType)
{
	AMAssert(0 != pAcnt);
	AMAssert(0 != szName  && eType>=0 && eType <= 8);

	if(pAcnt->szName)
	{
		AMFree(pAcnt->szName);
		pAcnt->szName = 0;
	}
	pAcnt->szName = AMMalloc(uiNameLen + 1);
	AMAssert(0 != pAcnt->szName);
	AMMemset(pAcnt->szName, 0, uiNameLen + 1);
	AMMemcpy(pAcnt->szName, szName, uiNameLen);
	
	pAcnt->eType = eType;

	if(pAcnt->szID)
	{
		AMFree(pAcnt->szID);
		pAcnt->szID = 0;
	}
	pAcnt->szID = AMMalloc(uiNameLen + ID_HEAD_LEN + 1);
	AMAssert(0 != pAcnt->szID);
	AMMemset(pAcnt->szID, 0, uiNameLen + ID_HEAD_LEN + 1);
	AMStrcpy(pAcnt->szID, szID_Head[eType]);
	AMMemcpy(pAcnt->szID + ID_HEAD_LEN, szName, uiNameLen);
}
예제 #2
0
Node *
construct_Node(size_t nlinks)
{
  Node *ptr = NULL;

  CHECK_VARA(ptr = (Node *)AMMalloc(sizeof *ptr), NULL);
  if (!(ptr->ptr = (struct _Node **)AMMalloc(sizeof *(ptr->ptr) * nlinks))) {
    if (!(ptr->ptr = (struct _Node **)AMMalloc(sizeof *(ptr->ptr) * nlinks))) {
      if (!(ptr->ptr = (struct _Node **)AMMalloc(sizeof *(ptr->ptr) * nlinks))) {
        return ptr;
      }
    }
  }
  return ptr;
}
예제 #3
0
int8_t
resize_Vector(Vector * vec, size_t size)
{
  void *ptr;
  size_t offset = size * O(vec);

  CHECK_VARN(vec, EINVAL);
  CHECK_VARA(ptr = AMMalloc(offset),EALLOCF);
  ARR_COPY_WRAP(Vector,ptr,vec,size);
  /*offset = S(vec) * O(vec);
  if(M(vec)) {
	  if(S(vec) == 0) {
		  printf("%d\n",__LINE__);
	  } else if(H(vec) < T(vec)) {
		  printf("%d\n",__LINE__);
		  memcpy(ptr,H(vec),((char *)T(vec) - (char *)H(vec)));
	  } else if((void *)((char *)(H(vec)) + offset) < vec->end) {
		  printf("%d\n",__LINE__);
		  memcpy(ptr,H(vec),offset);
	  } else {
		  ptrdiff_t spaces = ((char *)vec->end - (char *)H(vec));
		  memcpy(ptr,H(vec),(size_t)spaces);
		  memcpy((char *)(ptr + spaces),M(vec),O(vec) * (S(vec) - spaces/O(vec)));
	  }
	  AMFree(M(vec));
  }*/
  ARR_SETUP_POINTERS(Vector,ptr,vec,size);
  return SUCCESS;
}
예제 #4
0
AMInt32	_AIMAuth_setSession(AIMAuth *pAuth, const AMChar *szSession)
{
	AMInt32 iLen = 0;
	AMAssert(pAuth && szSession);
	iLen = AMStrlen(szSession);
	AMAssert(iLen);
	
	if(pAuth->szSession)
	{
		AMFree(pAuth->szSession);
		pAuth->szSession = AMNULL;
	}
#if 1	//dynamic
	pAuth->szSession = szSession;
#else
	pAuth->szSession = (AMChar *)AMMalloc(iLen + 1);
	if(!pAuth->szSession)
		return eAIM_RESULT_MALLOC_ERROR;

	AMStrcpy(pAuth->szSession, szSession);
#endif
	pAuth->iStatus = eAUTH_SESSION;

	return eAIM_RESULT_OK;
}
예제 #5
0
AMChar	*	BuildSigXMLFromStruct(AIM_SIGNATURE *pSigStruct, const AMChar *szSig)//只是把5个sig造好,没有追加后面的loop/st/ci等设置
{
	AMChar	*	szResultXML = AMNULL;
	AMInt32		iLen = 0, iPos = 0, i=0;
	AMAssert(pSigStruct);
	iLen = sizeof(XML_SIG_TEMPHEAD) + sizeof(XML_SIG_TEMPTAIL) + 3*MAX_INT_NUMBER_LEN;

	iLen += szSig?AMStrlen(szSig):0 + 11;

	for(i=0; i< MAX_SIG_COUNT-1; i++)
		iLen += pSigStruct->szSignature[i]?AMStrlen(pSigStruct->szSignature[i]):0 + 11;//11 for "<Sig></Sig>"

	szResultXML = (AMChar*)AMMalloc(iLen);
	if(!szResultXML)
		return AMNULL;

	AMMemset(szResultXML, 0, iLen);

	AMMemcpy(szResultXML, HeadTag(XML_TAG_SIGOP), sizeof(HeadTag(XML_TAG_SIGOP))-1);

	AMStrcat(szResultXML, HeadTag(XML_TAG_SIG));
	if(szSig)
		AMStrcat(szResultXML, szSig);
	AMStrcat(szResultXML, TailTag(XML_TAG_SIG));
	
	for(i=0; i< MAX_SIG_COUNT-1; i++)
	{
		AMStrcat(szResultXML, HeadTag(XML_TAG_SIG));
		AMStrcat(szResultXML, pSigStruct->szSignature[i]);
		AMStrcat(szResultXML, TailTag(XML_TAG_SIG));
	}

	return szResultXML;
}
예제 #6
0
AMTaskMgr* AMTaskMgrCreate(AMInt32 concurNum)
{
    AMInt32 index = 0;
    if(concurNum < 0)
        concurNum = AMASYNCTASK_DEFAULT_EXECUTE_COUNT;
    else if(concurNum > AMASYNCTASK_MAX_EXECUTE_COUNT)
        concurNum = AMASYNCTASK_MAX_EXECUTE_COUNT;

    _AMTaskMgrInit();
    AMThreadMutexLock(&gMutex);
    for(;index < AMASYNCTASK_SUPPORTED_MAXMGR; index++)
    {
        if(gTaskMgr[index] == AMNULL)
        {
            _AMTaskMgr* _taskMgr = (_AMTaskMgr*)AMMalloc(sizeof(_AMTaskMgr));
            if(_taskMgr == AMNULL)
            {
                AMThreadMutexUnlock(&gMutex);
                return AMNULL;
            }
			gTaskMgrCount++;
            AMMemset(_taskMgr, 0 , sizeof(_AMTaskMgr));
            _taskMgr->mId = index;
            _taskMgr->mConcurNum = concurNum;
            AMThreadMutexCreate(&_taskMgr->mMutex);
            AMThreadMutexUnlock(&gMutex);
            return (AMTaskMgr*)_taskMgr;
        }
    }
    AMThreadMutexUnlock(&gMutex);
    return AMNULL;
}
예제 #7
0
IAIMessage*	IAIMessage_Create()
{
	IAIMessage	*pRet = 0;
	pRet = (IAIMessage*)AMMalloc(sizeof(IAIMessage));
	AMAssert(0 != pRet);
	AMMemset(pRet, 0, sizeof(IAIMessage));
	return pRet;
}
예제 #8
0
AIMAccount *		IAccount_Create()
{
	AIMAccount *pRet = AMMalloc(sizeof(AIMAccount));
	AMAssert(0 != pRet);
	AMMemset(pRet, 0, sizeof(AIMAccount));

	return pRet;
}
예제 #9
0
IASession *	IASession_Create(const AMChar *szContactID, IASessionModel *pSesModel)
{
	IASession *pRet = 0;
	AMUInt32	ui = 0, uiLen = 0;
	AMAssert(0 != szContactID);
	pRet = (IASession*)AMMalloc(sizeof(IASession));
	AMMemset(pRet, 0, sizeof(IASession));
	uiLen = AMStrlen(szContactID);
	AMAssert(8 < uiLen);
	pRet->szContactID = (AMChar *)AMMalloc(uiLen + 1);
	for(ui = 0; ui < uiLen; ui++)
		pRet->szContactID[ui] = szContactID[ui];
	pRet->szContactID[uiLen] = 0;

	pRet->pSesModel = pSesModel;

	return pRet;
}
예제 #10
0
PCRetCode ReaderRecvBody(PacketConnection* pPacketConnection, AMUInt8* pHead, AMUInt8** ppBodyBuffer, AMInt32* pBodyLength)
{
	AMInt32 length = 0;
	
#ifdef AMOS_DEBUG
	AMPrintf("noble:ReaderRecvBody <<<<.\n");
#endif

	*pBodyLength = getIntValue(pHead, 12);
	
	if(*pBodyLength <0 /*|| *pBodyLength > PC_MAX_PROTOCOL_LEN */)
	{
	#ifdef AMOS_DEBUG
		AMPrintf("noble:reader: bodyLength exceed limited(0~20000) = %d\n", *pBodyLength);
	#endif
		//send a body exceed exception to up-layer.
		ReaderExceedExceptionHandler(pPacketConnection->pProtocolEngine, *pBodyLength);
		return eContinue;
	}

	// 分配Body空间并填充
	*ppBodyBuffer = (AMUInt8*)AMMalloc(*pBodyLength);
	if(*ppBodyBuffer == NULL)
	{
	#ifdef AMOS_DEBUG
		AMPrintf("noble:malloc pBodyBuffer error = %d.\n", *pBodyLength);
		AMAssert(0);
	#endif
		return eJumpWhile;
	}
	memset(*ppBodyBuffer, 0, *pBodyLength);
	
    length = PCContextGetInstance()->recv(
		pPacketConnection->pProtocolEngine->pPCCore->socketFd, *ppBodyBuffer, *pBodyLength);

	if( length != *pBodyLength)
	{
	#ifdef AMOS_DEBUG
		AMPrintf("noble:recv = %d != bodyLength = %d\n", length, *pBodyLength);
	#endif
		//first free memory
		AMFree(*ppBodyBuffer);
		*ppBodyBuffer = NULL;

		//send exception to up.
		if(ReaderRecvExceptionHandler(pPacketConnection,*pBodyLength,length) == eContinue)
			return eContinue;
		else
			return eJumpWhile;
	}
	
#ifdef AMOS_DEBUG
	AMPrintf("noble:ReaderRecvBody >>>>>.\n");
#endif
	return eOK;
}
예제 #11
0
int8_t resize_DequeVector(DequeVector *deque,size_t size) {
	void *ptr = NULL;
	CHECK_VARN(deque,EINVAL);
	CHECK_VARA(ptr = AMMalloc(size * O(deque)),EALLOCF);
	
	ARR_COPY_WRAP(DequeVector,ptr,deque,size);

	ARR_SETUP_POINTERS(DequeVector,ptr,deque,size);
	return 0;
}
예제 #12
0
AMVoid		IAGroup_SetPinyin(IAGroup *pGrp, AMChar *szPinyin, AMUInt32 uiLen)
{
	AMAssert(0 != pGrp && 0 != szPinyin && 0 < uiLen);
	if(pGrp->szPinyin)
	{
		AMFree(pGrp->szPinyin);
		pGrp->szPinyin = 0;
	}
	pGrp->szPinyin = (AMChar *)AMMalloc(uiLen + 1);
	AMAssert(0 != pGrp->szPinyin);
	AMMemcpy(pGrp->szPinyin, szPinyin, uiLen);
	pGrp->szPinyin[uiLen] = 0;
}
예제 #13
0
void GetXMLString(AMChar* pSrc, AMChar* token, AMInt32 tokenLen, AMChar** ppDst, AMInt32* pDstLen)
{
	AMInt32 length = 0;
	AMChar* pBegin = NULL;
	AMChar* pEnd   = NULL;
	AMInt32 tokenBeginLen = tokenLen + 3;
	AMInt32 tokenEndLen   = tokenLen + 4;
	AMChar* tokenBegin = (AMChar*)AMMalloc(tokenBeginLen);
	AMChar* tokenEnd   = (AMChar*)AMMalloc(tokenEndLen);

	memset(tokenBegin, 0, tokenBeginLen);
	memset(tokenEnd, 0, tokenEndLen);
	
	//denx: sprintf这个东西可能导致异常
	//sprintf(tokenBegin, "%c%s%c", '<', token, '>');
	//sprintf(tokenEnd, "%s%s%c", "</", token, '>');
	length = strlen(token);
	memcpy(tokenBegin, "<", 1);
	memcpy(tokenBegin+1, token, length);
	memcpy(tokenBegin+1+length, ">", 1);
	memcpy(tokenEnd, "</", 2);
	memcpy(tokenEnd+2, token, length);
	memcpy(tokenEnd+2+length, ">", 1);	

	pBegin = strstr(pSrc, tokenBegin);
	pEnd   = strstr(pSrc, tokenEnd);

	if(pBegin != NULL && pEnd != NULL)
	{
		pBegin+= strlen(tokenBegin);
		*pDstLen = pEnd - pBegin;
		*ppDst = (AMChar*)AMMalloc(*pDstLen+1);  //此处申请的内存将在外面自动释放
		memset(*ppDst, 0, *pDstLen+1);
		memcpy(*ppDst, pBegin, *pDstLen);
	}

	AMFree(tokenBegin);
	AMFree(tokenEnd);
}
예제 #14
0
AMVoid			IAccount_SetPwd(AIMAccount *pAcnt, const AMChar *szPwd, AMUInt32 uiPwdLen)
{
	AMAssert(0 != pAcnt && 0 != szPwd);
	if(pAcnt->szPwd)
	{
		AMFree(pAcnt->szPwd);
		pAcnt->szPwd = 0;
	}
	pAcnt->szPwd = (AMChar *)AMMalloc(uiPwdLen+1);
	AMAssert(0 != pAcnt->szPwd);
	AMMemcpy(pAcnt->szPwd, szPwd, uiPwdLen);
	pAcnt->szPwd[uiPwdLen] = 0;
}
예제 #15
0
AMVoid			IAccount_SetBindID(AIMAccount *pAcnt, const AMChar *szBindID, AMUInt32 uiIdLen)
{
	AMAssert(0 != pAcnt && 0 != szBindID);
	if(pAcnt->szBindID)
	{
		AMFree(pAcnt->szBindID);
		pAcnt->szBindID = 0;
	}
	pAcnt->szBindID = (AMChar *)AMMalloc(uiIdLen+1);
	AMAssert(0 != pAcnt->szBindID);
	AMMemcpy(pAcnt->szBindID, szBindID, uiIdLen);
	pAcnt->szBindID[uiIdLen] = 0;
}
예제 #16
0
AMVoid		IAGroup_SetName(IAGroup *pGrp, AMChar *szName, AMUInt32 uiLen)
{
	AMAssert(0 != pGrp && 0 != szName && 0 < uiLen);
	if(pGrp->szName)
	{
		AMFree(pGrp->szName);
		pGrp->szName = 0;
	}
	pGrp->szName = (AMChar *)AMMalloc(uiLen + 1);
	AMAssert(0 != pGrp->szName);
	AMMemcpy(pGrp->szName, szName, uiLen);
	pGrp->szName[uiLen] = 0;
}
예제 #17
0
/*
 *	外面传入szSession\szRawPacket, 赋值(不拷贝)给AIMAuth
 */
AIMAuth *_AIMAuth_create(const AMChar *szSession, const AMChar *szRawPacket, AMUInt32 uiLen)
{
	AIMAuth *pAuth = AMNULL;
	pAuth = (AIMAuth *)AMMalloc(sizeof(AIMAuth));
	if(!pAuth)
		return AMNULL;
	AMMemset(pAuth, 0, sizeof(AIMAuth));
	pAuth->szSession = szSession;
	pAuth->szRawPacket = szRawPacket;
	pAuth->uiPacketLen = uiLen;
	pAuth->iStatus = eAUTH_SESSION;

	return pAuth;
}
예제 #18
0
AMVoid		IAIMessage_SetContent(IAIMessage *pMsg, const AMChar *szContent, AMUInt32 iLen)
{
	AMAssert(0 != pMsg);
	if(pMsg->szContent)
	{
		AMFree(pMsg->szContent);
		pMsg->szContent = 0;
	}

	pMsg->szContent = (AMChar *)AMMalloc(iLen + 1);
	AMAssert(0 != pMsg->szContent);
	AMMemcpy(pMsg->szContent, szContent, iLen);
	pMsg->szContent[iLen] = 0;
}
예제 #19
0
AMVoid		IAIMessage_SetCntID(IAIMessage *pMsg, const AMChar * szCntID, AMUInt32	uiIDLen)
{
	AMAssert(0 != pMsg && 0 != szCntID);
	if(pMsg->szContactID)
	{
		AMFree(pMsg->szContactID);
		pMsg->szContactID = 0;
	}

	pMsg->szContactID = (AMChar *)AMMalloc(uiIDLen + 1);
	AMAssert(0 != pMsg->szContactID);
	AMMemcpy(pMsg->szContactID, szCntID, uiIDLen);
	pMsg->szContactID[uiIDLen] = 0;
}
예제 #20
0
AIM_RESULT	OnRspGetProfile(AMVoid *pvArg, AIM_RSP_GET_PROFILE *pRspGetProfile)
{
    IAIM *pIM = (IAIM*)(((AMPVoid*)pvArg)[1]);
    IAIMessage	*pMsg = 0;
    AMInt32 iContentLen = 0, i = 0, iPos = 0, iLen = 0;;
    pMsg = IAIMessage_Create();
    pMsg->bUnread = AMTRUE;
    pMsg->eType = (AIM_MSG_TYPE)GET_PEER_UDB_PROFILE;
    IAIMessage_SetCntID(pMsg, pRspGetProfile->szContactId, AMStrlen(pRspGetProfile->szContactId));

    iContentLen = pRspGetProfile->iTotalLen + 4 + AMStrlen(pRspGetProfile->szContactId) + sizeof(UID_KEYWROD_ID);
    iContentLen +=  pRspGetProfile->iCount*2;

    pMsg->szContent = (AMChar *)AMMalloc(iContentLen);
    if(AMNULL == pMsg->szContent)
    {
        IAIMessage_Destroy(pMsg);
        return eAIM_RESULT_NOT_READY;
    }
    AMMemset(pMsg->szContent, 0, iContentLen);

    for(i=0; i<pRspGetProfile->iCount; i++)
    {
        if(AMNULL != pRspGetProfile->pszValues[i])
        {
            iLen = AMStrlen(pRspGetProfile->pszKeys[i]);
            AMMemcpy(pMsg->szContent+iPos, pRspGetProfile->pszKeys[i], iLen);
            iPos += iLen;
            pMsg->szContent[iPos++] = '\1';
            iLen = AMStrlen(pRspGetProfile->pszValues[i]);
            AMMemcpy(pMsg->szContent+iPos, pRspGetProfile->pszValues[i], iLen);
            iPos += iLen;
            pMsg->szContent[iPos++] = '\1';
        }
    }

    AMMemcpy(pMsg->szContent+iPos, UID_KEYWROD_ID, sizeof(UID_KEYWROD_ID)-1);//加上"uid\1'contactId'"
    iPos += sizeof(UID_KEYWROD_ID)-1;
    pMsg->szContent[iPos++] = '\1';

    AMStrcat(pMsg->szContent+iPos, pRspGetProfile->szContactId);//不需要尾巴了

    DPRINT("IASessionModel_OnPeerVerifyConfig.................%s\n", pMsg->szContent);

    Adapter_OnIncomingSysMsg(pIM->pSesModel, pMsg, pvArg);

    IAIMessage_Destroy(pMsg);

    return eAIM_RESULT_OK;
}
예제 #21
0
int8_t insert_PrioQueue(PrioQueue *obj, int32_t priority, void *data, size_t datasize) {
	PrioNode *ptr;
	CHECK_VARN(obj,EINVAL);
	CHECK_VARN(data,EINVAL);
	CHECK_VARA(ptr = AMMalloc(sizeof *ptr),EALLOCF);
#ifdef AMOS_DEBUG
	if(!(ptr->data = obj->data->API.alloc(datasize, __FILE__, __LINE__))) {
#else
	if(!(ptr->data = obj->data->API.alloc(datasize))) {
#endif
		AMFree(ptr);
		return EALLOCF;
	}
	ptr->priority = priority;
	obj->data->API.copy(ptr->data,data,datasize);
	return insert(Heap,(obj->data),ptr,STATIC);
}

F_DUPLICATE(PrioQueue) {
	PrioQueue *dst;
	CHECK_VARN(obj,NULL);
	CHECK_VARA(dst = AMMalloc(sizeof *dst),NULL);
	if(!(dst->data = duplicate(Heap,obj->data))) {
		AMFree(dst);
		return NULL;
	} else {
		return dst;
	}
}

void *top_data_PrioQueue(PrioQueue *obj) {
	CHECK_VARN(obj,NULL);
	if(!empty(Heap,(obj->data))) {
		return NULL;
	}
	return ((PrioNode *)top(Heap,(obj->data)))->data;
}
예제 #22
0
void QueueCreate(Queue** ppObject)
{
	if(ppObject == NULL)
		return;

	*ppObject = (Queue*)AMMalloc(sizeof(Queue));
	if(*ppObject)
	{
		PCContextGetInstance()->mutexCreate(&(*ppObject)->mutexCritical);
		PCContextGetInstance()->semaphoreCreate(&(*ppObject)->semaphore, 0, MAX_QUEUE_ITEMS);

		(*ppObject)->pFirst = (*ppObject)->pLast = NULL;
		(*ppObject)->pFirstLow = (*ppObject)->pLastLow = NULL;
	}
}
예제 #23
0
AMVoid			IAccount_SetPhoneNum(AIMAccount *pAcnt, const AMChar *szPhone)//, AMUInt32 uiPhoneLen)
{
	AMUInt32 uiPhoneLen = 0;
	AMAssert(0 != pAcnt && 0 != szPhone);
	if(pAcnt->szPhoneNum)
	{
		AMFree(pAcnt->szPhoneNum);
		pAcnt->szPhoneNum = 0;
	}
	uiPhoneLen = AMStrlen(szPhone);
	pAcnt->szPhoneNum = (AMChar *)AMMalloc(uiPhoneLen+1);
	AMAssert(0 != pAcnt->szPhoneNum);
	AMMemcpy(pAcnt->szPhoneNum, szPhone, uiPhoneLen);
	pAcnt->szPhoneNum[uiPhoneLen] = 0;
}
예제 #24
0
AMVoid			IAccount_SetWebMD5(AIMAccount *pAcnt, const AMChar *szToken, AMUInt32 uiTokenLen)
{
	AMAssert(0 != pAcnt && 0 != szToken);
	if(pAcnt->szWebMD5)
	{
		AMFree(pAcnt->szWebMD5);
		pAcnt->szWebMD5 = 0;
		pAcnt->uiWebMD5Len = 0;
	}
	pAcnt->szWebMD5 = (AMChar *)AMMalloc(uiTokenLen+1);
	AMAssert(0 != pAcnt->szWebMD5);
	AMMemcpy(pAcnt->szWebMD5, szToken, uiTokenLen);
	pAcnt->szWebMD5[uiTokenLen] = 0;
	pAcnt->uiWebMD5Len = uiTokenLen;
}
예제 #25
0
AIM_RESULT	OnRspGetDegree(AMVoid *pvArg, AIM_RSP_GET_DEGREE *pRspGetDegree)
{
    IAIM *pIM = (IAIM*)(((AMPVoid*)pvArg)[1]);
    IAIMessage	*pMsg = AMNULL;
    AMChar		*pBuf = AMNULL;
    AMInt32		iLen = 0;

    AMAssert(AMNULL != pIM && AMNULL != pRspGetDegree);

    DPRINT("IASessionModel_OnGetDegree.........................Entering!\n");

    pMsg = IAIMessage_Create();
    if(pRspGetDegree->szContactId)
        IAIMessage_SetCntID(pMsg, pRspGetDegree->szContactId, AMStrlen(pRspGetDegree->szContactId));

    if(0 == pRspGetDegree->iRetCode)//成功
    {
        pMsg->eType = (AIM_MSG_TYPE)GET_DEGREE_OK;
        pBuf = (AMChar *)AMMalloc(MAX_INT_NUMBER_LEN*3);
        if(AMNULL == pBuf)
        {
            IAIMessage_Destroy(pMsg);
            return eAIM_RESULT_MALLOC_ERROR;
        }
        AMMemset(pBuf, 0, MAX_INT_NUMBER_LEN*3);
        iLen += _AIMItoa(pRspGetDegree->iUserLevel, pBuf);
        pBuf[iLen++] = ',';
        iLen += _AIMItoa(pRspGetDegree->iTotalDegree, pBuf+iLen);
        pBuf[iLen++] = ',';
        iLen += _AIMItoa(pRspGetDegree->iNeedDegree, pBuf+iLen);
        pMsg->szContent	= pBuf;
    }
    else//失败
    {
        DPRINT("IASessionModel_OnGetDegree.......................Fail!\n");
        pMsg->eType = (AIM_MSG_TYPE)GET_DEGREE_FAIL;
    }

    DPRINT("IASessionModel_OnGetDegree.......................%s\n", pMsg->szContent);

    Adapter_OnIncomingSysMsg(pIM->pSesModel, pMsg, pvArg);

    IAIMessage_Destroy(pMsg);

    DPRINT("IASessionModel_OnGetDegree.........................OK!\n");

    return eAIM_RESULT_OK;
}
예제 #26
0
AIM_RESULT	OnRspGetPortrait(AMVoid *pvArg, AIM_RSP_GET_PROTRAIT *rspGetPortrait)
{
    AIM_CONTACT_UPDATE_DATA	*pPresent = 0;
    AMInt32 i=0;
    if(!rspGetPortrait->iRetCode)
    {
        pPresent = (AIM_CONTACT_UPDATE_DATA	*)AMMalloc(sizeof(AIM_CONTACT_UPDATE_DATA));
        pPresent->szID = rspGetPortrait->szContactId;
        pPresent->szSignature = rspGetPortrait->szValue;
        pPresent->ucType = 2;

        JavaPreListener(pvArg, pPresent, 1);
        AMFree(pPresent);
    }
    return eAIM_RESULT_OK;
}
예제 #27
0
PCCore* PCCoreCreate()
{
	PCCore* pPCCore = NULL;
	
	pPCCore = (PCCore*)AMMalloc(sizeof(PCCore));
	memset(pPCCore, 0, sizeof(PCCore));

	if(pPCCore)
	{
		QueueCreate(&pPCCore->pReaderQueue);
		QueueCreate(&pPCCore->pSenderQueue);
		QueueCreate(&pPCCore->pCallbackQueue);
	}

	return pPCCore;
}
예제 #28
0
AMVoid			IAccount_SetSignature(AIMAccount *pAcnt, const AMChar *szSignature, AMUInt32 uiLen)
{
	AMAssert(0 != pAcnt);
	if(pAcnt->szSignature)
	{
		AMFree(pAcnt->szSignature);
		pAcnt->szSignature = 0;
	}

	if(0 == szSignature)
		return ;

	pAcnt->szSignature = (AMChar *)AMMalloc(uiLen+1);
	AMAssert(0 != pAcnt->szSignature);
	AMMemcpy(pAcnt->szSignature, szSignature, uiLen);
	pAcnt->szSignature[uiLen] = 0;
}
예제 #29
0
AMVoid			IAccount_SetSigXML(AIMAccount *pAcnt, const AMChar *szXML, AMUInt32 uiLen)
{
	AMAssert(0 != pAcnt);
	if(pAcnt->szSigXML)
	{
		AMFree(pAcnt->szSigXML);
		pAcnt->szSigXML = 0;
	}

	if(0 == uiLen)
		return ;

	pAcnt->szSigXML = (AMChar *)AMMalloc(uiLen+1);
	AMAssert(0 != pAcnt->szSigXML);
	AMMemcpy(pAcnt->szSigXML, szXML, uiLen);
	pAcnt->szSigXML[uiLen] = 0;
}
예제 #30
0
IAGroup	*	IAGroup_CreateProc(AMBool bLight)
{
	IAGroup	*pGrp = AMMalloc(sizeof(IAGroup));
	AMAssert(0 != pGrp);
	AMMemset(pGrp, 0, sizeof(IAGroup));

	if(!bLight)
	{
		construct(List, &pGrp->lChildCnt, sizeof(IAContact), NOFREE);
		set_compare(List, &pGrp->lChildCnt, IAContact_CmpPinyin);

		construct(List, &pGrp->lChildGrp, sizeof(IAGroup), NOFREE);
		set_compare(List, &pGrp->lChildGrp, IAGroup_CmpPinyin);
	}

	return pGrp;
}