psyced/world/net/irc/library.i

56 lines
2.1 KiB
OpenEdge ABL

// vim:noexpandtab:syntax=lpc
// $Id: library.i,v 1.22 2007/10/08 11:00:31 lynx Exp $
//
// this gets included into the system function library
// also known as "simul_efun" in mud-speak.
#define NO_INHERIT
#include "irc.h" // gets numeric codes
#include "error.h" // gets numeric codes
#include "reply.h" // gets numeric codes
// one global method mapping
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
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_unavailable_nick_place" : ERR_BANNEDFROMCHAN, // pretty close
//"_status_place_members" : RPL_NAMREPLY,
// not accurate, because it is the /motto command
//"_echo_set_description" : RPL_NOWAWAY,
//"_echo_set_description_none" : RPL_UNAWAY,
// not accurate, because it only reflects the existence of a text msg
//"_status_presence_description" : RPL_NOWAWAY,
//"_status_presence" : RPL_UNAWAY,
// and what's worse, it's not working.. let's try something else..
// i'll just add these messages to /irchere and /ircgone
"_echo_set_description_away" : RPL_NOWAWAY,
"_echo_set_description_away_none" : RPL_UNAWAY,
]);
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";
return source +"NOTICE";
}