new submissions using MIT license

Conflicts:
	world/drivers/ldmud/master/accept.c
	world/net/library/legal.c
	world/net/user.c
This commit is contained in:
psyc://psyced.org/~lynX 2010-02-21 10:03:11 +01:00
commit 949734b379
11 changed files with 157 additions and 41 deletions

View File

@ -3995,6 +3995,7 @@ person, user
+ allow multiple psyc clients per user, thx tg
usercmd
+ /forceenter only exists temporarily to circumvent a bug
- immediately show presence of a newly acquired friend, thx tg
userthreads, threads, accept etc
+ experimental microblogging on your web profile, thx tg
#define _flag_enable_module_microblogging

View File

@ -1,18 +1,22 @@
[ «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» ]
psyced, a scalable distributed multi-protocol chat and messaging server
solution based on the PSYC protocol for synchronous conferencing.
___
Copyright (C) since 1997 by:
Carlo von Loesch (psyc://ve.symlynX.com/~lynX).
Carlo von Loesch (psyc://psyced.org/~lynX).
Since 2002 copyright also in parts by:
Philipp Hancke (psyc://goodadvice.pages.de/~fippo)
Tobias Josefowitz (psyc://goodadvice.pages.de/~heldensaga)
Arne Gödeke (psyc://psyced.org/~el) and
Dominik Sander (psyc://psyced.org/~depairet).
___
All development prior to 2010 has been published under a GNU GPL as
described below. Development since 2010-01-01 is published under the
MIT license also described below. To deploy psyced installations of
versions since 2010, both license requirements must typically be met.
___ Until 2010:
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as
@ -22,33 +26,47 @@ ___
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
___ Since 2010:
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
___
This program is also available under different license from
Carlo von Loesch and symlynX. To this purpose all copyright
owners grant Carlo von Loesch and symlynX the right to use
and license this program in whatever suitable way.
owners until 2010 grant Carlo von Loesch and symlynX the right
to use and license this program in whatever suitable way.
Should you wish to contribute to this program, you can receive a
write access to the psyced software repository from symlynX. By checking
code in, you grant us permission to license your contribution under
both the GNU General Public License and under other licenses as
described above.
With the act of checking into the software repository, you guarantee
By the act of submitting code to the psyced maintainers you guarantee
that you are either the author and copyright owner of the contribution
you are making, or that you have a license to use said contribution in
a way compatible with our terms of use. If you fail to do so, you
remain the sole responsible for your acting; no part of the
a way compatible with our licenses. If you fail to do so, you
remain the sole responsible for your actions; no part of the
responsibility will be transferred to symlynX.
This means, for example, that you cannot contribute code elements
which stem from an other GPL project, as this would not comply with
the dual licensing requirement described above.
the MIT license requirement after 2010.
You can however keep this kind of modifications to yourself, or
publish your own GPL licensed fork of this software, or - in agreement
with us - add optional parts to this software clearly marked as not
adhering to the dual license described above.
adhering to this license.
[ «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» «» ]

View File

@ -392,10 +392,10 @@ object compile_object(string file) {
return (object)0;
#ifdef _flag_enable_module_microblogging
string username;
if (sscanf(file, "place/~%s#updates", username)) {
object p;
unless ((p = SIMUL_EFUN_FILE->summon_person(username, NET_PATH "user")) && p->vQuery("password")) {
string username, channel;
if (sscanf(file, "place/~%s#%s", username, channel)) {
object p = SIMUL_EFUN_FILE->summon_person(username, NET_PATH "user");
unless (p && !p->isNewbie()) {
P3(("PLACE %O NOT CLONED: %O isn't a registered user\n", name, username));
return (object)0;
}

View File

@ -547,11 +547,14 @@ int boss(mixed guy) {
mixed find_place(mixed a) {
P3((">> find_place(%O)\n", a))
string path, err;
string path, err, nick;
object o;
if (objectp(a)) return a;
if (path = lower_uniform(a)) return path;
#ifdef _flag_enable_module_microblogging
if (sscanf(a, "~%s", nick) && legal_name(nick)) a += "#follow";
#endif
unless (a = legal_name(a, 1)) return 0;
path = PLACE_PATH + lower_case(a); // assumes amylaar
o = find_object(path);

View File

@ -28,10 +28,11 @@ varargs string legal_name(string name, int isPlace) {
}
#ifdef _flag_enable_module_microblogging
string nick;
if (isPlace && sscanf(name, "~%s#updates", nick))
n = nick;
string nick, channel;
if (isPlace && sscanf(name, "~%s#%s", nick, channel))
return (legal_name(nick) && legal_name(channel)) ? name : 0;
#endif
string chars = "\
abcdefghijklmnopqrstuvwxyz\
ABCDEFGHIJKLMNOPQRSTUVWXYZ\

View File

@ -655,6 +655,9 @@ sName2(a) {
if (v("locations")) linkCleanUp("_crash");
else vSet("locations", ([ ]));
#ifdef _flag_enable_module_microblogging
unless (v("channels")) vSet("channels", ([]));
#endif
// protection against file read errors
if (IS_NEWBIE) {
if (boss(a)) {
@ -2917,6 +2920,28 @@ static qFriends() {
return present[1..];
}
#ifdef _flag_enable_module_microblogging
qFriend(object snicker) {
P3((">> qFriend(%O)\n", snicker))
return member(friends, snicker);
}
qFollower(object snicker) {
P3((">> qFollower(%O)\n", snicker))
foreach (string c : v("channels")) {
object p = find_place(c);
P3((">>> c: %O, p: %O\n", c, p))
if (p && p->qMember(snicker)) return 1;
}
return 0;
}
sChannel(string channel) {
P3((">> sChannel(%O)\n", channel))
v("channels")[channel] = 1;
}
#endif
sPerson(person, ix, value) {
P2(("%O: sPerson(%O, %O, %O) bfor: %O\n", MYNICK, person, ix, value, ppl))
// TODO: we need some register_context / deregister_context here

View File

@ -2614,3 +2614,8 @@ qAide(snicker, aidesonly) {
qOwner(snicker) { return member(v("owners"), lower_case(snicker)); }
#endif
qMember(snicker) {
P3((">> qMember(%O) in _u: %O\n", snicker, _u))
return member(_u, snicker);
}

View File

@ -113,7 +113,7 @@ cmd(a, args, b, source, vars) {
case "blog":
case "submit":
case "addentry":
unless (qAide(SNICKER)) return;
unless (canPost(SNICKER)) return;
unless (sizeof(args) >= 1) {
sendmsg(source, "_warning_usage_submit",
"Usage: /submit <text>", ([ ]));
@ -123,7 +123,7 @@ cmd(a, args, b, source, vars) {
// TODO: append fuer multiline-sachen
#if 0
case "iterator":
unless (qAide(SNICKER)) return;
unless (canPost(SNICKER)) return;
sendmsg(source, "_notice_thread_iterator",
"[_iterator] blog entries have been requested "
"since creation.", ([
@ -135,7 +135,7 @@ cmd(a, args, b, source, vars) {
#endif
case "deblog":
case "delentry":
unless (qAide(SNICKER)) return;
unless (canPost(SNICKER)) return;
// ist das ein typecheck ob args ein int is?
if (sizeof(regexp( ({ args[1] }) , "^[0-9][0-9]*$"))) {
unless (delEntry(to_int(args[1]), source, vars)) {
@ -273,7 +273,8 @@ addComment(text, unick, entry_id) {
"_comment" : text,
"_nick" : unick,
]) );
return save();
save();
return 1;
}
return -1;
}
@ -288,7 +289,7 @@ delEntry(int number, source, vars) {
unless (size = sizeof(entries)) return 0;
if (number >= size) return 0;
if (qAide(unick = lower_case(SNICKER))) {
if (canPost(unick = lower_case(SNICKER))) {
unless (lower_case(entries[number]["author"]) == unick) return 0;
}
@ -349,7 +350,7 @@ htget(prot, query, headers, qs, data) {
// return 1;
}
#ifdef OWNED
if (qAide(nick)) {
if (canPost(nick)) {
#endif
#if 0
sendmsg(target, "_request_authentication", "please auth me!",
@ -628,3 +629,7 @@ displayHeader() {
displayFooter() {
w("_HTML_tail_threads", "</body></html>");
}
canPost(snicker) {
return qAide(snicker);
}

View File

@ -2,14 +2,64 @@
#include <person.h>
#include <status.h>
#define BLAME "!configuration"
#define DONT_REWRITE_NICKS
inherit NET_PATH "place/threads";
volatile mixed lastTry;
volatile string owner;
volatile string channel;
load(name, keep) {
P3((">> userthreads:load(%O, %O)\n", name, keep))
string nick;
P3((">> userthreads:load(%O, %O)\n", name, keep))
if (sscanf(name, "~%s#updates", nick))
vSet("owners", ([ nick: 0 ]));
sscanf(name, "~%s#%s", owner, channel);
vSet("owners", ([ owner: 0 ]));
return ::load(name, keep);
vSet("_restrict_invitation", BLAME);
vSet("_filter_conversation", BLAME);
return ::load(name, keep);
}
enter(source, mc, data, vars) {
P3((">> userthreads:enter(%O, %O, %O, %O)\n", source, mc, data, vars))
object p = summon_person(owner, NET_PATH "user");
string src = psyc_name(source);
unless (p && (p == source || qAide(src) || p->qFriend(source) || p->qFollower(source))) {
sendmsg(source, "_error_place_enter_necessary_invitation",
"[_nick_place] can only be entered upon invitation.",
([ "_nick_place" : qName() ]) );
if (source != lastTry) {
castmsg(ME, "_failure_place_enter_necessary_invitation",
"Admission into [_nick_place] denied for uninvited user [_nick].",
vars);
lastTry = source;
}
return 0;
}
if (p == source) {
p->sChannel(MYNICK);
}
return ::enter(source, mc, data, vars);
}
cmd(a, args, b, source, vars) {
P3((">> threads:cmd(%O, %O, %O, %O, %O)", a, args, b, source, vars))
switch (a) {
case "add": // or similar
// add follower to this channel, TODO
}
return ::cmd(a, args, b, source, vars);
}
canPost(snicker) {
return qOwner(snicker);
}

View File

@ -285,7 +285,7 @@ htDescription(anonymous, query, headers, qs, variant, vars) {
//
# ifdef _flag_enable_module_microblogging
object u = find_place("~" + nick + "#updates");
object u = find_place("~" + nick + "#follow"); //TODO
string updates = objectp(u) ? u->htMain(10) : "";
# endif
return psyctext(page, vars + ([
@ -927,11 +927,12 @@ case "_failure_network_connect_invalid_port":
// person.c was never asked for opinion, so i'm putting this into user.c
#if 0 //def ALPHA
string loc;
foreach (t, loc : v("locations")s)
foreach (t, loc : v("locations")) {
if (member(loc, vars["_source_relay"])) {
P1(("%O in %O talking to its %O location at %O.",
mc, ME, t, loc))
sLocation(t, 0);
}
}
#else
foreach (string type, mapping locs : v("locations")) {

View File

@ -2424,6 +2424,12 @@ friend(rm, entity, ni, trustee) {
// if (member(ppl, t)) switch(ppl[t][PPL_NOTIFY]) {
switch (member(ppl, t) ? ppl[t][PPL_NOTIFY] : PPL_NOTIFY_NONE) {
case PPL_NOTIFY_OFFERED:
sPerson(t, PPL_NOTIFY, PPL_NOTIFY_DEFAULT);
friends[entity, FRIEND_NICK] = ni || 1;
if (objectp(entity))
insert_member(entity);
else
insert_member(entity, parse_uniform(entity, 1)[URoot]);
// this used to imply a symmetric request for
// friendship, but we prefer to make it an
// informational message instead. the protocol
@ -2440,7 +2446,9 @@ friend(rm, entity, ni, trustee) {
// within psyc.. even jabber should
// normally auto-acknowledge this request
sendmsg(entity, "_request_friendship_implied",
0, ([ "_nick": MYNICK ]) );
0, ([ "_nick": MYNICK, "_degree_availability": availability ]) );
sendmsg(entity, "_request_status_person",
0, ([ "_nick": MYNICK ]) );
// did i just say something about symmetry?
#ifdef TRY_THIS
// currently friend() only gets called from
@ -2452,7 +2460,6 @@ friend(rm, entity, ni, trustee) {
// carrying _presence be enough? well, we
// don't have _presence yet
#endif
sPerson(t, PPL_NOTIFY, PPL_NOTIFY_DEFAULT);
return 1;
case PPL_NOTIFY_NONE:
sPerson(t, PPL_NOTIFY, PPL_NOTIFY_PENDING);