Skip to content

Commit

Permalink
Moving choice social frontend into the dsnp tree. One upstream from n…
Browse files Browse the repository at this point in the history
…ow on.
  • Loading branch information
Adrian Thurston committed Jan 22, 2012
1 parent 2e6e81c commit 65685ca
Show file tree
Hide file tree
Showing 74 changed files with 6,336 additions and 0 deletions.
98 changes: 98 additions & 0 deletions choicesocial/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#
# Copyright (c) 2008-2011, Adrian Thurston <[email protected]>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

PACKAGE = choicesocial
VERSION = 0.13

BUILD_SUBDIRS = doc etc db src scripts

#*************************************

ALL_SUBDIRS = $(BUILD_SUBDIRS)

# Programs
CXX = @CXX@

prefix = @prefix@

# build targets
all: $(BUILD_SUBDIRS)

.PHONY: $(ALL_SUBDIRS)

$(BUILD_SUBDIRS):
@cd $@ && $(MAKE)

# clean targets.

CLEAN_SUBDIRS = $(ALL_SUBDIRS:%=%-clean)

.PHONY: $(CLEAN_SUBDIRS)

$(CLEAN_SUBDIRS):
@cd $(@:%-clean=%) && $(MAKE) clean

clean: $(CLEAN_SUBDIRS)
rm -f tags

# distcleaan targets

DISTCLEAN_SUBDIRS = $(ALL_SUBDIRS:%=%-distclean)

.PHONY: $(DISTCLEAN_SUBDIRS)

$(DISTCLEAN_SUBDIRS):
@cd $(@:%-distclean=%) && $(MAKE) distclean

distclean: $(DISTCLEAN_SUBDIRS)
rm -f Makefile config.cache config.status config.log

#install targets

INSTALL_SUBDIRS = $(BUILD_SUBDIRS:%=%-install)

.PHONY: $(INSTALL_SUBDIRS)

$(INSTALL_SUBDIRS):
@cd $(@:%-install=%) && $(MAKE) install

install: $(INSTALL_SUBDIRS)

DIST = $(PACKAGE)-$(VERSION)

dist: all
rm -Rf $(DIST)
mkdir $(DIST)
mkdir $(DIST)/doc
cp doc/INSTALL $(DIST)/doc/
cp doc/PROTOCOL_VERSION $(DIST)/doc/
cp doc/Makefile.in $(DIST)/doc/
cp doc/INIT_SYSTEM.in $(DIST)/doc/
cp doc/new-site.sh $(DIST)/doc/
mkdir $(DIST)/etc
cp etc/Makefile.in $(DIST)/etc/
cp etc/choicesocial.php $(DIST)/etc/
find src -name .svn -prune -or -type f -print | xargs cp --parents -t $(DIST)/
mkdir $(DIST)/db
cp db/Makefile.in $(DIST)/db/
cp db/*.sql $(DIST)/db/
mkdir $(DIST)/scripts
cp scripts/command.sh $(DIST)/scripts/
cp scripts/Makefile.in $(DIST)/scripts/
cp schema_version $(DIST)/
cp configure $(DIST)
cp Makefile.in $(DIST)
tar -czf $(DIST).tar.gz $(DIST)
rm -Rf $(DIST)
56 changes: 56 additions & 0 deletions choicesocial/configure.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
dnl Copyright (c) 2008-2011, Adrian Thurston <[email protected]>
dnl
dnl Permission to use, copy, modify, and/or distribute this software for any
dnl purpose with or without fee is hereby granted, provided that the above
dnl copyright notice and this permission notice appear in all copies.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

AC_INIT(src/webroot/index.php)
dnl AC_CONFIG_HEADER(etc/config.h)

dnl Checks for programs.
AC_PROG_CXX
AC_LANG_C

dnl Check for definition of MAKE.
AC_PROG_MAKE_SET

AC_CHECK_PROG( PROG_CONVERT, "convert", "convert" )
AC_CHECK_PROG( PROG_GM, "gm", "gm" )

AC_ARG_WITH(www-user,
[ --with-notif-user=who user the webserver runs as (default is www-data)],
[WWW_USER="$withval"], [WWW_USER="www-data"] )

AC_SUBST(WWW_USER)

if test -n "$PROG_CONVERT"; then
CONVERT="$PROG_CONVERT"
elif test -n "$PROG_GM"; then
CONVERT="$PROG_GM"
else
AC_ERROR([no convert program found for making thumbnails])
fi
AC_SUBST(CONVERT)

dnl The DNSPd installation. Default it to prefix.
AC_ARG_WITH(dsnpd,
[ --with-dsnpd=/dsnpd/prefix place where dsnpd is installed],
[WITH_DSNPD="$withval"], [WITH_DSNPD="$prefix"] )

DSNPDd="$WITH_DSNPD/bin/dsnpd"
AC_CHECK_FILE( $DSNPDd, [], AC_ERROR([$DSNPDd not found]) )

AC_SUBST(WITH_DSNPD)

dnl write output files
AC_OUTPUT(Makefile doc/Makefile etc/Makefile db/Makefile src/Makefile scripts/Makefile)

echo "configuration of Choice Social complete"
25 changes: 25 additions & 0 deletions choicesocial/db/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Copyright (c) 2009, 2011, Adrian Thurston <[email protected]>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

prefix = @prefix@

all:

install: all
install -d $(DESTDIR)$(prefix)/share/choicesocial
install -m '644' *.sql $(DESTDIR)$(prefix)/share/choicesocial

clean:

215 changes: 215 additions & 0 deletions choicesocial/db/choice.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@

DROP TABLE IF EXISTS user;
CREATE TABLE user
(
id BIGINT NOT NULL AUTO_INCREMENT,

user VARCHAR(20),
pass_salt CHAR(24) BINARY,
pass VARCHAR(40) BINARY,

user_keys_id BIGINT,
identity_id BIGINT,
relationship_id BIGINT,
network_id BIGINT,

PRIMARY KEY( id ),
UNIQUE KEY ( user )
);

DROP TABLE IF EXISTS identity;
CREATE TABLE identity
(
id BIGINT NOT NULL AUTO_INCREMENT,

iduri VARCHAR(128),
hash VARCHAR(48) BINARY,

PRIMARY KEY( id ),
UNIQUE KEY ( iduri )
);

DROP TABLE IF EXISTS relationship;
CREATE TABLE relationship
(
id BIGINT NOT NULL AUTO_INCREMENT,

user_id BIGINT,

-- 1: self.
-- 8: friend.
type SMALLINT,

identity_id BIGINT,

-- User's view of the remote identity. This is used for one's own data
-- as well.
name TEXT,
email VARCHAR(50),

PRIMARY KEY( id ),
UNIQUE( user_id, identity_id )
);

DROP TABLE IF EXISTS friend_request;
CREATE TABLE friend_request
(
id BIGINT NOT NULL AUTO_INCREMENT,

user_id BIGINT,
identity_id BIGINT,
relationship_id BIGINT,

accept_reqid VARCHAR(48) BINARY,

PRIMARY KEY( id )
);

DROP TABLE IF EXISTS sent_friend_request;
CREATE TABLE sent_friend_request
(
id BIGINT NOT NULL AUTO_INCREMENT,

user_id BIGINT,
identity_id BIGINT,
relationship_id BIGINT,

user_notify_reqid VARCHAR(48) BINARY,

PRIMARY KEY( id )
);

DROP TABLE IF EXISTS friend_claim;
CREATE TABLE friend_claim
(
id BIGINT NOT NULL AUTO_INCREMENT,

user_id BIGINT,
identity_id BIGINT,
relationship_id BIGINT,

PRIMARY KEY( id ),
UNIQUE KEY ( user_id, identity_id )
);

DROP TABLE IF EXISTS network;
CREATE TABLE network
(
id BIGINT NOT NULL AUTO_INCREMENT,

user_id BIGINT,

-- 1: primary.
-- 2: friend group.
type SMALLINT,

-- Name visible to the user.
private_name VARCHAR(20),

-- Name distributed to others.
dist_name VARCHAR(48) BINARY,

key_gen BIGINT,

PRIMARY KEY ( id )
);

--
-- Should have three tables:
-- published_owner: owner's view of what's published
-- published_friend: friend's view of what's published
-- activity_stream: what's going on with the user's friends.
--

DROP TABLE IF EXISTS activity;
CREATE TABLE activity
(
id BIGINT NOT NULL AUTO_INCREMENT,

-- What is it?
pub_type INT,

-- The actors.
user_id BIGINT,
publisher_id BIGINT,
author_id BIGINT,
subject_id BIGINT,

-- Supplied by the publisher.
message_id VARCHAR(48),

time_published TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
time_received TIMESTAMP DEFAULT 0,

-- Pointers to material.
remote_resource TEXT,
remote_presentation TEXT,

local_resource TEXT,
local_presentation TEXT,
local_thumbnail TEXT,

message BLOB,

PRIMARY KEY ( id ),

-- The publishers are relationship_ids, which are all unique to each
-- user, so we don't need to include user_id.
UNIQUE KEY ( publisher_id, message_id )
);

DROP TABLE IF EXISTS image;
CREATE TABLE image
(
user_id BIGINT,
seq_num BIGINT NOT NULL AUTO_INCREMENT,

rows INT,
cols INT,
mime_type VARCHAR(32),

PRIMARY KEY ( user_id, seq_num )
);

DROP TABLE IF EXISTS remote_image;
CREATE TABLE remote_image
(
user_id BIGINT,
seq_num BIGINT NOT NULL AUTO_INCREMENT,

PRIMARY KEY ( user_id, seq_num )
);


DROP TABLE IF EXISTS publication;
CREATE TABLE publication
(
id BIGINT NOT NULL AUTO_INCREMENT,

message_id VARCHAR(64),

user_id BIGINT,
author_id BIGINT,
subject_id BIGINT,

publication_type INT,
local_resource TEXT,
local_presentation TEXT,

time_published TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

message BLOB,

PRIMARY KEY ( id )
);

--
-- Database schema verison. Initialize it.
--
DROP TABLE IF EXISTS version;
CREATE TABLE version
(
version INT
);

INSERT INTO version ( version ) VALUES ( 3 );
Loading

0 comments on commit 65685ca

Please sign in to comment.