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 ======================================================== == NEXT RELEASE ========================================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
? support tls multiplexing on all suitable ports ? support tls multiplexing on all suitable ports
- change UResource and UUser usage to the new UNick
________________________________________________________________________ ________________________________________________________________________
== currently being inspected =========================================== == currently being inspected ===========================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

View File

@ -1,6 +1,12 @@
<PSYC:TEXTDB> ## vim:syntax=mail <PSYC:TEXTDB> ## vim:syntax=mail
## Check utf-8: Praise Atatürk! ## 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 _message
|[_nick] sendet Dir: [_data] |[_nick] sendet Dir: [_data]

View File

@ -1,6 +1,12 @@
<PSYC:TEXTDB> ## vim:syntax=mail <PSYC:TEXTDB> ## vim:syntax=mail
## Check utf-8: Praise Atatürk! ## 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 _message
|[_nick] sends you: [_data] |[_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 // and have it replaced by object.. but that's not the case
// we _could_ however do that by using _uniform_trustee // we _could_ however do that by using _uniform_trustee
// and doing is_localhost on all _uniform's at parsing time // and doing is_localhost on all _uniform's at parsing time
if (is_localhost(u[UHost])) { if (is_localhost(u[UHost])) trustee_nick = u[UNick];
trustee_nick = u[UResource][1..];
}
} }
if (get_trust(trustee_nick, 0) < MINIMUM_TRUST) return 1; if (get_trust(trustee_nick, 0) < MINIMUM_TRUST) return 1;
// entweder trustee ist ein local nick, dann kriegen wir den // 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()) { // if (u[UPort] && u[UPort] == query_imp_port()) {
// vergleichen mit bisheriger logik in parse.i TODO // vergleichen mit bisheriger logik in parse.i TODO
if (u[UResource][0] == '~') 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 if (u[UUser]) target = find_person(u[UUser]);
else target = find_object(u[UResource]); else target = find_object(u[UResource]);
// } // }

View File

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

View File

@ -182,12 +182,7 @@ advertise(source) {
gated[source] = 1; gated[source] = 1;
} }
#endif #endif
} else { } else login = u[UNick];
// 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 ..];
} }
unless (login && strlen(login)) return; unless (login && strlen(login)) return;
// introduce the federation user into the ircnet // introduce the federation user into the ircnet
@ -226,7 +221,7 @@ render(mc, data, vars, source) {
// return; // return;
// } // }
// string ircsrc = (u[UScheme] || "xmpp") +";"+ // string ircsrc = (u[UScheme] || "xmpp") +";"+
// (UName(u) +"|"+ // (u[UNick] +"|"+
// replace(u[UHost], ".", "_"); // replace(u[UHost], ".", "_");
if (source) { if (source) {
advertise(source); advertise(source);

View File

@ -204,7 +204,7 @@ static int _status_place_members(mixed source, string mc,
# else # else
"_nick" : n, "_nick" : n,
# endif # endif
"_nick_login" : u[UResource], "_nick_login" : u[UNick],
"_identification_host" : u[UHost], "_identification_host" : u[UHost],
"_IRC_away" : "H", "_IRC_away" : "H",
"_IRC_hops" : "1", "_IRC_hops" : "1",
@ -412,12 +412,12 @@ w(string mc, string data, mapping vars, mixed source) {
# ifdef ALIASES # ifdef ALIASES
if (raliases[source]) { if (raliases[source]) {
nick2 = raliases[source]; nick2 = raliases[source];
vars["_source_hack"] = nick2 + ((u[UUser] || vars["_source_hack"] = nick2 +"!"+
(u[UResource] && u[UResource][0])) u[UNick]? u[UNick] +"@"+ u[UHost]
? "!"+ UName(u) +"@"+ u[UHost] : (vars["_nick_long"]
: "!"+ (vars["_nick_long"] || vars["_INTERNAL_nick_plain"] || vars["_INTERNAL_nick_plain"]
|| vars["_nick"]) || vars["_nick"])
+"@alias.undefined"); +"@alias.undefined";
} }
unless (nick2) { unless (nick2) {
@ -426,7 +426,7 @@ w(string mc, string data, mapping vars, mixed source) {
case "psyc": case "psyc":
if (u[UUser] || (u[UResource] && strlen(u[UResource]) if (u[UUser] || (u[UResource] && strlen(u[UResource])
&& u[UResource][0] == '~')) { && u[UResource][0] == '~')) {
string tmp = UName(u); string tmp = u[UNick];
vars["_source_hack"] = u[UScheme] + "://" vars["_source_hack"] = u[UScheme] + "://"
+ u[UHostPort] +"/~"+ tmp +"!"+ tmp +"@" + u[UHostPort] +"/~"+ tmp +"!"+ tmp +"@"
+ u[UHostPort]; + 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); t = PLACEPREFIX + NODEPREP(vars["_nick_place"]) +"@"+ NAMEPREP(jabberhost);
} else if (u = parse_uniform(vars["_context"])) { } else if (u = parse_uniform(vars["_context"])) {
if (u[UScheme] == "psyc") 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: else // here we presume we have a u@h or xmpp:
t = NODEPREP(u[UUser]) + "@" + NAMEPREP(u[UHost]); t = NODEPREP(u[UUser]) + "@" + NAMEPREP(u[UHost]);
} else { } else {

View File

@ -404,7 +404,7 @@ int msg(string source, string mc, string data,
break; break;
case "kick": // TODO: we could add a callback for this case "kick": // TODO: we could add a callback for this
mc = "_request_execute_kick"; 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); vars["_reason"] = ARGS(2);
break; break;
case "ban": // TODO: we could add a callback for this 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", P0(("private message in place.. from %O to %O\n",
ME, o)) ME, o))
sendmsg(o, "_message_public_whisper", sendmsg(o, "_message_public_whisper",
node["/body"][Cdata], ([ "_nick_target": u[UResource] || u[UUser]])); node["/body"][Cdata], ([ "_nick_target": u[UNick]]));
} }
#endif #endif
return 1; 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? // or let psyc users be the same person as on xmpp?
// YES we want transparent upgrades from xmpp to psyc! // YES we want transparent upgrades from xmpp to psyc!
if (t[0] == '@') if (t[0] == '@')
t = PLACEPREFIX+ t[1..] +"@"+ u[UHost]; t = PLACEPREFIX+ u[UNick] +"@"+ u[UHost];
else else
t = t[1..] +"@"+ u[UHost]; t = u[UNick] +"@"+ u[UHost];
} else { } else {
// the usual "shouldn't happen" case which however does // the usual "shouldn't happen" case which however does
t = u[UHost]; 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 // no _nick? okay, then it has to be this one
q = UNIFORM(source) || "?"; 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; r += p + q;
#endif #endif
break; break;
@ -72,7 +73,8 @@ varargs string psyctext(string s, mapping m, vastring data,
r += p + (nick || m["_nick"] || m["_source"] || UNIFORM(source) || "?"); r += p + (nick || m["_nick"] || m["_source"] || UNIFORM(source) || "?");
#else #else
q = m["_source"] || UNIFORM(source) || "?"; 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; r += p + q;
#endif #endif
break; break;
@ -81,7 +83,8 @@ varargs string psyctext(string s, mapping m, vastring data,
r += p + (nick || m["_nick"] || m["_source_relay"] || "?"); r += p + (nick || m["_nick"] || m["_source_relay"] || "?");
#else #else
q = m["_source_relay"] || "?"; 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; r += p + q;
#endif #endif
break; break;
@ -90,7 +93,8 @@ varargs string psyctext(string s, mapping m, vastring data,
r += p + (m["_nick_target"] || m["_target"] || "?"); r += p + (m["_nick_target"] || m["_target"] || "?");
#else #else
q = m["_target"] || "?"; 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; r += p + q;
#endif #endif
break; break;
@ -99,7 +103,8 @@ varargs string psyctext(string s, mapping m, vastring data,
r += p + (m["_nick_place"] || m["_context"] || "?"); r += p + (m["_nick_place"] || m["_context"] || "?");
#else #else
q = m["_context"] || "?"; 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; r += p + q;
#endif #endif
break; break;

View File

@ -2541,7 +2541,7 @@ logon(host) {
if (u = parse_uniform(ni)) { if (u = parse_uniform(ni)) {
// <lynX> first we change the ppl, then we need this code // <lynX> first we change the ppl, then we need this code
// if (is_localhost(u[UHost])) { // if (is_localhost(u[UHost])) {
// o = summon_person(u[UResource][1..]); // o = summon_person(u[UNick]);
// insert_member(o); // insert_member(o);
// } else { // } else {
o = ni; 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 // und nicht bei jeder remote suorce generell? TODO
mixed *u = parse_uniform(source); mixed *u = parse_uniform(source);
if (u) { if (u) {
string n = u[UUser]; n = u[UNick];
if (!n && u[UResource]
&& u[UResource][0] == '~') {
n = u[UResource][1..];
}
unless (n) return 0; // not n? hm... unless (n) return 0; // not n? hm...
unless (vars["_nick"] unless (vars["_nick"]

View File

@ -120,7 +120,7 @@ object find_psyc_object(array(mixed) u) {
string t, r, svc, user; string t, r, svc, user;
object o; object o;
user = u[UUser]; user = u[UNick];
r = u[UResource]; r = u[UResource];
if (r && strlen(r)) { if (r && strlen(r)) {
#if __EFUN_DEFINED__(trim) #if __EFUN_DEFINED__(trim)
@ -132,13 +132,6 @@ object find_psyc_object(array(mixed) u) {
if (strlen(r)) switch(r[0]) { if (strlen(r)) switch(r[0]) {
case '^': case '^':
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; break;
case '$': case '$':
// target wird auf serv/args gesetzt // 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 #ifdef NONIX
if (strlen(u[UResource]) > 1) if (strlen(u[UResource]) > 1)
cvars["_INTERNAL_nick_target"] = u[UResource][1..]; cvars["_INTERNAL_nick_target"] = u[UNick];
#endif #endif
P3(("DEBUG: is_localhost is %O for %O of %O\n", P3(("DEBUG: is_localhost is %O for %O of %O\n",
is_localhost(u[UHost]), u[UHost], u)) 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 // my nickspace. used by psyctext(). could be passed as closure, but then
// it wouldn't be available for *any* psyctext call in user objects. // it wouldn't be available for *any* psyctext call in user objects.
uni2nick(n) { uni2nick(n, vars) {
PT(("uni2nick(%O) in %O\n", n, ME)) P3(("uni2nick(%O) in %O\n", n, ME))
#ifdef USE_AUTOALIAS #ifdef USE_AUTOALIAS
string ln = lower_case(n); string ln = lower_case(n);
string al = raliases[ln]; string al = raliases[ln];
if (al) return al; if (al) return al;
if (member(raliases, ln)) return n; // marked dead if (member(raliases, ln)) return n; // marked dead
mixed u = parse_uniform(n); 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]); al = lower_case(u[UNick]);
if (aliases[al]) { if (aliases[al]) {
raliases[ln] = 0; // mark dead raliases[ln] = 0; // mark dead
PT(("uni2nick: already belongs to %O\n", aliases[al])) P2(("uni2nick: already belongs to %O\n", aliases[al]))
w("_failure_unavailable_alias", w("_failure_unavailable_alias", 0,
"No alias for [_uniform_new]: [_nick_old] already belongs to [_uniform_old].",
([ "_uniform_new": n, ([ "_uniform_new": n,
"_uniform_old": aliases[al], "_uniform_old": aliases[al],
"_nick_old": al ]) ); "_nick_old": al ]) );
@ -52,9 +54,8 @@ uni2nick(n) {
} }
aliases[al] = n; aliases[al] = n;
raliases[ln] = al = u[UNick]; raliases[ln] = al = u[UNick];
PT(("uni2nick: autoaliased %O to %O\n", n, al)) P2(("uni2nick: autoaliased %O to %O\n", n, al))
w("_notice_add_alias_automatic", w("_notice_add_alias_temporary", 0,
"[_uniform_entity] is known as [_nick_entity].",
([ "_uniform_entity": n, ([ "_uniform_entity": n,
"_nick_entity": al ]) ); "_nick_entity": al ]) );
return al; return al;