gmyth/gmyth/gmyth_util.c
branchtrunk
changeset 951 7b0d87ef5e63
parent 950 6308269b026e
     1.1 --- a/gmyth/gmyth/gmyth_util.c	Tue Dec 15 20:48:32 2009 +0000
     1.2 +++ b/gmyth/gmyth/gmyth_util.c	Wed Dec 16 10:06:21 2009 +0000
     1.3 @@ -775,6 +775,50 @@
     1.4      return program;
     1.5  }
     1.6  
     1.7 +GSList *
     1.8 +gmyth_util_get_all_pending(GMythBackendInfo * backend_info,
     1.9 +                           gboolean * conflicts)
    1.10 +{
    1.11 +    GSList         *program_list = NULL;
    1.12 +    GMythSocket    *socket;
    1.13 +    gboolean        res;
    1.14 +
    1.15 +    socket = gmyth_socket_new();
    1.16 +    res = gmyth_socket_connect_to_backend(socket, backend_info->hostname,
    1.17 +                                          backend_info->port, TRUE);
    1.18 +
    1.19 +    if (res) {
    1.20 +        GMythStringList *slist = gmyth_string_list_new();
    1.21 +        int              pos, lines, count;
    1.22 +
    1.23 +        gmyth_string_list_append_char_array(slist, "QUERY_GETALLPENDING");
    1.24 +
    1.25 +        gmyth_socket_sendreceive_stringlist(socket, slist);
    1.26 +
    1.27 +        if (gmyth_string_list_length(slist) > 1) {
    1.28 +            GMythProgramInfo *program;
    1.29 +
    1.30 +            *conflicts = gmyth_string_list_get_int(slist, 0);
    1.31 +            count = gmyth_string_list_get_int(slist, 1);
    1.32 +            lines = (gmyth_string_list_length(slist) - 2) / count;
    1.33 +
    1.34 +            for(pos = 2; pos < 2 + count * lines; pos += lines) {
    1.35 +                program =
    1.36 +                  gmyth_program_info_from_string_list_from_pos(slist, pos);
    1.37 +
    1.38 +                if (program)
    1.39 +                    program_list = g_slist_prepend(program_list, program);
    1.40 +            }
    1.41 +        }
    1.42 +        g_object_unref(slist);
    1.43 +
    1.44 +        gmyth_socket_close_connection(socket);
    1.45 +    }
    1.46 +    g_object_unref(socket);
    1.47 +
    1.48 +    return g_slist_reverse(program_list);
    1.49 +}
    1.50 +
    1.51  #if !GLIB_CHECK_VERSION (2, 10, 0)
    1.52  
    1.53  /*