diff options
Diffstat (limited to 'src/misagent.c')
| -rw-r--r-- | src/misagent.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/misagent.c b/src/misagent.c index 2dd3451..095edba 100644 --- a/src/misagent.c +++ b/src/misagent.c | |||
| @@ -202,6 +202,46 @@ LIBIMOBILEDEVICE_API misagent_error_t misagent_copy(misagent_client_t client, pl | |||
| 202 | 202 | ||
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | LIBIMOBILEDEVICE_API misagent_error_t misagent_copy_all(misagent_client_t client, plist_t* profiles) | ||
| 206 | { | ||
| 207 | if (!client || !client->parent || !profiles) | ||
| 208 | return MISAGENT_E_INVALID_ARG; | ||
| 209 | |||
| 210 | client->last_error = MISAGENT_E_UNKNOWN_ERROR; | ||
| 211 | |||
| 212 | plist_t dict = plist_new_dict(); | ||
| 213 | plist_dict_set_item(dict, "MessageType", plist_new_string("CopyAll")); | ||
| 214 | plist_dict_set_item(dict, "ProfileType", plist_new_string("Provisioning")); | ||
| 215 | |||
| 216 | misagent_error_t res = misagent_error(property_list_service_send_xml_plist(client->parent, dict)); | ||
| 217 | plist_free(dict); | ||
| 218 | dict = NULL; | ||
| 219 | |||
| 220 | if (res != MISAGENT_E_SUCCESS) { | ||
| 221 | debug_info("could not send plist, error %d", res); | ||
| 222 | return res; | ||
| 223 | } | ||
| 224 | |||
| 225 | res = misagent_error(property_list_service_receive_plist(client->parent, &dict)); | ||
| 226 | if (res != MISAGENT_E_SUCCESS) { | ||
| 227 | debug_info("could not receive response, error %d", res); | ||
| 228 | return res; | ||
| 229 | } | ||
| 230 | if (!dict) { | ||
| 231 | debug_info("could not get response plist"); | ||
| 232 | return MISAGENT_E_UNKNOWN_ERROR; | ||
| 233 | } | ||
| 234 | |||
| 235 | res = misagent_check_result(dict, &client->last_error); | ||
| 236 | if (res == MISAGENT_E_SUCCESS) { | ||
| 237 | *profiles = plist_copy(plist_dict_get_item(dict, "Payload")); | ||
| 238 | } | ||
| 239 | plist_free(dict); | ||
| 240 | |||
| 241 | return res; | ||
| 242 | |||
| 243 | } | ||
| 244 | |||
| 205 | LIBIMOBILEDEVICE_API misagent_error_t misagent_remove(misagent_client_t client, const char* profileID) | 245 | LIBIMOBILEDEVICE_API misagent_error_t misagent_remove(misagent_client_t client, const char* profileID) |
| 206 | { | 246 | { |
| 207 | if (!client || !client->parent || !profileID) | 247 | if (!client || !client->parent || !profileID) |
