1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

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

@ -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);