Logo Search packages:      
Sourcecode: libmpdclient version File versions  Download package

bool mpd_response_next ( struct mpd_connection connection  ) 

Finishes the response of the current list command. If there are data pairs left, they are discarded.

Returns:
true on success, false on error

Definition at line 71 of file response.c.

References mpd_connection::command_list_remaining, mpd_connection::discrete_finished, mpd_connection::error, MPD_ERROR_MALFORMED, MPD_ERROR_STATE, mpd_recv_pair(), mpd_response_next(), mpd_return_pair(), mpd_connection::receiving, and mpd_connection::sending_command_list_ok.

Referenced by mpd_response_next().

{
      struct mpd_pair *pair;

      if (mpd_error_is_defined(&connection->error))
            return false;

      if (!connection->receiving) {
            mpd_error_code(&connection->error, MPD_ERROR_STATE);
            mpd_error_message(&connection->error,
                          "Response is already finished");
            return false;
      }

      if (!connection->sending_command_list_ok) {
            mpd_error_code(&connection->error, MPD_ERROR_STATE);
            mpd_error_message(&connection->error,
                          "Not in command list mode");
            return false;
      }

      while (!connection->discrete_finished) {
            if (connection->command_list_remaining == 0 ||
                !connection->receiving) {
                  mpd_error_code(&connection->error,
                               MPD_ERROR_MALFORMED);
                  mpd_error_message(&connection->error,
                                "No list_OK found");
                  return false;
            }

            pair = mpd_recv_pair(connection);
            if (pair != NULL)
                  mpd_return_pair(connection, pair);
            else if (mpd_error_is_defined(&connection->error))
                  return false;
      }

      connection->discrete_finished = false;
      return true;
}


Generated by  Doxygen 1.6.0   Back to index