1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00
psyced/world/net/place/userthreads.c
Gabor Adam Toth 424bc2bf70 user channel improvements
- allow arbitrary user channels to be subscribed, e.g. #follow or #friends, /sub ~user defaults to #follow
- friends & /invite'd strangers are allowed to join
2010-02-20 23:22:52 +01:00

65 lines
1.5 KiB
C

#include <net.h>
#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))
sscanf(name, "~%s#%s", owner, channel);
vSet("owners", ([ owner: 0 ]));
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);
}