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

mpd_malloc struct mpd_status* mpd_recv_status ( struct mpd_connection connection  )  [read]

Receives a mpd_status object from the server.

Returns:
the received mpd_status object, or NULL on error

Definition at line 47 of file cstatus.c.

References mpd_connection::error, MPD_ERROR_OOM, mpd_recv_pair(), mpd_recv_status(), mpd_return_pair(), mpd_status_begin(), mpd_status_feed(), and mpd_status_free().

Referenced by mpd_recv_status(), and mpd_run_status().

{
      struct mpd_status * status;
      struct mpd_pair *pair;

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

      status = mpd_status_begin();
      if (status == NULL) {
            mpd_error_code(&connection->error, MPD_ERROR_OOM);
            return NULL;
      }

      while ((pair = mpd_recv_pair(connection)) != NULL) {
            mpd_status_feed(status, pair);
            mpd_return_pair(connection, pair);
      }

      if (mpd_error_is_defined(&connection->error)) {
            mpd_status_free(status);
            return NULL;
      }

      return status;
}


Generated by  Doxygen 1.6.0   Back to index