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

use some more psyc_object()

This commit is contained in:
psyc://psyced.org/~lynX 2011-07-24 18:30:36 +02:00
parent 13846359c0
commit 15dd8c0ada
4 changed files with 16 additions and 3 deletions

View file

@ -659,6 +659,8 @@ int xmpp_sendmsg(mixed target, string mc, mixed data, mapping vars,
if (o = targets[tmp]) { if (o = targets[tmp]) {
P2(("%O to be delivered on %O\n", P2(("%O to be delivered on %O\n",
otarget, o )) otarget, o ))
// in XMPP this is sufficient since other servers on the same IP
// need to have a different domain name
} else if (is_localhost(lower_case(u[UHost]))) { } else if (is_localhost(lower_case(u[UHost]))) {
unless (u[UUser]) { unless (u[UUser]) {
P0(("Intercepted %O to %O from %O\n", mc, target, source)) P0(("Intercepted %O to %O from %O\n", mc, target, source))

View file

@ -2675,9 +2675,14 @@ sAide(whom) {
int ret; int ret;
mapping aides = v("aides") || ([]); mapping aides = v("aides") || ([]);
// change local uniform to nick #if 0
// change local uniform to nick ... isn't really correct like this
array(mixed) u = parse_uniform(whom); array(mixed) u = parse_uniform(whom);
if (u && is_localhost(lower_case(u[UHost]))) whom = u[UResource]; if (u && is_localhost(lower_case(u[UHost]))) whom = u[UResource];
#else
object o = psyc_object(whom);
if (o) whom = o->qName();
#endif
t = lower_case(whom); t = lower_case(whom);
if (aides[t]) { if (aides[t]) {

View file

@ -112,6 +112,7 @@ varargs string psyc_name(mixed source, vastring localpart) {
return obj2unl[source] = s; return obj2unl[source] = s;
} }
// in most situtation this is correct function to find local psyc objects
object psyc_object(string uniform) { object psyc_object(string uniform) {
// unl2obj can become too big and cause a sprintf error here // unl2obj can become too big and cause a sprintf error here
// so you don't want this debug output on a production server! // so you don't want this debug output on a production server!
@ -119,6 +120,7 @@ object psyc_object(string uniform) {
return unl2obj[uniform]; return unl2obj[uniform];
} }
// you probably want to use the much simpler psyc_object() above
object find_psyc_object(array(mixed) u) { object find_psyc_object(array(mixed) u) {
P3((">> find_psyc_object(%O)\n", u)) P3((">> find_psyc_object(%O)\n", u))
string t, r, svc, user; string t, r, svc, user;

View file

@ -225,6 +225,8 @@ void dispatch(mapping rvars, mapping evars, mixed method, mixed body) {
if (vars["_target"]) { if (vars["_target"]) {
// FIXME: delivery copycat from below // FIXME: delivery copycat from below
// beware: source is set to 0 here as it may not be present // beware: source is set to 0 here as it may not be present
unless (target = psyc_object(vars["_target"]))
// FIXME: this doesn't handle remote objects properly!
target = find_psyc_object(parse_uniform(vars["_target"])); target = find_psyc_object(parse_uniform(vars["_target"]));
PT(("target is %O\n", target)) PT(("target is %O\n", target))
// FIXME: net/entity can not yet deal with 0 method // FIXME: net/entity can not yet deal with 0 method
@ -288,6 +290,8 @@ void dispatch(mapping rvars, mapping evars, mixed method, mixed body) {
if (!vars["_target"]) { if (!vars["_target"]) {
target = find_object(NET_PATH "root"); target = find_object(NET_PATH "root");
} else { } else {
unless (target = psyc_object(vars["_target"]))
// FIXME: this doesn't handle remote objects properly!
target = find_psyc_object(parse_uniform(vars["_target"])); target = find_psyc_object(parse_uniform(vars["_target"]));
} }
PT(("target is %O\n", target)) PT(("target is %O\n", target))