Example #1
0
void ClientConn::HandlePdu(CImPdu* pPdu)
{
    //printf("pdu type = %u\n", pPdu->GetPduType());
	//printf("msg_type=%d\n", pPdu->GetCommandId());
	switch (pPdu->GetCommandId()) {
        case IM::BaseDefine::DFFX_CID_OTHER_HEARTBEAT:
//		printf("Heartbeat\n");
		break;
        case IM::BaseDefine::DFFX_CID_LOGIN_RES_USERLOGIN:
            _HandleLoginResponse(pPdu);
		break;
		
        case IM::BaseDefine::DFFX_CID_MSG_DATA_ACK:
            _HandleSendMsg(pPdu);
        break;		
       
        case IM::BaseDefine::DFFX_CID_MSG_DATA:
            _HandleMsgData(pPdu);
            break;
				
		default:
			printf("wrong msg_type=%d\n", pPdu->GetCommandId());
			log("wrong msg_type=%d\n", pPdu->GetCommandId());
			break;
	}
}
Example #2
0
void CRouteConn::HandlePdu(CImPdu* pPdu)
{
	switch (pPdu->GetPduType()) {
	case IM_PDU_TYPE_HEARTBEAT:
		// do not take any action, heart beat only update m_last_recv_tick
		break;
	case IM_PDU_TYPE_ONLINE_USER_INFO:
		_HandleOnlineUserInfo( (CImPduOnlineUserInfo*)pPdu );
		break;
	case IM_PDU_TYPE_USER_STATUS_UPDATE:
		_HandleUserStatusUpdate( (CImPduUserStatusUpdate*)pPdu );
		break;
	case IM_PDU_TYPE_FRIEND_STATUS_QUERY:
		_HandleFriendStatusQuery( (CImPduFriendStatusQuery*)pPdu );
		break;
	case IM_PDU_TYPE_FRIEND_STATUS_NOTIFY:
		_HandleFriendStatusNotify( (CImPduFriendStatusNotify*)pPdu );
		break;
	case IM_PDU_TYPE_MSG_DATA:
		_HandleMsgData( (CImPduMsgData*)pPdu );
		break;
	case IM_PDU_TYPE_P2P_MSG:
		_HandleP2PMsg( (CImPduP2PMsg*)pPdu );
		break;
	case IM_PDU_TYPE_ROLE_SET:
		_HandleRoleSet( (CImPduRoleSet*)pPdu );
		break;
	case IM_PDU_TYPE_USER_STATUS_REQUEST:
		_HandleUserStatusRequest( (CImPduUserStatusRequest*)pPdu );
		break;
	case IM_PDU_TYPE_USERS_STATUS_REQUEST:
		_HandleUsersStatusRequest( (CImPduUsersStatusRequest*)pPdu );
		break;
    case IM_PDU_TYPE_SERVER_KICK_USER:
        _HandleKickOut((CImPduServerKickUser *)pPdu);
        break;
   
    case IM_PDU_TYPE_USER_CLIENT_TYPE_REQUEST:
        _HandleUserClientType((CImPduUserClientTypeRequest *)pPdu);
        break;
     
	case IM_PDU_TYPE_FILE_NOTIFY:
		_HandleFileNotify((CImPduFileNotify*)pPdu);
		break;
	case IM_PDU_TYPE_GROUP_CREATE_TMP_GROUP_RESPONSE:
	case IM_PDU_TYPE_GROUP_CHANGE_MEMBER_RESPONSE:
    case IM_PDU_TYPE_GROUP_CREATE_NORMAL_GROUP_NOTIFY:
    case IM_PDU_TYPE_GROUP_CHANGE_MEMBER_NOTIFY:
		_BroadcastMsg(pPdu);
		break;
    
    case IM_PDU_TYPE_GROUP_P2P_MSG_RESPONSE:
        _BroadcastMsg(pPdu);
        break;
        
	default:
		log("CRouteConn::HandlePdu, wrong pdu type: %d\n", pPdu->GetPduType());
		break;
	}
}
Example #3
0
void ClientConn::HandlePdu(CImPdu* pPdu)
{
    //printf("pdu type = %u\n", pPdu->GetPduType());
	switch (pPdu->GetCommandId()) {
        case IM::BaseDefine::CID_OTHER_HEARTBEAT:
//		printf("Heartbeat\n");
		break;
        case IM::BaseDefine::CID_LOGIN_RES_USERLOGIN:  
			_HandleLoginResponse(pPdu);
		break;
        case IM::BaseDefine::CID_BUDDY_LIST_ALL_USER_RESPONSE:
			_HandleUser(pPdu);
        break;
        case IM::BaseDefine::CID_BUDDY_LIST_USER_INFO_RESPONSE:
			_HandleUserInfo(pPdu);
        break;
        case IM::BaseDefine::CID_MSG_DATA_ACK:
            _HandleSendMsg(pPdu);
        break;
        case IM::BaseDefine::CID_MSG_UNREAD_CNT_RESPONSE: 
			_HandleUnreadCnt(pPdu);
            break;
        case IM::BaseDefine::CID_BUDDY_LIST_RECENT_CONTACT_SESSION_RESPONSE:
			_HandleRecentSession(pPdu);
        break;
        case IM::BaseDefine::CID_MSG_LIST_RESPONSE:
			_HandleMsgList(pPdu);
        break;
        case IM::BaseDefine::CID_MSG_DATA:
            _HandleMsgData(pPdu);
		break;
		case IM::BaseDefine::CID_BUDDY_LIST_DEPARTMENT_RESPONSE:
			_HandleDepartMentInfo(pPdu);
        break;
		case IM::BaseDefine::CID_GROUP_NORMAL_LIST_RESPONSE:
			_HandleGroupList(pPdu);
		break;
		case IM::BaseDefine::CID_GROUP_INFO_RESPONSE:
			_HandleGroupInfo(pPdu);
        break;
		default:
		log("wrong msg_type=%d\n", pPdu->GetCommandId());
		break;
	}
}
Example #4
0
void CRouteServConn::HandlePdu(CImPdu* pPdu)
{
	switch (pPdu->GetPduType()) {
	case IM_PDU_TYPE_HEARTBEAT:
		break;
	case IM_PDU_TYPE_SERVER_KICK_USER:
		_HandleKickUser( (CImPduServerKickUser*)pPdu );
		break;
	case IM_PDU_TYPE_FRIEND_STATUS_LIST:
		_HandleFriendStatusList( (CImPduFriendStatusList*)pPdu );
		break;
	case IM_PDU_TYPE_FRIEND_STATUS_NOTIFY:
		_HandleFriendStatusNotify( (CImPduFriendStatusNotify*)pPdu );
		break;
	case IM_PDU_TYPE_MSG_DATA:
	{
		CImPduMsgData* pPduMsg = (CImPduMsgData*)pPdu;
		if (CHECK_MSG_TYPE_GROUP(pPduMsg->GetMsgType()))
            s_group_chat->HandleGroupMessage(pPduMsg);
		else
            _HandleMsgData(pPduMsg);
		break;
	}
	case IM_PDU_TYPE_P2P_MSG:
		_HandleP2PMsg( (CImPduP2PMsg*)pPdu );
		break;
    case IM_PDU_TYPE_GROUP_P2P_MSG_RESPONSE:
        _HandleGroupP2PMsg((CImPduGroupP2PMessageResponse*)pPdu);
        break;
	case IM_PDU_TYPE_USER_STATUS_RESPONSE:
		_HandleUserStatusResponse( (CImPduUserStatusResponse*)pPdu );
		break;
	case IM_PDU_TYPE_USERS_STATUS_RESPONSE:
		_HandleUsersStatusResponse( (CImPduUsersStatusResponse*)pPdu );
		break;
    case IM_PDU_TYPE_USER_CLIENT_TYPE_RESPONSE:
        _HandleUserClientTypeResponse((CImPduUserClientTypeResponse*) pPdu);
        break;
    case IM_PDU_TYPE_FILE_NOTIFY:
        s_file_handler->HandleFileNotify((CImPduFileNotify *)pPdu);
        break;
    /*
	case IM_PDU_TYPE_FILE_REQUEST:
		s_file_handler->HandleFileRequest( (CImPduFileRequest*)pPdu );
		break;
	case IM_PDU_TYPE_FILE_RESPONSE:
		s_file_handler->HandleFileResponse( (CImPduFileResponse*)pPdu );
		break;
	case IM_PDU_TYPE_FILE_RECV_READY:
		s_file_handler->HandleFileRecvReady( (CImPduFileRecvReady*)pPdu );
		break;
	case IM_PDU_TYPE_FILE_ABORT:
		s_file_handler->HandleFileAbort( (CImPduFileAbort*)pPdu );
		break;
	case IM_PDU_TYPE_FILE_UPLOAD_OFFLINE_NOTIFY:
		s_file_handler->HandleFileUploadOfflineNotify( (CImPduFileUploadOfflineNotify*)pPdu );
		break;
	case IM_PDU_TYPE_FILE_DOWNLOAD_OFFLINE_NOTIFY:
		s_file_handler->HandleFileDownloadOfflineNotify( (CImPduFileDownloadOfflineNotify*)pPdu );
		break;
    */
	case IM_PDU_TYPE_GROUP_CREATE_TMP_GROUP_RESPONSE:
		s_group_chat->HandleGroupCreateTmpGroupBroadcast((CImPduGroupCreateTmpGroupResponse*)pPdu);
		break;
	case IM_PDU_TYPE_GROUP_CHANGE_MEMBER_RESPONSE:
		s_group_chat->HandleGroupChangeMemberBroadcast((CImPduGroupChangeMemberResponse*)pPdu);
		break;
    case IM_PDU_TYPE_GROUP_CREATE_NORMAL_GROUP_NOTIFY:
        s_group_chat->HandleGroupCreateNormalGroupNotify((CImPduGroupCreateNormalGroupNotify*)pPdu);
        break;
    case IM_PDU_TYPE_GROUP_CHANGE_MEMBER_NOTIFY:
        s_group_chat->HandleGroupChangeMemberNotify((CImPduGroupChangeMemberNotify*)pPdu);
        break;
	default:
		log("unknown pdu_type=%d\n", pPdu->GetPduType());
		break;
	}
}