Skip to content

Commit

Permalink
More messing with iMessage owner information.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 21, 2016
1 parent aed562d commit b482219
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions archive_imessage.pl
Expand Up @@ -773,12 +773,22 @@ sub lookup_address {
or fail("Couldn't prepare distinct account SELECT statement: " . $DBI::errstr);
$stmt->execute() or fail("Couldn't execute distinct address SELECT statement: " . $DBI::errstr);

my $default_account = undef;
while (my @row = $stmt->fetchrow_array()) {
my $account = shift @row;
next if not defined $account;
my $address = $account;
$address =~ s/\A[ep]\://i or fail("Unexpected account format '$account'");
dbgprint("distinct account: '$account' -> '$address'\n");
lookup_address($account, $address);
$default_account = $account if not defined $default_account; # oh well.
}

if (not defined $default_account) {
dbgprint("Ugh, forcing a default account.\n");
$default_account = 'e:donotreply@icloud.com'; # oh well.
$longnames{$default_account} = 'Unknown User';
$shortnames{$default_account} = 'Unknown';
}

%mac_addressbook = (); # dump all this, we're done with it.
Expand Down Expand Up @@ -892,6 +902,8 @@ sub talk_gap {
if (($handle_id != $lasthandle_id) or (talk_gap($lastdate, $date))) {
flush_conversation(0);

$account = $default_account if (not defined $account); # happens on old SMS messages.

$imessageuser = $account;
if ($imessageuser =~ s/\A([ep])\://i) {
my $type = lc($1);
Expand All @@ -903,11 +915,12 @@ sub talk_gap {
fail("BUG: this shouldn't have happened."); # we checked this before.
}

$imessageuserhost = $imessageuser;
$imessageuserhost =~ s/\A.*\@//;
$imessageuserlongname = $longnames{$account};
$imessageusershortname = $shortnames{$account};

$imessageuserhost = $imessageuser;
$imessageuserhost =~ s/\A.*\@//;

dbgprint("longname for imessageuser ($imessageuser) == $imessageuserlongname\n");
dbgprint("shortname for imessageuser ($imessageuser) == $imessageusershortname\n");
dbgprint("imessageuserhost == $imessageuserhost\n");
Expand Down

0 comments on commit b482219

Please sign in to comment.