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]) {
P2(("%O to be delivered on %O\n",
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]))) {
unless (u[UUser]) {
P0(("Intercepted %O to %O from %O\n", mc, target, source))

View file

@ -2675,9 +2675,14 @@ sAide(whom) {
int ret;
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);
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);
if (aides[t]) {

View file

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

View file

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