Skip to content

Commit

Permalink
Update libplist requirement to 2.6.0 and use PLIST_DICT helper for cl…
Browse files Browse the repository at this point in the history
…eaner code
  • Loading branch information
nikias committed Sep 15, 2024
1 parent e9a0dce commit 0b1b233
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LT_INIT

# Checks for libraries.
PKG_CHECK_MODULES(libusb, libusb-1.0 >= 1.0.9)
PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.3.0)
PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.6.0)
PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= 1.3.0, have_limd=yes, have_limd=no)
PKG_CHECK_MODULES(limd_glue, libimobiledevice-glue-1.0 >= 1.0.0)

Expand Down
30 changes: 5 additions & 25 deletions src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,7 @@ static int send_listener_list(struct mux_client *client, uint32_t tag)
plist_dict_set_item(l, "Blacklisted", plist_new_bool(0));
n = NULL;
if (lc->info) {
n = plist_dict_get_item(lc->info, "BundleID");
}
if (n) {
plist_dict_set_item(l, "BundleID", plist_copy(n));
plist_dict_copy_item(l, lc->info, "BundleID", NULL);
}
plist_dict_set_item(l, "ConnType", plist_new_uint(0));

Expand Down Expand Up @@ -632,28 +629,11 @@ static char* plist_dict_get_string_val(plist_t dict, const char* key)

static void update_client_info(struct mux_client *client, plist_t dict)
{
plist_t node = NULL;
plist_t info = plist_new_dict();

node = plist_dict_get_item(dict, "BundleID");
if (node && (plist_get_node_type(node) == PLIST_STRING)) {
plist_dict_set_item(info, "BundleID", plist_copy(node));
}

node = plist_dict_get_item(dict, "ClientVersionString");
if (node && (plist_get_node_type(node) == PLIST_STRING)) {
plist_dict_set_item(info, "ClientVersionString", plist_copy(node));
}

node = plist_dict_get_item(dict, "ProgName");
if (node && (plist_get_node_type(node) == PLIST_STRING)) {
plist_dict_set_item(info, "ProgName", plist_copy(node));
}

node = plist_dict_get_item(dict, "kLibUSBMuxVersion");
if (node && (plist_get_node_type(node) == PLIST_UINT)) {
plist_dict_set_item(info, "kLibUSBMuxVersion", plist_copy(node));
}
plist_dict_copy_item(info, dict, "BundleID", NULL);
plist_dict_copy_item(info, dict, "ClientVersionString", NULL);
plist_dict_copy_item(info, dict, "ProgName", NULL);
plist_dict_copy_item(info, dict, "kLibUSBMuxVersion", NULL);
plist_free(client->info);
client->info = info;
}
Expand Down

0 comments on commit 0b1b233

Please sign in to comment.