aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-08-16 19:38:07 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-08-16 19:38:07 -0700
commitce515ac2e815cf6c392691743393ea6ebc42c832 (patch)
tree7c22e8e4e243b574e43faedbf6351f9fc1a8e6ca
parent30e3a65c0f15f2cbcc538b35c18b1f60490fda9b (diff)
downloadvolse-hubzilla-ce515ac2e815cf6c392691743393ea6ebc42c832.tar.gz
volse-hubzilla-ce515ac2e815cf6c392691743393ea6ebc42c832.tar.bz2
volse-hubzilla-ce515ac2e815cf6c392691743393ea6ebc42c832.zip
prepare for federation
-rw-r--r--boot.php8
-rw-r--r--database.sql2
-rw-r--r--mod/contacts.php2
-rw-r--r--mod/dfrn_confirm.php9
4 files changed, 14 insertions, 7 deletions
diff --git a/boot.php b/boot.php
index 7754ad1f4..5d476649d 100644
--- a/boot.php
+++ b/boot.php
@@ -10,10 +10,10 @@ define ( 'REGISTER_CLOSED', 0);
define ( 'REGISTER_APPROVE', 1);
define ( 'REGISTER_OPEN', 2);
-define ( 'DIRECTION_ANY', 0);
-define ( 'DIRECTION_IN', 1);
-define ( 'DIRECTION_OUT', 2);
-define ( 'DIRECTION_BOTH', 3);
+define ( 'DIRECTION_NONE', 0); // No relationship
+define ( 'DIRECTION_IN', 1); // VIP e.g. has FAN
+define ( 'DIRECTION_OUT', 2); // FAN to a VIP
+define ( 'DIRECTION_BOTH', 3); // Mutual Friends
define ( 'NOTIFY_INTRO', 0x0001 );
define ( 'NOTIFY_CONFIRM', 0x0002 );
diff --git a/database.sql b/database.sql
index 0cbfc754d..886c4b3b6 100644
--- a/database.sql
+++ b/database.sql
@@ -52,6 +52,8 @@ CREATE TABLE IF NOT EXISTS `contact` (
`uid` int(11) NOT NULL COMMENT 'owner uid',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`self` tinyint(1) NOT NULL DEFAULT '0',
+ `rel` tinyint(1) NOT NULL DEFAULT '0',
+ `network` char(255) NOT NULL,
`name` char(255) NOT NULL,
`photo` text NOT NULL,
`thumb` text NOT NULL,
diff --git a/mod/contacts.php b/mod/contacts.php
index 2afa81c97..2a767102f 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -230,7 +230,7 @@ function contacts_content(&$a) {
case DIRECTION_OUT :
$sql_extra2 = " AND `dfrn-id` != '' AND `issued-id` = '' ";
break;
- case DIRECTION_ANY :
+ case DIRECTION_NONE :
default:
$sql_extra2 = '';
break;
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index 359ddef17..98c1488f8 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -44,6 +44,8 @@ function dfrn_confirm_post(&$a) {
xml_status(3);
}
+ $relation = $r[0]['rel'];
+
// Decrypt all this stuff we just received
$foreign_pubkey = $ret[0]['site-pubkey'];
@@ -116,9 +118,10 @@ function dfrn_confirm_post(&$a) {
$thumb = $a->get_baseurl() . '/images/default-profile-sm.jpg';
}
- $r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `name-date` = '%s', `uri-date` = '%s', `avatar-date` = '%s', `blocked` = 0, `pending` = 0 WHERE `id` = %d LIMIT 1",
+ $r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `rel` = %d, `name-date` = '%s', `uri-date` = '%s', `avatar-date` = '%s', `blocked` = 0, `pending` = 0 `network` = 'dfrn' WHERE `id` = %d LIMIT 1",
dbesc($photo),
dbesc($thumb),
+ intval(($relation == DIRECTION_IN) ? DIRECTION_BOTH: DIRECTION_OUT),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
@@ -189,6 +192,7 @@ function dfrn_confirm_post(&$a) {
}
$contact_id = $r[0]['id'];
+ $relation = $r[0]['rel'];
$site_pubkey = $r[0]['site-pubkey'];
$dfrn_confirm = $r[0]['confirm'];
$aes_allow = $r[0]['aes_allow'];
@@ -325,9 +329,10 @@ function dfrn_confirm_post(&$a) {
$thumb = $a->get_baseurl() . '/images/default-profile-sm.jpg';
}
- $r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `name-date` = '%s', `uri-date` = '%s', `avatar-date` = '%s', `blocked` = 0, `pending` = 0 WHERE `id` = %d LIMIT 1",
+ $r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `rel` = %d, `name-date` = '%s', `uri-date` = '%s', `avatar-date` = '%s', `blocked` = 0, `pending` = 0 `network` = 'dfrn' WHERE `id` = %d LIMIT 1",
dbesc($photo),
dbesc($thumb),
+ intval(($relation == DIRECTION_OUT) ? DIRECTION_BOTH: DIRECTION_IN),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),