summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-04-02 04:11:02 +0200
committerGravatar Martin Szulecki2010-04-05 19:12:50 +0200
commit5acdb60f197b192f475373a710077c62b6d6f4f3 (patch)
tree0107153406294d8f020b62f4be67d0076ddd3778
parent1c539d6972f5350821c64d7ad3ab25706db88f34 (diff)
downloadideviceinstaller-5acdb60f197b192f475373a710077c62b6d6f4f3.tar.gz
ideviceinstaller-5acdb60f197b192f475373a710077c62b6d6f4f3.tar.bz2
Add compatibility for libimobiledevice API >= 1.1.0
-rw-r--r--configure.ac4
-rw-r--r--src/ideviceinstaller.c28
2 files changed, 32 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index ab3945b..4dc3d76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,10 @@ PKG_CHECK_MODULES(libimobiledevice10, libimobiledevice-1.0 >= 1.0.0, libimobiled
20if test x"$libimobiledevice_1_0" = xyes; then 20if test x"$libimobiledevice_1_0" = xyes; then
21 AC_DEFINE([HAVE_LIBIMOBILEDEVICE_1_0], 1, [Define if libimobiledevice is using 1.0.0 API]) 21 AC_DEFINE([HAVE_LIBIMOBILEDEVICE_1_0], 1, [Define if libimobiledevice is using 1.0.0 API])
22fi 22fi
23PKG_CHECK_MODULES(libimobiledevice11, libimobiledevice-1.0 >= 1.1.0, libimobiledevice_1_1=yes, libimobiledevice_1_1=no)
24if test x"$libimobiledevice_1_1" = xyes; then
25 AC_DEFINE([HAVE_LIBIMOBILEDEVICE_1_1], 1, [Define if libimobiledevice is using 1.1.0 API])
26fi
23PKG_CHECK_MODULES(libplist, libplist >= 0.15) 27PKG_CHECK_MODULES(libplist, libplist >= 0.15)
24PKG_CHECK_MODULES(libzip, libzip >= 0.8) 28PKG_CHECK_MODULES(libzip, libzip >= 0.8)
25 29
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c
index 86c6fe7..c8bc239 100644
--- a/src/ideviceinstaller.c
+++ b/src/ideviceinstaller.c
@@ -75,7 +75,11 @@ static void notifier(const char *notification)
75 notified = 1; 75 notified = 1;
76} 76}
77 77
78#ifdef HAVE_LIBIMOBILEDEVICE_1_1
79static void status_cb(const char *operation, plist_t status, void *unused)
80#else
78static void status_cb(const char *operation, plist_t status) 81static void status_cb(const char *operation, plist_t status)
82#endif
79{ 83{
80 if (status && operation) { 84 if (status && operation) {
81 plist_t npercent = plist_dict_get_item(status, "PercentComplete"); 85 plist_t npercent = plist_dict_get_item(status, "PercentComplete");
@@ -665,17 +669,29 @@ run_again:
665 } 669 }
666 if (install_mode) { 670 if (install_mode) {
667 printf("Installing '%s'\n", pkgname); 671 printf("Installing '%s'\n", pkgname);
672#ifdef HAVE_LIBIMOBILEDEVICE_1_1
673 instproxy_install(ipc, pkgname, client_opts, status_cb, NULL);
674#else
668 instproxy_install(ipc, pkgname, client_opts, status_cb); 675 instproxy_install(ipc, pkgname, client_opts, status_cb);
676#endif
669 } else { 677 } else {
670 printf("Upgrading '%s'\n", pkgname); 678 printf("Upgrading '%s'\n", pkgname);
679#ifdef HAVE_LIBIMOBILEDEVICE_1_1
680 instproxy_upgrade(ipc, pkgname, client_opts, status_cb, NULL);
681#else
671 instproxy_upgrade(ipc, pkgname, client_opts, status_cb); 682 instproxy_upgrade(ipc, pkgname, client_opts, status_cb);
683#endif
672 } 684 }
673 instproxy_client_options_free(client_opts); 685 instproxy_client_options_free(client_opts);
674 free(pkgname); 686 free(pkgname);
675 wait_for_op_complete = 1; 687 wait_for_op_complete = 1;
676 notification_expected = 1; 688 notification_expected = 1;
677 } else if (uninstall_mode) { 689 } else if (uninstall_mode) {
690#ifdef HAVE_LIBIMOBILEDEVICE_1_1
691 instproxy_uninstall(ipc, appid, NULL, status_cb, NULL);
692#else
678 instproxy_uninstall(ipc, appid, NULL, status_cb); 693 instproxy_uninstall(ipc, appid, NULL, status_cb);
694#endif
679 wait_for_op_complete = 1; 695 wait_for_op_complete = 1;
680 notification_expected = 1; 696 notification_expected = 1;
681 } else if (list_archives_mode) { 697 } else if (list_archives_mode) {
@@ -834,7 +850,11 @@ run_again:
834 } 850 }
835 } 851 }
836 852
853#ifdef HAVE_LIBIMOBILEDEVICE_1_1
854 instproxy_archive(ipc, appid, client_opts, status_cb, NULL);
855#else
837 instproxy_archive(ipc, appid, client_opts, status_cb); 856 instproxy_archive(ipc, appid, client_opts, status_cb);
857#endif
838 instproxy_client_options_free(client_opts); 858 instproxy_client_options_free(client_opts);
839 wait_for_op_complete = 1; 859 wait_for_op_complete = 1;
840 if (skip_uninstall) { 860 if (skip_uninstall) {
@@ -968,11 +988,19 @@ run_again:
968 } 988 }
969 goto leave_cleanup; 989 goto leave_cleanup;
970 } else if (restore_mode) { 990 } else if (restore_mode) {
991#ifdef HAVE_LIBIMOBILEDEVICE_1_1
992 instproxy_restore(ipc, appid, NULL, status_cb, NULL);
993#else
971 instproxy_restore(ipc, appid, NULL, status_cb); 994 instproxy_restore(ipc, appid, NULL, status_cb);
995#endif
972 wait_for_op_complete = 1; 996 wait_for_op_complete = 1;
973 notification_expected = 1; 997 notification_expected = 1;
974 } else if (remove_archive_mode) { 998 } else if (remove_archive_mode) {
999#ifdef HAVE_LIBIMOBILEDEVICE_1_1
1000 instproxy_remove_archive(ipc, appid, NULL, status_cb, NULL);
1001#else
975 instproxy_remove_archive(ipc, appid, NULL, status_cb); 1002 instproxy_remove_archive(ipc, appid, NULL, status_cb);
1003#endif
976 wait_for_op_complete = 1; 1004 wait_for_op_complete = 1;
977 } else { 1005 } else {
978 printf 1006 printf