AIM_RESULT OnRspLogin(AMVoid *pvArg, AIM_RSP_LOGIN * pRspLogin) { IAIM *pIM = (IAIM*)(((AMPVoid*)pvArg)[1]); if(!pRspLogin->iRetCode) return (AIM_RESULT)JavaConnListener(pvArg, CONN_CB_LOGINOK, pIM->iTimeDiff + AMGetUpTime(NULL)); else return (AIM_RESULT)JavaConnListener(pvArg, CONN_CB_LOGINFAIL, pRspLogin->eInfo); }
static AMChar *_genSession() { AMInt32 iGMTime = AMGetUpTime(AMNULL); AMChar *szSession = AMNULL; AMInt32 iUsed = 0, i = 0; szSession = (AMChar *)AMMalloc(LEN_SESSION + 1); if(!szSession) return AMNULL; AMMemset(szSession, 0, LEN_SESSION + 1); AMStrcpy(szSession, SESSION_PREFIX_AIM); iUsed = sizeof(SESSION_PREFIX_AIM) + _AIMItoa(iGMTime, szSession + sizeof(SESSION_PREFIX_AIM) - 1) -1; for(i=iUsed; i<LEN_SESSION; i++) szSession[i] = '0'; return szSession; }