From a602585399f1eff08bee160477292a4e29dfd29d Mon Sep 17 00:00:00 2001 From: "psyc://psyced.org/~lynX" <@> Date: Sat, 7 Mar 2009 10:30:44 +0100 Subject: [PATCH] upgrade gammas --- CHANGESTODO | 3 ++ world/net/http/header.i | 2 +- world/net/http/login.c | 2 +- world/net/irc/common.c | 3 -- world/net/irc/user.c | 6 ---- world/net/jabber/component.c | 2 +- world/net/jabber/gateway.c | 2 -- world/net/jabber/mixin_parse.c | 6 ---- world/net/jabber/server.c | 2 -- world/net/library.i | 6 ---- world/net/library/jsonparser.pike | 37 ------------------------- world/net/output.c | 19 ------------- world/net/person.c | 2 -- world/net/place/archetype.gen | 2 -- world/net/psyc/circuit.c | 6 ++-- world/net/psyc/common.c | 2 -- world/net/psyc/parse.i | 24 ++-------------- world/net/psyc/udp.c | 2 +- world/net/user.c | 46 ++++++------------------------- world/net/usercmd.i | 2 +- 20 files changed, 20 insertions(+), 156 deletions(-) diff --git a/CHANGESTODO b/CHANGESTODO index 6c95da1..5931efc 100644 --- a/CHANGESTODO +++ b/CHANGESTODO @@ -314,6 +314,9 @@ ________________________________________________________________________ but they should, everywhere except for irc maybe - tg reports: the nick shows up like net/irc/user/#foo in IRC ++ add a _time_sent whenever messages are queued for later delivery, like + when there is no circuit yet. + + install.sh sollte lieber mit bereits ausgepackten tars operieren können damit man darin tweaken kann und install nochmal anwerfen kann ... geht bei psyclpc, aber nicht beim psyced diff --git a/world/net/http/header.i b/world/net/http/header.i index 8f989a6..a047f6c 100644 --- a/world/net/http/header.i +++ b/world/net/http/header.i @@ -22,7 +22,7 @@ varargs http_error(string prot, int code, string comment, string html) { // apparently there isn't a single app that calls this with "html" P2(("hterror(%O,%O,%O,%O) in %O\n", prot,code,comment,html, ME)) -#if defined(GAMMA) && defined(T) +#if defined(T) // use the textdb if available out = psyctext( T("_PAGES_error", "[_code]\n" diff --git a/world/net/http/login.c b/world/net/http/login.c index 581c2fc..6f2e817 100644 --- a/world/net/http/login.c +++ b/world/net/http/login.c @@ -16,7 +16,7 @@ htget(prot, query, headers, qs) { } else { PT(("replacing cookie %O\n", headers["cookie"])) htok3(prot, 0, "Set-Cookie: psyced=\""+ qs +"\";\n"); -#ifdef GAMMA +#if 1 // login was supposed to something more than just /surf // but until this is the case, why lose time? return NET_PATH "http/examine"->htget(0, query, headers, qs); diff --git a/world/net/irc/common.c b/world/net/irc/common.c index 852db55..85b0f5c 100644 --- a/world/net/irc/common.c +++ b/world/net/irc/common.c @@ -163,9 +163,6 @@ render(string mc, string data, mapping vars, mixed source) { // this goes thru ->v() if (t && v("timestamp") != "off" // && abbrev("_message", mc) && stringp(data)) { -# ifndef GAMMA - if (stringp(t)) t = to_int(t); // we need types ;) -# endif if (v("timestamp") == "on") { string msa = " "; msa[0] = 0x01; // msa's CTCP character diff --git a/world/net/irc/user.c b/world/net/irc/user.c index 7d925b2..d922ebe 100644 --- a/world/net/irc/user.c +++ b/world/net/irc/user.c @@ -745,10 +745,6 @@ autojoin() { string s; if (isService) return -1; -# ifndef GAMMA - unless (v("place")) - vSet("place", T("_MISC_defplace", DEFPLACE)); -# endif // subscriptions are stored in lowercase, warum auch immer if (sizeof(v("subscriptions"))) foreach (s in v("subscriptions")) { @@ -762,10 +758,8 @@ autojoin() { , // _automatic_subscription 0, 0, ([ "_amount_history" : _limit_amount_history_place_default ])); } else { -# ifdef GAMMA unless (v("place")) vSet("place", T("_MISC_defplace", DEFPLACE)); -# endif # ifndef _flag_disable_place_default // call_out(#'placeRequest, delay++, v("place"), ... placeRequest(v("place"), diff --git a/world/net/jabber/component.c b/world/net/jabber/component.c index 4398808..2dbe8ab 100644 --- a/world/net/jabber/component.c +++ b/world/net/jabber/component.c @@ -119,7 +119,7 @@ int msg(string source, string mc, string data, #else unless(vars["_language"]) vars["_language"] = "en"; #endif -#ifndef GAMMA // TODO: decide if this is good or bad +#if 0 else if (abbrev("_status_person_absent", mc)) { PT(("Intercepted absent from %O to %O\n", mc, source, ME)) return 1; diff --git a/world/net/jabber/gateway.c b/world/net/jabber/gateway.c index 41e50f6..7cc3565 100644 --- a/world/net/jabber/gateway.c +++ b/world/net/jabber/gateway.c @@ -56,12 +56,10 @@ quit() { disconnected(remainder) { // TODO: handle remainder P2(( "gateway %O disconnected\n", ME )) -#ifdef GAMMA // sometimes we get complete presence packets in the socket close // remainder. probably broken xmpp implementations, let's try and // do the best we can with it by forwarding stuff to feed(). if (remainder && strlen(remainder)) feed(remainder); -#endif if (objectp(active)) active -> removeGateway(streamid); #ifdef _flag_log_sockets_XMPP log_file("RAW_XMPP", "\n%O disc\t%O", ME, ctime()); diff --git a/world/net/jabber/mixin_parse.c b/world/net/jabber/mixin_parse.c index e90560f..f868613 100644 --- a/world/net/jabber/mixin_parse.c +++ b/world/net/jabber/mixin_parse.c @@ -298,7 +298,6 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) { } else { // no relaying allowed, so we ignore hostname o = summon_person(tu[UUser]); -#ifdef GAMMA // xep 0085 typing notices - we even split active into a separate message // for now. could be sent as a flag if ((node[t="/composing"] || node[t="/active"] || @@ -307,7 +306,6 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) { // ... sendmsg(o, "_notice_typing_" + t[1..], 0, vars); } -#endif // there are some messages which dont have a body // we dont care about those unless (node["/body"]) return; @@ -384,9 +382,6 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) { // so there wont be circular error messages if (tu[UUser]) { o = summon_person(tu[UUser]); -#ifndef GAMMA - if (o && o->execute_callback(node["@id"], ({ vars["_INTERNAL_identification"], vars, node }))) return 1; -#else // the following should catch errors - in theory, requires testing if (o) { int cb_ret; @@ -401,7 +396,6 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) { return 1; } } -#endif } if (tu[UResource]) { // innerxml diff --git a/world/net/jabber/server.c b/world/net/jabber/server.c index 6e33333..26c4028 100644 --- a/world/net/jabber/server.c +++ b/world/net/jabber/server.c @@ -115,14 +115,12 @@ userLogon() { return ::userLogon(); } -#ifdef GAMMA authChecked(result, varargs array(mixed) args) { // a point where we could be sending our jabber:iq:auth reply // instead of letting _notice_login do that PT(("%O got authChecked %O, %O\n", ME, result, args)) return ::authChecked(result, args...); } -#endif jabberMsg(XMLNode node) { XMLNode helper; diff --git a/world/net/library.i b/world/net/library.i index e311a5e..d04dcce 100644 --- a/world/net/library.i +++ b/world/net/library.i @@ -1087,12 +1087,6 @@ varargs int sendmsg(mixed target, string mc, mixed data, mapping vars, #endif unless (source) source = previous_object(); -#ifndef GAMMA - // entity.c doesn't allow vars to be missing so we might - // just aswell enforce it in the whole psyced source that - // vars always need to be given as mapping. TODO - unless (mappingp(vars)) vars = ([]); -#endif // target = lower_case(target) ist fuer xmpp nicht // gut, weil der resource-teil dort case-sensitive // ist... der node@domain-Part aber nicht diff --git a/world/net/library/jsonparser.pike b/world/net/library/jsonparser.pike index 704c21e..0cd2b75 100644 --- a/world/net/library/jsonparser.pike +++ b/world/net/library/jsonparser.pike @@ -107,34 +107,6 @@ PROTECTED void back() { myIndex -= 1; } -#ifndef GAMMA -// funny.. we already have two better ways to do hex2int than this: -// -/// -/// Get the hex value of a character (base16). -/// -/// -/// A character between '0' and '9' or between 'A' and 'F' or -/// between 'a' and 'f'. -/// -/// An int between 0 and 15, or -1 if c was not a hex digit. -PROTECTED int dehexchar(int c) { - if (c >= '0' && c <= '9') - { - return c - '0'; - } - if (c >= 'A' && c <= 'F') - { - return c + 10 - 'A'; - } - if (c >= 'a' && c <= 'f') - { - return c + 10 - 'a'; - } - return -1; -} -#endif - /// /// Determine if the source string still contains characters that next() can consume. /// @@ -335,17 +307,8 @@ PROTECTED varargs string unescape(string s) if (c == '+') { c = ' '; } else if (c == '%' && (i + 2 < len)) { -#ifndef GAMMA - int d = dehexchar(s[i+1]); - int e = dehexchar(s[i+2]); - if (d >= 0 && e >= 0) { - c = (d*16 + e); - i += 2; - } -#else i += 2; c = hex2int(s[i-1 .. i]); -#endif } sb+=int2char(c); } diff --git a/world/net/output.c b/world/net/output.c index 750e870..c95d9c7 100644 --- a/world/net/output.c +++ b/world/net/output.c @@ -58,25 +58,6 @@ int emit(string message) { // right now no purpose in classic psyc server printStyle(mc) { return ([]); } -#ifndef GAMMA -// p() is for "unimportant" output -// -// each user.c should override this method with its own variant -// if special formatting (html, irc protocol..) is appropriate -// otherwise this will output "unformatted" text, and should be -// called as such -// -// does anything use this anymore? TODO -string p(string fmt, string a,string b,string c,string d,string e,string f, - string g,string h,string i,string j,string k) { - string message; - PT(("p(%O,%O,%O,%O..)\n", fmt, a,b,c)) - message = sprintf(fmt, a,b,c,d,e,f,g,h,i,j,k); - emit(message); - return message; -} -#endif - #ifdef LPC3 // hm, this could move away TODO telnet_negotiation(int cmd, int option, array(int) optargs) { diff --git a/world/net/person.c b/world/net/person.c index 4efd882..87ac0ca 100644 --- a/world/net/person.c +++ b/world/net/person.c @@ -1772,9 +1772,7 @@ PT(("_failure_filter_strangers to %O from %O\n", source, ME)) t = objectp(source) ? ((vars && vars["_nick"]) || "(?)") : (source || psource); -#ifdef GAMMA if (t == v("reply")) break; -#endif vSet("reply", t); // generation of "away" message in irc-speak #ifndef _flag_enable_unauthenticated_message_private diff --git a/world/net/place/archetype.gen b/world/net/place/archetype.gen index ccc2c80..81aa3c1 100644 --- a/world/net/place/archetype.gen +++ b/world/net/place/archetype.gen @@ -665,7 +665,6 @@ castPresence(source, mc, data, vars, filterpresence) { // actually insert the new member into our data structures // (happens after all checks have passed) insert_member(source, mc, data, vars, ni, neu, again) { -#ifdef GAMMA unless (ni) { P0(("insert_member w/out nick for %O in %O.\n", source, ME)) // try to make the ugly three trailing parameters optional @@ -673,7 +672,6 @@ insert_member(source, mc, data, vars, ni, neu, again) { neu = !MEMBER(source); // don't output the status again again = 0; } -#endif #ifdef PLACE_MASQUERADE if (vars["_nick_local"]) snames[source] = vars["_nick_local"]; #endif diff --git a/world/net/psyc/circuit.c b/world/net/psyc/circuit.c index a16b2d1..23f9c28 100644 --- a/world/net/psyc/circuit.c +++ b/world/net/psyc/circuit.c @@ -246,7 +246,6 @@ int logon(int neverfails) { } #ifdef __TLS__ -# ifdef GAMMA sAuthHosts(([ ])); // reset authhosts if (tls_available() && tls_query_connection_state(ME) == 1 && mappingp(cert = tls_certificate(ME, 0))) { if (cert[0] != 0) { @@ -268,7 +267,7 @@ int logon(int neverfails) { else foreach(t : m) sAuthenticated(NAMEPREP(t)); } //#ifdef _flag_allow_certificate_name_common // to be switched this year -#ifndef _flag_disallow_certificate_name_common +# ifndef _flag_disallow_certificate_name_common // assume that CN is a host // as this is an assumption only, we may NEVER register_target it // note: CN is deprecated for good reasons. @@ -276,7 +275,7 @@ int logon(int neverfails) { P1(("%O believing CN %O\n", ME, t)) sAuthenticated(NAMEPREP(t)); } -#endif +# endif if (m = tls_query_connection_info(ME)) { P2(("%O is using the %O cipher.\n", ME, m[TLS_CIPHER])) // shouldn't our negotiation have ensured we have PFS? @@ -292,7 +291,6 @@ int logon(int neverfails) { } } } -# endif #endif cvars = ([]); diff --git a/world/net/psyc/common.c b/world/net/psyc/common.c index 9cecc5d..512e089 100644 --- a/world/net/psyc/common.c +++ b/world/net/psyc/common.c @@ -131,7 +131,6 @@ varargs int rootMsg(mixed source, string mc, string data, } #endif break; -#ifdef GAMMA case "_notice_authentication": P0(("rootMsg got a _notice_authentication. never happens since entity.c\n")) register_location(vars["_location"], source, 1); @@ -139,7 +138,6 @@ varargs int rootMsg(mixed source, string mc, string data, case "_error_invalid_authentication": monitor_report(mc, psyctext("Breach: [_source] reports invalid authentication provided by [_location]", vars, data, source)); break; -#endif #if 0 case "_request_session_compression": case "_request_session_compress": diff --git a/world/net/psyc/parse.i b/world/net/psyc/parse.i index 2040724..631b0e8 100644 --- a/world/net/psyc/parse.i +++ b/world/net/psyc/parse.i @@ -170,15 +170,7 @@ private int conclude() { unless (lastvar) return 0; // if (abbrev("_INTERNAL", lastvar)) not necessary because // the following check only allows lowercase for now - if ( -#ifdef GAMMA - !legal_keyword(lastvar) -#else - // very relaxed strategy - strlen(lastvar) < 2 || lastvar[0] != '_' // policy may change - || lastvar[1] > 'z' || lastvar[1] < 'a' -#endif - ) { + if ( !legal_keyword(lastvar) ) { croak("_error_illegal_protocol_variable", "You are not allowed to present a variable named [_variable_name].", ([ "_variable_name": lastvar ])); @@ -318,13 +310,11 @@ vamixed parse(string a) { } if (vname != "") { conclude(); -#ifdef GAMMA // 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 unless (vcheck) { @@ -461,17 +451,7 @@ vamixed parse(string a) { #ifdef BITKOENIG_SYNTAX sscanf(a, "%s %s", a, buffer); #endif -#ifdef GAMMA - if (!legal_keyword(a)) -#else - // pretty inefficient strategy here - for (i=strlen(a)-1; i>=0; i--) - unless (a[i] == '_' || - (a[i] >= 'a' && a[i] <= 'z') || - (a[i] >= '0' && a[i] <= '9') || - (a[i] >= 'A' && a[i] <= 'Z')) -#endif - { + if (!legal_keyword(a)) { croak("_error_illegal_method", "That's not a valid method name."); QUIT diff --git a/world/net/psyc/udp.c b/world/net/psyc/udp.c index 9ba6f1e..cf465b7 100644 --- a/world/net/psyc/udp.c +++ b/world/net/psyc/udp.c @@ -70,7 +70,7 @@ parseUDP2(host, ip, port, msg) { } // else: we presume a UDP 4404 also listens on TCP -#ifndef GAMMA +#if 0 P1(("./psyc/udp.c: paranoid extra restart\n")) restart(); // leading . does that anyway #endif diff --git a/world/net/user.c b/world/net/user.c index 8a739b0..df97a10 100644 --- a/world/net/user.c +++ b/world/net/user.c @@ -769,9 +769,7 @@ case "_status_description_place": sscanf(vars["_tag_reply"], "%s %s", variant, t); //PT(("format %O tag %O\n", variant, t)) descvars = vars; -#ifdef GAMMA descvars["_source"] = source; -#endif switch (variant) { default: // client doesn't want HTML @@ -929,9 +927,7 @@ case "_failure_redirect": placeRequest(vars["_source_redirect"], mc, 0, 1); } // else.. we'll see -#ifdef GAMMA // enough to make the messages visible? return 1; -#endif } break; case "_echo_place_enter_INTERNAL_CHECK": // only do the check and dont write anything @@ -1184,13 +1180,16 @@ case "_status": D2( if (vars["_nick"] != nick) D(S("u:msg _nick %O is changed into %O\n", vars["_nick"], nick)); ) -#if 0 //ndef GAMMA +#ifdef ALPHA // DANGEROUS CHANGE! I added this line to make sure // remote UNI is shown on private messages. let's see // if it breaks anything --- 2003-05-09 // // for irssi w/ no-irssi-echo-chatting a backup comes in handy. // --- 2005-01-07 + // + // tg has found out that this little line keeps masquerade from + // breaking for ircers: they would see object path otherwise unless (vars["_nick_verbatim"]) vars["_nick_verbatim"] = vars["_nick"]; #endif vars["_nick"] = nick; @@ -1209,20 +1208,6 @@ case "_status": return 1; } -#ifndef GAMMA -// print() is for "important" output which gets lastlogged -// -// if no lastlog mechanism is available, -// you may choose to use this thing here -// -print(fmt, a,b,c,d,e,f,g,h,i,j,k) { - string m = sprintf(fmt, a,b,c,d,e,f,g,h,i,j,k); - P1(("user:print(%O,%O,%O..)\n", fmt,a,b)) - emit(m); - return m; -} -#endif - // pr() has replaced p(), P() and print() in most cases. // it uses the PSYC "message code" (actually a PSYC method) // for classification of output going to the user @@ -1436,20 +1421,13 @@ wAction(mc, data, vars, source, variant, nick) { w(mc+"_text_action"+variant, data, va, source); else { if (va["_nick_target"]) - w(mc+"_action"+variant, -#ifdef GAMMA - 0, -#else - // bei _message gehört sich das nicht - "[_nick_target]: [_nick] [_action].", -#endif - va, source); + w(mc+"_action"+variant, 0, va, source); else w(mc+"_action"+variant, -#ifdef GAMMA - "[_nick] [_action].", -#else +#ifdef ALPHA 0, +#else + "[_nick] [_action].", #endif va, source); } @@ -1550,10 +1528,6 @@ autojoin() { vSet("place", DEFPLACE); # endif P2(("autojoin with %O %O %O\n", v("place"), place, places)) -# ifndef GAMMA - unless (v("place")) - vSet("place", T("_MISC_defplace", DEFPLACE)); -# endif // see also http://about.psyc.eu/Client_coders#Room_members if (sizeof(places)) { #if 0 @@ -1600,10 +1574,8 @@ autojoin() { } else { # ifndef _flag_disable_place_default -# ifdef GAMMA unless (v("place")) vSet("place", T("_MISC_defplace", DEFPLACE)); -# endif // re-entering your last place is unusual by irc // habits, but since we don't want people to set up // autojoins they may find this quite practical until @@ -1707,7 +1679,6 @@ disconnected(remainder) { // user did not detach his client properly. we'll make a wild guess // at how many messages he may have missed - enough to make the user // check the lastlog if that's not enough. -#ifdef GAMMA // FIXME: problem with jabber/user running into some bug when // lastlog messages are shown.. which at this point of course // creates a recursion - thus, eliminating the otherwise useful @@ -1719,7 +1690,6 @@ disconnected(remainder) { P1(("unexpected disconnect in %O\n", ME)) vInc("new", 7); } -#endif // actually - we could show all messages since last activity // from user. TODO #ifdef AVAILABILITY_OFFLINE diff --git a/world/net/usercmd.i b/world/net/usercmd.i index e736a42..d8fe755 100644 --- a/world/net/usercmd.i +++ b/world/net/usercmd.i @@ -3385,7 +3385,7 @@ static placeRequest(where, mc, leave, quiet, morevars) { return msg($1, $2, $3, $4); :); // we use our right to leave the context ourselves // after informing the place.. -# ifdef GAMMA +# ifdef BETA // but that makes any _notice_place_leave run // into the filter so i comment it out leavePlace(where);