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

let the past begone in cvs land. welcome to igit igit!

This commit is contained in:
PSYC 2009-01-26 20:21:29 +01:00
commit 4e601cf1c7
509 changed files with 77963 additions and 0 deletions

78
world/net/applet/server.c Normal file
View file

@ -0,0 +1,78 @@
// $Id: server.c,v 1.14 2007/09/27 11:01:04 lynx Exp $ // vim:syntax=lpc
#include <net.h>
#include <person.h>
#include <server.h>
volatile array(string) legal_vars = ({
"password", "place", "agent", "layout", "language"
});
volatile mapping vars;
qScheme() { return "applet"; }
createUser(nick) {
return named_clone(APPLET_PATH "user", nick);
}
keepUserObject(user) {
// P1(("app: %O, %O\n",user, abbrev(APPLET_PATH "user", o2s(user))))
return abbrev(APPLET_PATH "user", o2s(user));
// return user->vQuery("scheme") == "applet";
}
// the following is new..
logon() {
vars = ([]);
return ::logon();
}
hello(in) {
string vnam, vval;
P2(("%O applet says: %O\n", ME, in))
if (sscanf(in, "=_%s%t%s", vnam, vval)) {
if (vval && strlen(vval)) {
// D2(D("applet says: '"+in+"'\n");)
if (vnam == "lang") vnam = "language";
if (index(legal_vars, vnam) != -1) { vars[vnam] = vval; }
}
next_input_to(#'hello);
return 1;
}
if (member(vars, "language"))
sTextPath(vars["layout"] || qLayout(), vars["language"], qScheme());
return ::hello(in);
}
promptForPassword() {
// don't impose room on registered users
vars = m_delete(vars, "place");
if (member(vars, "password")) return password(vars["password"]);
// pr("_query_password_person",
// "Please supply password for %s.\n", nick);
return ::promptForPassword();
}
morph() {
// don't overwrite password
vars = m_delete(vars, "password");
if (user) {
user -> vDel("agent"); // is this really useful?
if (vars) user -> vMerge(vars);
}
return ::morph();
}
pr(mc, fmt, a,b,c,d,e,f,g,h,i,j,k) {
if (mc) {
unless (fmt = T(mc, fmt)) return;
if (abbrev("_query", mc)) fmt = "|?"+ fmt;
}
printf(fmt, a,b,c,d,e,f,g,h,i,j,k);
return 1;
}

93
world/net/applet/user.c Normal file
View file

@ -0,0 +1,93 @@
// $Id: user.c,v 1.12 2007/09/22 09:35:56 lynx Exp $ // vim:syntax=lpc
#include <net.h>
#include <user.h>
input(a, dest) {
next_input_to(#'input);
return ::input(a, dest);
}
logon() {
vSet("scheme", "applet");
// vDel("layout");
next_input_to(#'input);
return ::logon();
}
msg(source, mc, data, mapping vars, showingLog) {
if (abbrev("_notice_place", mc)) {
// this ifdef is no longer necessary since /silence does the job
#ifndef EVENTS
// especially for the applet:
// generate the +/- messages for ppl joining/leaving
//
if (abbrev("_notice_place_leave", mc))
emit("|-"+ vars["_nick"] +"\n");
else if (abbrev("_notice_place_enter", mc))
emit("|+"+ vars["_nick"] +"\n");
// and don't generate the traditional blurb ?
//return;
#else
// if (!boss(ME)) return;
#endif
}
return ::msg(source, mc, data, vars, showingLog);
}
// print function using textdb and VECP-methods
pr(mc, fmt, a,b,c,d,e,f,g,h,i,j,k) {
P3(("pr(%O,%O,%O,%O,%O..)\n", mc, fmt, a,b,c))
if (mc) {
unless (fmt = T(mc, fmt)) return;
#ifndef EVENTS
if (abbrev("_echo_place_leave", mc)) {
clearRoom();
// warum eigentlich nur diese beiden?
if (abbrev("_echo_place_leave_navigate", mc) ||
abbrev("_echo_place_leave_teleport", mc)) return;
// weil sonst die logout-meldung den bach runtergeht
}
#endif
if (!(abbrev("_message", mc)
# ifdef PREFIXES
|| abbrev("_prefix", mc)
# endif
)) {
if (abbrev("_list", mc) || abbrev("_echo", mc))
fmt = "|* "+ fmt;
else {
if (abbrev("_query", mc))
fmt = "|?"+ fmt;
else
fmt = "|!"+ fmt; // errors and such
}
}
}
return emit(sprintf(fmt, a,b,c,d,e,f,g,h,i,j,k));
}
#ifndef EVENTS
showRoom() {
array(string) list;
int i;
unless (place) return 0;
list = place -> names();
p("|=%s\n", list ? implode(list, ", ") : "");
return 1;
}
clearRoom() {
// array(string) list;
// int i;
// unless (place) return 0;
// list = place -> names();
// for (i = sizeof(list)-1; i>=0; i--) emit("|-"+ list[i] +"\n");
write("|=\n");
return 1;
}
#endif