From 7b3b955117f2217b161dfbb5f98e39593a5e1042 Mon Sep 17 00:00:00 2001 From: "psyc://psyced.org/~lynX" <@> Date: Sat, 7 Nov 2009 00:07:54 +0100 Subject: [PATCH] bugfix: enforce uniforms in _routes --- CHANGESTODO | 3 +++ world/default/en/jabber.textdb | 24 ++++++++++++------------ world/net/group/master.c | 27 ++++++++++++++++++++++++--- world/net/jabber/common.c | 2 +- world/net/jabber/mixin_parse.c | 4 ++-- world/net/jabber/user.c | 2 +- world/net/place/archetype.gen | 3 +++ 7 files changed, 46 insertions(+), 19 deletions(-) diff --git a/CHANGESTODO b/CHANGESTODO index c632db6..9b7587c 100644 --- a/CHANGESTODO +++ b/CHANGESTODO @@ -3977,4 +3977,7 @@ irc/user - handle root messages jabber/* - deal with < and > in status updates +group/master +- don't use local objects as they may get replaced and zeroed + use local uniforms instead (fixes some strange ghost membership fx) diff --git a/world/default/en/jabber.textdb b/world/default/en/jabber.textdb index 70bf913..3b69c56 100644 --- a/world/default/en/jabber.textdb +++ b/world/default/en/jabber.textdb @@ -366,28 +366,28 @@ _notice_place_leave | _status_presence_here -|[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_here_talkative -|chat[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|chat[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_here_busy -|dnd[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|dnd[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_away -|away[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|away[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_absent_vacation -|xa[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|xa[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_absent -|[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_here_quiet | _notice_presence_here -|[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_presence_here_plain | @@ -396,19 +396,19 @@ _notice_presence_here_quiet | _notice_presence_here_talkative -|chat[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|chat[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_presence_here_busy -|dnd[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|dnd[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_presence_away -|away[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|away[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_presence_absent_vacation -|xa[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|xa[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_presence_absent -|[_XML_description_presence]<[_INTERNAL_mood_jabber]/> +|[_INTERNAL_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_person_absent_netburp |xa{_notice_person_absent_netburp} diff --git a/world/net/group/master.c b/world/net/group/master.c index 10121f7..2711a52 100644 --- a/world/net/group/master.c +++ b/world/net/group/master.c @@ -30,6 +30,10 @@ #include #include +#ifdef BETA +# define ENFORCE_UNIFORM +#endif + #ifdef CONTEXT_STATE // {{{ # define HEADER_ONLY # include "../state.c" @@ -98,7 +102,7 @@ castmsg(source, mc, data, vars) { #endif // }}} P2(("%O castmsg(%O,%O,%O..) for %O\n", ME, source,mc,data, _routes)) - D3(P2(("%O vars = %O\n", ME, vars))) + D4(P2(("%O vars = %O\n", ME, vars))) // _context is an MMP variable, so we use it internally with objectp vars["_context"] = ME; @@ -114,11 +118,11 @@ castmsg(source, mc, data, vars) { foreach (route, noa : _routes) { #if defined(TIDILY) && defined(MEMBERS_BY_SOURCE) - P3(("place:each(%O,t=%O,s=%O,mc=%O,d=%O,v=%O)\n", + P4(("place:each(%O,t=%O,s=%O,mc=%O,d=%O,v=%O)\n", mappingp(noa) ? sizeof(noa) : noa, route, source, mc, data, vars)) #else - P3(("place:each(%O,t=%O,s=%O,mc=%O,d=%O,v=%O)\n", + P4(("place:each(%O,t=%O,s=%O,mc=%O,d=%O,v=%O)\n", noa, route, source, mc, data, vars)) #endif // if (route == source) return; // skip sender @@ -191,6 +195,9 @@ protected load(file) { remove_member(source, origin) { mixed t; +#ifdef ENFORCE_UNIFORM + if (objectp(source)) source = psyc_name(source); +#endif P2(("%O remove_member(%O, %O)\n", ME, source, origin)) if (origin && ( #if 1 //defined(TIDILY) && defined(MEMBERS_BY_SOURCE) @@ -241,10 +248,23 @@ jabberisten die freundschaft zum user#fippo entfernte: P2(("%O encountered unnecessary remove of %O from %O\n", ME, source, _routes)) } + P3(("%O -> _routes = %O\n", ME, _routes)) } insert_member(source, origin) { mixed t; + +#ifdef ENFORCE_UNIFORM + // when storing objects into _routes stupid things can happen: + // when a user is created, all her local friends are cloned and + // placed into her context. if one of those local friends logs in + // under different access a different user object is created - + // the old one is destroyed and, guess what, this context mapping + // is not updated. always using uniforms is a way to solve this + // problem. + // + if (objectp(source)) source = psyc_name(source); +#endif P2(("%O insert_member(%O, %O)\n", ME, source, origin)) if (objectp(origin) && (t = origin->qOrigin())) { #ifdef FORK @@ -279,6 +299,7 @@ insert_member(source, origin) { // would be nice to do it here, but that's not correct //revision += 1; #endif + P3(("%O -> _routes = %O\n", ME, _routes)) } // code duplicaton is faster than others diff --git a/world/net/jabber/common.c b/world/net/jabber/common.c index 2f2141b..7a26c02 100644 --- a/world/net/jabber/common.c +++ b/world/net/jabber/common.c @@ -300,7 +300,7 @@ render(string mc, string data, mapping vars, mixed source) { // if this kind of problem recurrs, we should quote every // single damn variable if (vars["_description_presence"]) - vars["_XML_description_presence"] = + vars["_INTERNAL_XML_description_presence"] = xmlquote(vars["_description_presence"]); if (stringp(data)) data = xmlquote(data); else if (vars["_action"]) diff --git a/world/net/jabber/mixin_parse.c b/world/net/jabber/mixin_parse.c index bdd2e28..12e6233 100644 --- a/world/net/jabber/mixin_parse.c +++ b/world/net/jabber/mixin_parse.c @@ -550,7 +550,7 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) { vars["_description_presence"] = (node["/status"] && node["/status"][Cdata]) ? node["/status"][Cdata] : ""; // "Get psyced!"; - vars["_XML_description_presence"] = + vars["_INTERNAL_XML_description_presence"] = xmlquote(vars["_description_presence"]); vars["_INTERNAL_mood_jabber"] = "neutral"; sendmsg(o, "_notice_presence_absent", 0, @@ -695,7 +695,7 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) { vars["_description_presence"] = (node["/status"] && node["/status"][Cdata]) ? node["/status"][Cdata] : ""; // "Get psyced!"; - vars["_XML_description_presence"] = + vars["_INTERNAL_XML_description_presence"] = xmlquote(vars["_description_presence"]); vars["_degree_availability"] = jabber2avail[node["/show"] && node["/show"][Cdata]]; diff --git a/world/net/jabber/user.c b/world/net/jabber/user.c index 805dcde..7d74c5b 100644 --- a/world/net/jabber/user.c +++ b/world/net/jabber/user.c @@ -251,7 +251,7 @@ showFriends() { "_INTERNAL_target_jabber" : myjid, "_INTERNAL_source_jabber" : mkjid(person), "_description_presence" : "", // TODO: get these from state - "_XML_description_presence" : "", + "_INTERNAL_XML_description_presence" : "", "_INTERNAL_mood_jabber" : "neutral" ])); } diff --git a/world/net/place/archetype.gen b/world/net/place/archetype.gen index 7d23e52..cc24c61 100644 --- a/world/net/place/archetype.gen +++ b/world/net/place/archetype.gen @@ -768,6 +768,7 @@ insert_member(source, mc, data, vars, ni, neu, again) { # else // only this code runs vars["_duty"] = "member"; + // why not _role instead of _duty? # endif #endif // OWNED // we are also echoing his vars back to the requestor @@ -1150,6 +1151,8 @@ msg(source, mc, data, mapping vars) { || abbrev("_request_invitation", mc)) { mc = "_notice_place"+mc[8..]; #ifdef PLACE_TOPIC + // hm, this doesn't just go back to the new + // person.. it is resent to all.. if (v("topic") &&! abbrev("_request_leave", mc)) vars["_topic"] = v("topic"); #endif