replace the local server nickspace by autoalias!

This commit is contained in:
psyc://psyced.org/~lynX 2009-03-04 00:40:26 +01:00
parent a4e16cd2c4
commit 8e4e990261
46 changed files with 246 additions and 101 deletions

View File

@ -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. This file contains TODO and CHANGES (at EOF) rolled into one.
Essentially: whenever you fix something, move that line to the end of file. Essentially: whenever you fix something, move that line to the end of file.
@ -7,6 +7,8 @@ ________________________________________________________________________
== NEXT RELEASE ======================================================== == NEXT RELEASE ========================================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
? support tls multiplexing on all suitable ports ? support tls multiplexing on all suitable ports
- change UResource and UUser usage to the new UNick
________________________________________________________________________ ________________________________________________________________________
== currently being inspected =========================================== == currently being inspected ===========================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@ -98,7 +100,7 @@ INVITE ISSUES
- /invite should do remote echo like _message_private, not local - /invite should do remote echo like _message_private, not local
REMOVE NICKNAMES FROM PROTOCOL 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 arrays rather than as strings. this opens up the possibility to have
a stringprepped+lowercased version of the uniform for comparisons. 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 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 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 if we want to introduce arrays instead of strings we must ensure we can
compare them without an extra objectp() distinction. compare them without an extra objectp() distinction.
+ this also allows us to REMOVE ALL _nick VARS and extract nick from uniforms hmm.. not sure about this idea, but we can move forward anyway:
+ support addressing of uniform portions by psyctext entity syntax + REMOVE ALL _nick VARS and extract nick from uniforms
(how does psyctext state support fit into that picture?) 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 PRESENCE STATUS
+ all _status_person need to be upgraded to _status_presence with + 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 (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 - this would probably also solve the issue with the ~nick object name plan
+ and it allows for multiple jabber resources, of course + 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 ? 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 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 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 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. 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: PSYC protokoll verbessern, dass implementationen einfach sein können:
+ die lookup_identification queue in place/basic ist vermutlich nicht + die lookup_identification queue in place/basic ist vermutlich nicht
notwendig, da (a) clients den zutritt zu einem raum von ihrer UNI notwendig, da (a) clients den zutritt zu einem raum von ihrer UNI
@ -3853,4 +3862,17 @@ sockets
psyconf psyconf
+ generate bin/psyced with -u, -d and -m flags using git + generate bin/psyced with -u, -d and -m flags using git
+ merged archetype.pl into here, which improves sandbox security + 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?

View File

@ -1,5 +1,5 @@
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
#include <sandbox.h> #include <sandbox.h>
// more elegant way to do it // more elegant way to do it

View File

@ -1 +1 @@
#include "../../../world/net/library/url.c" #include "../../../world/net/library/uniform.c"

View File

@ -2,7 +2,7 @@ Stdio.File s;
function inputto; function inputto;
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
import net.library.uniforms; import net.library.uniforms;
import net.library; import net.library;

View File

@ -33,7 +33,7 @@ inherit NET_PATH "library/tls";
# endif # endif
inherit NET_PATH "library/text"; inherit NET_PATH "library/text";
inherit NET_PATH "library/time"; inherit NET_PATH "library/time";
inherit NET_PATH "library/url"; inherit NET_PATH "library/uniform";
#endif #endif
#endif //PIKE #endif //PIKE

View File

@ -5,7 +5,7 @@
#ifdef FORK // {{{ #ifdef FORK // {{{
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
#include <services.h> #include <services.h>
inherit NET_PATH "state"; inherit NET_PATH "state";

View File

@ -20,7 +20,7 @@
#include <net.h> #include <net.h>
#include <storage.h> #include <storage.h>
#include <url.h> #include <uniform.h>
#ifdef ENTITY_STATE //{{{ #ifdef ENTITY_STATE //{{{
# define HEADER_ONLY # define HEADER_ONLY

View File

@ -12,7 +12,7 @@
// necessity to recover. // necessity to recover.
// //
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
//#include <text.h> //#include <text.h>
inherit NET_PATH "gateway/generic"; inherit NET_PATH "gateway/generic";

View File

@ -19,7 +19,7 @@
// gateway in python (see aim.c) // gateway in python (see aim.c)
// //
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
//#include <text.h> //#include <text.h>
#include <xml.h> #include <xml.h>

View File

@ -28,7 +28,7 @@
#include <net.h> #include <net.h>
#include <person.h> #include <person.h>
#include <status.h> #include <status.h>
#include <url.h> #include <uniform.h>
#ifdef CONTEXT_STATE // {{{ #ifdef CONTEXT_STATE // {{{
# define HEADER_ONLY # define HEADER_ONLY

View File

@ -18,7 +18,7 @@
#ifdef PERSISTENT_SLAVES #ifdef PERSISTENT_SLAVES
# define PARANOID_PERSISTENT_SLAVES # define PARANOID_PERSISTENT_SLAVES
# include <url.h> # include <uniform.h>
inherit NET_PATH "storage"; inherit NET_PATH "storage";
private volatile string _file; private volatile string _file;

View File

@ -4,7 +4,7 @@
#include <net.h> #include <net.h>
#include <text.h> #include <text.h>
#include <person.h> #include <person.h>
#include <url.h> #include <uniform.h>
#define NO_INHERIT #define NO_INHERIT
#include <user.h> #include <user.h>

View File

@ -6,7 +6,7 @@
// //
#include <ht/http.h> #include <ht/http.h>
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
#include <services.h> #include <services.h>
virtual inherit NET_PATH "output"; // virtual: in case we get inherited.. virtual inherit NET_PATH "output"; // virtual: in case we get inherited..

View File

@ -17,7 +17,7 @@
# define HTTP_PORT 44444 // should return null instead? # define HTTP_PORT 44444 // should return null instead?
#endif #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) { string htuniform(object server, string prot, mapping headers) {
// it is really totally crazy to trust what the browser says // it is really totally crazy to trust what the browser says
string host = headers["host"]; string host = headers["host"];

View File

@ -8,7 +8,7 @@
// //
#include <ht/http.h> #include <ht/http.h>
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
#include <xml.h> #include <xml.h>
#include <lpctypes.h> #include <lpctypes.h>

View File

@ -11,13 +11,11 @@
#define RANDHEXSTRING sprintf("%x", random(__INT_MAX__)) #define RANDHEXSTRING sprintf("%x", random(__INT_MAX__))
// maybe we should expect psyc usage peak around 2030? // maybe we should expect psyc usage peak around 2030
// or will psyc reform its protocol by then anyway? //efine PSYC_EPOCH 1234567890 // 2009-02-14 00:31:30 CET
// ok.. let's go for 2009 so we can renovate time formats #define PSYC_EPOCH 1440444041 // 2015-08-24 21:20:41 CET (Monday)
// around 2020.. by the way, 2009-02-14 is a saturday, so // 2000000000 is 2033-05-18 05:33:20 CET (Wednesday)
// we'll be having a hot friday night party for psyc epoch! // 2002002002 is 2033-06-10 09:40:02 CET (Friday)
//
#define PSYC_EPOCH 1234567890 // 2009-02-14 00:31:30 CET
// TODO: new driver will be able to combine \n, too // TODO: new driver will be able to combine \n, too
// new expat parser will also be able to combine > // new expat parser will also be able to combine >
@ -230,6 +228,7 @@
#endif #endif
#ifdef EXPERIMENTAL #ifdef EXPERIMENTAL
# define USE_AUTOALIAS
// fippo's brilliant single-user channel emulation for jabber MUCs // fippo's brilliant single-user channel emulation for jabber MUCs
// unfortunately it provides no advantages over the old method, yet. // unfortunately it provides no advantages over the old method, yet.
// would be cool to cache a member list at least! TODO // would be cool to cache a member list at least! TODO
@ -243,6 +242,7 @@
//# ifndef __PIKE__ //# ifndef __PIKE__
//# define USE_LIVING //# define USE_LIVING
//# endif //# endif
# define USE_THE_NICK
#endif #endif
#ifdef __NO_SRV__ // since psyclpc 4.0.4 #ifdef __NO_SRV__ // since psyclpc 4.0.4

View File

@ -16,7 +16,7 @@
#include <net.h> #include <net.h>
#include <storage.h> #include <storage.h>
#include <status.h> #include <status.h>
#include <url.h> #include <uniform.h>
#ifdef BRAIN #ifdef BRAIN

View File

@ -19,9 +19,10 @@
#define UHostPort 12 // just host:port (and transport) #define UHostPort 12 // just host:port (and transport)
#define URoot 13 // root UNI of peer/server #define URoot 13 // root UNI of peer/server
#define USlashes 14 // the // if the protocol has them #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) // (not provided by parse_uniform)
#define USize 15 #define USize 16
#define UName(uniform) (uniform[UUser] || uniform[UResource][1 ..]) #define UName(uniform) (uniform[UUser] || uniform[UResource][1 ..])
#endif #endif

View File

@ -37,7 +37,7 @@
#include <status.h> #include <status.h>
#include <services.h> #include <services.h>
#include <text.h> #include <text.h>
#include <url.h> #include <uniform.h>
#include "error.h" // gets numeric codes #include "error.h" // gets numeric codes
#include "reply.h" // gets numeric codes #include "reply.h" // gets numeric codes
@ -219,7 +219,7 @@ advertise(source) {
//static send(source, text) { //static send(source, text) {
render(mc, data, vars, source) { render(mc, data, vars, source) {
//# include <url.h> //# include <uniform.h>
// mixed *u = parse_uniform(psyc_name(source)); // mixed *u = parse_uniform(psyc_name(source));
// unless (mappingp(u) && u[UHost]) { // unless (mappingp(u) && u[UHost]) {
// P1(("failed\n")) // P1(("failed\n"))

View File

@ -14,7 +14,7 @@ inherit IRC_PATH "decode";
#include "reply.h" #include "reply.h"
#include "person.h" #include "person.h"
#include "psyc.h" #include "psyc.h"
#include "url.h" #include "uniform.h"
#include "hack.i" #include "hack.i"

View File

@ -4,7 +4,7 @@
#define NO_INHERIT #define NO_INHERIT
#include "jabber.h" #include "jabber.h"
#undef NO_INHERIT #undef NO_INHERIT
#include <url.h> #include <uniform.h>
#ifdef ERQ_WITHOUT_SRV #ifdef ERQ_WITHOUT_SRV
# define hostname host // hostname contains the name before SRV resolution # define hostname host // hostname contains the name before SRV resolution

View File

@ -6,7 +6,7 @@
#include <net.h> #include <net.h>
#include <text.h> #include <text.h>
//virtual inherit NET_PATH "output"; //virtual inherit NET_PATH "output";
#include <url.h> #include <uniform.h>
#ifdef __psyclpc__ #ifdef __psyclpc__
# if __VERSION_MICRO__ > 4 # if __VERSION_MICRO__ > 4

View File

@ -4,7 +4,7 @@
#define NO_INHERIT #define NO_INHERIT
#include "jabber.h" #include "jabber.h"
#undef NO_INHERIT #undef NO_INHERIT
#include <url.h> #include <uniform.h>
inherit NET_PATH "xml/common"; inherit NET_PATH "xml/common";

View File

@ -7,7 +7,7 @@
#define NO_INHERIT #define NO_INHERIT
#include "jabber.h" // inherits net/jabber/common #include "jabber.h" // inherits net/jabber/common
#undef NO_INHERIT #undef NO_INHERIT
#include "url.h" #include "uniform.h"
#include "services.h" #include "services.h"
#define NO_INHERIT #define NO_INHERIT

View File

@ -1,6 +1,6 @@
#include "jabber.h" #include "jabber.h"
#include <net.h> // vim:set syntax=lpc #include <net.h> // vim:set syntax=lpc
#include <url.h> #include <uniform.h>
#include "presence.h" #include "presence.h"
#include <time.h> #include <time.h>

View File

@ -1,6 +1,6 @@
#include "jabber.h" #include "jabber.h"
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
// just renderMembers // just renderMembers
#include NET_PATH "members.i" #include NET_PATH "members.i"

View File

@ -3,7 +3,7 @@
#include "server.h" // inherits net/server #include "server.h" // inherits net/server
#include "person.h" // find_person #include "person.h" // find_person
#include "url.h" #include "uniform.h"
#include <sys/tls.h> #include <sys/tls.h>
volatile string authtag; volatile string authtag;

View File

@ -2,7 +2,7 @@
#include "jabber.h" #include "jabber.h"
#include "user.h" #include "user.h"
#include "person.h" #include "person.h"
#include <url.h> #include <uniform.h>
#include <peers.h> #include <peers.h>
// important to #include user.h first // important to #include user.h first
@ -33,7 +33,7 @@ qHasCurrentPlace() { return 0; }
void create() { void create() {
jabber2avail = shared_memory("jabber2avail"); jabber2avail = shared_memory("jabber2avail");
return ::create(); ::create();
} }
/* it should be posible to do some things in a way that can be shared between /* it should be posible to do some things in a way that can be shared between

View File

@ -4,7 +4,7 @@
#include <net.h> #include <net.h>
#include <services.h> #include <services.h>
#include <person.h> #include <person.h>
#include <url.h> #include <uniform.h>
#ifdef _uniform_node #ifdef _uniform_node
# define myUNL _uniform_node # define myUNL _uniform_node

View File

@ -9,7 +9,13 @@
// linked to the driver. see also CHANGESTODO for thoughts on how to do a // 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() // generic template replacement C function in a way that it does psyctext()
// effectively, but can also be used for other syntaxes. // effectively, but can also be used for other syntaxes.
//
// local debug messages - turn them on by using psyclpc -DDpsyctext=<level>
#ifdef Dpsyctext
# undef DEBUG
# define DEBUG Dpsyctext
#endif
#include <net.h> #include <net.h>
#include <proto.h> #include <proto.h>
@ -17,7 +23,11 @@ varargs string psyctext(string s, mapping m, vastring data,
vamixed source, vastring nick) { vamixed source, vastring nick) {
string r, p, q, v; 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 ""; unless(s) return "";
if (s == "") { if (s == "") {
if (data) s = data; if (data) s = data;
@ -31,12 +41,70 @@ varargs string psyctext(string s, mapping m, vastring data,
unless (mappingp(m)) return s; unless (mappingp(m)) return s;
#endif #endif
r=""; r="";
while (sscanf(s, "%s[%s]%s", p, v, s) && v) { while (sscanf(s, "%s[%s]%s", p, v, s) && v) switch(v) {
if (v == "_nick") r += p + (nick || m["_nick"]); case "_data":
else if (v == "_data") r += p + (data || ""); r += p + (data || "");
else unless (member(m, v)) { break;
if (v == "_source") r += p + UNIFORM(source); case "_nick":
else { #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 #ifdef _flag_debug_unresolved_psyctext
raise_error(v +" unresolved in psyctext format\n"); raise_error(v +" unresolved in psyctext format\n");
#else #else
@ -45,7 +113,6 @@ varargs string psyctext(string s, mapping m, vastring data,
#endif #endif
r += p + "["+v+"]"; // pretend we havent seen it r += p + "["+v+"]"; // pretend we havent seen it
} }
}
else if (stringp(m[v])) r += p + m[v]; else if (stringp(m[v])) r += p + m[v];
else if (pointerp(m[v])) { // used by showMembers else if (pointerp(m[v])) { // used by showMembers
r += p + implode(m[v], ", "); r += p + implode(m[v], ", ");
@ -54,7 +121,7 @@ varargs string psyctext(string s, mapping m, vastring data,
else if (intp(m[v])) { // used by /lu and /edit else if (intp(m[v])) { // used by /lu and /edit
if (v == "_time_idle") if (v == "_time_idle")
r += p + timedelta(m[v]); 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]); r += p + time_or_date(m[v]);
else else
r += p + to_string(m[v]); r += p + to_string(m[v]);
@ -76,6 +143,7 @@ varargs string psyctext(string s, mapping m, vastring data,
} }
} }
if (s != "") r += s; if (s != "") r += s;
P4(("\t-> %s\n", r))
return r; return r;
} }
@ -89,7 +157,6 @@ varargs string psyctext(string s, mapping m, vastring data,
// evil!! -lynX // evil!! -lynX
// //
varargs void w(string mc, string data, mixed vars) { 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", raise_error(sprintf("%O ended up in library/text:w(%s) for %O\n",
previous_object(), mc, this_interactive())); previous_object(), mc, this_interactive()));
} }

View File

@ -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.. // URLs.. URIs.. UNLs.. UNIs.. maybe even URNs..
// the fact they wear a uniform is the only thing these items have in common // the fact they wear a uniform is the only thing these items have in common
@ -7,10 +7,10 @@
// common format.. the uniform :) // common format.. the uniform :)
// //
// TODO: first move everything called _uniform or url somewhere into here // 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 <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
string legal_url(string url, string scheme) { string legal_url(string url, string scheme) {
if (scheme &&! abbrev(scheme+":", url)) return 0; 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 /** 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
** **
** <fippo> what about using ** <fippo> what about using
** http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#regexp ? ** 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; u[UHost] = t;
P4(("parse_uniform %s = %O (tolerant: %O)\n", url, u, tolerant)) 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; return u;
} }

View File

@ -41,7 +41,7 @@
#include <person.h> #include <person.h>
#include <psyc.h> #include <psyc.h>
#include <storage.h> #include <storage.h>
#include <url.h> #include <uniform.h>
#if __EFUN_DEFINED__(tls_query_connection_info) #if __EFUN_DEFINED__(tls_query_connection_info)
# include <sys/tls.h> # include <sys/tls.h>

View File

@ -125,7 +125,7 @@
#include <net.h> #include <net.h>
#include <person.h> #include <person.h>
#include <status.h> #include <status.h>
#include <url.h> #include <uniform.h>
#include <driver.h> #include <driver.h>
#ifdef BETA #ifdef BETA

View File

@ -13,7 +13,7 @@
#include <status.h> #include <status.h>
#include <driver.h> #include <driver.h>
#ifdef WE_PROBABLY_DONT_NEED_THIS #ifdef WE_PROBABLY_DONT_NEED_THIS
# include <url.h> # include <uniform.h>
#endif #endif
virtual inherit NET_PATH "place/storic"; virtual inherit NET_PATH "place/storic";

View File

@ -16,7 +16,7 @@
#include <services.h> #include <services.h>
#include <person.h> #include <person.h>
#include <driver.h> #include <driver.h>
#include <url.h> #include <uniform.h>
#include <text.h> #include <text.h>
#include <psyc.h> #include <psyc.h>

View File

@ -5,7 +5,7 @@
#include "common.h" #include "common.h"
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
#include <psyc.h> #include <psyc.h>
#ifdef __MCCP__ #ifdef __MCCP__

View File

@ -73,7 +73,12 @@ static int build_header(string key, mixed val, mapping vars) {
#endif #endif
} }
} else if (intp(val)) { } else if (intp(val)) {
#ifdef SPYC
klopp = abbrev("_date", key) ? to_string(val - PSYC_EPOCH)
: to_string(val);
#else
klopp = to_string(val); klopp = to_string(val);
#endif
} else { } else {
mixed k,d, sep; mixed k,d, sep;

View File

@ -322,6 +322,8 @@ vamixed parse(string a) {
// intermediate hack in lack of real type support // intermediate hack in lack of real type support
// which needs to be done in net/spyc // which needs to be done in net/spyc
if (abbrev("_time", vname)) vvalue = to_int(vvalue); if (abbrev("_time", vname)) vvalue = to_int(vvalue);
// unused as yet: else if (abbrev("_date", vname))
// vvalue = PSYC_EPOCH + to_int(vvalue);
#endif #endif
cvars[lastvar = vname] = vvalue; cvars[lastvar = vname] = vvalue;
#ifdef SYSTEM_SECRET #ifdef SYSTEM_SECRET

View File

@ -7,7 +7,7 @@
// einen generischen relay für allerlei zwecke. // einen generischen relay für allerlei zwecke.
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
//#include <text.h> //#include <text.h>
//inherit NET_PATH "gateway/generic"; //inherit NET_PATH "gateway/generic";

View File

@ -5,7 +5,7 @@
#include <net.h> #include <net.h>
#include <person.h> #include <person.h>
#include <services.h> #include <services.h>
#include <url.h> #include <uniform.h>
#include <psyc.h> #include <psyc.h>
// SECURITY CONCERN: // SECURITY CONCERN:

View File

@ -4,7 +4,7 @@
* this is currently broken and I dont have the time to fix it * this is currently broken and I dont have the time to fix it
*/ */
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
#include <person.h> #include <person.h>
#include <dns.h> #include <dns.h>
@ -30,7 +30,7 @@
* *
*/ */
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
#include <person.h> #include <person.h>
#include "sip.h" #include "sip.h"

View File

@ -3,7 +3,7 @@
#include "psyc.h" #include "psyc.h"
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
#include <tls.h> #include <tls.h>
#include <text.h> #include <text.h>

View File

@ -81,6 +81,9 @@ void dispatch(mixed header_vars, mixed varops, mixed method, mixed body) {
vop[2] = 0; vop[2] = 0;
} }
break; break;
case "_date":
vop[2] = to_int(vop[2]) + PSYC_EPOCH;
break;
case "_time": case "_time":
case "_amount": case "_amount":
vop[2] = to_int(vop[2]); vop[2] = to_int(vop[2]);

View File

@ -3,7 +3,7 @@
#include "psyc.h" #include "psyc.h"
#include <net.h> #include <net.h>
#include <url.h> #include <uniform.h>
#include <text.h> #include <text.h>
inherit NET_PATH "spyc/parse"; inherit NET_PATH "spyc/parse";

View File

@ -11,7 +11,7 @@
#include <net.h> #include <net.h>
#include <person.h> #include <person.h>
#include <psyc.h> #include <psyc.h>
#include <url.h> #include <uniform.h>
inherit NET_PATH "person"; inherit NET_PATH "person";
inherit NET_PATH "common"; inherit NET_PATH "common";
@ -29,6 +29,48 @@ volatile mapping tags;
volatile int showEcho; volatile int showEcho;
volatile mixed beQuiet; 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.. // jabber needs no private echo but plenty of public echo..
// net/jabber takes care of that, we just give it echo here. // net/jabber takes care of that, we just give it echo here.
// in psyc echoes are essential, so they are on. // in psyc echoes are essential, so they are on.
@ -371,9 +413,7 @@ msg(source, mc, data, mapping vars, showingLog) {
) { ) {
if (data && index(data, '\n') != -1) if (data && index(data, '\n') != -1)
data = replace(data, "\n", " "); data = replace(data, "\n", " ");
// this used to trigger a systemwide _request_authentication #ifdef USE_THE_NICK
//t = lookup_identification(source, vars["_source_identification"]);
// now uni::msg does these kind of things
if (t != source) { if (t != source) {
if (objectp(source)) { if (objectp(source)) {
# ifdef ALIASES # ifdef ALIASES
@ -444,11 +484,13 @@ msg(source, mc, data, mapping vars, showingLog) {
# endif # endif
} }
nick2 = nick; nick2 = nick;
#endif // USE_THE_NICK
// belongs into person.c? // belongs into person.c?
if (mc == "_message") mc = vars["_context"] ? if (mc == "_message") mc = vars["_context"] ?
"_message_public" : "_message_private"; "_message_public" : "_message_private";
P3(("%O got msg(%O,%O,%O,%O)\n", ME,source,mc,data,vars)) P3(("%O got msg(%O,%O,%O,%O)\n", ME,source,mc,data,vars))
} }
#ifdef USE_THE_NICK
else if (nick && nick != MYNICK) { else if (nick && nick != MYNICK) {
# ifdef ALIASES # ifdef ALIASES
string tn; string tn;
@ -468,6 +510,7 @@ msg(source, mc, data, mapping vars, showingLog) {
nick2 = vars["_nick_stylish"] || vars["_nick_local"] || nick; nick2 = vars["_nick_stylish"] || vars["_nick_local"] || nick;
} else nick2 = nick = MYNICK; } else nick2 = nick = MYNICK;
P3(("q/n/n2: %O,%O,%O\n", MYNICK,nick,nick2)) P3(("q/n/n2: %O,%O,%O\n", MYNICK,nick,nick2))
#endif // USE_THE_NICK
t = vars && vars["_context"] || source; t = vars && vars["_context"] || source;
#ifdef SANDBOX #ifdef SANDBOX

View File

@ -40,7 +40,7 @@
#include <closures.h> #include <closures.h>
#include <driver.h> #include <driver.h>
#include <misc.h> #include <misc.h>
#include <url.h> #include <uniform.h>
#include <services.h> #include <services.h>
#include <status.h> #include <status.h>
@ -2422,8 +2422,7 @@ friend(rm, entity, ni, trustee) {
// nick, not the one the user typed in. // nick, not the one the user typed in.
t = ([ "_nick": MYNICK ]); t = ([ "_nick": MYNICK ]);
if (trustee) t["_trustee"] = trustee; if (trustee) t["_trustee"] = trustee;
sendmsg(entity, "_request_friendship", sendmsg(entity, "_request_friendship", 0, t);
"[_nick] kindly asks for your friendship.", t);
return 1; return 1;
} }
# endif // _flag_disable_module_friendship # endif // _flag_disable_module_friendship