- $xml = simplexml_load_string($res);
- $status = (int) $xml->status;
- $message = unxmlify($xml->message); // human readable text of what may have gone wrong.
- switch($status) {
- case 0:
- notice( t("Confirmation completed successfully.") . EOL);
- if(strlen($message))
- notice( t('Remote site reported: ') . $message . EOL);
- break;
- case 1:
- // birthday paradox - generate new dfrn-id and fall through.
- $new_dfrn_id = random_string();
- $r = q("UPDATE contact SET `issued-id` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
- dbesc($new_dfrn_id),
- intval($contact_id),
- intval($uid)
+ $xml = simplexml_load_string($res);
+ $status = (int) $xml->status;
+ $message = unxmlify($xml->message); // human readable text of what may have gone wrong.
+ switch($status) {
+ case 0:
+ notice( t("Confirmation completed successfully.") . EOL);
+ if(strlen($message))
+ notice( t('Remote site reported: ') . $message . EOL);
+ break;
+ case 1:
+ // birthday paradox - generate new dfrn-id and fall through.
+ $new_dfrn_id = random_string();
+ $r = q("UPDATE contact SET `issued-id` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ dbesc($new_dfrn_id),
+ intval($contact_id),
+ intval($uid)
+ );
+
+ case 2:
+ notice( t("Temporary failure. Please wait and try again.") . EOL);
+ if(strlen($message))
+ notice( t('Remote site reported: ') . $message . EOL);
+ break;
+
+
+ case 3:
+ notice( t("Introduction failed or was revoked.") . EOL);
+ if(strlen($message))
+ notice( t('Remote site reported: ') . $message . EOL);
+ break;
+ }
+
+ if(($status == 0) && ($intro_id)) {
+
+ // Success. Delete the notification.
+
+ $r = q("DELETE FROM `intro` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($intro_id),
+ intval($uid)