Merge pull request #3577 from annando/2in1

Issue 3571 and Diaspora mail bugfix
This commit is contained in:
Tobias Diekershoff 2017-07-11 08:31:39 +02:00 committed by GitHub
commit 81dedb3f92
2 changed files with 18 additions and 4 deletions

View file

@ -1529,6 +1529,8 @@ class Diaspora {
$person = self::person_by_handle($msg_author); $person = self::person_by_handle($msg_author);
dba::lock('mail');
$r = q("SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1", $r = q("SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1",
dbesc($msg_guid), dbesc($msg_guid),
intval($importer["uid"]) intval($importer["uid"])
@ -1556,6 +1558,8 @@ class Diaspora {
dbesc($msg_created_at) dbesc($msg_created_at)
); );
dba::unlock();
q("UPDATE `conv` SET `updated` = '%s' WHERE `id` = %d", q("UPDATE `conv` SET `updated` = '%s' WHERE `id` = %d",
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($conversation["id"]) intval($conversation["id"])
@ -1832,6 +1836,12 @@ class Diaspora {
return false; return false;
} }
$body = diaspora2bb($text);
$body = self::replace_people_guid($body, $person["url"]);
dba::lock('mail');
$r = q("SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1", $r = q("SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1",
dbesc($guid), dbesc($guid),
intval($importer["uid"]) intval($importer["uid"])
@ -1841,10 +1851,6 @@ class Diaspora {
return false; return false;
} }
$body = diaspora2bb($text);
$body = self::replace_people_guid($body, $person["url"]);
q("INSERT INTO `mail` (`uid`, `guid`, `convid`, `from-name`,`from-photo`,`from-url`,`contact-id`,`title`,`body`,`seen`,`reply`,`uri`,`parent-uri`,`created`) q("INSERT INTO `mail` (`uid`, `guid`, `convid`, `from-name`,`from-photo`,`from-url`,`contact-id`,`title`,`body`,`seen`,`reply`,`uri`,`parent-uri`,`created`)
VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, '%s', '%s', %d, %d, '%s','%s','%s')", VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, '%s', '%s', %d, %d, '%s','%s','%s')",
intval($importer["uid"]), intval($importer["uid"]),
@ -1863,6 +1869,8 @@ class Diaspora {
dbesc($created_at) dbesc($created_at)
); );
dba::unlock();
q("UPDATE `conv` SET `updated` = '%s' WHERE `id` = %d", q("UPDATE `conv` SET `updated` = '%s' WHERE `id` = %d",
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($conversation["id"]) intval($conversation["id"])

View file

@ -827,6 +827,12 @@ class Probe {
} }
} }
foreach ($webfinger["aliases"] as $alias) {
if (substr($alias, 0, 5) == 'acct:') {
$data["addr"] = substr($alias, 5);
}
}
if (!isset($data["network"]) || ($hcard_url == "")) { if (!isset($data["network"]) || ($hcard_url == "")) {
return false; return false;
} }