Пример #1
0
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;
}
Пример #2
0
static AMInt32 IAccountModel_OnSelAcnt(void* pvAcntor, int iCnt, char **pszValue, char**pszName)
{
	IAccountModel *pAcntModel = (IAccountModel *)pvAcntor;
	AIMAccount *pAcnt = 0;
	AMAssert(0 !=pAcntModel);

	DPRINT("IAccountModel_OnSelAcnt %s ! %s ! %s ! %s ! %s ! %s ! %s\n"
		, pszValue[0], pszValue[1], pszValue[2], pszValue[3], pszValue[4], pszValue[5], pszValue[6]);

	pAcnt = IAccount_Create();

	pAcnt->_iRid =			AMAtoi(pszValue[0]);

	if(0 != IAccount_SetID(pAcnt, pszValue[1], AMStrlen(pszValue[1])))
		return -1;

	pAcnt->uiFlag =	AMAtoi(pszValue[4]);

	if(pAcnt->uiFlag&01 && 0 != AMStrcmp("0", pszValue[2]))
	{
		IAccount_SetToken(pAcnt, pszValue[2], AMStrlen(pszValue[2]));
	}

	if(0 != AMStrcmp("0", pszValue[3]))
	{
		IAccount_SetPhoneNum(pAcnt, pszValue[3]);
	}
	pAcnt->ePresence =		AMAtoi(pszValue[5]);
	pAcnt->iGroupStamp =	AMAtoi(pszValue[6]);
	pAcnt->iContactStamp =	AMAtoi(pszValue[7]);
	pAcnt->iBlackStamp =	AMAtoi(pszValue[8]);
	pAcnt->iRevBlackStamp = AMAtoi(pszValue[9]);

	if(0 != AMStrcmp("0", pszValue[10]))
	{
		IAccount_SetSigXML(pAcnt, pszValue[10], AMStrlen(pszValue[10]));
	}
	push_front_List(&pAcntModel->listAcnt, pAcnt, sizeof(AIMAccount), DYNAMIC);

	return 0;
}
Пример #3
0
AMInt32		SigXML2SigStruct(const AMChar *szSigXML, AMHandle hSig)
{
	int i = 0;
	AMChar *szBegin = AMNULL, *szEnd = AMNULL;
	AIM_SIGNATURE *pSig = (AIM_SIGNATURE*)hSig;
	AMAssert(0 != szSigXML && AMNULL != pSig);

	AMMemset(pSig, 0, sizeof(AIM_SIGNATURE));

	szBegin = AMStrstr(szSigXML, HeadTag(XML_TAG_SIG));
	i=0;
	while(AMNULL != szBegin && i<MAX_SIG_COUNT)
	{
		szBegin += sizeof(HeadTag(XML_TAG_SIG)) -1;
		szEnd = AMStrstr(szBegin, TailTag(XML_TAG_SIG));

		if(AMNULL != szEnd)	
		{
			if(szEnd-szBegin < MAX_SIG_LEN)
			{
				AMMemcpy(pSig->szSignature[i], szBegin, szEnd-szBegin);
			}
			szBegin = AMStrstr(szEnd, HeadTag(XML_TAG_SIG));		
		}
		else
			break;

		i++;
	}

	if(AMNULL == szEnd)
		szEnd = szSigXML;

	szBegin = AMStrstr(szEnd, HeadTag(XML_TAG_LOOP));
	if(AMNULL != szBegin)
		pSig->iLoop = AMAtoi(szBegin + sizeof(HeadTag(XML_TAG_LOOP))-1);
	else
		szBegin = szSigXML;

	szBegin = AMStrstr(szBegin, HeadTag(XML_TAG_T));
	if(AMNULL != szBegin)
		pSig->iT = AMAtoi(szBegin + sizeof(HeadTag(XML_TAG_T))-1);
	else
		szBegin = szSigXML;
	
	szBegin = AMStrstr(szBegin, HeadTag(XML_TAG_CI));
	if(AMNULL != szBegin)
		pSig->iCI = AMAtoi(szBegin + sizeof(HeadTag(XML_TAG_CI))-1);
	else
		szBegin = szSigXML;

	szBegin = AMStrstr(szBegin, HeadTag(XML_TAG_ST));
	if(AMNULL != szBegin)
		pSig->iST = AMAtoi(szBegin + sizeof(HeadTag(XML_TAG_ST))-1);
	else
		szBegin = szSigXML;

	szBegin = AMStrstr(szBegin, HeadTag(XML_TAG_RET));
	if(AMNULL != szBegin)
		pSig->iRet = AMAtoi(szBegin + sizeof(HeadTag(XML_TAG_RET))-1);
	else
		szBegin = szSigXML;

	szBegin = AMStrstr(szBegin, HeadTag(XML_TAG_FLAG));
	if(AMNULL != szBegin)
		pSig->iFlag	 = AMAtoi(szBegin + sizeof(HeadTag(XML_TAG_FLAG))-1);
	else
		szBegin = szSigXML;

	szBegin = AMStrstr(szBegin, HeadTag(XML_TAG_EMP));
	if(AMNULL != szBegin)
		pSig->iEmp = AMAtoi(szBegin + sizeof(HeadTag(XML_TAG_EMP))-1);
	
	return 0;
}
Пример #4
0
static AMInt32 IASession_OnSelUnreadCnt(void* pvRet, int iCnt, char **pszValue, char**pszName)
{
	AMInt32 *piRet = (AMInt32*)pvRet;
	*piRet = AMAtoi(pszValue[0]);
	return 0;
}
Пример #5
0
static AMInt32 ASession_OnSelMsgCount(void* pvCnt, int iCnt, char **pszValue, char**pszName)
{
	AMInt32	*piCnt = (AMInt32*)pvCnt;
	*piCnt = AMAtoi(pszValue[0]);
	return 0;
}