bugfix: enforce uniforms in _routes

This commit is contained in:
psyc://psyced.org/~lynX 2009-11-07 00:07:54 +01:00
parent 37a4720711
commit 7b3b955117
7 changed files with 46 additions and 19 deletions

View File

@ -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)

View File

@ -366,28 +366,28 @@ _notice_place_leave
|<presence type='unavailable' to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]' id='[_tag]'><x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='none' role='none'/></x></presence>
_status_presence_here
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_here_talkative
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>chat</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>chat</show><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_here_busy
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>dnd</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>dnd</show><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_away
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>away</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>away</show><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_absent_vacation
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_absent
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]' type='unavailable'><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]' type='unavailable'><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_here_quiet
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'/>
_notice_presence_here
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber_bare]'><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber_bare]'><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_presence_here_plain
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'/>
@ -396,19 +396,19 @@ _notice_presence_here_quiet
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'/>
_notice_presence_here_talkative
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber_bare]'><show>chat</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber_bare]'><show>chat</show><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_presence_here_busy
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>dnd</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>dnd</show><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_presence_away
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>away</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>away</show><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_presence_absent_vacation
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_presence_absent
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]' type='unavailable'><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]' type='unavailable'><status>[_INTERNAL_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_person_absent_netburp
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>{_notice_person_absent_netburp}</status></presence>

View File

@ -30,6 +30,10 @@
#include <status.h>
#include <uniform.h>
#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

View File

@ -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"])

View File

@ -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]];

View File

@ -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"
]));
}

View File

@ -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