bool Registration::handleIq( Stanza *stanza )
  {
    if( stanza->subtype() == StanzaIqError )
    {
      Tag *e = stanza->findChild( "error" );

      if( e->empty() || !m_registrationHandler )
        return false;

      if( e->hasChild( "conflict" ) || e->hasAttribute( "code", "409" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_CONFLICT );
      else if( e->hasChild( "not-acceptable" ) || e->hasAttribute( "code", "406" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_NOT_ACCEPTABLE );
      else if( e->hasChild( "bad-request" ) || e->hasAttribute( "code", "400" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_BAD_REQUEST );
      else if( e->hasChild( "forbidden" ) || e->hasAttribute( "code", "403" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_FORBIDDEN );
      else if( e->hasChild( "registration-required" ) || e->hasAttribute( "code", "407" ) )
        m_registrationHandler->handleRegistrationResult(
            RegistrationHandler::REGISTRATION_REGISTRATION_REQUIRED );
      else if( e->hasChild( "unexpected-request" ) || e->hasAttribute( "code", "400" ) )
        m_registrationHandler->handleRegistrationResult(
            RegistrationHandler::REGISTRATION_UNEXPECTED_REQUEST );
      else if( e->hasChild( "not-authorized" ) || e->hasAttribute( "code", "401" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_NOT_AUTHORIZED );
      else if( e->hasChild( "not-allowed" ) || e->hasAttribute( "code", "405" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_NOT_ALLOWED );
      else
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::UNKNOWN_ERROR );
    }
    return false;
  }
示例#2
0
文件: main.cpp 项目: sembruk/osm2xmap
 Coords addCoordsToWay(XmapWay& way, const Symbol& symbol, OsmWay osmWay, bool reverse = false) {
     if (reverse) {
         osmWay.reverse();
     }
     Tag dashSymbolTag = symbol.NdSymbolTag();
     Coords lastGeographicCoords;
     for (const auto& osmNode : osmWay) {
         int flags = 0;
         if (!dashSymbolTag.empty()) {
             if(osmNode.getTagMap().exist(dashSymbolTag)) {
                 flags = 32;
             }
         }
         Coords coords = osmNode.getCoords();
         lastGeographicCoords = coords;
         coords = Main::transform.geographicToMap(coords);
         way.addCoord(coords,flags);
     }
     return lastGeographicCoords;
 }