1
0
Fork 0

NETWORK_MAIL2 was never finished, so remove it as well

This commit is contained in:
Michael 2017-12-03 09:19:58 +00:00
parent adf802474b
commit 6f7510550d
12 changed files with 24 additions and 189 deletions

View file

@ -259,7 +259,6 @@ define('NETWORK_OSTATUS', 'stat'); // status.net, identi.ca, GNU-soc
define('NETWORK_FEED', 'feed'); // RSS/Atom feeds with no known "post/notify" protocol define('NETWORK_FEED', 'feed'); // RSS/Atom feeds with no known "post/notify" protocol
define('NETWORK_DIASPORA', 'dspr'); // Diaspora define('NETWORK_DIASPORA', 'dspr'); // Diaspora
define('NETWORK_MAIL', 'mail'); // IMAP/POP define('NETWORK_MAIL', 'mail'); // IMAP/POP
define('NETWORK_MAIL2', 'mai2'); // extended IMAP/POP
define('NETWORK_FACEBOOK', 'face'); // Facebook API define('NETWORK_FACEBOOK', 'face'); // Facebook API
define('NETWORK_LINKEDIN', 'lnkd'); // LinkedIn define('NETWORK_LINKEDIN', 'lnkd'); // LinkedIn
define('NETWORK_XMPP', 'xmpp'); // XMPP define('NETWORK_XMPP', 'xmpp'); // XMPP
@ -290,7 +289,6 @@ $netgroup_ids = array(
NETWORK_FEED => (-4), NETWORK_FEED => (-4),
NETWORK_DIASPORA => (-5), NETWORK_DIASPORA => (-5),
NETWORK_MAIL => (-6), NETWORK_MAIL => (-6),
NETWORK_MAIL2 => (-7),
NETWORK_FACEBOOK => (-8), NETWORK_FACEBOOK => (-8),
NETWORK_LINKEDIN => (-9), NETWORK_LINKEDIN => (-9),
NETWORK_XMPP => (-10), NETWORK_XMPP => (-10),

View file

@ -85,7 +85,6 @@ function network_to_name($s, $profile = "") {
NETWORK_LINKEDIN => t('LinkedIn'), NETWORK_LINKEDIN => t('LinkedIn'),
NETWORK_XMPP => t('XMPP/IM'), NETWORK_XMPP => t('XMPP/IM'),
NETWORK_MYSPACE => t('MySpace'), NETWORK_MYSPACE => t('MySpace'),
NETWORK_MAIL2 => t('Email'),
NETWORK_GPLUS => t('Google+'), NETWORK_GPLUS => t('Google+'),
NETWORK_PUMPIO => t('pump.io'), NETWORK_PUMPIO => t('pump.io'),
NETWORK_TWITTER => t('Twitter'), NETWORK_TWITTER => t('Twitter'),

View file

@ -198,9 +198,6 @@ function import_account(App $a, $file) {
case NETWORK_DIASPORA: case NETWORK_DIASPORA:
// send relocate message (below) // send relocate message (below)
break; break;
case NETWORK_MAIL2:
/// @TODO ?
break;
case NETWORK_FEED: case NETWORK_FEED:
case NETWORK_MAIL: case NETWORK_MAIL:
// Nothing to do // Nothing to do

View file

@ -559,7 +559,7 @@ function contacts_content(App $a) {
} }
$lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : ''); $lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : '');
$poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2)); $poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL));
$nettype = sprintf( t('Network type: %s'),network_to_name($contact['network'], $contact["url"])); $nettype = sprintf( t('Network type: %s'),network_to_name($contact['network'], $contact["url"]));
@ -586,7 +586,7 @@ function contacts_content(App $a) {
'3' => t('Fetch keywords'), '3' => t('Fetch keywords'),
'2' => t('Fetch information and keywords'))); '2' => t('Fetch information and keywords')));
} }
if (in_array($contact['network'], array(NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2))) if (in_array($contact['network'], array(NETWORK_FEED, NETWORK_MAIL)))
$poll_interval = contact_poll_interval($contact['priority'],(! $poll_enabled)); $poll_interval = contact_poll_interval($contact['priority'],(! $poll_enabled));
if ($contact['network'] == NETWORK_DFRN) if ($contact['network'] == NETWORK_DFRN)
@ -994,7 +994,7 @@ function _contact_detail_for_template($rr){
*/ */
function contact_actions($contact) { function contact_actions($contact) {
$poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2)); $poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL));
$contact_action = array(); $contact_action = array();
// Provide friend suggestion only for Friendica contacts // Provide friend suggestion only for Friendica contacts

View file

@ -292,15 +292,12 @@ function dfrn_request_post(App $a) {
* *
* Cleanup old introductions that remain blocked. * Cleanup old introductions that remain blocked.
* Also remove the contact record, but only if there is no existing relationship * Also remove the contact record, but only if there is no existing relationship
* Do not remove email contacts as these may be awaiting email verification
*/ */
$r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel` $r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel`
FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id` FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0 WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
AND `contact`.`network` != '%s' AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE "
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ",
dbesc(NETWORK_MAIL2)
); );
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
@ -315,32 +312,6 @@ function dfrn_request_post(App $a) {
} }
} }
/*
*
* Cleanup any old email intros - which will have a greater lifetime
*/
$r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel`
FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
AND `contact`.`network` = '%s'
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
dbesc(NETWORK_MAIL2)
);
if (DBM::is_result($r)) {
foreach ($r as $rr) {
if(! $rr['rel']) {
q("DELETE FROM `contact` WHERE `id` = %d AND NOT `self`",
intval($rr['cid'])
);
}
q("DELETE FROM `intro` WHERE `id` = %d",
intval($rr['iid'])
);
}
}
$email_follow = (x($_POST,'email_follow') ? intval($_POST['email_follow']) : 0);
$real_name = (x($_POST,'realname') ? notags(trim($_POST['realname'])) : ''); $real_name = (x($_POST,'realname') ? notags(trim($_POST['realname'])) : '');
$url = trim($_POST['dfrn_url']); $url = trim($_POST['dfrn_url']);
@ -351,125 +322,25 @@ function dfrn_request_post(App $a) {
$hcard = ''; $hcard = '';
if($email_follow) { // Detect the network
$data = Probe::uri($url);
$network = $data["network"];
if(! validate_email($url)) { // Canonicalise email-style profile locator
notice( t('Invalid email address.') . EOL); $url = Probe::webfingerDfrn($url,$hcard);
return;
if (substr($url,0,5) === 'stat:') {
// Every time we detect the remote subscription we define this as OStatus.
// We do this even if it is not OStatus.
// we only need to pass this through another section of the code.
if ($network != NETWORK_DIASPORA) {
$network = NETWORK_OSTATUS;
} }
$addr = $url; $url = substr($url,5);
$name = ($realname) ? $realname : $addr;
$nick = substr($addr,0,strpos($addr,'@'));
$url = 'http://' . substr($addr,strpos($addr,'@') + 1);
$nurl = normalise_url($host);
$poll = 'email ' . random_string();
$notify = 'smtp ' . random_string();
$network = NETWORK_MAIL2;
$rel = CONTACT_IS_FOLLOWER;
$mail_disabled = ((function_exists('imap_open') && (! Config::get('system','imap_disabled'))) ? 0 : 1);
if(Config::get('system','dfrn_only'))
$mail_disabled = 1;
if(! $mail_disabled) {
$failed = false;
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
if (! DBM::is_result($r)) {
notice( t('This account has not been configured for email. Request failed.') . EOL);
return;
}
}
$r = q("insert into contact ( uid, created, addr, name, nick, url, nurl, poll, notify, blocked, pending, network, rel )
values( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d ) ",
intval($uid),
dbesc(datetime_convert()),
dbesc($addr),
dbesc($name),
dbesc($nick),
dbesc($url),
dbesc($nurl),
dbesc($poll),
dbesc($notify),
intval($blocked),
intval($pending),
dbesc($network),
intval($rel)
);
$r = q("SELECT `id`, `network` FROM `contact` WHERE `poll` = '%s' AND `uid` = %d LIMIT 1",
dbesc($poll),
intval($uid)
);
if (DBM::is_result($r)) {
$contact_id = $r[0]['id'];
$def_gid = get_default_group($uid, $r[0]["network"]);
if (intval($def_gid))
group_add_member($uid, '', $contact_id, $def_gid);
$photo = avatar_img($addr);
$r = q("UPDATE `contact` SET
`photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
`name-date` = '%s',
`uri-date` = '%s',
`avatar-date` = '%s',
`hidden` = 0,
WHERE `id` = %d
",
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($contact_id)
);
}
// contact is created. Now create an introduction
$hash = random_string();
$r = q("INSERT INTO `intro` ( `uid`, `contact-id`, knowyou, note, hash, datetime, blocked )
VALUES( %d , %d, %d, '%s', '%s', '%s', %d ) ",
intval($uid),
intval($contact_id),
((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
dbesc(notags(trim($_POST['dfrn-request-message']))),
dbesc($hash),
dbesc(datetime_convert()),
1
);
// Next send an email verify form to the requestor.
} else { } else {
// Detect the network $network = NETWORK_DFRN;
$data = Probe::uri($url);
$network = $data["network"];
// Canonicalise email-style profile locator
$url = Probe::webfingerDfrn($url,$hcard);
if (substr($url,0,5) === 'stat:') {
// Every time we detect the remote subscription we define this as OStatus.
// We do this even if it is not OStatus.
// we only need to pass this through another section of the code.
if ($network != NETWORK_DIASPORA)
$network = NETWORK_OSTATUS;
$url = substr($url,5);
} else
$network = NETWORK_DFRN;
} }
logger('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG); logger('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
@ -849,27 +720,6 @@ function dfrn_request_content(App $a) {
$page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:"); $page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:");
// see if we are allowed to have NETWORK_MAIL2 contacts
$mail_disabled = ((function_exists('imap_open') && (! Config::get('system','imap_disabled'))) ? 0 : 1);
if (Config::get('system','dfrn_only')) {
$mail_disabled = 1;
}
if (! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($a->profile['uid'])
);
if (! DBM::is_result($r)) {
$mail_disabled = 1;
}
}
// "coming soon" is disabled for now
//$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29"));
$emailnet = "";
$invite_desc = sprintf( $invite_desc = sprintf(
t('If you are not yet a member of the free social web, <a href="%s/siteinfo">follow this link to find a public Friendica site and join us today</a>.'), t('If you are not yet a member of the free social web, <a href="%s/siteinfo">follow this link to find a public Friendica site and join us today</a>.'),
get_server() get_server()
@ -891,7 +741,6 @@ function dfrn_request_content(App $a) {
'$diasnote' => sprintf (t(' - please do not use this form. Instead, enter %s into your Diaspora search bar.'),$target_addr), '$diasnote' => sprintf (t(' - please do not use this form. Instead, enter %s into your Diaspora search bar.'),$target_addr),
'$your_address' => t('Your Identity Address:'), '$your_address' => t('Your Identity Address:'),
'$invite_desc' => $invite_desc, '$invite_desc' => $invite_desc,
'$emailnet' => $emailnet,
'$submit' => t('Submit Request'), '$submit' => t('Submit Request'),
'$cancel' => t('Cancel'), '$cancel' => t('Cancel'),
'$nickname' => $a->argv[1], '$nickname' => $a->argv[1],

View file

@ -156,7 +156,7 @@ Class Cron {
$contacts = q("SELECT `contact`.`id` FROM `user` $contacts = q("SELECT `contact`.`id` FROM `user`
STRAIGHT_JOIN `contact` STRAIGHT_JOIN `contact`
ON `contact`.`uid` = `user`.`uid` AND `contact`.`rel` IN (%d, %d) AND `contact`.`poll` != '' ON `contact`.`uid` = `user`.`uid` AND `contact`.`rel` IN (%d, %d) AND `contact`.`poll` != ''
AND `contact`.`network` IN ('%s', '%s', '%s', '%s', '%s') $sql_extra AND `contact`.`network` IN ('%s', '%s', '%s', '%s') $sql_extra
AND NOT `contact`.`self` AND NOT `contact`.`blocked` AND NOT `contact`.`readonly` AND NOT `contact`.`self` AND NOT `contact`.`blocked` AND NOT `contact`.`readonly`
AND NOT `contact`.`archive` AND NOT `contact`.`archive`
WHERE NOT `user`.`account_expired` AND NOT `user`.`account_removed` $abandon_sql ORDER BY RAND()", WHERE NOT `user`.`account_expired` AND NOT `user`.`account_removed` $abandon_sql ORDER BY RAND()",
@ -165,8 +165,7 @@ Class Cron {
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_OSTATUS),
dbesc(NETWORK_FEED), dbesc(NETWORK_FEED),
dbesc(NETWORK_MAIL), dbesc(NETWORK_MAIL)
dbesc(NETWORK_MAIL2)
); );
if (!DBM::is_result($contacts)) { if (!DBM::is_result($contacts)) {

View file

@ -376,7 +376,6 @@ class Delivery {
break; break;
case NETWORK_MAIL: case NETWORK_MAIL:
case NETWORK_MAIL2:
if (Config::get('system','dfrn_only')) { if (Config::get('system','dfrn_only')) {
break; break;

View file

@ -447,7 +447,7 @@ class Notifier {
// It only makes sense to distribute answers to OStatus messages to Friendica and OStatus - but not Diaspora // It only makes sense to distribute answers to OStatus messages to Friendica and OStatus - but not Diaspora
$sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."')"; $sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."')";
} else { } else {
$sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."', '".NETWORK_DIASPORA."', '".NETWORK_MAIL."', '".NETWORK_MAIL2."')"; $sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."', '".NETWORK_DIASPORA."', '".NETWORK_MAIL."')";
} }
} else { } else {
$public_message = false; $public_message = false;
@ -537,9 +537,8 @@ class Notifier {
} }
$r2 = q("SELECT `id`, `name`,`network` FROM `contact` $r2 = q("SELECT `id`, `name`,`network` FROM `contact`
WHERE `network` in ('%s', '%s') AND `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `rel` != %d", WHERE `network` in ('%s') AND `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `rel` != %d",
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
dbesc(NETWORK_MAIL2),
intval($owner['uid']), intval($owner['uid']),
intval(CONTACT_IS_SHARING) intval(CONTACT_IS_SHARING)
); );

View file

@ -311,7 +311,7 @@ Class OnePoll
$xml = $ret['body']; $xml = $ret['body'];
unlink($cookiejar); unlink($cookiejar);
} elseif ($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) { } elseif ($contact['network'] === NETWORK_MAIL) {
logger("Mail: Fetching for ".$contact['addr'], LOGGER_DEBUG); logger("Mail: Fetching for ".$contact['addr'], LOGGER_DEBUG);

View file

@ -1484,9 +1484,6 @@ function update_1164() {
$r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)", $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
NETWORK_MAIL, NETWORK_MAIL); NETWORK_MAIL, NETWORK_MAIL);
$r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
NETWORK_MAIL2, NETWORK_MAIL2);
$r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)", $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
NETWORK_FACEBOOK, NETWORK_FACEBOOK); NETWORK_FACEBOOK, NETWORK_FACEBOOK);

View file

@ -7,7 +7,6 @@
<li><a href="http://friendica.com" title="{{$friendica}}">{{$friendica}}</a></li> <li><a href="http://friendica.com" title="{{$friendica}}">{{$friendica}}</a></li>
<li><a href="http://joindiaspora.com" title="{{$diaspora}}">{{$diaspora}}</a> {{$diasnote}}</li> <li><a href="http://joindiaspora.com" title="{{$diaspora}}">{{$diaspora}}</a> {{$diasnote}}</li>
<li><a href="http://ostatus.org" title="{{$public_net}}" >{{$statusnet}}</a></li> <li><a href="http://ostatus.org" title="{{$public_net}}" >{{$statusnet}}</a></li>
{{if $emailnet}}<li>{{$emailnet}}</li>{{/if}}
</ul> </ul>
</p> </p>
<p> <p>

View file

@ -8,7 +8,6 @@
<li><a href="http://friendica.com" title="{{$friendica}}">{{$friendica}}</a></li> <li><a href="http://friendica.com" title="{{$friendica}}">{{$friendica}}</a></li>
<li><a href="http://joindiaspora.com" title="{{$diaspora}}">{{$diaspora}}</a> {{$diasnote}}</li> <li><a href="http://joindiaspora.com" title="{{$diaspora}}">{{$diaspora}}</a> {{$diasnote}}</li>
<li><a href="http://ostatus.org" title="{{$public_net}}" >{{$statusnet}}</a></li> <li><a href="http://ostatus.org" title="{{$public_net}}" >{{$statusnet}}</a></li>
{{if $emailnet}}<li>{{$emailnet}}</li>{{/if}}
</ul> </ul>
{{$invite_desc}} {{$invite_desc}}
</p> </p>