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

things that happened in 2008

This commit is contained in:
psyc://psyced.org/~lynX 2009-01-26 21:12:53 +01:00
parent 8f98522570
commit 94530cc322
136 changed files with 3222 additions and 2873 deletions

View file

@ -1,4 +1,5 @@
// $Id: common.c,v 1.107 2008/04/16 14:21:17 lynx Exp $ // vim:syntax=lpc
// vim:foldmethod=marker:syntax=lpc:noexpandtab
// $Id: common.c,v 1.120 2008/12/16 11:58:52 lynx Exp $
//
// common functions for IRC servers and clients (gateways)
//
@ -33,12 +34,13 @@ parse(a) {
//if (a[<1] == ' ' || a[0] == ' ')
a = trim(a, TRIM_BOTH);
// efun probably faster than doing all those checks anyway
#else
#else //{{{
// not as efficient as it could be, but we have trim() anyway
// move this into a pike macro for trim() emulation?
if (a == "") return; // first make sure there's something at all
while (a[0] == ' ') a = a[1..];
while (a[<1] == ' ') a = a[0..<2];
#endif
#endif //}}}
if (a == "") return; // don't let " \n" execute "/s"
unless (sscanf(a, ":%s %s", from, t)) t = a;
sscanf(t, "%s :%s", t, text);
@ -53,9 +55,11 @@ ircMsg(from, cmd, args, text, all) {
case "motd":
motd();
return 1;
#ifndef BETA
case "lusers":
lusers();
return 1;
#endif
case "time":
t = time();
t1 = ctime(t);
@ -111,6 +115,7 @@ motd() {
// dummerweise fiel hier im Zuge des neuen emit das '- ' flach - fippo
P3(("MOTD_FILE (%O) found\n", MOTD_FILE))
motd_file = read_file(MOTD_FILE);
P4(("MOTD = %O\n", motd_file))
emit(sreply(RPL_MOTD, ":" + motd_file));
} else
#endif
@ -132,10 +137,14 @@ motd() {
return 1;
}
#ifndef BETA
lusers() {
# ifndef _flag_disable_query_server
reply(RPL_LUSERCLIENT, ":There are " + amount_people()
+ " users on this server\n");
+ " users on this server");
# endif
}
#endif
qCharset() {}
@ -143,56 +152,47 @@ render(string mc, string data, mapping vars, mixed source) {
string template, output;
mixed t;
P0(("common:render %O %O\n", ME, data));
P3(("common:render %O %O\n", ME, data));
#if 1 // def IRCEXPERIMENTAL
template = T(mc, 0); // enable textdb inheritance
#else
template = T(mc, "");
#endif
<<<<<<< common.c
=======
#ifndef _flag_disable_stamp_time_IRC
t = vars["_time_place"] || vars["_time_log"];
// this goes thru ->v()
if (t && v("timestamp") != "off" // && abbrev("_message", mc)
&& stringp(data)) {
# ifndef GAMMA
if (stringp(t)) t = to_int(t); // we need types ;)
# endif
if (v("timestamp") == "on") {
string msa = " ";
msa[0] = 0x01; // msa's CTCP character
// should use psyctime instead of unixtime
data = msa +"TS "+ (t - PSYC_EPOCH) +msa+ data;
} else
data = "["+ hhmm(ctime(t)) +"] "+ data; // use T() ?
data = "["+ time_or_date(t) +"] "+ data; // use T() ?
P3(("%O data is %O\n", ME, data))
}
#endif
>>>>>>> 1.107
P3(("c:r pre ptext: %O %O %O %O\n", template, vars, data, source ));
output = psyctext( template, vars, data, source);
P3(("c:r 1st ptext: %O\n", output));
if (!output || output=="") return D2(D("irc/user: empty output\n"));
#ifndef _flag_disable_stamp_time_IRC
if (t = vars["_time_place"] || vars["_time_log"]) {
PT(("%O got timestamp %O\n", ME, t))
}
if (t && v("timestamp") != "off" && abbrev("_message", mc)
&& stringp(output)) {
output = v("timestamp")
? output +" ["+ hhmm(ctime(t)) +"]" // use T() ?
: output + "%TS "+ hhmm(ctime(t)) +"%";
}
#endif
#ifdef NEW_LINE
output += "\n";
#else
if (template == "") {
#ifdef PREFIXES
// der ganze prefix kram is im irc protokoll in der
// tat blödsinn.. muss ma anders machen..
# ifdef PREFIXES //{{{
if (abbrev("_prefix", mc)) return prefix = output+" ";
else
#endif
# endif //}}}
output += "\n";
}
if (output[0] == '#') output = SERVER_SOURCE + output[1..];
#endif
if (output[0] == '#') output = SERVER_SOURCE + output[1 ..];
else if (output[0] != ':') {
string t2;
@ -228,12 +228,11 @@ render(string mc, string data, mapping vars, mixed source) {
log_file("IRC_TEXTDB", "%O\n", mc);
return;
}
// _silent: when casts from a conversation-filtered place
// arrive, which isnt known to the client as a channel, we
// revert to personal notices to not irritate it.
if (
#ifdef NOT_EXPERIMENTAL
#if 1
// would be nicer to check if source is a place but
// isn't trivial right here.. looks like joining remote
// xmpp: mucs is affected by this change - you may not
@ -275,13 +274,16 @@ render(string mc, string data, mapping vars, mixed source) {
"_members" : vars["_nick_me"] ]));
w(mc[..<8] + "_end", 0, vars);
}
P4(("calling emit(%O)\n", output));
emit(output);
}
// server:w() doesnt call this anyway, so we dont need last_prefix
//volatile private string last_prefix;
emit(string output) {
//PT(("common:emit %O %O\n", ME, output));
string* outlines;
P3(("common:emit %O %O\n", ME, output));
// misteries of virtual inheritance.. why doesnt this get called
// from gatebot? we need to get this working for 512-split!!
#ifdef _flag_log_sockets_IRC
@ -296,25 +298,37 @@ emit(string output) {
P4(("output in %O = %O\n", cs, output))
}
#endif
if (output[<1] != '\n')
return EMIT(output);
if (strlen(output) < MAX_IRC_BYTES)
return EMIT(chomp(output) + "\r\n");
else {
if (output[<1] != '\n') {
// this is used when prompting for password
P4(("irc:emit optimized for prefix on %O\n", output))
return EMIT(output);
}
outlines = explode(slice_from_end(output, 0, 2), "\n");
if (sizeof(outlines) == 1 && strlen(output) < MAX_IRC_BYTES) {
// optimized for single line
P4(("irc:emit single %O\n", outlines[0]))
return EMIT(outlines[0] + "\r\n");
} else {
string split_prefix, line;
int cut, t;
cut = strstr(output, " :");
P3(("IRC:emit splitting large line at %O\n%O\n", cut, output))
P4(("IRC:emit splitting large line at %O\n%O\n", cut, outlines))
if (cut >= 0) {
split_prefix = output[..++cut];
output = output[++cut..<2];
if (output[0] == output[<1] && output[0] == 0x01) {
output = chop(output);
split_prefix = outlines[0][.. ++cut];
#if 0 // annoying rendering bug we had here.. but is <2 always wrong?
outlines[0] = outlines[0][++cut .. <2];
#else
outlines[0] = outlines[0][++cut .. <1];
#endif
if (strlen(outlines[0])
&& outlines[0][0] == outlines[0][<1]
&& outlines[0][0] == 0x01) {
outlines[0] = chop(outlines[0]);
}
} else {
split_prefix = ""; //last_prefix;
output = chop(output);
outlines[0] = chop(outlines[0]);
}
// because of additional \\\r\n we have to subtract 3
cut = MAX_IRC_BYTES-3 - strlen(split_prefix);
@ -324,10 +338,9 @@ emit(string output) {
"to be able to do 512 splitting\n%O\n", ME, line))
return;
}
foreach(line : explode(output, "\n")) if (strlen(line)) {
// maybe we should just throw away everything beyond
foreach(line : outlines) if (strlen(line)) {
while (strlen(line) > cut) {
#ifdef NOT_EXPERIMENTAL
#if 1
// we shall look for last whitespace instead
t = rindex(line, ' ', cut);
if (t > 9) {
@ -337,12 +350,14 @@ emit(string output) {
// any realistic ideas
// how to do do this
// just once?
P4(("splitting an msa line %O\n", line[.. t]))
EMIT(split_prefix + line[..t]
+ line[0..0] + "\r\n");
line = line[t+1..];
line = line[t+1 ..];
} else {
EMIT(split_prefix + line[..t]+ "\r\n");
line = line[t+1..];
P4(("time for %O\n", line[.. t]))
EMIT(split_prefix + line[.. t]+ "\r\n");
line = line[t+1 ..];
}
} else {
P1(("%O encountered data w/out ' ' to "
@ -353,7 +368,7 @@ emit(string output) {
// we might aswell use the old
// backslash splitting code below here
}
#else
#else //{{{
t = line[cut] == '\r' ? cut-1 : cut;
// msa's CTCP character
@ -371,8 +386,9 @@ emit(string output) {
+ "\\\r\n");
line = line[cut+1..];
}
#endif
#endif //}}}
}
P4(("irc:emit each %O\n", line))
EMIT(split_prefix + line +"\r\n");
}
}

View file

@ -1,10 +1,11 @@
// $Id: decode.c,v 1.28 2008/01/21 10:25:12 lynx Exp $ // vim:syntax=lpc
// $Id: decode.c,v 1.30 2008/07/28 20:30:48 lynx Exp $ // vim:syntax=lpc
//
// generic CTCP implementation, also includes color code filter.
// msa (Markku Savela, if i remember the spelling right) came up
// with the crazy idea of using binary code 1 as the escape code
// for CTCP, so we put that code into the variable msa.
//
#include "irc.h"
#include <net.h>
volatile string msa, msare, cc, bc, uc;
@ -45,7 +46,7 @@ version(text, target, req, srcnick, source) {
sendmsg(target, "_request_version",
"[_nick] requests your version.",
([ "_nick" : srcnick ]), source );
#ifndef NO_IRC_AUTO_REQUEST_VERSION
#ifndef _flag_disable_request_version_IRC
} else if (target == query_server_unl()) {
if (text) vSet("agent", text);
#endif

View file

@ -1,4 +1,4 @@
// $Id: gatebot.c,v 1.146 2008/03/11 13:42:26 lynx Exp $ // vim:syntax=lpc
// $Id: gatebot.c,v 1.151 2008/09/12 15:37:39 lynx Exp $ // vim:syntax=lpc
//
// the PSYC-IRC gateway robot.
// based on the ircbot.c in Nemesis that i wrote in 1992. -lynX
@ -33,12 +33,11 @@
// deal with when something needs to be fixed. Having two implementations
// of the same thing wouldn't be what we want, anyway.
#include <net.h>
#include "gatebot.h"
#include <status.h>
#include <services.h>
#include <text.h>
#include <url.h>
#include "gatebot.h"
#include "error.h" // gets numeric codes
#include "reply.h" // gets numeric codes
@ -49,12 +48,12 @@ inherit IRC_PATH "decode";
// message queueing and automatic reconnect mgmt
inherit NET_PATH "circuit";
#ifndef SERVER_URL
# define SERVER_URL query_server_unl()
#ifndef _uniform_node
# define _uniform_node query_server_unl()
#endif
#ifdef RELAY
# define IRCER_UNIFORM(NICK) (SERVER_URL +"~"+ NICK)
# define IRCER_UNIFORM(NICK) (_uniform_node +"~"+ NICK)
#else
// will upgrade to irc: syntax..
# define IRCER_UNIFORM(NICK) (MYLOWERNICK +":"+ NICK)
@ -231,7 +230,7 @@ render(mc, data, vars, source) {
// return;
// }
// string ircsrc = (u[UScheme] || "xmpp") +";"+
// (u[UUser] || u[UResource][1..]) +"|"+
// (UName(u) +"|"+
// replace(u[UHost], ".", "_");
if (source) {
advertise(source);
@ -398,7 +397,7 @@ case RPL_LUSERCLIENT:
from+": "+text);
break;
case RPL_NAMREPLY:
names = text; namesfrom = from; namesto = a[3];
names = text; namesfrom = from; namesto = a[3][1 ..];
#ifdef CHAT_CHANNEL
castmsg(ME, "_notice_place_members_IRC",
"On [_nick_place_IRC]: [_members_IRC]",
@ -662,10 +661,10 @@ logon(failure) {
# endif
// leave login procedure to place.gen
#else
emit("NICK "+ IRCGATE_NICK +"\nUSER "+ IRCGATE_USERID
+" . . :"+ IRCGATE_NAME +"\n"
emit("NICK "+ IRCGATE_NICK +"\r\nUSER "+ IRCGATE_USERID
+" . . :"+ IRCGATE_NAME +"\r\n"
#ifdef IRCGATE_HIDE
+"MODE "+ IRCGATE_NICK +" +i\n"
+"MODE "+ IRCGATE_NICK +" +i\r\n"
#endif
);
#endif

View file

@ -1,4 +1,4 @@
// $Id: ghost.c,v 1.8 2007/08/27 16:54:13 lynx Exp $
// $Id: ghost.c,v 1.9 2008/04/24 15:19:36 lynx Exp $
//
// <lynX> ghost users serve the purpose of implementing all the features of
// a PSYC/Jabber identity for users of an IRC network whose identities are
@ -15,7 +15,7 @@ volatile object relay;
#include "user.c"
emit(string output) {
protected int emit(string output) {
unless (relay) {
//relay = RELAY_OBJECT -> load();
relay = find_object(RELAY_OBJECT);

View file

@ -1,5 +1,11 @@
// $Id: irc.h,v 1.17 2008/01/16 10:59:30 lynx Exp $ // vim:syntax=lpc
//
// $Id: irc.h,v 1.19 2008/08/11 09:13:12 lynx Exp $ // vim:syntax=lpc
// local debug messages - turn them on by using psyclpc -DDirc=<level>
#ifdef Dirc
# undef DEBUG
# define DEBUG Dirc
#endif
#include <net.h>
#ifndef NO_INHERIT
@ -31,3 +37,4 @@ inherit IRC_PATH "common";
#ifndef IRCD
# define IRCD D3
#endif

View file

@ -1,5 +1,5 @@
// vim:noexpandtab:syntax=lpc
// $Id: library.i,v 1.22 2007/10/08 11:00:31 lynx Exp $
// $Id: library.i,v 1.25 2008/08/23 19:07:27 lynx Exp $
//
// this gets included into the system function library
// also known as "simul_efun" in mud-speak.
@ -14,25 +14,13 @@ volatile mapping p2i;
string psyc2irc(string mc, mixed source) {
mixed c;
#if 0
// the code below will no longer generate server notices for remote
// sources - fippo likes it better that way
if (!source || objectp(source)) source = SERVER_SOURCE;
// i bet irssi wont like the !*@* (the weird problem we had with it
// about artifical nickname changes for same ident...)
//else source = ":" + source + "!*@* ";
else source = ":" + source + " ";
#else
// unfortunately, "pidgin" displays the non-server notices in an
// very annoying manner - one new window for each friend...
// will have to postpone this change until pidgin is fixed
source = SERVER_SOURCE;
#endif
// looks like this should entirely evaporate into textdb...
unless (p2i) p2i = ([ // sorted by psyc method
"_list_places_members" : RPL_NAMREPLY,
// asking for a prompt is an error in irc protocol
"_query_password" : ERR_PASSWDMISMATCH,
"_status_place_topic" : RPL_TOPIC,
//"_error_necessary_membership" : ERR_NOSUCHCHANNEL,
"_error_unavailable_nick_place" : ERR_BANNEDFROMCHAN, // pretty close
//"_status_place_members" : RPL_NAMREPLY,
@ -50,6 +38,23 @@ string psyc2irc(string mc, mixed source) {
if (c = p2i[mc]) return SERVER_SOURCE + c;
// if (abbrev("_notice_place_enter", mc)) c = "JOIN";
// else if (abbrev("_notice_place_leave", mc)) c = "PART";
#ifdef _flag_enable_notice_from_source_IRC
// the code below will no longer generate server notices for remote
// sources - fippo likes it better that way
// if (!source) source = SERVER_SOURCE;
if (!source || objectp(source)) source = SERVER_SOURCE;
// why aren't we trying to display something useful for an object here?
//
// i bet irssi wont like the !*@* (the weird problem we had with it
// about artifical nickname changes for same ident...)
//else source = ":" + source + "!*@* ";
else source = ":" + source + " ";
return source +"NOTICE";
#else
// unfortunately, "pidgin" displays the non-server notices in an
// very annoying manner - one new window for each friend...
// will have to postpone this change until pidgin is fixed
return SERVER_SOURCE +"NOTICE";
#endif
}

View file

@ -1,4 +1,4 @@
// $Id: reply.h,v 1.9 2006/01/13 20:28:57 lynx Exp $ // vim:syntax=lpc
// $Id: reply.h,v 1.10 2008/07/27 21:27:07 lynx Exp $ // vim:syntax=lpc
//
// many useful and broken numerics have been added since the IRC RFCs
@ -86,6 +86,7 @@
#define RPL_NOTOPIC "331" // determine the channel topic, one of two
#define RPL_TOPIC "332" // replies is sent. If the topic is set,
// RPL_TOPIC is sent back else RPL_NOTOPIC.
// ... we also employ "333" for delivering author and timestamp
#define RPL_INVITING "341" // Returned by the server to indicate that
// the attempted INVITE message was

View file

@ -1,4 +1,4 @@
// $Id: server.c,v 1.85 2007/11/27 16:13:41 lynx Exp $ // vim:syntax=lpc
// $Id: server.c,v 1.86 2008/10/16 13:07:13 lynx Exp $ // vim:syntax=lpc
//
// IRC protocol receptionist
//
@ -41,6 +41,7 @@ parse(a) {
if (ME) next_input_to(#'parse);
}
// allow for nickserv syntax somehow?
promptForPassword() {
// string me;
//

View file

@ -1,4 +1,5 @@
// $Id: user.c,v 1.552 2008/04/11 10:37:25 lynx Exp $ // vim:syntax=lpc
// vim:foldmethod=marker:syntax=lpc:noexpandtab
// $Id: user.c,v 1.565 2008/10/01 10:59:47 lynx Exp $
//
// server-side handler for a logged in IRC client
//
@ -36,14 +37,14 @@ msg(source, mc, data, mapping vars, showingLog) {
int special;
mixed a, res;
#ifdef PREFIXES
#ifdef PREFIXES //{{{
//ob das folgende so klug ist müssen wir (ich?) noch ergründen.
//aber da es temporär eh nicht genutzt wird...
//bis dahin erstmal jedesmal löschen.
if (prefix) {
prefix = 0;
}
#endif
#endif //}}}
P4(("irc:msg (%O,%s,%O,%O)\n", source, mc, data, vars))
P2(("irc:msg (%O,%s,%O..)\n", source, mc, data))
@ -88,11 +89,11 @@ msg(source, mc, data, mapping vars, showingLog) {
// this is partly a hack for a more generic 512-byte-length problem
// but we need a #366 end of names...
// maybe call ::msg and then return writing the 366
#ifdef ENTER_MEMBERS
#ifdef ENTER_MEMBERS //{{{
if (mc == "_status_place_members")
return _status_place_members(source, mc, data, vars);
else
#endif
#endif //}}}
if (mc == "_message_announcement") {
// what about not checking for _context and using ::msg() or even
// w()?
@ -113,7 +114,6 @@ msg(source, mc, data, mapping vars, showingLog) {
static int namreply(mapping vars) {
mixed u;
#ifdef NOT_EXPERIMENTAL
// TODO: control == silent ist eigentlich nicht richtig,
// control == keine join/part waere richtiger
// && vars["_control"] != "silent"
@ -137,7 +137,7 @@ static int namreply(mapping vars) {
// normal behaviour, when _amount is sent instead of _list
// w/o is american for without ;)
P3(("Empty or anonymous channel: %O w/o _list_members\n",
mc))
vars["_nick_place"]))
}
// this code is all weirdly redundant with net/user.c
// doing renderMembers itself in some cases, in some not -
@ -148,18 +148,6 @@ static int namreply(mapping vars) {
"_members" : u,
"_nick_me" : MYNICK ]) );
render("_status_place_members_end", 0, vars);
#else
if (pointerp(vars["_list_members_nicks"])) {
u = implode(vars["_list_members_nicks"], " "); // _tab
# ifdef _flag_encode_uniforms_IRC
u = uniform2irc(u);
# endif
w("_status_place_members", 0, ([
"_nick_place" : vars["_nick_place"],
"_members" : u ]) );
}
w("_status_place_members_end", 0, vars);
#endif
return 1;
}
@ -250,17 +238,17 @@ w(string mc, string data, mapping vars, mixed source) {
P3(("%O: irc:w(%O, %O, %O, %O) %O\n", ME, mc, data, 0, source, vars))
#ifdef PREFIXES
#ifdef PREFIXES //{{{
// completely skip these methods.. sagt fippo.. na ob das richtig ist!?
if (abbrev("_prefix", mc)) return 1;
#endif
#endif //}}}
#ifndef GHOST
// should it be..?
//unless (ONLINE) return;
unless (interactive(ME)) return;
#endif
#ifdef VARS_IS_SACRED
#ifdef VARS_IS_SACRED //{{{
// "VARS_IS_SACRED" bedeutet dass *kein* copy gemacht wurde und
// man deshalb hier paranoid sein muss. der normalfall ist, dass
// der raum uns ne kopie gibt.. ist auch gut so, denn der irc code
@ -273,7 +261,7 @@ w(string mc, string data, mapping vars, mixed source) {
// konnten ist mir ein rätsel.. aber ich habs mit eigenen augen
// gesehen.. ich kopiers sogar nach /ve/data/damaged-rendezvous.o
// ah.. der neue foreach code im place ist schuld
#else
#else //}}}
unless (mappingp(vars)) vars = ([]);
#endif
if (trail("_important", mc)) {
@ -327,7 +315,7 @@ w(string mc, string data, mapping vars, mixed source) {
return ::wAction(mc, data, vars
+ ([ "_action" : T("_TEXT_action_says", 0) ]),
source, "", vars["_nick"]);
#ifdef OLD_LOCAL_NICK_PLAIN_TEXTDB_HACK
#ifdef OLD_LOCAL_NICK_PLAIN_TEXTDB_HACK //{{{
else if (vars["_nick_local"]) { // less work
if (mc == "_message_echo_public_action"
&& (t = vars["_INTERNAL_nick_plain"])) {
@ -343,7 +331,7 @@ w(string mc, string data, mapping vars, mixed source) {
sTextPath(0, v("language"), v("scheme"));
}
}
#else
#else //}}}
else if (vars["_nick_local"] &&
vars["_nick_local"] == vars["_nick"])
vars["_nick"] = vars["_INTERNAL_nick_plain"] || vars["_nick_verbatim"];
@ -394,11 +382,12 @@ w(string mc, string data, mapping vars, mixed source) {
|| abbrev(query_server_unl() +"~", source)
#endif
) {
#ifdef GHOST
#ifdef GHOST //{{{
// in S2S mode we are not supposed to deliver nick!user@host
// thus we use plain nicks or plain uniforms
vars["_source_hack"] = vars["_INTERNAL_nick_plain"] || vars["_nick"];
#else
#else //}}}
# if 0 // OLD // according to elmex "should never happen" happened...
if (vars["_nick"]) {
vars["_source_hack"] =
(vars["_INTERNAL_nick_plain"] || vars["_nick"])
@ -407,15 +396,22 @@ w(string mc, string data, mapping vars, mixed source) {
+"@" SERVER_HOST;
} else // should never happen
vars["_source_hack"] = to_string(source);
# else // EXPERIMENTAL
nick2 = vars["_INTERNAL_nick_plain"] || vars["_nick"];
vars["_source_hack"] = nick2 ? nick2
+"!"+ (vars["_nick_long"] || vars["_INTERNAL_nick_plain"]
|| vars["_nick"]) +"@" SERVER_HOST
: to_string(source); // should never happen
# endif
} else if (abbrev("_echo_place_enter", mc)) {
vars["_source_hack"] = MYNICK + "!" + MYNICK + "@" SERVER_HOST;
#endif
} else {
#ifdef GHOST
#ifdef GHOST //{{{
// in S2S mode we are not supposed to deliver nick!user@host
// thus we use plain nicks or plain uniforms
vars["_source_hack"] = source;
#else
#else //}}}
u = parse_uniform(source);
unless (u) {
// this happens when a user@host notation gets here..
@ -431,8 +427,7 @@ w(string mc, string data, mapping vars, mixed source) {
nick2 = raliases[source];
vars["_source_hack"] = nick2 + ((u[UUser] ||
(u[UResource] && u[UResource][0]))
? "!" + (u[UUser] || u[UResource][1..])
+ "@" + u[UHost]
? "!"+ UName(u) +"@"+ u[UHost]
: "!"+ (vars["_nick_long"] || vars["_INTERNAL_nick_plain"]
|| vars["_nick"])
+"@alias.undefined");
@ -444,10 +439,10 @@ 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);
vars["_source_hack"] = u[UScheme] + "://"
+ u[UHostPort] + "/~" + (u[UUser] || u[UResource][1..])
+ "!" + (u[UUser] || u [UResource][1..]) + "@"
+ u[UHostPort];
+ u[UHostPort] +"/~"+ tmp +"!"+ tmp +"@"
+ u[UHostPort];
P4(("w:psyc _source_hack %O\n", vars["_source_hack"]))
} else {
vars["_source_hack"] = uniform2irc(source)
@ -508,7 +503,7 @@ w(string mc, string data, mapping vars, mixed source) {
output[<2] = 0x01;
emit(output);
return 1;
# ifdef IRC_FRIENDCHANNEL
# ifdef IRC_FRIENDCHANNEL //{{{
} else {
# ifdef IRC_FRIENDCHANNEL_HEREAWAY
string old = vars["_degree_availability_old"];
@ -539,14 +534,14 @@ w(string mc, string data, mapping vars, mixed source) {
else
emit(":"+ SERVER_HOST +" MODE & -v-o "+ vars["_nick"] +"\n");
# endif
# endif
# endif //}}}
}
} else
# endif
P2(("irc/user:w(%O,%O,..,%O)\n", mc, data, source))
t = 0;
PSYC_TRY(mc) {
#ifdef IRC_FRIENDCHANNEL
#ifdef IRC_FRIENDCHANNEL //{{{
case "_list_friends_offline": // _tab
t = " "; // fall thru
case "_list_friends_away": // _tab
@ -587,7 +582,13 @@ w(string mc, string data, mapping vars, mixed source) {
reply(RPL_ENDOFNAMES, "& :End of Buddylist.");
# endif
return 1;
#endif
#endif //}}}
case "_status_place_topic":
// traditional IRC topic message without author
render(mc +"_only", 0, vars);
// extra semi-official '333' code containing author and time
render(mc +"_author", 0, vars);
return 1;
case "_status_place_members_automatic":
mc = "_status_place_members"; // fall thru
case "_status_place_members":
@ -684,13 +685,13 @@ w(string mc, string data, mapping vars, mixed source) {
"_nick_new" : vars["_alias"] ])) + "\n");
break;
#endif
#ifdef ENTER_MEMBERS //{{{
// now obsolete since net/user does the rendering of _list_members
// and converts it to _status_members* w()
#ifdef ENTER_MEMBERS
case "_echo_place_enter":
namreply(vars);
break;
#endif
#endif //}}}
case "_message_public":
case "_message":
case "_notice_place_leave":
@ -741,29 +742,25 @@ wAction(mc, data, vars, source, variant, nick) {
return ::wAction(mc, data, vars, source, variant, nick);
}
#ifndef HISTORY_AMOUNT
# define HISTORY_AMOUNT 5
#ifndef _limit_amount_history_place_default
# define _limit_amount_history_place_default 5
#endif
// irc has it's own autojoin, which is a little different from others
autojoin() {
#ifndef GHOST // too tricky for now
#if !defined(_flag_disable_place_enter_automatic) && !defined(GHOST) // too tricky for now
mixed t, t2;
#if 0 //def DRIVER_HAS_SMALL_BUFFER
int delay;
#endif
string s;
if (isService) return -1;
# ifndef GAMMA
unless (v("place"))
vSet("place", T("_MISC_defplace", DEFPLACE));
# endif
// subscriptions are stored in lowercase, warum auch immer
if (sizeof(v("subscriptions")))
foreach (s in v("subscriptions")) {
#if 0 //def DRIVER_HAS_SMALL_BUFFER
call_out(#'placeRequest, delay++, s, "_request_enter", //_automatic_subscription
0, 0, ([ "_amount_history" : HISTORY_AMOUNT ]));
#else
// call_out(#'placeRequest, delay++, s, "_request_enter", //_automatic_subscription
placeRequest(s,
# ifdef SPEC
"_request_context_enter"
@ -771,32 +768,33 @@ autojoin() {
"_request_enter"
# endif
, // _automatic_subscription
0, 0, ([ "_amount_history" : HISTORY_AMOUNT ]));
#endif
0, 0, ([ "_amount_history" : _limit_amount_history_place_default ]));
} else {
#if 0 //def DRIVER_HAS_SMALL_BUFFER
call_out(#'placeRequest, delay++, v("place"), "_request_enter_login",
0, 0, ([ "_amount_history" : HISTORY_AMOUNT ]));
#else
placeRequest(v("place"),
# ifdef SPEC
"_request_context_enter"
# else
"_request_enter"
# ifdef GAMMA
unless (v("place"))
vSet("place", T("_MISC_defplace", DEFPLACE));
# endif
# ifndef _flag_disable_place_default
// call_out(#'placeRequest, delay++, v("place"), ...
placeRequest(v("place"),
# ifdef SPEC
"_request_context_enter"
# else
"_request_enter"
# endif
"_login", 0, 0,
([ "_amount_history" : HISTORY_AMOUNT ]));
#endif
([ "_amount_history" : _limit_amount_history_place_default ]));
# endif
}
#ifdef IRC_FRIENDCHANNEL
# ifdef IRC_FRIENDCHANNEL_HEREAWAY
# ifdef IRC_FRIENDCHANNEL //{{{
# ifdef IRC_FRIENDCHANNEL_HEREAWAY
emit(":"+ MYNICK +" JOIN :&HERE\n");
emit(":"+ MYNICK +" JOIN :&AWAY\n");
# else
# else
emit(":"+ MYNICK +" JOIN :&\n");
# endif
#endif
#endif
# endif
# endif //}}}
#endif // GHOST || _flag_disable_place_enter_automatic
}
logon() {
@ -812,6 +810,13 @@ logon() {
// vDel("agent"); -- either you start a ctcp to find it out
// or we prefer to have the old info
vDel("query"); // server-side query would drive most ircers crazy
#if 0
// what's wrong with doing this.. here?
// it's redundant, as it happens again in ::logon
sTextPath(0, v("language"), v("scheme"));
// it's necessary for _request_user_amount to work
// let's see if we can simply postpone that to after ::logon
#endif
//
// this helps handle the /set visiblespeakaction setting if this
// define has changed
@ -863,11 +868,22 @@ logon() {
// SILENCE: ach und ich weiss nicht ob /quote silence bzw /silence den psyced befehl silence aufruft, aber imo sollte er das aus verwirrungs-vermeidungs-gruenden nicht tun. silence im irc ist serverseitiges ignore.
# endif
# ifndef BETA
lusers();
# endif
motd();
rc = ::logon();
// we have to do this after logon, or the textdb will fail
# ifndef NO_IRC_AUTO_REQUEST_VERSION
// the following things happen after logon, because the textdb isn't
// available earlier. if this order of things is not acceptable, then
// we have to run sTextPath twice (see above)
# ifdef BETA
# ifndef _flag_disable_query_server
sendmsg("/", "_request_user_amount", 0, ([]));
// reply.h says RPL_LUSERME is mandatory.. huh.. FIXME?
// #255 [_nick_me] :I have 4404 clients and 4404 servers
# endif
# endif
# ifndef _flag_disable_request_version_IRC
// since we cannot relay tagged version requests to the client
// easily, we request the version number once at starting time.
// any other protocol finds it completely normal to exchange
@ -995,6 +1011,7 @@ case "mode":
return 1;
case "topic":
unless (args && strlen(args)) return;
P4(("IRC topic %O %O\n", args, text))
unless (t = channel2place(args)) return;
t = find_place(t) || t;
// The topic for channel <channel> is returned if there is
@ -1022,16 +1039,30 @@ case "user":
vSet("mottotext", text);
return 1;
case "invite":
sscanf(args, "%s #%s", n, t);
// t = channel2place(t) || t;
vSet("place", t);
place = find_place(t);
P2(("irc: invite %s into %s = %O\n", n, t, place))
if (invite(n)) {
// room should send this if successful or
// ERR_USERONCHANNEL or ERR_CHANOPRIVSNEEDED otherwise?
reply(RPL_INVITING, args);
if (sscanf(args, "%s #%s", n, t) && strlen(t)) {
t2 = find_place(t);
if (!t2 || !places[t2]) {
PT(("irc: invite %s into %s = %O.\n", n, t, t2))
w("_error_necessary_membership",
0, ([ "_nick_place": t ]));
return 1;
}
vSet("place", t);
place = t2;
} else {
#if 0
// atypical: allow for invite using current place.
n = args;
// runs the risk of you inviting the person to the
// wrong channel. too risky. let's go traditional:
#else
reply(ERR_NEEDMOREPARAMS,
"INVITE :Not enough parameters");
return 1;
#endif
}
if (invite(n)) reply(RPL_INVITING, args);
// else: ERR_USERONCHANNEL or ERR_CHANOPRIVSNEEDED otherwise?
return 1;
case "join":
case "part":
@ -1153,7 +1184,7 @@ static privmsg(args, text, req) {
unless (stringp(text) && strlen(text)) return;
#ifdef EXPERIMENTAL
#ifdef GAMMA
// fippoism typing indicator.. but shouldn't it *do* something
// after detecting this CTCP-like "typing" flag hack?
if (strlen(text) > 1 && text[<1] == 0x0f && text[<2] == 0x0f) {
@ -1161,9 +1192,9 @@ static privmsg(args, text, req) {
}
#endif
if (index(args, ',') > 0) {
w("_failure_unsupported_targets_multiple",
w("_failure_unsupported_targets_multiple",
"We do not allow sending to several recipients at once. Why did your client ignore our MAXTARGETS=1 directive?");
return 0;
return 0;
}
if (room = channel2place(args)) {
if (!place || !v("place") || stricmp(room, v("place"))) {