set_time_limit(0);
-define ( 'BUILD_ID', 1018 );
+define ( 'BUILD_ID', 1019 );
define ( 'DFRN_PROTOCOL_VERSION', '2.0' );
define ( 'EOL', "<br />\r\n" );
$curl_time = intval(get_config('system','curl_timeout'));
- if($curl_time)
- curl_setopt($ch, CURLOPT_TIMEOUT, $curl_time);
+ curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
// by default we will allow self-signed certs
// but you can override this
$s = curl_exec($ch);
- $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ $http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
$header = substr($s,0,strpos($s,"\r\n\r\n"));
if(stristr($header,'100') && (strlen($header) < 30)) {
// 100 Continue has two headers, get the real one
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
$curl_time = intval(get_config('system','curl_timeout'));
- if($curl_time)
- curl_setopt($ch, CURLOPT_TIMEOUT, $curl_time);
+ curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
if(is_array($headers))
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$s = curl_exec($ch);
- $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ $http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
$header = substr($s,0,strpos($s,"\r\n\r\n"));
if(stristr($header,'100') && (strlen($header) < 30)) {
// 100 Continue has two headers, get the real one
PRIMARY KEY ( `id` )
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
+CREATE TABLE IF NOT EXISTS `queue` (
+`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`cid` INT NOT NULL ,
+`created` DATETIME NOT NULL ,
+`last` DATETIME NOT NULL ,
+`content` MEDIUMTEXT NOT NULL
+) ENGINE = MYISAM DEFAULT CHARSET=utf8;
$xml = post_url($contact['notify'],$postvars);
- logger('dfrn_deliver: ' . "SENDING: " . print_r($postvars,true) . "\n" . "RECEIVING: " . $xml);
+ logger('dfrn_deliver: ' . "SENDING: " . print_r($postvars,true) . "\n" . "RECEIVING: " . $xml, LOGGER_DATA);
+
+ if(! strlen($xml))
+ return(-1);
$res = simplexml_load_string($xml);
case 'dfrn':
logger('notifier: dfrndelivery: ' . $contact['name']);
$deliver_status = dfrn_deliver($owner,$contact,$atom);
+
+ if($deliver_status == (-1)) {
+ // queue message for redelivery
+
+ }
+
break;
default:
if($followup && $contact['notify']) {
- slapper($owner,$contact['notify'],$slap);
+ logger('notifier: slapdelivery: ' . $contact['name']);
+ $deliver_status = slapper($owner,$contact['notify'],$slap);
+
+ if($deliver_status == (-1)) {
+ // queue message for redelivery
+
+ }
+
+
}
else {
logger('notifier: slapdelivery: ' . $contact['name']);
foreach($slaps as $slappy) {
if($contact['notify']) {
- slapper($owner,$contact['notify'],$slappy);
+ $deliver_status = slapper($owner,$contact['notify'],$slappy);
+ if($deliver_status == (-1)) {
+ // queue message for redelivery
+ // if not already in queue
+ // else if deliver_status ok and queued, remove from queue
+
+ }
}
}
}
break;
}
+
if(($cmd === 'mail') && ($deliver_status == 0)) {
$r = q("UPDATE `mail` SET `delivered` = 1 WHERE `id` = %d LIMIT 1",
intval($item_id)
logger('notifier: urldelivery: ' . $url);
foreach($slaps as $slappy) {
if($url) {
- slapper($owner,$url,$slappy);
+ $deliver_status = slapper($owner,$url,$slappy);
}
}
}
}
logger('slapper returned ' . $return_code);
- return;
+ if(! $return_code)
+ return(-1);
+ return ((substr($return_code,0,1) === '2') ? 0 : 1);
}
$errors ++;
}
}
- }
+ }
return $errors;
}
\ No newline at end of file
}
+function update_1018() {
+ q("CREATE TABLE IF NOT EXISTS `queue` (
+`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`cid` INT NOT NULL ,
+`created` DATETIME NOT NULL ,
+`last` DATETIME NOT NULL ,
+`content` MEDIUMTEXT NOT NULL
+) ENGINE = MYISAM DEFAULT CHARSET=utf8 ");
+}