use the UNick

This commit is contained in:
psyc://psyced.org/~lynX 2009-03-04 11:27:19 +01:00
parent 8e4e990261
commit 6fd2423ff9
17 changed files with 52 additions and 56 deletions

View File

@ -7,8 +7,6 @@ ________________________________________________________________________
== NEXT RELEASE ========================================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
? support tls multiplexing on all suitable ports
- change UResource and UUser usage to the new UNick
________________________________________________________________________
== currently being inspected ===========================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

View File

@ -1,6 +1,12 @@
<PSYC:TEXTDB> ## vim:syntax=mail
## Check utf-8: Praise Atatürk!
_failure_unavailable_alias
|Kein Name für [_uniform_new]: [_nick_old] gehört bereits [_uniform_old].
_notice_add_alias_temporary
|[_uniform_entity] wird als [_nick_entity] dargestellt.
_message
|[_nick] sendet Dir: [_data]

View File

@ -1,6 +1,12 @@
<PSYC:TEXTDB> ## vim:syntax=mail
## Check utf-8: Praise Atatürk!
_failure_unavailable_alias
|No alias for [_uniform_new]: [_nick_old] already belongs to [_uniform_old].
_notice_add_alias_temporary
|[_uniform_entity] is shown as [_nick_entity].
_message
|[_nick] sends you: [_data]

View File

@ -422,9 +422,7 @@ msg(source, mc, data, vars) {
// and have it replaced by object.. but that's not the case
// we _could_ however do that by using _uniform_trustee
// and doing is_localhost on all _uniform's at parsing time
if (is_localhost(u[UHost])) {
trustee_nick = u[UResource][1..];
}
if (is_localhost(u[UHost])) trustee_nick = u[UNick];
}
if (get_trust(trustee_nick, 0) < MINIMUM_TRUST) return 1;
// entweder trustee ist ein local nick, dann kriegen wir den

View File

@ -82,7 +82,7 @@ msg(source, mc, data, mapping vars, showingLog, target) {
// if (u[UPort] && u[UPort] == query_imp_port()) {
// vergleichen mit bisheriger logik in parse.i TODO
if (u[UResource][0] == '~')
target = find_person(u[UResource][1..]);
target = find_person(u[UNick]);
else if (u[UUser]) target = find_person(u[UUser]);
else target = find_object(u[UResource]);
// }

View File

@ -24,5 +24,4 @@
// (not provided by parse_uniform)
#define USize 16
#define UName(uniform) (uniform[UUser] || uniform[UResource][1 ..])
#endif

View File

@ -182,12 +182,7 @@ advertise(source) {
gated[source] = 1;
}
#endif
} else {
// maybe this kind of logic should be in parse_uniform?
// or is it too rarely needed thus inefficient?
login = u[UResource];
if (stringp(login) && strlen(login) > 1)
login = login[1 ..];
} else login = u[UNick];
}
unless (login && strlen(login)) return;
// introduce the federation user into the ircnet
@ -226,7 +221,7 @@ render(mc, data, vars, source) {
// return;
// }
// string ircsrc = (u[UScheme] || "xmpp") +";"+
// (UName(u) +"|"+
// (u[UNick] +"|"+
// replace(u[UHost], ".", "_");
if (source) {
advertise(source);

View File

@ -204,7 +204,7 @@ static int _status_place_members(mixed source, string mc,
# else
"_nick" : n,
# endif
"_nick_login" : u[UResource],
"_nick_login" : u[UNick],
"_identification_host" : u[UHost],
"_IRC_away" : "H",
"_IRC_hops" : "1",
@ -412,12 +412,12 @@ w(string mc, string data, mapping vars, mixed source) {
# ifdef ALIASES
if (raliases[source]) {
nick2 = raliases[source];
vars["_source_hack"] = nick2 + ((u[UUser] ||
(u[UResource] && u[UResource][0]))
? "!"+ UName(u) +"@"+ u[UHost]
: "!"+ (vars["_nick_long"] || vars["_INTERNAL_nick_plain"]
|| vars["_nick"])
+"@alias.undefined");
vars["_source_hack"] = nick2 +"!"+
u[UNick]? u[UNick] +"@"+ u[UHost]
: (vars["_nick_long"]
|| vars["_INTERNAL_nick_plain"]
|| vars["_nick"])
+"@alias.undefined";
}
unless (nick2) {
@ -426,7 +426,7 @@ w(string mc, string data, mapping vars, mixed source) {
case "psyc":
if (u[UUser] || (u[UResource] && strlen(u[UResource])
&& u[UResource][0] == '~')) {
string tmp = UName(u);
string tmp = u[UNick];
vars["_source_hack"] = u[UScheme] + "://"
+ u[UHostPort] +"/~"+ tmp +"!"+ tmp +"@"
+ u[UHostPort];

View File

@ -150,7 +150,7 @@ varargs string mkjid(mixed who, mixed vars, mixed ignore_context, string target
t = PLACEPREFIX + NODEPREP(vars["_nick_place"]) +"@"+ NAMEPREP(jabberhost);
} else if (u = parse_uniform(vars["_context"])) {
if (u[UScheme] == "psyc")
t = PLACEPREFIX + NODEPREP(u[UResource][1..]) + "@" + NAMEPREP(u[UHost]);
t = PLACEPREFIX + NODEPREP(u[UNick]) + "@" + NAMEPREP(u[UHost]);
else // here we presume we have a u@h or xmpp:
t = NODEPREP(u[UUser]) + "@" + NAMEPREP(u[UHost]);
} else {

View File

@ -404,7 +404,7 @@ int msg(string source, string mc, string data,
break;
case "kick": // TODO: we could add a callback for this
mc = "_request_execute_kick";
vars["_nick_target"] = is_formal(args[1]) ? parse_uniform(args[1])[UResource] : args[1];
vars["_nick_target"] = is_formal(args[1]) ? parse_uniform(args[1])[UNick] : args[1];
vars["_reason"] = ARGS(2);
break;
case "ban": // TODO: we could add a callback for this

View File

@ -532,7 +532,7 @@ message(XMLNode node) {
P0(("private message in place.. from %O to %O\n",
ME, o))
sendmsg(o, "_message_public_whisper",
node["/body"][Cdata], ([ "_nick_target": u[UResource] || u[UUser]]));
node["/body"][Cdata], ([ "_nick_target": u[UNick]]));
}
#endif
return 1;
@ -1164,9 +1164,9 @@ varargs string mkjid(mixed who, mixed vars, mixed ignore_nick, mixed ignore_cont
// or let psyc users be the same person as on xmpp?
// YES we want transparent upgrades from xmpp to psyc!
if (t[0] == '@')
t = PLACEPREFIX+ t[1..] +"@"+ u[UHost];
t = PLACEPREFIX+ u[UNick] +"@"+ u[UHost];
else
t = t[1..] +"@"+ u[UHost];
t = u[UNick] +"@"+ u[UHost];
} else {
// the usual "shouldn't happen" case which however does
t = u[UHost];

View File

@ -62,7 +62,8 @@ varargs string psyctext(string s, mapping m, vastring data,
// no _nick? okay, then it has to be this one
q = UNIFORM(source) || "?";
}
if (previous_object()) q = previous_object()->uni2nick(q) || q;
if (previous_object())
q = previous_object()->uni2nick(q, m) || q;
r += p + q;
#endif
break;
@ -72,7 +73,8 @@ varargs string psyctext(string s, mapping m, vastring data,
r += p + (nick || m["_nick"] || m["_source"] || UNIFORM(source) || "?");
#else
q = m["_source"] || UNIFORM(source) || "?";
if (previous_object()) q = previous_object()->uni2nick(q) || q;
if (previous_object())
q = previous_object()->uni2nick(q, m) || q;
r += p + q;
#endif
break;
@ -81,7 +83,8 @@ varargs string psyctext(string s, mapping m, vastring data,
r += p + (nick || m["_nick"] || m["_source_relay"] || "?");
#else
q = m["_source_relay"] || "?";
if (previous_object()) q = previous_object()->uni2nick(q) || q;
if (previous_object())
q = previous_object()->uni2nick(q, m) || q;
r += p + q;
#endif
break;
@ -90,7 +93,8 @@ varargs string psyctext(string s, mapping m, vastring data,
r += p + (m["_nick_target"] || m["_target"] || "?");
#else
q = m["_target"] || "?";
if (previous_object()) q = previous_object()->uni2nick(q) || q;
if (previous_object())
q = previous_object()->uni2nick(q, m) || q;
r += p + q;
#endif
break;
@ -99,7 +103,8 @@ varargs string psyctext(string s, mapping m, vastring data,
r += p + (m["_nick_place"] || m["_context"] || "?");
#else
q = m["_context"] || "?";
if (previous_object()) q = previous_object()->uni2nick(q) || q;
if (previous_object())
q = previous_object()->uni2nick(q, m) || q;
r += p + q;
#endif
break;

View File

@ -2541,7 +2541,7 @@ logon(host) {
if (u = parse_uniform(ni)) {
// <lynX> first we change the ppl, then we need this code
// if (is_localhost(u[UHost])) {
// o = summon_person(u[UResource][1..]);
// o = summon_person(u[UNick]);
// insert_member(o);
// } else {
o = ni;

View File

@ -1078,12 +1078,7 @@ P1(("ident: %O is really %O\n", t, source))
// und nicht bei jeder remote suorce generell? TODO
mixed *u = parse_uniform(source);
if (u) {
string n = u[UUser];
if (!n && u[UResource]
&& u[UResource][0] == '~') {
n = u[UResource][1..];
}
n = u[UNick];
unless (n) return 0; // not n? hm...
unless (vars["_nick"]

View File

@ -120,7 +120,7 @@ object find_psyc_object(array(mixed) u) {
string t, r, svc, user;
object o;
user = u[UUser];
user = u[UNick];
r = u[UResource];
if (r && strlen(r)) {
#if __EFUN_DEFINED__(trim)
@ -132,13 +132,6 @@ object find_psyc_object(array(mixed) u) {
if (strlen(r)) switch(r[0]) {
case '^':
case '~':
if (user) {
// croak("_error_invalid_uniform_user_duplicate",
// "Two users in uniform not allowed here.");
// QUIT
return 0; // TODO!
}
user = r[1..];
break;
case '$':
// target wird auf serv/args gesetzt

View File

@ -988,7 +988,7 @@ protected int deliver(mixed ip, string host, string mc, string buffer, mapping c
}
#ifdef NONIX
if (strlen(u[UResource]) > 1)
cvars["_INTERNAL_nick_target"] = u[UResource][1..];
cvars["_INTERNAL_nick_target"] = u[UNick];
#endif
P3(("DEBUG: is_localhost is %O for %O of %O\n",
is_localhost(u[UHost]), u[UHost], u))

View File

@ -31,20 +31,22 @@ volatile mixed beQuiet;
// my nickspace. used by psyctext(). could be passed as closure, but then
// it wouldn't be available for *any* psyctext call in user objects.
uni2nick(n) {
PT(("uni2nick(%O) in %O\n", n, ME))
uni2nick(n, vars) {
P3(("uni2nick(%O) in %O\n", n, ME))
#ifdef USE_AUTOALIAS
string ln = lower_case(n);
string al = raliases[ln];
if (al) return al;
if (member(raliases, ln)) return n; // marked dead
mixed u = parse_uniform(n);
// unfortunately UNick already comes lowercased..
// using qName() for objectp would help here
// or we start using mixed case uniforms.. TODO
al = lower_case(u[UNick]);
if (aliases[al]) {
raliases[ln] = 0; // mark dead
PT(("uni2nick: already belongs to %O\n", aliases[al]))
w("_failure_unavailable_alias",
"No alias for [_uniform_new]: [_nick_old] already belongs to [_uniform_old].",
P2(("uni2nick: already belongs to %O\n", aliases[al]))
w("_failure_unavailable_alias", 0,
([ "_uniform_new": n,
"_uniform_old": aliases[al],
"_nick_old": al ]) );
@ -52,9 +54,8 @@ uni2nick(n) {
}
aliases[al] = n;
raliases[ln] = al = u[UNick];
PT(("uni2nick: autoaliased %O to %O\n", n, al))
w("_notice_add_alias_automatic",
"[_uniform_entity] is known as [_nick_entity].",
P2(("uni2nick: autoaliased %O to %O\n", n, al))
w("_notice_add_alias_temporary", 0,
([ "_uniform_entity": n,
"_nick_entity": al ]) );
return al;