示例#1
0
	void Core::PrepareReplyTab (const Message_ptr& message, const Account_ptr& account)
	{
		auto cmt = new ComposeMessageTab ();
		cmt->SelectAccount (account);
		cmt->PrepareReply (message);
		emit gotTab (cmt->GetTabClassInfo ().VisibleName_, cmt);
	}
示例#2
0
    int CWorldDbmgr::FromRpcCall(CPluto& u, CDbOper& db)
    {
        //printf("CWorldDbmgr::from_rpc_call\n");
        //print_hex_pluto(u);

        pluto_msgid_t msg_id = -1;
        T_VECTOR_OBJECT* p = NULL;

        //这一段要加锁(2012/02/15改为不加锁)
        {
            //CMutexGuard _g(m_rpcMutex);

            msg_id = u.GetMsgId();
            if(!CheckClientRpc(u))
            {
                LogWarning("from_rpc_call", "invalid rpcall error.unknown msgid:%d\n", msg_id);
                return -1;
            }

            p = m_rpc.Decode(u);
            if(p == NULL)
            {
                LogWarning("from_rpc_call", "rpc Decode error.unknown msgid:%d\n", msg_id);
                return -1;
            }

            if(u.GetDecodeErrIdx() > 0)
            {
                ClearTListObject(p);
                //PrintHexPluto(u);
                LogWarning("from_rpc_call", "rpc Decode error.msgid:%d;pluto err idx=%d\n", msg_id, u.GetDecodeErrIdx());
                return -2;
            }
        }

        //这一段不用加锁
        int nRet = -1;
        switch(msg_id)
        {
            case MSGID_DBMGR_INSERT_ENTITY:
            {
                nRet = InsertDB(p, db);
                break;
            }
            case MSGID_DBMGR_SELECT_ENTITY:
            {
                nRet = LookupEntityByDbId(p, db);
                break;
            }
            case MSGID_DBMGR_UPDATE_ENTITY:
            {
                nRet = UpdateEntity(p, db);
                break;
            }
            case MSGID_DBMGR_UPDATE_ENTITY_REDIS:
            {
                nRet = UpdateEntityToRedis(p, db);
                break;
            }
            case MSGID_DBMGR_SELECT_ACCOUNT:
            {
                nRet = SelectAccount(p, db);
                break;
            }
            case MSGID_DBMGR_RAW_MODIFY_NORESP:
            {
                nRet = QueryModifyNoResp(p, db);
                break;
            }
            case MSGID_DBMGR_CREATEBASE_FROM_NAME:
            {
                nRet = LookupEntityByName(p, db);
                break;
            }
            case MSGID_DBMGR_LOAD_ALL_AVATAR:
            {
                nRet = LoadAllAvatars(p, db);
                break;
            }
            case MSGID_DBMGR_LOAD_ENTITIES_OF_TYPE:
            {
                nRet = LoadEntitiesOfType(p, db);
                break;
            }
            case MSGID_DBMGR_SHUTDOWN_SERVER:
            {
                nRet = ShutdownServer(p);
                break;
            }
            case MSGID_DBMGR_REDIS_HASH_LOAD:
            {
                nRet = RedisHashLoad(p, db);
                break;
            }
            case MSGID_DBMGR_REDIS_HASH_SET:
            {
                nRet = RedisHashSet(p, db);
                break;
            }
            case MSGID_DBMGR_REDIS_HASH_DEL:
            {
                nRet = RedisHashDel(p, db);
                break;
            }
            case MSGID_DBMGR_DEL_ACCOUNT_CACHE:
            {
                nRet = DestroyAccountCache(p);
                break;
            }

            case MSGID_DBMGR_UPDATE_ITEMS:
            {
                nRet = UpdateArrayItemsToDb(p, db);
                break;
            }
            case MSGID_DBMGR_LOADING_ITEMS:
            {
                nRet = LoadingArrayItemsToInventory(p, db);
                break;
            }
            case MSGID_DBMGR_INCREMENTAL_UPDATE_ITEMS:
            {
                nRet = IncremantalUpdateItems(p, db);
                break;
            }

            case MSGID_DBMGR_TABLE_SELECT:
            {
                nRet = TableSelect(p, db);
                break;
            }
            case MSGID_DBMGR_UPDATE_BATCH:
            {
                nRet = TableUpdateBatch(p, db);
                break;
            }
            case MSGID_DBMGR_TABLE_INSERT:
            {
                nRet = TableInsert(p, db);
                break;
            }
            case MSGID_DBMGR_TABLE_EXCUTE:
            {
                nRet = TableExcute(p, db);
                break;
            }
            case MSGID_DBMGR_TABLE2_SELECT:
            {
                nRet = Table2Select(p, db);
                break;
            }
            case MSGID_DBMGR_TABLE2_INSERT:
            {
                nRet = Table2Insert(p, db);
                break;
            }
            case MSGID_DBMGR_TABLE2_EXCUTE:
            {
                nRet = Table2Excute(p, db);
                break;
            }
            default:
            {
                break;
            }
        }

        if(nRet != 0)
        {
            LogWarning("from_rpc_call", "rpc error.msg_id=%d;ret=%d\n", msg_id, nRet);
        }

        ClearTListObject(p);

        return 0;
    }