protected void requestResult(RequestType type,String url,String result,int responseCode,String error,String encoding){
  int length=-1;
  if (result != null) {
    length=result.length();
  }
  String encodingText=encoding == null ? "" : ", " + encoding;
  LOGGER.info("GOT (" + responseCode + ", "+ length+ encodingText+ "): "+ url+ (error != null ? " [" + error + "]" : ""));
  String stream=removeRequest(url);
  if (type == RequestType.STREAM) {
    streamInfoManager.requestResult(url,result,responseCode,stream);
  }
 else   if (type == RequestType.STREAMS) {
    streamInfoManager.requestResultStreams(url,result,responseCode);
  }
 else   if (type == RequestType.EMOTICONS) {
    emoticonManager.emoticonsReceived(result,stream);
  }
 else   if (type == RequestType.CHAT_ICONS) {
    if (result == null) {
      LOGGER.warning("Error requesting stream icons: " + result);
      return;
    }
    List<Usericon> icons=parseChatIcons(result,stream);
    if (icons == null) {
      LOGGER.warning("Error parsing stream icons: " + result);
      return;
    }
 else {
      resultListener.receivedUsericons(icons);
      requestedChatIcons.add(stream);
    }
  }
 else   if (type == RequestType.GLOBAL_BADGES) {
    resultListener.receivedUsericons(badgeManager.handleGlobalBadgesResult(result));
  }
 else   if (type == RequestType.ROOM_BADGES) {
    resultListener.receivedUsericons(badgeManager.handleRoomBadgesResult(result,stream));
  }
 else   if (type == RequestType.CHANNEL || type == RequestType.CHANNEL_PUT) {
    handleChannelInfoResult(type,url,result,responseCode,stream);
  }
 else   if (type == RequestType.GAME_SEARCH) {
    if (result == null) {
      LOGGER.warning("Error searching for game");
      return;
    }
    Set<String> games=parseGameSearch(result);
    if (games == null) {
      LOGGER.warning("Error parsing game search result");
      return;
    }
    resultListener.gameSearchResult(games);
  }
 else   if (type == RequestType.FOLLOWERS) {
    followerManager.received(responseCode,stream,result);
  }
 else   if (type == RequestType.SUBSCRIBERS) {
    subscriberManager.received(responseCode,stream,result);
  }
 else   if (type == RequestType.USERINFO) {
    String displayName=parseNameFromUserInfo(result);
    resultListener.receivedDisplayName(StringUtil.toLowerCase(stream),displayName);
  }
 else   if (type == RequestType.CHAT_SERVER) {
    resultListener.receivedServer(stream,parseServer(result));
  }
 else   if (type == RequestType.CHAT_INFO) {
    resultListener.receivedChatInfo(ChatInfo.decode(stream,result));
  }
}

protected void requestResult ( RequestType type , String url , String result , int responseCode , String error , String encoding ) { int length = - 1 ; if ( result != null ) { length = result . length ( ) ; } String encodingText = encoding == null ? "" : ", " + encoding ; LOGGER . info ( "GOT (" + responseCode + ", " + length + encodingText + "): " + url + ( error != null ? " [" + error + "]" : "" ) ) ; String stream = removeRequest ( url ) ; if ( type == RequestType . STREAM ) { streamInfoManager . requestResult ( url , result , responseCode , stream ) ; } else if ( type == RequestType . STREAMS ) { streamInfoManager . requestResultStreams ( url , result , responseCode ) ; } else if ( type == RequestType . EMOTICONS ) { emoticonManager . emoticonsReceived ( result , stream ) ; } else if ( type == RequestType . CHAT_ICONS ) { if ( result == null ) { LOGGER . warning ( "Error requesting stream icons: " + result ) ; return ; } List < Usericon > icons = parseChatIcons ( result , stream ) ; if ( icons == null ) { LOGGER . warning ( "Error parsing stream icons: " + result ) ; return ; } else { resultListener . receivedUsericons ( icons ) ; requestedChatIcons . add ( stream ) ; } } else if ( type == RequestType . GLOBAL_BADGES ) { resultListener . receivedUsericons ( badgeManager . handleGlobalBadgesResult ( result ) ) ; } else if ( type == RequestType . ROOM_BADGES ) { resultListener . receivedUsericons ( badgeManager . handleRoomBadgesResult ( result , stream ) ) ; } else if ( type == RequestType . CHANNEL || type == RequestType . CHANNEL_PUT ) { handleChannelInfoResult ( type , url , result , responseCode , stream ) ; } else if ( type == RequestType . GAME_SEARCH ) { if ( result == null ) { LOGGER . warning ( "Error searching for game" ) ; return ; } Set < String > games = parseGameSearch ( result ) ; if ( games == null ) { LOGGER . warning ( "Error parsing game search result" ) ; return ; } resultListener . gameSearchResult ( games ) ; } else if ( type == RequestType . FOLLOWERS ) { followerManager . received ( responseCode , stream , result ) ; } else if ( type == RequestType . SUBSCRIBERS ) { subscriberManager . received ( responseCode , stream , result ) ; } else if ( type == RequestType . USERINFO ) { String displayName = parseNameFromUserInfo ( result ) ; resultListener . receivedDisplayName ( StringUtil . toLowerCase ( stream ) , displayName ) ; } else if ( type == RequestType . CHAT_SERVER ) { resultListener . receivedServer ( stream , parseServer ( result ) ) ; } else if ( type == RequestType . CHAT_INFO ) { resultListener . receivedChatInfo ( ChatInfo . decode ( stream , result ) ) ; } }
called by the request thread to work on the result of the request .
