summaryrefslogtreecommitdiffstats
path: root/src/NotificationProxy.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-11-10 23:31:49 +0100
committerGravatar Matt Colyer2009-11-11 07:33:08 -0800
commiteaf80002c6e82c6b7a376bb61c9884ec3cf750b4 (patch)
treefc273d59ad7e5db3db2aba1006bebc6d8e0ac28d /src/NotificationProxy.c
parentfdf94756f8f6a9fc9d218725f429d64fd91d7679 (diff)
downloadlibimobiledevice-eaf80002c6e82c6b7a376bb61c9884ec3cf750b4.tar.gz
libimobiledevice-eaf80002c6e82c6b7a376bb61c9884ec3cf750b4.tar.bz2
Finish migration to latest plist API.
[#77 state:resolved] Signed-off-by: Matt Colyer <matt@colyer.name>
Diffstat (limited to 'src/NotificationProxy.c')
-rw-r--r--src/NotificationProxy.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/NotificationProxy.c b/src/NotificationProxy.c
index ee2ad95..884be5f 100644
--- a/src/NotificationProxy.c
+++ b/src/NotificationProxy.c
@@ -318,35 +318,27 @@ static int np_get_notification(np_client_t client, char **notification)
318 return -2; 318 return -2;
319 } 319 }
320 320
321 plist_t cmd_key_node = plist_find_node_by_key(dict, "Command");
322 plist_t cmd_value_node = plist_get_next_sibling(cmd_key_node);
323 char *cmd_value = NULL; 321 char *cmd_value = NULL;
322 plist_t cmd_value_node = plist_dict_get_item(dict, "Command");
324 323
325 if (plist_get_node_type(cmd_value_node) == PLIST_STRING) { 324 if (plist_get_node_type(cmd_value_node) == PLIST_STRING) {
326 plist_get_string_val(cmd_value_node, &cmd_value); 325 plist_get_string_val(cmd_value_node, &cmd_value);
327 } 326 }
328 327
329 if (cmd_value && !strcmp(cmd_value, "RelayNotification")) { 328 if (cmd_value && !strcmp(cmd_value, "RelayNotification")) {
330 plist_t name_key_node = plist_get_next_sibling(cmd_value_node);
331 plist_t name_value_node = plist_get_next_sibling(name_key_node);
332
333 char *name_key = NULL;
334 char *name_value = NULL; 329 char *name_value = NULL;
330 plist_t name_value_node = plist_dict_get_item(dict, "Name");
335 331
336 if (plist_get_node_type(name_key_node) == PLIST_KEY) {
337 plist_get_key_val(name_key_node, &name_key);
338 }
339 if (plist_get_node_type(name_value_node) == PLIST_STRING) { 332 if (plist_get_node_type(name_value_node) == PLIST_STRING) {
340 plist_get_string_val(name_value_node, &name_value); 333 plist_get_string_val(name_value_node, &name_value);
341 } 334 }
342 335
343 res = -2; 336 res = -2;
344 if (name_key && name_value && !strcmp(name_key, "Name")) { 337 if (name_value_node && name_value) {
345 *notification = name_value; 338 *notification = name_value;
346 log_debug_msg("%s: got notification %s\n", __func__, name_value); 339 log_debug_msg("%s: got notification %s\n", __func__, name_value);
347 res = 0; 340 res = 0;
348 } 341 }
349 free(name_key);
350 } else if (cmd_value && !strcmp(cmd_value, "ProxyDeath")) { 342 } else if (cmd_value && !strcmp(cmd_value, "ProxyDeath")) {
351 log_debug_msg("%s: ERROR: NotificationProxy died!\n", __func__); 343 log_debug_msg("%s: ERROR: NotificationProxy died!\n", __func__);
352 res = -1; 344 res = -1;