1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

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

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