From d73c0fd50c3637ba3d457aa06dc8a0de4f8b63fc Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 1 Jan 2017 01:26:31 -0500 Subject: [PATCH] Deal with archives from iOS 10.2. --- archive_imessage.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/archive_imessage.pl b/archive_imessage.pl index 2c89a22..2b6b373 100755 --- a/archive_imessage.pl +++ b/archive_imessage.pl @@ -708,8 +708,11 @@ sub parse_addressbook_name { $addressbookdb = DBI->connect("DBI:SQLite:dbname=$addressbookdbname", '', '', { RaiseError => 0 }) or fail("Couldn't open addressbook database at '$archivedir/$addressbookdbname': " . $DBI::errstr); - $lookupstmt = $addressbookdb->prepare('select c15Phone, c16Email, c11Nickname, c0First, c2Middle, c1Last from ABPersonFullTextSearch_content where ((c15Phone LIKE ?) or (c15Phone LIKE ?) or (c15Phone LIKE ?) or (c16Email LIKE ?) or (c16Email LIKE ?) or (c16Email LIKE ?)) limit 1;') - or fail("Couldn't prepare name lookup SELECT statement: " . $DBI::errstr); + $lookupstmt = $addressbookdb->prepare('select c15Phone, c16Email, c11Nickname, c0First, c2Middle, c1Last from ABPersonFullTextSearch_content where ((c15Phone LIKE ?) or (c15Phone LIKE ?) or (c15Phone LIKE ?) or (c16Email LIKE ?) or (c16Email LIKE ?) or (c16Email LIKE ?)) limit 1;'); + if (not $lookupstmt) { # this changed in iOS 10.2 + $lookupstmt = $addressbookdb->prepare('select c16Phone, c17Email, c12Nickname, c0First, c2Middle, c1Last from ABPersonFullTextSearch_content where ((c16Phone LIKE ?) or (c16Phone LIKE ?) or (c16Phone LIKE ?) or (c17Email LIKE ?) or (c17Email LIKE ?) or (c17Email LIKE ?)) limit 1;') + or fail("Couldn't prepare name lookup SELECT statement: " . $DBI::errstr); + } } sub lookup_ios_address {