示例#1
0
AIM_RESULT	OnNtfUpdateGroup(AMVoid *pvArg, AIM_NTF_UPDATE_GROUP *pNtfUpdateGroup)
{
    AMInt64 i64GrpId = 0;
    AMChar *szContactId = AMNULL;
    AMInt32 iType = 0;

    if(eAIM_GROUP_ADD == pNtfUpdateGroup->eType)
        iType = CONTACT_ADDED;
    else if(eAIM_GROUP_REMOVE == pNtfUpdateGroup->eType)
        iType = CONTACT_REMOVED;

    IAIMGroup_GetID(pNtfUpdateGroup->hGroup, &i64GrpId);
    IAIMContact_GetID(pNtfUpdateGroup->hContact, (const AMChar **)&szContactId);
    return (AIM_RESULT)JavaCntListener(pvArg, iType, i64GrpId, szContactId);
}
示例#2
0
//请求得到联系人列表
void CWangWangNetLib::RequestGetContactList()
{   
    
    AMHandle *pGrps = AMNULL;
    AMInt32 iCount = 0;
    AMInt64 iGrpId = 0;   
    
    ContactList_t retContactList;
    
    IAIM *pIM = (IAIM *)hIM;
    IAContact * pCnt=AMNULL;
    
    int times=0;
	int retryCount=1000;

    while ((!pIM || !pIM->pCntModel) && (times < retryCount))
    {
        AMSleep(1);
        times++;
    }
    if (times >= retryCount) 
    {
        return;
    }
     
    times=0;
	retryCount=500;
    while (((pIM->pCntModel)->lTopGrp.size  == 0) && (times < retryCount))
    {
        AMSleep(1);
        times++;
    } 
    if (times >= retryCount) 
    {
        return;
    }
    
    if (eAIM_RESULT_OK  != IAIM_GetTopGroups(pIM, &pGrps, &iCount)
        || (pGrps == AMNULL) ) 
    {
            return;
    }
   
    for(int i=0; i<iCount; i++)
    {
        
        IAIMGroup_GetID(pGrps[i], &iGrpId);
            
        AMHandle *phCnts = AMNULL;
        AMInt32 iCount_contacts = 0;
        const AMChar    *szCntName = AMNULL;
            
        IAIMGroup_GetContacts(pGrps[i], AMFALSE, &phCnts, &iCount_contacts);
        
        for(int i=0; i<iCount_contacts; i++) 
        {
            
            IAIMContact_GetID(phCnts[i], &szCntName);
            IAIM_GetContactByID(pIM, szCntName, (AMHandle *)&pCnt);
            
            CContactInfo contactInfo;
            contactInfo.m_strUid = szCntName;
            contactInfo.m_groupId = iGrpId;
            contactInfo.m_strNickName = pCnt->szName;
            retContactList.push_back(contactInfo);
            
        }
        
    }
    
    IAIM_ReleaseTopGroups(pIM, pGrps, iCount);
    
    if (g_pCallback)
    {
        g_pCallback->OnReturnContactList(retContactList,pIM->pAcnt->iContactStamp);
    }
    
	return ;
    
}
示例#3
0
void CWangWangNetLib::RequestGetGroupList()
{ 
    AMHandle *pGrps = AMNULL;
    AMInt32 iCount = 0;
    AMInt64 iGrpId = 0;
    
    const AMChar    *szGrpName = AMNULL;
    
    IAIM *pIM = (IAIM *)hIM;  
    
    int times=0;
	int retryCount=1000;
    
    while ((!pIM || !pIM->pCntModel) && (times < retryCount))
    {
        AMSleep(1);
        times++;
    }
    if (times >= retryCount) 
    {
        return;
    }
    
    times=0;
	retryCount=500;
    while (((pIM->pCntModel)->lTopGrp.size  == 0) && (times < retryCount))
    {
        AMSleep(1);
        times++;
    } 
    if (times >= retryCount) 
    {
        return;
    }

    if (eAIM_RESULT_OK  != IAIM_GetTopGroups(pIM, &pGrps, &iCount)
        || (pGrps == AMNULL) ) 
    {
        return;
    }
    
    GroupList_t retGroupList;
    
    for(int i=iCount-1; i>=0; i--)
    {
        IAIMGroup_GetID(pGrps[i], &iGrpId);
        IAIMGroup_GetName(pGrps[i], &szGrpName);
        //旺旺好友grpid -6666
        if (iGrpId != -6666) 
        {
            
            CGroupInfo groupInfo;
            groupInfo.m_groupId = iGrpId; 
            
            groupInfo.m_parentId = 0;
            groupInfo.m_groupName = szGrpName;
            
            retGroupList.push_back(groupInfo);
        }
        
    }
    
    IAIM_ReleaseTopGroups(hIM, pGrps, iCount);
    
    if (g_pCallback)
    { 
        g_pCallback->OnReturnGroupList(retGroupList,pIM->pAcnt->iGroupStamp);
    }
    
    return ;
    
}