当前位置: 首页>>代码示例>>C++>>正文


C++ GetSession函数代码示例

本文整理汇总了C++中GetSession函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSession函数的具体用法?C++ GetSession怎么用?C++ GetSession使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetSession函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetSession

void UtrnetDemoGameInstance::FindSessions(TSharedPtr<const FUniqueNetId> UserId, FName SessionName, bool bIsLAN, bool bIsPresence)
{
    isLoading_ = true;
    
    // Get the SessionInterface from our OnlineSubsystem
    IOnlineSessionPtr Sessions = GetSession();

    if (Sessions.IsValid() && Sessions.IsValid() && UserId.IsValid())
    {
        /*
        Fill in all the SearchSettings, like if we are searching for a LAN game and how many results we want to have!
        */
        SessionSearch = MakeShareable(new FOnlineSessionSearch());

        SessionSearch->bIsLanQuery = bIsLAN;
        SessionSearch->MaxSearchResults = 20;
        SessionSearch->PingBucketSize = 50;

        // We only want to set this Query Setting if "bIsPresence" is true
        if (bIsPresence)
        {
            SessionSearch->QuerySettings.Set(SEARCH_PRESENCE, bIsPresence, EOnlineComparisonOp::Equals);
        }

        TSharedRef<FOnlineSessionSearch> SearchSettingsRef = SessionSearch.ToSharedRef();

        // Set the Delegate to the Delegate Handle of the FindSession function
        OnFindSessionsCompleteDelegateHandle = Sessions->AddOnFindSessionsCompleteDelegate_Handle(OnFindSessionsCompleteDelegate);

        // Finally call the SessionInterface function. The Delegate gets called once this is finished
        if(!Sessions->FindSessions(*UserId, SearchSettingsRef)) {
            OnFindSessionsComplete(false);
        }
    } else {
        // If something goes wrong, just call the Delegate Function directly with "false".
        OnFindSessionsComplete(false);        
    }
}
开发者ID:erichen,项目名称:trnetdemo,代码行数:38,代码来源:trnetDemoGameInstance.cpp

示例2: HX_ASSERT

HXBOOL CHXDirectory::MakeCurrentDir()
{
    HXBOOL bRetVal = FALSE;

    HX_ASSERT("MakeCurrentDir Not Working As Expected" == NULL);

    if (GetSession() && (!m_strPath.IsEmpty()))
    {
	OS_STRING_TYPE osFileName(m_strPath);
	TPtrC symbNameDesc((TText*) ((OS_TEXT_PTR) osFileName));
	
	bRetVal = (m_symbSession.SetSessionPath(symbNameDesc) == KErrNone);
	if (bRetVal)
	{
#ifndef HELIX_CONFIG_SYMBIAN_PLATFORM_SECURITY
        // SetDefaultPath is depricated in Symbian 9
	    bRetVal = (m_symbSession.SetDefaultPath(symbNameDesc) == KErrNone);
#endif 
	}
    }

    return bRetVal;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:23,代码来源:symbhxdir.cpp

示例3: GetSession

void Player::SendLevelupInfo(uint32 level, uint32 Hp, uint32 Mana, uint32 Stat0, uint32 Stat1, uint32 Stat2, uint32 Stat3, uint32 Stat4)
{
    packet_SMSG_LEVELUP_INFO packet;
    packet.level = level;
    packet.Hp = Hp;
    packet.Mana = Mana;

    // grep: these are probably the other powers :)
    packet.unk0 = 0;
    packet.unk1 = 0;
    packet.unk2 = 0;
    packet.unk3 = 0;
	packet.unk4 = 0;
    packet.unk5 = 0;

    // Append stat differences
    packet.Stat0 = Stat0;
    packet.Stat1 = Stat1;
    packet.Stat2 = Stat2;
    packet.Stat3 = Stat3;
    packet.Stat4 = Stat4;
    GetSession()->OutPacket(SMSG_LEVELUP_INFO, sizeof(packet_SMSG_LEVELUP_INFO),(const char*)&packet);
}
开发者ID:Ballwinkle,项目名称:Ascent_NG,代码行数:23,代码来源:PlayerPacketWrapper.cpp

示例4: RemoveFromWorld

void Transporter::TeleportTransport(uint32 newMapid, uint32 oldmap, float x, float y, float z)
{
    //sEventMgr.RemoveEvents(this, EVENT_TRANSPORTER_NEXT_WAYPOINT);

    RemoveFromWorld(false);
    SetMapId(newMapid);
    SetPosition(x, y, z, m_position.o, false);
    AddToWorld();

    WorldPacket packet(SMSG_TRANSFER_PENDING, 12);
    packet << newMapid;
    packet << getEntry();
    packet << oldmap;

    for (auto passengerGuid : m_passengers)
    {
        auto passenger = objmgr.GetPlayer(passengerGuid);
        if (passenger == nullptr)
            continue;

        passenger->GetSession()->SendPacket(&packet);
        bool teleport_successful = passenger->Teleport(LocationVector(x, y, z, passenger->GetOrientation()), this->GetMapMgr());
        if (!teleport_successful)
        {
            passenger->RepopAtGraveyard(passenger->GetPositionX(), passenger->GetPositionY(), passenger->GetPositionZ(), passenger->GetMapId());
        }
        else
        {
            if (!passenger->HasUnitMovementFlag(MOVEFLAG_TRANSPORT))
            {
                passenger->AddUnitMovementFlag(MOVEFLAG_TRANSPORT);
            }
        }
    }

    this->RespawnCreaturePassengers();
}
开发者ID:armm77,项目名称:AscEmu,代码行数:37,代码来源:TransporterHandler.cpp

示例5: GetSession

  void RoundIdService::Handle(QSharedPointer<WebRequest> wrp)
  {
    QSharedPointer<Session> session = GetSession();
    QVariantMap map;

    bool session_active = !session.isNull();
    map["active"] = false;
    map["id"] = "";

    if(session_active) {
      QSharedPointer<Dissent::Anonymity::Round> round =
        session->GetCurrentRound();

      if(!round.isNull()) {
        map["active"] = true;
        map["id"] = round->GetRoundId().ToString();
      } 
    } 

    wrp->GetOutputData().setValue(map);
    wrp->SetStatus(HttpResponse::STATUS_OK);
    emit FinishedWebRequest(wrp, true);
    return;
  }
开发者ID:franklinsxx,项目名称:Dissent,代码行数:24,代码来源:RoundIdService.cpp

示例6: SetCurrentDir

HXBOOL CHXDirectory::SetCurrentDir()
{
    HXBOOL bRetVal = FALSE;

    if (GetSession())
    {
	TFileName* psymbCurrentDir = new TFileName;

	if (psymbCurrentDir)
	{
	    bRetVal = (m_symbSession.SessionPath(*psymbCurrentDir) == KErrNone);

	    if (bRetVal)
	    {
		m_strPath = (const char *) OS_STRING2((OS_TEXT_PTR) psymbCurrentDir->Ptr(), 
						      psymbCurrentDir->Length());
	    }

	    delete psymbCurrentDir;
	}
    }

    return bRetVal;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:24,代码来源:symbhxdir.cpp

示例7: LOGS

// -----------------------------------------------------------------------------
// CUpnpHttpServer::SendMessageL
// Send HTTP message
// -----------------------------------------------------------------------------
//
TInt CUpnpHttpServer::SendMessageL( CUpnpHttpMessage* aMessage )
    {
    LOG_FUNC_NAME;

    if (!aMessage)
		{
		LOGS("CUpnpHttpServer::SendMessageL - Tried to send Null");
		return KErrNotFound;
		}

    TInt trapError( KErrNone );
    TInt sessId( KErrNone );

    TRAP(trapError, sessId = TrapSendMessageL( aMessage ) );

    if( trapError < KErrNone )
        {
        LOGS1( "HTTP *** Sending of message failed. Error: %i", trapError );
        // HttpSession errors that cannot be forwarded to upper layers
        if( -trapError >= EHttpBadRequest && -trapError <= EHttpExpectationFailed )
            {
            CUpnpHttpMessage* notify = NULL;
            notify = RUpnpHttpMessageFactory::HttpResponseErrorL( aMessage, -trapError );
            CUpnpHttpSession* sess = GetSession( aMessage->SessionId() );
            sess->DeleteThisSessionL( sess );

            ToReceiveStackD( notify ); //Upper layer takes care about cleanup
            }
        else
            {
            User::Leave(trapError);
            }
        }
    // nobody use the value
    return sessId;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:41,代码来源:upnphttpserver.cpp

示例8: oStatement

OGRSpatialReference *OGROCIDataSource::FetchSRS( int nId )

{
    if( nId < 0 )
        return NULL;

/* -------------------------------------------------------------------- */
/*      First, we look through our SRID cache, is it there?             */
/* -------------------------------------------------------------------- */
    int  i;

    for( i = 0; i < nKnownSRID; i++ )
    {
        if( panSRID[i] == nId )
            return papoSRS[i];
    }

/* -------------------------------------------------------------------- */
/*      Try looking up in MDSYS.CS_SRS table.                           */
/* -------------------------------------------------------------------- */
    OGROCIStatement oStatement( GetSession() );
    char            szSelect[200], **papszResult;

    snprintf( szSelect, sizeof(szSelect),
             "SELECT WKTEXT, AUTH_SRID, AUTH_NAME FROM MDSYS.CS_SRS "
             "WHERE SRID = %d AND WKTEXT IS NOT NULL", nId );

    if( oStatement.Execute( szSelect ) != CE_None )
        return NULL;

    papszResult = oStatement.SimpleFetchRow();
    if( CSLCount(papszResult) < 1 )
        return NULL;

/* -------------------------------------------------------------------- */
/*      Turn into a spatial reference.                                  */
/* -------------------------------------------------------------------- */
    char *pszWKT = papszResult[0];
    OGRSpatialReference *poSRS = NULL;

    poSRS = new OGRSpatialReference();
    if( poSRS->importFromWkt( &pszWKT ) != OGRERR_NONE )
    {
        delete poSRS;
        poSRS = NULL;
    }

/* -------------------------------------------------------------------- */
/*      If we have a corresponding EPSG code for this SRID, use that    */
/*      authority.                                                      */
/* -------------------------------------------------------------------- */
    int bGotEPSGMapping = FALSE;
    for( i = 0; anEPSGOracleMapping[i] != 0; i += 2 )
    {
        if( anEPSGOracleMapping[i] == nId )
        {
            poSRS->SetAuthority( poSRS->GetRoot()->GetValue(), "EPSG",
                                 anEPSGOracleMapping[i+1] );
            bGotEPSGMapping = TRUE;
            break;
        }
    }

/* -------------------------------------------------------------------- */
/*      Insert authority information, if it is available.               */
/* -------------------------------------------------------------------- */
    if( papszResult[1] != NULL && atoi(papszResult[1]) != 0
        && papszResult[2] != NULL && strlen(papszResult[1]) != 0
        && poSRS->GetRoot() != NULL
        && !bGotEPSGMapping )
    {
        poSRS->SetAuthority( poSRS->GetRoot()->GetValue(),
                             papszResult[2], atoi(papszResult[1]) );
    }

/* -------------------------------------------------------------------- */
/*      Add to the cache.                                               */
/* -------------------------------------------------------------------- */
    panSRID = (int *) CPLRealloc(panSRID,sizeof(int) * (nKnownSRID+1) );
    papoSRS = (OGRSpatialReference **)
        CPLRealloc(papoSRS, sizeof(void*) * (nKnownSRID + 1) );
    panSRID[nKnownSRID] = nId;
    papoSRS[nKnownSRID] = poSRS;

    nKnownSRID++;

    return poSRS;
}
开发者ID:ryandavid,项目名称:rotobox,代码行数:88,代码来源:ogrocidatasource.cpp

示例9: CPLError

void OGROCIDataSource::ValidateLayer( const char *pszLayerName )

{
    int iLayer;

/* -------------------------------------------------------------------- */
/*      Try to find layer.                                              */
/* -------------------------------------------------------------------- */
    for( iLayer = 0; iLayer < nLayers; iLayer++ )
    {
        if( EQUAL(pszLayerName,papoLayers[iLayer]->GetLayerDefn()->GetName()) )
            break;
    }

    if( iLayer == nLayers )
    {
        CPLError( CE_Failure, CPLE_AppDefined,
                  "ValidateLayer(): %s is not a recognised layer.",
                  pszLayerName );
        return;
    }

/* -------------------------------------------------------------------- */
/*      Verify we have an FID and geometry column for this table.       */
/* -------------------------------------------------------------------- */
    OGROCITableLayer *poLayer = (OGROCITableLayer *) papoLayers[iLayer];

    if( strlen(poLayer->GetFIDColumn()) == 0 )
    {
        CPLError( CE_Failure, CPLE_AppDefined,
                  "ValidateLayer(): %s lacks a fid column.",
                  pszLayerName );

        return;
    }

/* -------------------------------------------------------------------- */
/*      Prepare and execute the geometry validation.                    */
/* -------------------------------------------------------------------- */

    if( strlen(poLayer->GetGeometryColumn()) != 0 )
    {
        OGROCIStringBuf oValidateCmd;
        OGROCIStatement oValidateStmt( GetSession() );

        oValidateCmd.Append( "SELECT c." );
        oValidateCmd.Append( poLayer->GetFIDColumn() );
        oValidateCmd.Append( ", SDO_GEOM.VALIDATE_GEOMETRY(c." );
        oValidateCmd.Append( poLayer->GetGeometryColumn() );
        oValidateCmd.Append( ", m.diminfo) from " );
        oValidateCmd.Append( poLayer->GetLayerDefn()->GetName() );
        oValidateCmd.Append( " c, user_sdo_geom_metadata m WHERE m.table_name= '");
        oValidateCmd.Append( poLayer->GetLayerDefn()->GetName() );
        oValidateCmd.Append( "' AND m.column_name = '" );
        oValidateCmd.Append( poLayer->GetGeometryColumn() );
        oValidateCmd.Append( "' AND SDO_GEOM.VALIDATE_GEOMETRY(c." );
        oValidateCmd.Append( poLayer->GetGeometryColumn() );
        oValidateCmd.Append( ", m.diminfo ) <> 'TRUE'" );

        oValidateStmt.Execute( oValidateCmd.GetString() );

/* -------------------------------------------------------------------- */
/*      Report results to debug stream.                                 */
/* -------------------------------------------------------------------- */
        char **papszRow;

        while( (papszRow = oValidateStmt.SimpleFetchRow()) != NULL )
        {
            const char *pszReason = papszRow[1];

            if( EQUAL(pszReason,"13011") )
                pszReason = "13011: value is out of range";
            else if( EQUAL(pszReason,"13050") )
                pszReason = "13050: unable to construct spatial object";
            else if( EQUAL(pszReason,"13349") )
                pszReason = "13349: polygon boundary crosses itself";

            CPLDebug( "OCI", "Validation failure for FID=%s: %s",
                  papszRow[0], pszReason );
        }
    }
}
开发者ID:ryandavid,项目名称:rotobox,代码行数:82,代码来源:ogrocidatasource.cpp

示例10: show_chains

void show_chains(int *mapp, int *map) {
  char szBuffer[ 255 ];

  GetSession()->bout.Color(0);
  GetSession()->bout.ClearScreen();
  GetSession()->bout.NewLine();
  bool abort = false;
  bool next = false;
  if (GetApplication()->HasConfigFlag(OP_FLAGS_CHAIN_REG) && chains_reg) {
    sprintf(szBuffer, "|#5  Num |#1%-42.42s|#2%-22.22s|#1%-5.5s", "Description", "Sponsored by", "Usage");
    pla(szBuffer, &abort);

    if (okansi()) {
      sprintf(szBuffer, "|#%d %s", FRAME_COLOR,
              "\xDA\xC4\xC4\xC4\xC2\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC2\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC2\xC4\xC4\xC4\xC4\xC4\xBF");
    } else {
      sprintf(szBuffer, " +---+-----------------------------------------+---------------------+-----+");
    }
    pla(szBuffer, &abort);
    for (int i = 0; i < *mapp && !abort && !hangup; i++) {
      WUser user;
      strcat(szBuffer, ". ");
      if (okansi()) {
        GetApplication()->GetUserManager()->ReadUser(&user, chains_reg[map[i]].regby[0]);
        sprintf(szBuffer, " |#%d\xB3|#5%3d|#%d\xB3|#1%-41s|#%d\xB3|%2.2d%-21s|#%d\xB3|#1%5d|#%d\xB3",
                FRAME_COLOR,
                i + 1,
                FRAME_COLOR,
                chains[map[i]].description,
                FRAME_COLOR,
                (chains_reg[map[i]].regby[0]) ? 14 : 13,
                (chains_reg[map[i]].regby[0]) ? user.GetName() : "Available",
                FRAME_COLOR,
                chains_reg[map[i]].usage,
                FRAME_COLOR);
        pla(szBuffer, &abort);
        if (chains_reg[map[i]].regby[0] != 0) {
          for (int i1 = 1; i1 < 5 && !abort; i1++) {
            if (chains_reg[map[i]].regby[i1] != 0) {
              GetApplication()->GetUserManager()->ReadUser(&user, chains_reg[map[i]].regby[i1]);
              sprintf(szBuffer, " |#%d\xB3   \xBA%-41s\xB3|#2%-21s|#%d\xB3%5.5s\xB3",
                      FRAME_COLOR, " ", user.GetName(), FRAME_COLOR, " ");
              pla(szBuffer, &abort);
            }
          }
        }
      } else {
        GetApplication()->GetUserManager()->ReadUser(&user, chains_reg[map[i]].regby[0]);
        sprintf(szBuffer, " |%3d|%-41.41s|%-21.21s|%5d|",
                i + 1, chains[map[i]].description,
                (chains_reg[map[i]].regby[0]) ? user.GetName() : "Available",
                chains_reg[map[i]].usage);
        pla(szBuffer, &abort);
        if (chains_reg[map[i]].regby[0] != 0) {
          for (int i1 = 1; i1 < 5; i1++) {
            if (chains_reg[map[i]].regby[i1] != 0) {
              GetApplication()->GetUserManager()->ReadUser(&user, chains_reg[map[i]].regby[i1]);
              sprintf(szBuffer, " |   |                                         |%-21.21s|     |",
                      (chains_reg[map[i]].regby[i1]) ? user.GetName() : "Available");
              pla(szBuffer, &abort);
            }
          }
        }
      }
    }
    if (okansi()) {
      sprintf(szBuffer, "|#%d %s", FRAME_COLOR,
              "\xC0\xC4\xC4\xC4\xC1\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC1\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC1\xC4\xC4\xC4\xC4\xC4\xD9");
    } else {
      sprintf(szBuffer, " +---+-----------------------------------------+---------------------+-----+");
    }
    pla(szBuffer, &abort);

  } else {
    GetSession()->bout.DisplayLiteBar(" [ %s Online Programs ] ", syscfg.systemname);
    GetSession()->bout <<
                       "|#7\xDA\xC4\xC4\xC2\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC2\xC4\xC4\xC2\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xBF\r\n";
    for (int i = 0; i < *mapp && !abort && !hangup; i++) {
      sprintf(szBuffer, "|#7\xB3|#2%2d|#7\xB3 |#1%-33.33s|#7\xB3", i + 1, chains[map[i]].description);
      osan(szBuffer, &abort, &next);
      i++;
      if (!abort && !hangup) {
        char szBuffer[ 255 ];
        if (i >= *mapp) {
          sprintf(szBuffer, "  |#7\xB3                                  |#7\xB3");
        } else {
          sprintf(szBuffer, "|#2%2d|#7\xB3 |#1%-33.33s|#7\xB3", i + 1, chains[map[i]].description);
        }
        pla(szBuffer, &abort);
      }
    }
    GetSession()->bout <<
                       "|#7\xC0\xC4\xC4\xC1\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC1\xC4\xC4\xC1\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xD9\r\n";
  }
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:95,代码来源:chains.cpp

示例11: InterpretCommand


//.........这里部分代码省略.........
      // "SetMsgConf"
      SetMsgConf(szParam1[0]);
    }
    break;
    case 14: {
      // "SetDirConf"
      SetDirConf(szParam1[0]);
    }
    break;
    case 15: {
      // "EnableConf"
      EnableConf();
    }
    break;
    case 16: {
      // "DisableConf"
      DisableConf();
    }
    break;
    case 17: {
      // "Pause"
      pausescr();
    }
    break;
    case 18: {
      // "ConfigUserMenuSet"
      ConfigUserMenuSet();
      pMenuData->nFinished = 1;
      pMenuData->nReload = 1;
    }
    break;
    case 19: {
      // "DisplayHelp"
      if (GetSession()->GetCurrentUser()->IsExpert()) {
        AMDisplayHelp(pMenuData);
      }
    }
    break;
    case 20: {
      // "SelectSub"
      ChangeSubNumber();
    }
    break;
    case 21: {
      // "SelectDir"
      ChangeDirNumber();
    }
    break;
    case 22: {
      // "SubList"
      SubList();
    }
    break;
    case 23: {
      // "UpSubConf"
      UpSubConf();
    }
    break;
    case 24: {
      // "DownSubConf"
      DownSubConf();
    }
    break;
    case 25: {
      // "UpSub"
      UpSub();
开发者ID:bhaggerty,项目名称:wwiv,代码行数:67,代码来源:menuinterpretcommand.cpp

示例12: ASSERT

bool ChatHandler::ParseCommands(char const* text)
{
    ASSERT(text);
    ASSERT(*text);

    std::string fullcmd = text;

    /// chat case (.command or !command format)
    if (m_session)
    {
        if (text[0] != '!' && text[0] != '.')
            return false;
    }

    /// ignore single . and ! in line
    if (strlen(text) < 2)
        return false;
    // original `text` can't be used. It content destroyed in command code processing.

    /// ignore messages staring from many dots.
    if ((text[0] == '.' && text[1] == '.') || (text[0] == '!' && text[1] == '!'))
        return false;

    /// skip first . or ! (in console allowed use command with . and ! and without its)
    if (text[0] == '!' || text[0] == '.')
        ++text;

    if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd) && sHookMgr->OnCommand(GetSession() ? GetSession()->GetPlayer() : NULL, text))
    {
        if (m_session && !m_session->HasPermission(rbac::RBAC_PERM_COMMANDS_NOTIFY_COMMAND_NOT_FOUND_ERROR))
            return false;

        SendSysMessage(LANG_NO_CMD);
    }
    return true;
}
开发者ID:jameyboor,项目名称:ElunaTrinityWotlk,代码行数:36,代码来源:Chat.cpp

示例13: defined

bool WebAppInputLine::OpenInputFile(FILE** ppFile, const PathName& fileName)
{
  const char* lpszFileName = fileName.GetData();

#if defined(MIKTEX_WINDOWS)
  string utf8FileName;
  if (!Utils::IsUTF8(lpszFileName))
  {
    LogWarn("converting ANSI file name");
    utf8FileName = StringUtil::AnsiToUTF8(lpszFileName);
    LogWarn("conversion succeeded: " + utf8FileName);
    lpszFileName = utf8FileName.c_str();
  }
#endif

  shared_ptr<Session> session = GetSession();

  if (pimpl->enablePipes && lpszFileName[0] == '|')
  {
    string command = lpszFileName + 1;
    Session::ExamineCommandLineResult examineResult;
    string examinedCommand;
    string toBeExecuted;
    tie(examineResult, examinedCommand, toBeExecuted) = session->ExamineCommandLine(command);
    if (examineResult == Session::ExamineCommandLineResult::SyntaxError)
    {
      LogError("command line syntax error: " + command);
      return false;
    }
    if (examineResult != Session::ExamineCommandLineResult::ProbablySafe && examineResult != Session::ExamineCommandLineResult::MaybeSafe)
    {
      LogError("command is unsafe: " + command);
      return false;
    }
    switch (pimpl->shellCommandMode)
    {
    case ShellCommandMode::Unrestricted:
      toBeExecuted = command;
      break;
    case ShellCommandMode::Forbidden:
      LogError("command not executed: " + command);
      return false;
    case ShellCommandMode::Query:
      // TODO
    case ShellCommandMode::Restricted:
      if (examineResult != Session::ExamineCommandLineResult::ProbablySafe)
      {
        LogError("command not allowed: " + command);
        return false;
      }
      break;
    default:
      MIKTEX_UNEXPECTED();
    }
    LogInfo("executing input pipe: " + toBeExecuted);
    *ppFile = session->OpenFile(toBeExecuted, FileMode::Command, FileAccess::Read, false);
    pimpl->foundFile.Clear();
    pimpl->foundFileFq.Clear();
  }
  else
  {
#if defined(WITH_OMEGA)
    PathName unmangled;
    if (AmI("omega"))
    {
      unmangled = UnmangleNameOfFile(lpszFileName);
      lpszFileName = unmangled.GetData();
    }
#endif

    if (!session->FindFile(lpszFileName, GetInputFileType(), pimpl->foundFile))
    {
      return false;
    }

    pimpl->foundFileFq = pimpl->foundFile;
    pimpl->foundFileFq.MakeAbsolute();

#if 1 // 2015-01-15
    if (pimpl->foundFile[0] == '.' && PathName::IsDirectoryDelimiter(pimpl->foundFile[1]))
    {
      PathName temp(pimpl->foundFile.GetData() + 2);
      pimpl->foundFile = temp;
    }
#endif

    try
    {
      if (pimpl->foundFile.HasExtension(".gz"))
      {
        CommandLineBuilder cmd("zcat");
        cmd.AppendArgument(pimpl->foundFile);
        *ppFile = session->OpenFile(cmd.ToString(), FileMode::Command, FileAccess::Read, false);
      }
      else if (pimpl->foundFile.HasExtension(".bz2"))
      {
        CommandLineBuilder cmd("bzcat");
        cmd.AppendArgument(pimpl->foundFile);
        *ppFile = session->OpenFile(cmd.ToString(), FileMode::Command, FileAccess::Read, false);
      }
//.........这里部分代码省略.........
开发者ID:MiKTeX,项目名称:miktex,代码行数:101,代码来源:inputline.cpp

示例14: oStmt

OGRSpatialReference *OGRMSSQLSpatialDataSource::FetchSRS( int nId )

{
    if( nId <= 0 )
        return NULL;

/* -------------------------------------------------------------------- */
/*      First, we look through our SRID cache, is it there?             */
/* -------------------------------------------------------------------- */
    int  i;

    for( i = 0; i < nKnownSRID; i++ )
    {
        if( panSRID[i] == nId )
            return papoSRS[i];
    }

    OGRSpatialReference *poSRS = NULL;

/* -------------------------------------------------------------------- */
/*      Try looking up in spatial_ref_sys table                         */
/* -------------------------------------------------------------------- */
    if (bUseGeometryColumns)
    {
        CPLODBCStatement oStmt( GetSession() );
        oStmt.Appendf( "SELECT srtext FROM spatial_ref_sys WHERE srid = %d", nId );

        if( oStmt.ExecuteSQL() && oStmt.Fetch() )
        {
            if ( oStmt.GetColData( 0 ) )
            {
                poSRS = new OGRSpatialReference();
                char* pszWKT = (char*)oStmt.GetColData( 0 );
                if( poSRS->importFromWkt( &pszWKT ) != OGRERR_NONE )
                {
                    delete poSRS;
                    poSRS = NULL;
                }    
            }
        }
    }

/* -------------------------------------------------------------------- */
/*      Try looking up the EPSG list                                    */
/* -------------------------------------------------------------------- */
    if (!poSRS)
    {
        poSRS = new OGRSpatialReference();
        if( poSRS->importFromEPSG( nId ) != OGRERR_NONE )
        {
            delete poSRS;
            poSRS = NULL;
        } 
    }

/* -------------------------------------------------------------------- */
/*      Add to the cache.                                               */
/* -------------------------------------------------------------------- */
    if (poSRS)
    {
        panSRID = (int *) CPLRealloc(panSRID,sizeof(int) * (nKnownSRID+1) );
        papoSRS = (OGRSpatialReference **)
            CPLRealloc(papoSRS, sizeof(void*) * (nKnownSRID + 1) );
        panSRID[nKnownSRID] = nId;
        papoSRS[nKnownSRID] = poSRS;
        nKnownSRID++;
    }

    return poSRS;
}
开发者ID:pebbie,项目名称:OGRSpatialRef3D,代码行数:70,代码来源:ogrmssqlspatialdatasource.cpp

示例15: parse_email_info

/**
 * Finds GetSession()->usernum and system number from emailAddress, sets network number as
 * appropriate.
 * @param emailAddress The text of the email address.
 * @param pUserNumber OUT The User Number
 * @param pSystemmNumber OUT The System Number
 */
void parse_email_info(const std::string emailAddress, int *pUserNumber, int *pSystemNumber) {
  char *ss1, onx[20], ch, *mmk;
  unsigned nUserNumber, nSystemNumber;
  int i, nv, on, xx, onxi, odci;
  net_system_list_rec *csne;

  char szEmailAddress[ 255 ];
  strcpy(szEmailAddress, emailAddress.c_str());

  *pUserNumber = 0;
  *pSystemNumber = 0;
  net_email_name[0] = '\0';
  char *ss = strrchr(szEmailAddress, '@');
  if (ss == NULL) {
    nUserNumber = finduser1(szEmailAddress);
    if (nUserNumber > 0) {
      *pUserNumber = static_cast< unsigned short >(nUserNumber);
    } else if (wwiv::strings::IsEquals(szEmailAddress, "SYSOP")) {     // Add 4.31 Build3
      *pUserNumber = 1;
    } else {
      GetSession()->bout << "Unknown user.\r\n";
    }
  } else if (atoi(ss + 1) == 0) {
    for (i = 0; i < GetSession()->GetMaxNetworkNumber(); i++) {
      set_net_num(i);
      if ((WWIV_STRNICMP("internet", GetSession()->GetNetworkName(), 8) == 0) ||
          ((WWIV_STRNICMP("filenet", GetSession()->GetNetworkName(), 7) == 0) && (*pSystemNumber == 32767))) {
        strcpy(net_email_name, szEmailAddress);
        for (ss1 = net_email_name; *ss1; ss1++) {
          if ((*ss1 >= 'A') && (*ss1 <= 'Z')) {
            *ss1 += 'a' - 'A';
          }
        }
        *pSystemNumber = 1;
        break;
      }
    }
    if (i >= GetSession()->GetMaxNetworkNumber()) {
      GetSession()->bout << "Unknown user.\r\n";
    }
  } else {
    ss[0] = '\0';
    ss = &(ss[1]);
    i = strlen(szEmailAddress);
    while (i > 0 && szEmailAddress[i - 1] == ' ') {
      --i;
    }
    szEmailAddress[i] = 0;
    nUserNumber = atoi(szEmailAddress);
    if (nUserNumber == 0 && szEmailAddress[0] == '#') {
      nUserNumber = atoi(szEmailAddress + 1);
    }
    if (strchr(szEmailAddress, '@')) {
      nUserNumber = 0;
    }
    nSystemNumber = atoi(ss);
    ss1 = strchr(ss, '.');
    if (ss1) {
      ss1++;
    }
    if (nUserNumber == 0) {
      strcpy(net_email_name, szEmailAddress);
      i = strlen(net_email_name);
      while (i > 0 && net_email_name[i - 1] == ' ') {
        --i;
      }
      net_email_name[i] = '\0';
      if (net_email_name[0]) {
        *pSystemNumber = static_cast< unsigned short >(nSystemNumber);
      } else {
        GetSession()->bout << "Unknown user.\r\n";
      }
    } else {
      *pUserNumber = static_cast< unsigned short >(nUserNumber);
      *pSystemNumber = static_cast< unsigned short >(nSystemNumber);
    }
    if (*pSystemNumber && ss1) {
      for (i = 0; i < GetSession()->GetMaxNetworkNumber(); i++) {
        set_net_num(i);
        if (wwiv::strings::IsEqualsIgnoreCase(ss1, GetSession()->GetNetworkName())) {
          if (!valid_system(*pSystemNumber)) {
            GetSession()->bout.NewLine();
            GetSession()->bout << "There is no " << ss1 << " @" << *pSystemNumber << ".\r\n\n";
            *pSystemNumber = *pUserNumber = 0;
          } else {
            if (*pSystemNumber == net_sysnum) {
              *pSystemNumber = 0;
              if (*pUserNumber == 0) {
                *pUserNumber = static_cast< unsigned short >(finduser(net_email_name));
              }
              if (*pUserNumber == 0 || *pUserNumber > 32767) {
                *pUserNumber = 0;
                GetSession()->bout << "Unknown user.\r\n";
//.........这里部分代码省略.........
开发者ID:bhaggerty,项目名称:wwiv,代码行数:101,代码来源:bbsutl1.cpp


注:本文中的GetSession函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。