From 8e4e990261434b22928c2989a1bd57733f784114 Mon Sep 17 00:00:00 2001 From: "psyc://psyced.org/~lynX" <@> Date: Wed, 4 Mar 2009 00:40:26 +0100 Subject: [PATCH] replace the local server nickspace by autoalias! --- CHANGESTODO | 58 ++++++++++----- pike/net.pmod/library.pmod/module.pmod | 2 +- pike/net.pmod/library.pmod/uniforms.pmod | 2 +- pike/net.pmod/psyc.pmod/circuit.pike | 2 +- world/drivers/ldmud/library/library.c | 2 +- world/net/d/psyc.c | 2 +- world/net/entity.c | 2 +- world/net/gateway/aim.c | 2 +- world/net/gateway/icq.c | 2 +- world/net/group/master.c | 2 +- world/net/group/slave.c | 2 +- world/net/http/edit.c | 2 +- world/net/http/fetch.c | 2 +- world/net/http/library.i | 2 +- world/net/http/xmlrpc.c | 2 +- world/net/include/net.h | 14 ++-- world/net/include/place.gen | 2 +- world/net/include/{url.h => uniform.h} | 5 +- world/net/irc/gatebot.c | 4 +- world/net/irc/user.c | 2 +- world/net/jabber/active.c | 2 +- world/net/jabber/common.c | 2 +- world/net/jabber/component.c | 2 +- world/net/jabber/gateway.c | 2 +- world/net/jabber/mixin_parse.c | 2 +- world/net/jabber/mixin_render.c | 2 +- world/net/jabber/server.c | 2 +- world/net/jabber/user.c | 4 +- world/net/library.i | 2 +- world/net/library/text.c | 89 +++++++++++++++++++++--- world/net/library/{url.c => uniform.c} | 11 +-- world/net/person.c | 2 +- world/net/place/archetype.gen | 2 +- world/net/place/master.c | 2 +- world/net/psyc/circuit.c | 2 +- world/net/psyc/common.c | 2 +- world/net/psyc/edit.i | 5 ++ world/net/psyc/parse.i | 2 + world/net/psyc/relay.c | 2 +- world/net/psyc/udp.c | 2 +- world/net/sip/udp.c | 4 +- world/net/spyc/circuit.c | 2 +- world/net/spyc/dispatch.i | 3 + world/net/spyc/udp.c | 2 +- world/net/user.c | 77 +++++++++++++++----- world/net/usercmd.i | 5 +- 46 files changed, 246 insertions(+), 101 deletions(-) rename world/net/include/{url.h => uniform.h} (86%) rename world/net/library/{url.c => uniform.c} (92%) diff --git a/CHANGESTODO b/CHANGESTODO index 2201658..e0c5138 100644 --- a/CHANGESTODO +++ b/CHANGESTODO @@ -1,4 +1,4 @@ -$Id: CHANGESTODO,v 1.1650 2008/12/30 12:35:00 lynx Exp $ vim:nosmarttab +vim:nosmarttab:syntax=diff ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ This file contains TODO and CHANGES (at EOF) rolled into one. Essentially: whenever you fix something, move that line to the end of file. @@ -7,6 +7,8 @@ ________________________________________________________________________ == NEXT RELEASE ======================================================== ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ? support tls multiplexing on all suitable ports + +- change UResource and UUser usage to the new UNick ________________________________________________________________________ == currently being inspected =========================================== ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ @@ -98,7 +100,7 @@ INVITE ISSUES - /invite should do remote echo like _message_private, not local REMOVE NICKNAMES FROM PROTOCOL -+ remote uniforms could be passed around in the psyced as parse_uniform +? remote uniforms could be passed around in the psyced as parse_uniform arrays rather than as strings. this opens up the possibility to have a stringprepped+lowercased version of the uniform for comparisons. also this could be used as a key in a general hash of known remote objects @@ -109,9 +111,28 @@ REMOVE NICKNAMES FROM PROTOCOL in fact - we already don't need to do that for strings either - thus if we want to introduce arrays instead of strings we must ensure we can compare them without an extra objectp() distinction. -+ this also allows us to REMOVE ALL _nick VARS and extract nick from uniforms -+ support addressing of uniform portions by psyctext entity syntax - (how does psyctext state support fit into that picture?) + hmm.. not sure about this idea, but we can move forward anyway: ++ REMOVE ALL _nick VARS and extract nick from uniforms + or rather, let raliases resolve all uniforms to nicknames (uni2nick) +? support addressing of uniform portions by psyctext entity syntax +? shouldn't it be display-side job to decide how a [_source] is to be shown - + nick/alias when a friend (or local?), full uniform when unknown... + so all [_nick] should simply be replaced by [_source] etc. +! implementing the latter approach with the uni2nick callback strategy! +AUTOALIASES & ALIASES FOR PLACES ++ /set aliases auto + use temporary aliases for people in places, + keep them in [r]aliases mappings only, not in v("aliases") + copy them over only when the user decides to have private conversation + see also http://about.psyc.eu/nickspace +? can we even afford to have a setting to *disable* this behaviour? ++ aliases for places + we have had requests for a way to shorten or at least maintain (bookmark) + addresses of remote rooms. i wonder if we should go ahead and code it in + the next obvious way (polluting the output of the /alias command even more) + or we should look at presence/subscribe integration first (where the + distinction of users and rooms becomes less relevant). +! whenever a _context is output, its nick will be auto-added to raliases PRESENCE STATUS + all _status_person need to be upgraded to _status_presence with @@ -518,6 +539,7 @@ PROGRAMMABLE USER IDENTIFICATIONS & MULTIPLE CLIENT INTERFACES (and saga has been asking for years) .. read also 'person.gen' below - this would probably also solve the issue with the ~nick object name plan + and it allows for multiple jabber resources, of course + (but it means we need to actively support UNRs for UNLs) ? one day we could have a person.gen to create all sorts of user objects from, but it sure is confusing that each of them still needs to be able to call upon the various protocols.. this may either need a @@ -622,19 +644,6 @@ TYPE CHECKING AT PARSING TIME and fix the obvious candidates.. if a method is non-standard (we will be aware of this by 1.0) we should check each var mentioned in the body. -AUTOALIASES & ALIASES FOR PLACES -+ /set aliases auto - use temporary aliases for people in places, - keep them in [r]aliases mappings only, not in v("aliases") - copy them over only when the user decides to have private conversation - see also http://about.psyc.eu/nickspace -+ aliases for places - we have had requests for a way to shorten or at least maintain (bookmark) - addresses of remote rooms. i wonder if we should go ahead and code it in - the next obvious way (polluting the output of the /alias command even more) - or we should look at presence/subscribe integration first (where the - distinction of users and rooms becomes less relevant). see below: - PSYC protokoll verbessern, dass implementationen einfach sein können: + die lookup_identification queue in place/basic ist vermutlich nicht notwendig, da (a) clients den zutritt zu einem raum von ihrer UNI @@ -3853,4 +3862,17 @@ sockets psyconf + generate bin/psyced with -u, -d and -m flags using git + merged archetype.pl into here, which improves sandbox security +uniform ++ added pragmatic UNick field +user ++ uni2nick(uniform) returns a user's idea of a uniforms nickname. + with USE_AUTOALIAS it even allocates nicknames automatically. + and it actively disregards the old notion of local server nickspace. +- #ifdef USE_THE_NICK disables portions of code dedicated to handling + the local server nickspace, for a future that doesn't need that. +psyctext ++ let previous_object()->uni2nick(uniform) choose the way to display + entity nicknames (experimental). allows to remove nicks from protocol. +spyc/* psyc/* ++ should a _date type run on unixtime minus PSYC_EPOCH? diff --git a/pike/net.pmod/library.pmod/module.pmod b/pike/net.pmod/library.pmod/module.pmod index 9848b4f..101136f 100644 --- a/pike/net.pmod/library.pmod/module.pmod +++ b/pike/net.pmod/library.pmod/module.pmod @@ -1,5 +1,5 @@ #include -#include +#include #include // more elegant way to do it diff --git a/pike/net.pmod/library.pmod/uniforms.pmod b/pike/net.pmod/library.pmod/uniforms.pmod index 8d5dbe7..f73e42a 100644 --- a/pike/net.pmod/library.pmod/uniforms.pmod +++ b/pike/net.pmod/library.pmod/uniforms.pmod @@ -1 +1 @@ -#include "../../../world/net/library/url.c" +#include "../../../world/net/library/uniform.c" diff --git a/pike/net.pmod/psyc.pmod/circuit.pike b/pike/net.pmod/psyc.pmod/circuit.pike index c942a3b..6112c9b 100644 --- a/pike/net.pmod/psyc.pmod/circuit.pike +++ b/pike/net.pmod/psyc.pmod/circuit.pike @@ -2,7 +2,7 @@ Stdio.File s; function inputto; #include -#include +#include import net.library.uniforms; import net.library; diff --git a/world/drivers/ldmud/library/library.c b/world/drivers/ldmud/library/library.c index 9385f4e..e892706 100644 --- a/world/drivers/ldmud/library/library.c +++ b/world/drivers/ldmud/library/library.c @@ -33,7 +33,7 @@ inherit NET_PATH "library/tls"; # endif inherit NET_PATH "library/text"; inherit NET_PATH "library/time"; -inherit NET_PATH "library/url"; +inherit NET_PATH "library/uniform"; #endif #endif //PIKE diff --git a/world/net/d/psyc.c b/world/net/d/psyc.c index e6fec5a..b74845d 100644 --- a/world/net/d/psyc.c +++ b/world/net/d/psyc.c @@ -5,7 +5,7 @@ #ifdef FORK // {{{ #include -#include +#include #include inherit NET_PATH "state"; diff --git a/world/net/entity.c b/world/net/entity.c index 8fb8530..4561fd7 100644 --- a/world/net/entity.c +++ b/world/net/entity.c @@ -20,7 +20,7 @@ #include #include -#include +#include #ifdef ENTITY_STATE //{{{ # define HEADER_ONLY diff --git a/world/net/gateway/aim.c b/world/net/gateway/aim.c index 42d1a68..fe33dd7 100644 --- a/world/net/gateway/aim.c +++ b/world/net/gateway/aim.c @@ -12,7 +12,7 @@ // necessity to recover. // #include -#include +#include //#include inherit NET_PATH "gateway/generic"; diff --git a/world/net/gateway/icq.c b/world/net/gateway/icq.c index c03c29f..6596838 100644 --- a/world/net/gateway/icq.c +++ b/world/net/gateway/icq.c @@ -19,7 +19,7 @@ // gateway in python (see aim.c) // #include -#include +#include //#include #include diff --git a/world/net/group/master.c b/world/net/group/master.c index 9bc9d65..10121f7 100644 --- a/world/net/group/master.c +++ b/world/net/group/master.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #ifdef CONTEXT_STATE // {{{ # define HEADER_ONLY diff --git a/world/net/group/slave.c b/world/net/group/slave.c index e397ad0..d5a86d0 100644 --- a/world/net/group/slave.c +++ b/world/net/group/slave.c @@ -18,7 +18,7 @@ #ifdef PERSISTENT_SLAVES # define PARANOID_PERSISTENT_SLAVES -# include +# include inherit NET_PATH "storage"; private volatile string _file; diff --git a/world/net/http/edit.c b/world/net/http/edit.c index a4dfc1a..ef78f2a 100644 --- a/world/net/http/edit.c +++ b/world/net/http/edit.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include #define NO_INHERIT #include diff --git a/world/net/http/fetch.c b/world/net/http/fetch.c index 794d0d0..5800b77 100644 --- a/world/net/http/fetch.c +++ b/world/net/http/fetch.c @@ -6,7 +6,7 @@ // #include #include -#include +#include #include virtual inherit NET_PATH "output"; // virtual: in case we get inherited.. diff --git a/world/net/http/library.i b/world/net/http/library.i index 01d85a5..195b295 100644 --- a/world/net/http/library.i +++ b/world/net/http/library.i @@ -17,7 +17,7 @@ # define HTTP_PORT 44444 // should return null instead? #endif -// not worthy of summoning url.h for this one.. +// not worthy of summoning uniform.h for this one.. string htuniform(object server, string prot, mapping headers) { // it is really totally crazy to trust what the browser says string host = headers["host"]; diff --git a/world/net/http/xmlrpc.c b/world/net/http/xmlrpc.c index ac50aa3..75c8a67 100644 --- a/world/net/http/xmlrpc.c +++ b/world/net/http/xmlrpc.c @@ -8,7 +8,7 @@ // #include #include -#include +#include #include #include diff --git a/world/net/include/net.h b/world/net/include/net.h index 171e847..589bcb2 100644 --- a/world/net/include/net.h +++ b/world/net/include/net.h @@ -11,13 +11,11 @@ #define RANDHEXSTRING sprintf("%x", random(__INT_MAX__)) -// maybe we should expect psyc usage peak around 2030? -// or will psyc reform its protocol by then anyway? -// ok.. let's go for 2009 so we can renovate time formats -// around 2020.. by the way, 2009-02-14 is a saturday, so -// we'll be having a hot friday night party for psyc epoch! -// -#define PSYC_EPOCH 1234567890 // 2009-02-14 00:31:30 CET +// maybe we should expect psyc usage peak around 2030 +//efine PSYC_EPOCH 1234567890 // 2009-02-14 00:31:30 CET +#define PSYC_EPOCH 1440444041 // 2015-08-24 21:20:41 CET (Monday) + // 2000000000 is 2033-05-18 05:33:20 CET (Wednesday) + // 2002002002 is 2033-06-10 09:40:02 CET (Friday) // TODO: new driver will be able to combine \n, too // new expat parser will also be able to combine > @@ -230,6 +228,7 @@ #endif #ifdef EXPERIMENTAL +# define USE_AUTOALIAS // fippo's brilliant single-user channel emulation for jabber MUCs // unfortunately it provides no advantages over the old method, yet. // would be cool to cache a member list at least! TODO @@ -243,6 +242,7 @@ //# ifndef __PIKE__ //# define USE_LIVING //# endif +# define USE_THE_NICK #endif #ifdef __NO_SRV__ // since psyclpc 4.0.4 diff --git a/world/net/include/place.gen b/world/net/include/place.gen index 63a61e8..373ed3d 100644 --- a/world/net/include/place.gen +++ b/world/net/include/place.gen @@ -16,7 +16,7 @@ #include #include #include -#include +#include #ifdef BRAIN diff --git a/world/net/include/url.h b/world/net/include/uniform.h similarity index 86% rename from world/net/include/url.h rename to world/net/include/uniform.h index 5444a67..ad706f0 100644 --- a/world/net/include/url.h +++ b/world/net/include/uniform.h @@ -19,9 +19,10 @@ #define UHostPort 12 // just host:port (and transport) #define URoot 13 // root UNI of peer/server #define USlashes 14 // the // if the protocol has them -//efine UCircuit 15 // scheme:host:port +#define UNick 15 // whatever works as a nickname +//efine UCircuit 16 // scheme:host:port // (not provided by parse_uniform) -#define USize 15 +#define USize 16 #define UName(uniform) (uniform[UUser] || uniform[UResource][1 ..]) #endif diff --git a/world/net/irc/gatebot.c b/world/net/irc/gatebot.c index 3626543..3cd2126 100644 --- a/world/net/irc/gatebot.c +++ b/world/net/irc/gatebot.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include "error.h" // gets numeric codes #include "reply.h" // gets numeric codes @@ -219,7 +219,7 @@ advertise(source) { //static send(source, text) { render(mc, data, vars, source) { -//# include +//# include // mixed *u = parse_uniform(psyc_name(source)); // unless (mappingp(u) && u[UHost]) { // P1(("failed\n")) diff --git a/world/net/irc/user.c b/world/net/irc/user.c index 4bbc7b8..c9fa4d9 100644 --- a/world/net/irc/user.c +++ b/world/net/irc/user.c @@ -14,7 +14,7 @@ inherit IRC_PATH "decode"; #include "reply.h" #include "person.h" #include "psyc.h" -#include "url.h" +#include "uniform.h" #include "hack.i" diff --git a/world/net/jabber/active.c b/world/net/jabber/active.c index ec8b5da..0d3dea2 100644 --- a/world/net/jabber/active.c +++ b/world/net/jabber/active.c @@ -4,7 +4,7 @@ #define NO_INHERIT #include "jabber.h" #undef NO_INHERIT -#include +#include #ifdef ERQ_WITHOUT_SRV # define hostname host // hostname contains the name before SRV resolution diff --git a/world/net/jabber/common.c b/world/net/jabber/common.c index b026d67..3b1f047 100644 --- a/world/net/jabber/common.c +++ b/world/net/jabber/common.c @@ -6,7 +6,7 @@ #include #include //virtual inherit NET_PATH "output"; -#include +#include #ifdef __psyclpc__ # if __VERSION_MICRO__ > 4 diff --git a/world/net/jabber/component.c b/world/net/jabber/component.c index 39effa8..4398808 100644 --- a/world/net/jabber/component.c +++ b/world/net/jabber/component.c @@ -4,7 +4,7 @@ #define NO_INHERIT #include "jabber.h" #undef NO_INHERIT -#include +#include inherit NET_PATH "xml/common"; diff --git a/world/net/jabber/gateway.c b/world/net/jabber/gateway.c index 173c888..41e50f6 100644 --- a/world/net/jabber/gateway.c +++ b/world/net/jabber/gateway.c @@ -7,7 +7,7 @@ #define NO_INHERIT #include "jabber.h" // inherits net/jabber/common #undef NO_INHERIT -#include "url.h" +#include "uniform.h" #include "services.h" #define NO_INHERIT diff --git a/world/net/jabber/mixin_parse.c b/world/net/jabber/mixin_parse.c index d7653ba..e90560f 100644 --- a/world/net/jabber/mixin_parse.c +++ b/world/net/jabber/mixin_parse.c @@ -1,6 +1,6 @@ #include "jabber.h" #include // vim:set syntax=lpc -#include +#include #include "presence.h" #include diff --git a/world/net/jabber/mixin_render.c b/world/net/jabber/mixin_render.c index 0051dc9..b7d8818 100644 --- a/world/net/jabber/mixin_render.c +++ b/world/net/jabber/mixin_render.c @@ -1,6 +1,6 @@ #include "jabber.h" #include -#include +#include // just renderMembers #include NET_PATH "members.i" diff --git a/world/net/jabber/server.c b/world/net/jabber/server.c index 6f88c28..6e33333 100644 --- a/world/net/jabber/server.c +++ b/world/net/jabber/server.c @@ -3,7 +3,7 @@ #include "server.h" // inherits net/server #include "person.h" // find_person -#include "url.h" +#include "uniform.h" #include volatile string authtag; diff --git a/world/net/jabber/user.c b/world/net/jabber/user.c index 2e5e510..ecfcf8a 100644 --- a/world/net/jabber/user.c +++ b/world/net/jabber/user.c @@ -2,7 +2,7 @@ #include "jabber.h" #include "user.h" #include "person.h" -#include +#include #include // important to #include user.h first @@ -33,7 +33,7 @@ qHasCurrentPlace() { return 0; } void create() { jabber2avail = shared_memory("jabber2avail"); - return ::create(); + ::create(); } /* it should be posible to do some things in a way that can be shared between diff --git a/world/net/library.i b/world/net/library.i index 902dc5e..e311a5e 100644 --- a/world/net/library.i +++ b/world/net/library.i @@ -4,7 +4,7 @@ #include #include #include -#include +#include #ifdef _uniform_node # define myUNL _uniform_node diff --git a/world/net/library/text.c b/world/net/library/text.c index 53450ea..fad1337 100644 --- a/world/net/library/text.c +++ b/world/net/library/text.c @@ -9,7 +9,13 @@ // linked to the driver. see also CHANGESTODO for thoughts on how to do a // generic template replacement C function in a way that it does psyctext() // effectively, but can also be used for other syntaxes. -// + +// local debug messages - turn them on by using psyclpc -DDpsyctext= +#ifdef Dpsyctext +# undef DEBUG +# define DEBUG Dpsyctext +#endif + #include #include @@ -17,7 +23,11 @@ varargs string psyctext(string s, mapping m, vastring data, vamixed source, vastring nick) { string r, p, q, v; - P3(("psyctext(%O)\n", s)) +#if DEBUG > 2 + P3(("psyctext(%O, .., %O, %O, %O) %O\n", s, data, source, nick, m)) +#else + P2(("psyctext(%O, .., %O, %O, %O)\n", s, data, source, nick)) +#endif unless(s) return ""; if (s == "") { if (data) s = data; @@ -31,12 +41,70 @@ varargs string psyctext(string s, mapping m, vastring data, unless (mappingp(m)) return s; #endif r=""; - while (sscanf(s, "%s[%s]%s", p, v, s) && v) { - if (v == "_nick") r += p + (nick || m["_nick"]); - else if (v == "_data") r += p + (data || ""); - else unless (member(m, v)) { - if (v == "_source") r += p + UNIFORM(source); - else { + while (sscanf(s, "%s[%s]%s", p, v, s) && v) switch(v) { + case "_data": + r += p + (data || ""); + break; + case "_nick": +#ifdef USE_THE_NICK + r += p + (nick || m["_nick"] || "?"); +#else + // _nick can mean _source_relay instead of physical source + // and in some dirty cases we do not even provide _source_relay + q = m["_source_relay"] || m["_source"]; + unless (q) { + // so we are forced to use the _nick from the message + q = m["_nick"] || nick; + if (q) { + r += p + q; + break; + } + // no _nick? okay, then it has to be this one + q = UNIFORM(source) || "?"; + } + if (previous_object()) q = previous_object()->uni2nick(q) || q; + r += p + q; +#endif + break; + case "_source": + // should this support _source_relay? var inheritance! +#ifdef USE_THE_NICK + r += p + (nick || m["_nick"] || m["_source"] || UNIFORM(source) || "?"); +#else + q = m["_source"] || UNIFORM(source) || "?"; + if (previous_object()) q = previous_object()->uni2nick(q) || q; + r += p + q; +#endif + break; + case "_source_relay": +#ifdef USE_THE_NICK + r += p + (nick || m["_nick"] || m["_source_relay"] || "?"); +#else + q = m["_source_relay"] || "?"; + if (previous_object()) q = previous_object()->uni2nick(q) || q; + r += p + q; +#endif + break; + case "_target": +#ifdef USE_THE_NICK + r += p + (m["_nick_target"] || m["_target"] || "?"); +#else + q = m["_target"] || "?"; + if (previous_object()) q = previous_object()->uni2nick(q) || q; + r += p + q; +#endif + break; + case "_context": +#ifdef USE_THE_NICK + r += p + (m["_nick_place"] || m["_context"] || "?"); +#else + q = m["_context"] || "?"; + if (previous_object()) q = previous_object()->uni2nick(q) || q; + r += p + q; +#endif + break; + default: + unless (member(m, v)) { #ifdef _flag_debug_unresolved_psyctext raise_error(v +" unresolved in psyctext format\n"); #else @@ -44,7 +112,6 @@ varargs string psyctext(string s, mapping m, vastring data, data, previous_object())) #endif r += p + "["+v+"]"; // pretend we havent seen it - } } else if (stringp(m[v])) r += p + m[v]; else if (pointerp(m[v])) { // used by showMembers @@ -54,7 +121,7 @@ varargs string psyctext(string s, mapping m, vastring data, else if (intp(m[v])) { // used by /lu and /edit if (v == "_time_idle") r += p + timedelta(m[v]); - else if (abbrev("_time", v)) + else if (abbrev("_time", v)) // should be _date r += p + time_or_date(m[v]); else r += p + to_string(m[v]); @@ -76,6 +143,7 @@ varargs string psyctext(string s, mapping m, vastring data, } } if (s != "") r += s; + P4(("\t-> %s\n", r)) return r; } @@ -89,7 +157,6 @@ varargs string psyctext(string s, mapping m, vastring data, // evil!! -lynX // varargs void w(string mc, string data, mixed vars) { - // oh my god seit wann gibt's denn das!? raise_error(sprintf("%O ended up in library/text:w(%s) for %O\n", previous_object(), mc, this_interactive())); } diff --git a/world/net/library/url.c b/world/net/library/uniform.c similarity index 92% rename from world/net/library/url.c rename to world/net/library/uniform.c index d44aa82..58b0c6b 100644 --- a/world/net/library/url.c +++ b/world/net/library/uniform.c @@ -1,4 +1,4 @@ -// $Id: url.c,v 1.43 2008/03/29 20:36:43 lynx Exp $ // vim:syntax=lpc +// $Id: uniform.c,v 1.43 2008/03/29 20:36:43 lynx Exp $ // vim:syntax=lpc // // URLs.. URIs.. UNLs.. UNIs.. maybe even URNs.. // the fact they wear a uniform is the only thing these items have in common @@ -7,10 +7,10 @@ // common format.. the uniform :) // // TODO: first move everything called _uniform or url somewhere into here -// then rename everything into uniform, also url.c and url.h.. +// then rename everything into uniform, also uniform.c and uniform.h.. #include -#include +#include string legal_url(string url, string scheme) { if (scheme &&! abbrev(scheme+":", url)) return 0; @@ -21,7 +21,7 @@ string legal_url(string url, string scheme) { } /** pass it a URL string and it will find out if that string - ** is a uniform, and if so return an array as defined in url.h + ** is a uniform, and if so return an array as defined in uniform.h ** ** what about using ** http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#regexp ? @@ -90,6 +90,9 @@ varargs array(mixed) parse_uniform(string url, vaint tolerant) { } u[UHost] = t; P4(("parse_uniform %s = %O (tolerant: %O)\n", url, u, tolerant)) + u[UNick] = u[UUser] + || (strlen(u[UResource]) && u[UResource][1 ..]) + || u[UBody]; return u; } diff --git a/world/net/person.c b/world/net/person.c index 2f18ed0..3c9446f 100644 --- a/world/net/person.c +++ b/world/net/person.c @@ -41,7 +41,7 @@ #include #include #include -#include +#include #if __EFUN_DEFINED__(tls_query_connection_info) # include diff --git a/world/net/place/archetype.gen b/world/net/place/archetype.gen index b9bba37..d745fd6 100644 --- a/world/net/place/archetype.gen +++ b/world/net/place/archetype.gen @@ -125,7 +125,7 @@ #include #include #include -#include +#include #include #ifdef BETA diff --git a/world/net/place/master.c b/world/net/place/master.c index 705799a..9311bde 100644 --- a/world/net/place/master.c +++ b/world/net/place/master.c @@ -13,7 +13,7 @@ #include #include #ifdef WE_PROBABLY_DONT_NEED_THIS -# include +# include #endif virtual inherit NET_PATH "place/storic"; diff --git a/world/net/psyc/circuit.c b/world/net/psyc/circuit.c index 25af511..a16b2d1 100644 --- a/world/net/psyc/circuit.c +++ b/world/net/psyc/circuit.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include diff --git a/world/net/psyc/common.c b/world/net/psyc/common.c index 508d731..9cecc5d 100644 --- a/world/net/psyc/common.c +++ b/world/net/psyc/common.c @@ -5,7 +5,7 @@ #include "common.h" #include -#include +#include #include #ifdef __MCCP__ diff --git a/world/net/psyc/edit.i b/world/net/psyc/edit.i index a36203b..3c7af56 100644 --- a/world/net/psyc/edit.i +++ b/world/net/psyc/edit.i @@ -73,7 +73,12 @@ static int build_header(string key, mixed val, mapping vars) { #endif } } else if (intp(val)) { +#ifdef SPYC + klopp = abbrev("_date", key) ? to_string(val - PSYC_EPOCH) + : to_string(val); +#else klopp = to_string(val); +#endif } else { mixed k,d, sep; diff --git a/world/net/psyc/parse.i b/world/net/psyc/parse.i index ceb65e4..70f2032 100644 --- a/world/net/psyc/parse.i +++ b/world/net/psyc/parse.i @@ -322,6 +322,8 @@ vamixed parse(string a) { // intermediate hack in lack of real type support // which needs to be done in net/spyc if (abbrev("_time", vname)) vvalue = to_int(vvalue); +// unused as yet: else if (abbrev("_date", vname)) +// vvalue = PSYC_EPOCH + to_int(vvalue); #endif cvars[lastvar = vname] = vvalue; #ifdef SYSTEM_SECRET diff --git a/world/net/psyc/relay.c b/world/net/psyc/relay.c index ab1ce21..e32bfd6 100644 --- a/world/net/psyc/relay.c +++ b/world/net/psyc/relay.c @@ -7,7 +7,7 @@ // einen generischen relay für allerlei zwecke. #include -#include +#include //#include //inherit NET_PATH "gateway/generic"; diff --git a/world/net/psyc/udp.c b/world/net/psyc/udp.c index 1323fcf..9ba6f1e 100644 --- a/world/net/psyc/udp.c +++ b/world/net/psyc/udp.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include // SECURITY CONCERN: diff --git a/world/net/sip/udp.c b/world/net/sip/udp.c index 9b88a25..d53d044 100644 --- a/world/net/sip/udp.c +++ b/world/net/sip/udp.c @@ -4,7 +4,7 @@ * this is currently broken and I dont have the time to fix it */ #include -#include +#include #include #include @@ -30,7 +30,7 @@ * */ #include -#include +#include #include #include "sip.h" diff --git a/world/net/spyc/circuit.c b/world/net/spyc/circuit.c index de149d0..1c80fd3 100644 --- a/world/net/spyc/circuit.c +++ b/world/net/spyc/circuit.c @@ -3,7 +3,7 @@ #include "psyc.h" #include -#include +#include #include #include diff --git a/world/net/spyc/dispatch.i b/world/net/spyc/dispatch.i index 2e996ad..b36737b 100644 --- a/world/net/spyc/dispatch.i +++ b/world/net/spyc/dispatch.i @@ -81,6 +81,9 @@ void dispatch(mixed header_vars, mixed varops, mixed method, mixed body) { vop[2] = 0; } break; + case "_date": + vop[2] = to_int(vop[2]) + PSYC_EPOCH; + break; case "_time": case "_amount": vop[2] = to_int(vop[2]); diff --git a/world/net/spyc/udp.c b/world/net/spyc/udp.c index 50f1132..1a86bd2 100644 --- a/world/net/spyc/udp.c +++ b/world/net/spyc/udp.c @@ -3,7 +3,7 @@ #include "psyc.h" #include -#include +#include #include inherit NET_PATH "spyc/parse"; diff --git a/world/net/user.c b/world/net/user.c index 95aeaf4..41e4c55 100644 --- a/world/net/user.c +++ b/world/net/user.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include inherit NET_PATH "person"; inherit NET_PATH "common"; @@ -29,6 +29,48 @@ volatile mapping tags; volatile int showEcho; volatile mixed beQuiet; +// my nickspace. used by psyctext(). could be passed as closure, but then +// it wouldn't be available for *any* psyctext call in user objects. +uni2nick(n) { + PT(("uni2nick(%O) in %O\n", n, ME)) +#ifdef USE_AUTOALIAS + string ln = lower_case(n); + string al = raliases[ln]; + if (al) return al; + if (member(raliases, ln)) return n; // marked dead + mixed u = parse_uniform(n); + al = lower_case(u[UNick]); + if (aliases[al]) { + raliases[ln] = 0; // mark dead + PT(("uni2nick: already belongs to %O\n", aliases[al])) + w("_failure_unavailable_alias", +"No alias for [_uniform_new]: [_nick_old] already belongs to [_uniform_old].", + ([ "_uniform_new": n, + "_uniform_old": aliases[al], + "_nick_old": al ]) ); + return n; + } + aliases[al] = n; + raliases[ln] = al = u[UNick]; + PT(("uni2nick: autoaliased %O to %O\n", n, al)) + w("_notice_add_alias_automatic", + "[_uniform_entity] is known as [_nick_entity].", + ([ "_uniform_entity": n, + "_nick_entity": al ]) ); + return al; +#else + // this enables local nickspace, but it fails on local uniforms, + // it fails when local nick collides with alias, so either you make + // it super complicated here, or you keep it super stupid. + //if (objectp(n)) return n->qName(); +# ifdef ALIASES + return raliases[lower_case(n)] || n; +# else + return n; +# endif +#endif +} + // jabber needs no private echo but plenty of public echo.. // net/jabber takes care of that, we just give it echo here. // in psyc echoes are essential, so they are on. @@ -371,12 +413,10 @@ msg(source, mc, data, mapping vars, showingLog) { ) { if (data && index(data, '\n') != -1) data = replace(data, "\n", " "); - // this used to trigger a systemwide _request_authentication - //t = lookup_identification(source, vars["_source_identification"]); - // now uni::msg does these kind of things +#ifdef USE_THE_NICK if (t != source) { if (objectp(source)) { -#ifdef ALIASES +# ifdef ALIASES string t2; if (t2 = raliases[nick = source->qNameLower()]) { @@ -384,22 +424,22 @@ msg(source, mc, data, mapping vars, showingLog) { } else if (aliases[lower_case(nick)]) { nick = t; } -#else +# else nick = source->qName(); -#endif +# endif } else { -#ifdef ALIASES +# ifdef ALIASES nick = raliases[source] || source; -#else +# else nick = source; -#endif +# endif } -#ifndef TRUST_PSYC_HACK -# ifdef ALIASES +# ifndef TRUST_PSYC_HACK +# ifdef ALIASES } else if (raliases[source]) { nick = raliases[source]; -# endif +# endif } else { // short term solution (nick manager to follow) //if (nick) nick = "("+ source + ") "+ nick; @@ -428,7 +468,7 @@ msg(source, mc, data, mapping vars, showingLog) { "_nick":vars["_nick_verbatim"] ])); } else nick = stringp(source) ? source : to_string(source); -# if 0 //DEBUG > 1 +# if 0 //DEBUG > 1 // checking for validity of messages should // happen at psyc-parsing level.. maybe? YEEEES!! // and.. vars["_context"] is zero when showing log! @@ -440,17 +480,19 @@ msg(source, mc, data, mapping vars, showingLog) { } // this just wont work.. it even breaks // remote _message_echo_private's +# endif # endif -#endif } nick2 = nick; +#endif // USE_THE_NICK // belongs into person.c? if (mc == "_message") mc = vars["_context"] ? "_message_public" : "_message_private"; P3(("%O got msg(%O,%O,%O,%O)\n", ME,source,mc,data,vars)) } +#ifdef USE_THE_NICK else if (nick && nick != MYNICK) { -#ifdef ALIASES +# ifdef ALIASES string tn; // ein kleines bisschen hilflosigkeit (&&! showingLog) // @@ -464,10 +506,11 @@ msg(source, mc, data, mapping vars, showingLog) { } else if (aliases[tn] &&! showingLog) { nick2 = nick = UNIFORM(source); } else -#endif +# endif nick2 = vars["_nick_stylish"] || vars["_nick_local"] || nick; } else nick2 = nick = MYNICK; P3(("q/n/n2: %O,%O,%O\n", MYNICK,nick,nick2)) +#endif // USE_THE_NICK t = vars && vars["_context"] || source; #ifdef SANDBOX diff --git a/world/net/usercmd.i b/world/net/usercmd.i index 31b2995..616ee64 100644 --- a/world/net/usercmd.i +++ b/world/net/usercmd.i @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include @@ -2422,8 +2422,7 @@ friend(rm, entity, ni, trustee) { // nick, not the one the user typed in. t = ([ "_nick": MYNICK ]); if (trustee) t["_trustee"] = trustee; - sendmsg(entity, "_request_friendship", - "[_nick] kindly asks for your friendship.", t); + sendmsg(entity, "_request_friendship", 0, t); return 1; } # endif // _flag_disable_module_friendship