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

bool mpd_recv_queue_change_brief ( struct mpd_connection connection,
unsigned *  position_r,
unsigned *  id_r 
)

Receives a response element of mpd_send_queue_changes_brief().

Parameters:
connection A valid and connected mpd_connection.
position_r reference to the position of the changed song
id_r reference to the id of the changed song
Returns:
true on success, false on error or if there are no more changes in this response

Definition at line 121 of file queue.c.

References mpd_connection::error, MPD_ERROR_MALFORMED, mpd_recv_pair_named(), mpd_recv_queue_change_brief(), mpd_return_pair(), and mpd_pair::value.

Referenced by mpd_recv_queue_change_brief().

{
      struct mpd_pair *pair;

      pair = mpd_recv_pair_named(connection, "cpos");
      if (pair == NULL)
            return false;

      *position_r = atoi(pair->value);
      mpd_return_pair(connection, pair);

      pair = mpd_recv_pair_named(connection, "Id");
      if (pair == NULL) {
            mpd_return_pair(connection, pair);

            if (!mpd_error_is_defined(&connection->error)) {
                  mpd_error_code(&connection->error,
                               MPD_ERROR_MALFORMED);
                  mpd_error_message(&connection->error,
                                "No id received");
            }

            return false;
      }

      *id_r = atoi(pair->value);
      mpd_return_pair(connection, pair);

      return !mpd_error_is_defined(&connection->error);
}


Generated by  Doxygen 1.6.0   Back to index