mirror of
git://git.psyced.org/git/psyced
synced 2024-08-15 03:25:10 +00:00
let the past begone in cvs land. welcome to igit igit!
This commit is contained in:
commit
4e601cf1c7
509 changed files with 77963 additions and 0 deletions
54
world/net/include/auto.h
Normal file
54
world/net/include/auto.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
// $Id: auto.h,v 1.14 2007/09/07 09:07:32 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
#define _INCLUDE_AUTO_H
|
||||
|
||||
// first identify the driver
|
||||
// then load the driver abstraction kit
|
||||
//
|
||||
#ifdef __PIKE__
|
||||
|
||||
# include "../../drivers/pike/include/interface.h"
|
||||
# define ME this
|
||||
|
||||
#else // PIKE
|
||||
|
||||
#ifdef MUDOS
|
||||
# define DRIVER_PATH "/drivers/mudos/"
|
||||
# include <interface.h>
|
||||
#else
|
||||
//# if __EFUN_DEFINED__(filter)
|
||||
# ifdef __LDMUD__ // also matches __psyclpc__
|
||||
//# define LDMUD // we can check for __LDMUD__ instead
|
||||
# ifdef MUD
|
||||
# define DRIVER_PATH "/net/drivers/ldmud/"
|
||||
# else
|
||||
# define DRIVER_PATH "/drivers/ldmud/"
|
||||
# endif
|
||||
# else
|
||||
# define AMYLAAR
|
||||
# define DRIVER_PATH "/drivers/amylaar/"
|
||||
# endif
|
||||
# ifdef DRIVER_PATH
|
||||
# include DRIVER_PATH "sys/input_to.h"
|
||||
// hmm.. wanted to make this DEBUG>1 only, but.. doesn't work.. tant pis
|
||||
# include DRIVER_PATH "sys/debug_info.h"
|
||||
# include DRIVER_PATH "include/interface.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// useful global macros
|
||||
#define ME this_object()
|
||||
|
||||
#endif // PIKE
|
||||
|
||||
// perlisms for readability
|
||||
#define unless(COND) if (!(COND))
|
||||
#define until(COND) while (!(COND))
|
||||
|
||||
// more useful perlisms
|
||||
#define chop(STRING) slice_from_end(STRING, 0, 2)
|
||||
#define chomp(STRING) (char_from_end(STRING, 1) == '\n' ? chop(STRING) : STRING)
|
||||
|
||||
// extracts hh:mm:ss format from ctime output
|
||||
#define hhmmss(CTIME) CTIME[11..18]
|
||||
// extracts hh:mm format from ctime output (for idle times)
|
||||
#define hhmm(CTIME) CTIME[11..15]
|
9
world/net/include/closures.h
Normal file
9
world/net/include/closures.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
// closure.d -fix && rettung meines syntax-highlightings, sagt elridion
|
||||
|
||||
#define CL_INDEX (#'[)
|
||||
#define CL_IF (#'?)
|
||||
#define CL_NIF (#'?!)
|
||||
#define CL_RANGE (#'[..])
|
||||
#define CL_L_RANGE (#'[..)
|
||||
#define CL_LOWER_CASE (#'lower_case)
|
||||
|
122
world/net/include/debug.h
Normal file
122
world/net/include/debug.h
Normal file
|
@ -0,0 +1,122 @@
|
|||
// $Id: debug.h,v 1.23 2008/01/07 14:15:48 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
/* simplified form of conditional compilation */
|
||||
|
||||
#ifdef CONSOLE_CHARSET
|
||||
# if CONSOLE_CHARSET != SYSTEM_CHARSET
|
||||
# define ICONV(TEXT) convert_charset(TEXT, SYSTEM_CHARSET, CONSOLE_CHARSET)
|
||||
# else
|
||||
# define ICONV(TEXT) TEXT
|
||||
# endif
|
||||
#else
|
||||
# define ICONV(TEXT) TEXT
|
||||
#endif
|
||||
|
||||
#ifdef __LDMUD__
|
||||
//# define D(text) log_file(DEBUG_LOG, text)
|
||||
# define D(text) debug_message(ICONV(text), 1+4) // stdout + file
|
||||
# define PV(args) debug_message(ICONV(sprintf args), 4) // file only
|
||||
#else
|
||||
# define D(text) debug_message(ICONV(text))
|
||||
# define PV(args) debug_message(ICONV(sprintf args))
|
||||
#endif
|
||||
|
||||
// obsolete..?
|
||||
#define S sprintf
|
||||
|
||||
// the cool new thang:
|
||||
#define PP(args) D(sprintf args)
|
||||
// the old thang, but it's still being used in JaZ/* and suchlike
|
||||
#define P printf
|
||||
|
||||
#ifndef DEBUG_FLAGS
|
||||
# ifdef DEBUG
|
||||
# ifndef DEVELOPMENT
|
||||
# define PT(MSG)
|
||||
# define DT(CODE)
|
||||
# else
|
||||
# define PT(MSG) PP(MSG); /* temporary massive debug mode */
|
||||
# define DT(CODE) CODE
|
||||
# endif
|
||||
# if DEBUG == 1
|
||||
# define DEBUG_FLAGS 0x03
|
||||
# else
|
||||
# if DEBUG == 2
|
||||
# define DEBUG_FLAGS 0x07
|
||||
# else
|
||||
# if DEBUG == 3
|
||||
# define DEBUG_FLAGS 0x0f
|
||||
# else
|
||||
# if DEBUG == 4
|
||||
# define DEBUG_FLAGS 0x1f
|
||||
# else
|
||||
# define DEBUG_FLAGS 0x01
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
# define PT(MSG)
|
||||
# define DT(CODE)
|
||||
# define DEBUG_FLAGS 0x00 /* no debugging */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if DEBUG_FLAGS & 0x01
|
||||
# define D0(CODE) CODE
|
||||
# define P0(MSG) PP(MSG);
|
||||
#else
|
||||
# define D0(CODE)
|
||||
# define P0(MSG)
|
||||
#endif
|
||||
|
||||
#if DEBUG_FLAGS & 0x02
|
||||
# define D1(CODE) CODE
|
||||
# define P1(MSG) PP(MSG);
|
||||
// just can't go into interface.h
|
||||
# pragma save_types
|
||||
# pragma warn_deprecated
|
||||
#else
|
||||
# define D1(CODE)
|
||||
# define P1(MSG)
|
||||
#endif
|
||||
|
||||
#if DEBUG_FLAGS & 0x04
|
||||
# define D2(CODE) CODE
|
||||
# define P2(MSG) PP(MSG);
|
||||
#else
|
||||
# define D2(CODE)
|
||||
# define P2(MSG)
|
||||
#endif
|
||||
|
||||
#if DEBUG_FLAGS & 0x08
|
||||
# define D3(CODE) CODE
|
||||
# define P3(MSG) PV(MSG);
|
||||
#else
|
||||
# define D3(CODE)
|
||||
# define P3(MSG)
|
||||
#endif
|
||||
|
||||
#if DEBUG_FLAGS & 0x10
|
||||
# define D4(CODE) CODE
|
||||
# define P4(MSG) PV(MSG);
|
||||
#else
|
||||
# define D4(CODE)
|
||||
# define P4(MSG)
|
||||
#endif
|
||||
|
||||
#if DEBUG > 0
|
||||
# ifdef STRICT
|
||||
# define ASSERT(NAME,COND,VALUE) { unless (COND) { \
|
||||
PP(("Assertion %s failed in %O: %O\n", NAME, ME, VALUE)); \
|
||||
raise_error("Assertion failed (strict mode).\n"); } }
|
||||
# else
|
||||
# define ASSERT(NAME,COND,VALUE) { unless (COND) \
|
||||
PP(("Assertion %s failed in %O: %O\n", NAME, ME, VALUE)); }
|
||||
# endif
|
||||
#else
|
||||
# define ASSERT(NAME,CONDITION,VALUE)
|
||||
#endif
|
||||
|
||||
// #define WHERE_AM_I \
|
||||
// PP(("FILE " __FILE__ " DIR " __DIR__ " PATH0 " __PATH__(0) "\n"));
|
||||
|
4
world/net/include/dns.h
Normal file
4
world/net/include/dns.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#define DNS_SRV_NAME 0
|
||||
#define DNS_SRV_PORT 1
|
||||
#define DNS_SRV_PREF 2
|
||||
#define DNS_SRV_WEIGHT 3
|
41
world/net/include/ht/http.h
Normal file
41
world/net/include/ht/http.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
// $Id: http.h,v 1.6 2008/04/09 08:29:37 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
/*
|
||||
* NAME: http.h
|
||||
* DESCRIPTION: macros for HTTP
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_HT_HTTP_H
|
||||
#define _INCLUDE_HT_HTTP_H
|
||||
|
||||
#define HTTP_SERVER SERVER_VERSION " " DRIVER_VERSION
|
||||
#define HTTP_SVERS "HTTP/1.0"
|
||||
|
||||
// HTTP server replies
|
||||
|
||||
#define R_OK 200
|
||||
#define R_CREATED 201
|
||||
#define R_ACCEPTED 202
|
||||
#define R_PARTIAL 203
|
||||
#define R_NORESPONSE 204
|
||||
|
||||
#define R_MOVED 301
|
||||
#define R_FOUND 302
|
||||
#define R_METHOD 303
|
||||
#define R_NOTMODIFIED 304
|
||||
|
||||
#define R_BADREQUEST 400
|
||||
#define R_UNAUTHORIZED 401
|
||||
#define R_PAYMENTREQ 402
|
||||
#define R_FORBIDDEN 403
|
||||
#define R_NOTFOUND 404
|
||||
|
||||
#define R_INTERNALERR 500
|
||||
#define R_NOTIMPLEM 501
|
||||
#define R_TEMPOVERL 502
|
||||
#define R_GATEWTIMEOUT 503
|
||||
|
||||
#ifndef hthead
|
||||
# define hthead(TITLE) "<title>" CHATNAME " - "+( TITLE )+"</title>"
|
||||
#endif
|
||||
|
||||
#endif
|
17
world/net/include/lang.h
Normal file
17
world/net/include/lang.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
// psyced supports multilingual message output
|
||||
// these are the languages currently available
|
||||
// de_f = formal german: Sie-Form
|
||||
// en_g = geek english: looks like irc even in telnet, applet etc.
|
||||
//
|
||||
// it = italian is 30% done, the rest is german,
|
||||
// so it is useless to most. don't use it yet.
|
||||
|
||||
#define LANGUAGES "de", "de_f", "en", "en_g", "it"
|
||||
|
||||
// if you define this variable in your local.h,
|
||||
// telnet and other accesses will default to using
|
||||
// that language instead of english
|
||||
|
||||
#ifndef DEFLANG
|
||||
# define DEFLANG "en"
|
||||
#endif
|
10
world/net/include/methods.h
Normal file
10
world/net/include/methods.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
// not used..
|
||||
|
||||
#define M_eing ({ "error", "invalid", "name", "group" })
|
||||
|
||||
#define M_wug ({ "warning", "usage", "go" })
|
||||
#define M_wuq ({ "warning", "usage", "query" })
|
||||
#define M_wut ({ "warning", "usage", "tell" })
|
||||
|
||||
#define M_sqe ({ "status", "query", "end" })
|
||||
#define M_sqs ({ "status", "query", "start" })
|
8
world/net/include/misc.h
Normal file
8
world/net/include/misc.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
// $Id: misc.h,v 1.1 2007/06/17 20:50:45 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
|
||||
#define SOCKET_LIST_USER 1
|
||||
#define SOCKET_LIST_GHOST 2
|
||||
#define SOCKET_LIST_LINK 4
|
||||
|
||||
#define SOCKET_LIST_ALL (1+2+4)
|
||||
|
245
world/net/include/net.h
Normal file
245
world/net/include/net.h
Normal file
|
@ -0,0 +1,245 @@
|
|||
// $Id: net.h,v 1.142 2008/04/11 18:48:26 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
#ifndef _INCLUDE_NET_H
|
||||
#define _INCLUDE_NET_H
|
||||
|
||||
//efine SERVER_VERSION_MINOR "RC0i"
|
||||
#define SERVER_VERSION "psyced/0.99"
|
||||
#define SERVER_DESCRIPTION "PSYC-enhanced multicasting chat and messaging daemon"
|
||||
|
||||
#define TCP_PENDING_DISCONNECT 1
|
||||
#define TCP_PENDING_TIMEOUT 2
|
||||
|
||||
#define RANDHEXSTRING sprintf("%x", random(__INT_MAX__))
|
||||
|
||||
// maybe we should expect psyc usage peak around 2030?
|
||||
// or will psyc reform its protocol by then anyway?
|
||||
// ok.. let's go for 2009 so we can renovate time formats
|
||||
// around 2020.. by the way, 2009-02-14 is a saturday, so
|
||||
// we'll be having a hot friday night party for psyc epoch!
|
||||
//
|
||||
#define PSYC_EPOCH 1234567890 // 2009-02-14 00:31:30 CET
|
||||
|
||||
// TODO: new driver will be able to combine \n, too
|
||||
// new expat parser will also be able to combine >
|
||||
#define XML_CHARSET "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 </=\"'?.:@-_!#"
|
||||
// hmm.. common.c uses pcre with RE_UTF8 to ensure legal charset....
|
||||
|
||||
#ifndef _INCLUDE_AUTO_H
|
||||
# include "auto.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PIKE__
|
||||
# ifdef CONFIG_PATH
|
||||
# include CONFIG_PATH "config.h"
|
||||
# else
|
||||
# include "/local/config.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#ifdef PRO_PATH
|
||||
# include "/pro/include/pro.h"
|
||||
# ifndef HYBRID
|
||||
# define OPT_PATH PRO_PATH
|
||||
# else
|
||||
# define OPT_PATH NET_PATH
|
||||
# endif
|
||||
#else
|
||||
# define OPT_PATH NET_PATH
|
||||
#endif
|
||||
|
||||
#ifdef CHATDOMAIN
|
||||
# undef __DOMAIN_NAME__
|
||||
# define __DOMAIN_NAME__ CHATDOMAIN
|
||||
#endif
|
||||
|
||||
#ifndef SERVER_HOST
|
||||
# ifndef CHATHOST
|
||||
# define CHATHOST __HOST_NAME__
|
||||
# endif
|
||||
# if __DOMAIN_NAME__ != "unknown"
|
||||
# define SERVER_HOST CHATHOST "." __DOMAIN_NAME__
|
||||
# else
|
||||
# if __HOST_IP_NUMBER__ == "127.0.0.1"
|
||||
# define SERVER_HOST "localhost"
|
||||
# else
|
||||
# define SERVER_HOST CHATHOST
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define HAS_PORT(PORT, PATH) (defined(PATH) && defined(PORT) && PORT - 0)
|
||||
// also need HAS_TLS_PORT() ?
|
||||
|
||||
#ifndef HTTP_URL
|
||||
# if HAS_PORT(HTTP_PORT, HTTP_PATH)
|
||||
# define HTTP_URL "http://"+ (HTTP_PORT == 80 ? SERVER_HOST \
|
||||
: (SERVER_HOST +":"+ to_string(HTTP_PORT)))
|
||||
# else
|
||||
# define HTTP_URL "http://" SERVER_HOST
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef HTTPS_URL
|
||||
# if HAS_PORT(HTTPS_PORT, HTTP_PATH)
|
||||
# define HTTPS_URL "https://"+ (HTTPS_PORT == 443 ? SERVER_HOST \
|
||||
: (SERVER_HOST +":"+ to_string(HTTPS_PORT)))
|
||||
# else
|
||||
# define HTTPS_URL 0 // so that you can do
|
||||
// ((tls_available() && HTTPS_URL) || HTTP_URL)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// switching to UTF-8 should work now (if you keep .fmt files disabled!)
|
||||
#ifndef SYSTEM_CHARSET
|
||||
# define SYSTEM_CHARSET "UTF-8"
|
||||
//define SYSTEM_CHARSET "ISO-8859-15"
|
||||
#endif
|
||||
|
||||
#if defined(SYSTEM_CHARSET) && SYSTEM_CHARSET != "UTF-8"
|
||||
# define TO_UTF8(s) convert_charset((s), SYSTEM_CHARSET, "UTF-8")
|
||||
# define FROM_UTF8(s) convert_charset((s), "UTF-8", SYSTEM_CHARSET)
|
||||
#else
|
||||
# define TO_UTF8(s) (s)
|
||||
# define FROM_UTF8(s) (s)
|
||||
#endif
|
||||
|
||||
// this stuff is so popular.. can i really put it anywhere else?
|
||||
#ifndef DEFAULT_CONTENT_TYPE
|
||||
# define DEFAULT_CONTENT_TYPE "text/html; charset=" SYSTEM_CHARSET
|
||||
#endif
|
||||
|
||||
#if __EFUN_DEFINED__(stringprep)
|
||||
// stringprep needs utf8 arguments
|
||||
// this results in lots of conversions some of which look like
|
||||
// system->utf>system->utf. luckily UTF8 is our system charset.
|
||||
// so FROM_UTF8 and TO_UTF8 are normally nullmacros (see above)
|
||||
# include <idn.h>
|
||||
// beware, these macros dont have error handling...
|
||||
# define NODEPREP(s) FROM_UTF8(stringprep(TO_UTF8(s), STRINGPREP_XMPP_NODEPREP))
|
||||
# define NAMEPREP(s) FROM_UTF8(stringprep(TO_UTF8(s), STRINGPREP_NAMEPREP))
|
||||
# define RESOURCEPREP(s) FROM_UTF8(stringprep(TO_UTF8(s), STRINGPREP_XMPP_RESOURCEPREP))
|
||||
#else
|
||||
# define NODEPREP(s) lower_case(s)
|
||||
# define NAMEPREP(s) lower_case(s)
|
||||
# define RESOURCEPREP(s) (s)
|
||||
#endif
|
||||
|
||||
#ifdef MUD
|
||||
# define NO_NEWBIES
|
||||
#endif
|
||||
|
||||
#ifdef RELAY
|
||||
# define NO_NEWBIES // same as REGISTERED_USERS_ONLY ?
|
||||
// anyway, chance for some ifdef optimizations TODO
|
||||
# define IRCGATE_NICK "PSYC.EU"
|
||||
# undef DEFAULT_USER_OBJECT
|
||||
# define DEFAULT_USER_OBJECT IRC_PATH "ghost"
|
||||
#endif
|
||||
|
||||
#ifndef DEFAULT_USER_OBJECT
|
||||
# define DEFAULT_USER_OBJECT PSYC_PATH "user"
|
||||
#endif
|
||||
|
||||
#ifndef PRO_PATH
|
||||
// very specific to the way we do web applications
|
||||
# define htok this_interactive()->http_ok
|
||||
# define htok3(prot,type,extra) this_interactive()->http_ok(prot,type,extra)
|
||||
# define hterror this_interactive()->http_error
|
||||
# define htmlhead this_interactive()->http_head
|
||||
# define htmlpage this_interactive()->http_page
|
||||
# define htmltail this_interactive()->http_tail
|
||||
|
||||
# define HTERROR 1 // return mc if necessary?
|
||||
# define HTDONE 0
|
||||
# define HTMORE -1
|
||||
#endif
|
||||
|
||||
// even more specific to the way we parse commands
|
||||
// combine the rest of the arguments back into one string
|
||||
#define ARGS(x) implode(args[x..], " ")
|
||||
|
||||
// pick the psyc: uniform for objects, otherwise keep what we have
|
||||
#define UNIFORM(x) (objectp(x)? psyc_name(x): x)
|
||||
|
||||
// we currently make no distinction
|
||||
// now we do.
|
||||
//#define register_service(name) register_scheme(name)
|
||||
|
||||
#ifndef MYNICK // under certain circumstances may be useful differently
|
||||
# define MYNICK _myNick // was qName()
|
||||
# define MYLOWERNICK _myLowerCaseNick // was lower_case(qName())
|
||||
#endif
|
||||
|
||||
#define DIGESTAUTH_TIMEOUT 60
|
||||
|
||||
// sorry, but servers expect async auth and persons don*t provide without this
|
||||
// define. so we need this defined until someone ifdefs the servers.
|
||||
// i'll fix that friends thing (was the bug a friends thing?) tomorrow.
|
||||
#ifndef ASYNC_AUTH
|
||||
# define ASYNC_AUTH
|
||||
#endif
|
||||
|
||||
#ifndef NO_CUTTING_EDGE
|
||||
// should only affect how psyc clients are treated, but in fact the
|
||||
// entire net/jabber subsystem depends on this
|
||||
# define UNL_ROUTING
|
||||
# define USE_THE_RESOURCE
|
||||
# define MEMBERS_BY_SOURCE
|
||||
# define TAGGING
|
||||
# define TAGS_ONLY
|
||||
# define NEW_QUEUE
|
||||
//# define CACHE_PRESENCE
|
||||
// gut gut.. dann testen wir diesen kram halt auch
|
||||
# define QUIET_REMOTE_MEMBERS
|
||||
// wir können viel herumphilosophieren was richtig wäre, aber tatsächlich
|
||||
// effizienter verteilen werden wir auf kurze sicht eh nicht, so lets use this:
|
||||
# define SMART_UNICAST_FRIENDS
|
||||
# define NOT_EXPERIMENTAL // code that was experimental just until recently
|
||||
# define SIGS
|
||||
# define SWITCH2PSYC
|
||||
# define WANT_S2S_TLS
|
||||
# define WANT_S2S_SASL
|
||||
# define TRUSTINESS
|
||||
# define ENTER_MEMBERS
|
||||
# define PERSISTENT_MASTERS
|
||||
# define NEW_LINK
|
||||
# define NEW_UNLINK
|
||||
# define NEW_RENDER
|
||||
#endif
|
||||
|
||||
#ifndef _flag_disable_log_hosts
|
||||
# define _flag_log_hosts
|
||||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL
|
||||
// fippo's brilliant single-user channel emulation for jabber MUCs
|
||||
// unfortunately it provides no advantages over the old method, yet.
|
||||
// would be cool to cache a member list at least! TODO
|
||||
# define MUCSUC
|
||||
# define PERSISTENT_SLAVES
|
||||
// efine IRC_FRIENDCHANNEL // hopelessly needs more work
|
||||
# ifdef HTTP_PATH
|
||||
# define HTFORWARD // let person entity buffer output for http usage
|
||||
# endif
|
||||
#else
|
||||
//# define PRE_SPEC // things that changed during the spec process
|
||||
//# ifndef __PIKE__
|
||||
//# define USE_LIVING
|
||||
//# endif
|
||||
#endif
|
||||
|
||||
#ifdef __NO_SRV__ // since psyclpc 4.0.4
|
||||
# define ERQ_WITHOUT_SRV
|
||||
#else
|
||||
// still not official part of the ldmud distribution
|
||||
# define ERQ_LOOKUP_SRV 13
|
||||
// hmm seit psyclpc sollte das nicht mehr hier sein
|
||||
// und warum 13 wenn es 17 sein könnte? :)
|
||||
#endif
|
||||
|
||||
// still using rawp anywhere?
|
||||
#define rawp(TEXT) { P1(("rawp? "+TEXT)) emit(TEXT); }
|
||||
|
||||
#endif
|
67
world/net/include/peers.h
Normal file
67
world/net/include/peers.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
// $Id: peers.h,v 1.19 2007/08/10 09:27:04 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
|
||||
|
||||
// http://about.psyc.eu/Peer
|
||||
#ifndef PEER_H
|
||||
#define PEER_H
|
||||
#define PEER_ALIAS 0
|
||||
#define PEER_PRESENCE 1
|
||||
#define PEER_FLAGS 2
|
||||
#define PEER_CHANNELS 3
|
||||
#define PEER_CUSTOM 4
|
||||
#define PEER_SIZE 5
|
||||
|
||||
|
||||
#define PPL_DISPLAY 0
|
||||
|
||||
#define PPL_DISPLAY_NONE '0'
|
||||
#define PPL_DISPLAY_SMALL '2'
|
||||
#define PPL_DISPLAY_REGULAR ' '
|
||||
#define PPL_DISPLAY_BIG '6'
|
||||
#define PPL_DISPLAY_DEFAULT PPL_DISPLAY_REGULAR
|
||||
|
||||
#define PPL_NOTIFY 1
|
||||
|
||||
#define PPL_NOTIFY_IMMEDIATE '8'
|
||||
#define PPL_NOTIFY_DEFAULT PPL_NOTIFY_IMMEDIATE
|
||||
#define PPL_NOTIFY_DELAYED '6'
|
||||
#define PPL_NOTIFY_DELAYED_MORE '4'
|
||||
#define PPL_NOTIFY_FRIEND PPL_NOTIFY_DELAYED_MORE
|
||||
#define PPL_NOTIFY_MUTE '2'
|
||||
#define PPL_NOTIFY_PENDING '1' // friendship request sent
|
||||
#define PPL_NOTIFY_OFFERED '0' // friendship request received
|
||||
#define PPL_NOTIFY_NONE ' '
|
||||
|
||||
#define TIME_DELAY_NOTIFY (60 * 3) // 3 minutes
|
||||
|
||||
#define PPL_EXPOSE 2
|
||||
|
||||
// this stuff isn't implemented yet, but we could do it like this..
|
||||
#define PPL_EXPOSE_DEFAULT ' ' // depends on /set friendsexpose
|
||||
#if 0
|
||||
#define PPL_EXPOSE_NEVER 's' // keep this friendship secret
|
||||
#define PPL_EXPOSE_LINK 'l' // let a client app know this friend
|
||||
// just compare friendivity with the to_int value of the entry..
|
||||
#define PPL_EXPOSE_FRIEND '0' // let friends see this friend
|
||||
#define PPL_EXPOSE_FRIEND1 '1' // let friends of friends..
|
||||
#define PPL_EXPOSE_FRIEND2 '2' // friendivity level 2
|
||||
#define PPL_EXPOSE_FRIEND3 '3' // friendivity level 3
|
||||
#define PPL_EXPOSE_FRIEND4 '4' // friendivity level 4
|
||||
#define PPL_EXPOSE_FRIEND5 '5' // friendivity level 5 etc.
|
||||
#define PPL_EXPOSE_PUBLIC 'P' // show this friend to anyone
|
||||
#define PPL_EXPOSE_FLAUNT 'F' // flaunt this friend on websites
|
||||
#endif
|
||||
// right now the semantics of expose are as follows: if the value isn't
|
||||
// default, then it is '0' - '9' with 0 meaning secret and the rest whatever
|
||||
|
||||
#define PPL_TRUST 3 // values from '0' to '9'
|
||||
|
||||
#define PPL_TRUST_DEFAULT ' '
|
||||
|
||||
#define PPL_ANY 33333
|
||||
#define PPL_JSON 12345
|
||||
#define PPL_COMPLETE 4404
|
||||
|
||||
#define PPLDEC(CHAR) CHAR == ' ' ? "-" : (CHAR - '0')
|
||||
#endif
|
71
world/net/include/person.h
Normal file
71
world/net/include/person.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
// $Id: person.h,v 1.27 2007/09/18 09:49:17 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
#ifndef _INCLUDE_PERSON_H
|
||||
#define _INCLUDE_PERSON_H
|
||||
|
||||
#ifdef MUD
|
||||
# define find_person(N) find_living("psyc:"+lower_case(N))
|
||||
# define register_person(N) set_living_name("psyc:"+lower_case(N))
|
||||
// ; enable_commands()
|
||||
#endif
|
||||
|
||||
#include "presence.h"
|
||||
|
||||
// should the following 2 defines be in user.h?
|
||||
#define FRIEND_NICK 0
|
||||
#define FRIEND_AVAILABILITY 1
|
||||
|
||||
#if !defined(VOLATILE) && !defined(RELAY)
|
||||
# define ALIASES
|
||||
#endif
|
||||
|
||||
#ifdef DATA_FOR_THE_MASSES
|
||||
# define PERSON_DATA_FILE(name) (DATA_PATH "person/"+ name[0..0] +"/"+ name)
|
||||
#else
|
||||
# define PERSON_DATA_FILE(name) (DATA_PATH "person/"+ (name))
|
||||
#endif
|
||||
|
||||
// shouldn't alias be using psyc_name() instead of glueing urls?
|
||||
#ifdef ALIASES
|
||||
# define DEALIAS(to, from) { string t;\
|
||||
to = raliases[t = lower_case(from)]\
|
||||
|| (aliases[t] ? query_server_unl() +"~"+ from : from);\
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RELAY
|
||||
# define ONLINE (availability != 0)
|
||||
#else
|
||||
# define ONLINE (ME && (interactive(ME) || v("locations")[0]))
|
||||
#endif
|
||||
|
||||
#ifdef NO_NEWBIES
|
||||
# define IS_NEWBIE 0
|
||||
#else
|
||||
# define IS_NEWBIE (!v("password"))
|
||||
#endif
|
||||
|
||||
#define NO_SUCH_USER (!ONLINE && IS_NEWBIE)
|
||||
// this sounds very logical, but i doubt it is what we want or need
|
||||
//#define ONLINE (availability > AVAILABILITY_OFFLINE && ME && (interactive(ME) || v("locations")[0]))
|
||||
// the way user.c uses ONLINE for example doesn't look like this is good
|
||||
// such a change requires thoughtwork and testing
|
||||
|
||||
// privacy concerns:
|
||||
// we should not return the exact number of seconds etc.
|
||||
#define CALC_IDLE_TIME(t) \
|
||||
t = time() - v("aliveTime");\
|
||||
t = t < 30 ? 0 : t < 300 ? 300 : (t + random(200) - 100);
|
||||
|
||||
// should "new" become part of the lastlog.c mechanism? how?
|
||||
// should we simply use timestamp of last logout? that works
|
||||
// better with places for history-while-i-was-away too. TODO
|
||||
// (implement binary search for finding the oldest unread entry..)
|
||||
// so we could throw this away as soon as we have timestamp-based lastlog.
|
||||
#define myLogAppend(source, mc, data, vars) {\
|
||||
logAppend(source, mc, data, vars, _limit_amount_log); \
|
||||
unless (ONLINE) vInc("new"); \
|
||||
}
|
||||
|
||||
|
||||
#endif
|
647
world/net/include/place.gen
Normal file
647
world/net/include/place.gen
Normal file
|
@ -0,0 +1,647 @@
|
|||
// vim:noexpandtab:syntax=lpc
|
||||
// $Id: place.gen,v 1.135 2008/04/16 16:59:41 lynx Exp $
|
||||
//
|
||||
// documentation on http://about.psyc.eu/Create_Place
|
||||
//
|
||||
// place.gen was inspired by loc.h, a similar room generation system in
|
||||
// the Nemesis mudlib. Nemesis itself being a legendary MUD based in
|
||||
// Munich (http://www.nemesis.de). the innovation in this room generation
|
||||
// approach is to use the #include to generate code rather than to define
|
||||
// a series of macros and hope the user uses them the right way.
|
||||
// of course these days you could do a room generator in -say- perl..
|
||||
// or you could implement a mega do-everything room class which can then
|
||||
// be configured at runtime by web interface or slash command. in fact
|
||||
// standard.c is just that, only that it didn't get all that popular.
|
||||
|
||||
#include <net.h>
|
||||
#include <storage.h>
|
||||
#include <status.h>
|
||||
#include <url.h>
|
||||
|
||||
#ifdef BRAIN
|
||||
|
||||
# ifdef SLAVE
|
||||
# echo Configuration Error: BRAIN cannot be SLAVE
|
||||
# endif
|
||||
# undef CONNECT
|
||||
|
||||
#else
|
||||
|
||||
#ifndef DEFAULT_MASTER
|
||||
# define DEFAULT_MASTER "psyc://psyced.org"
|
||||
#endif
|
||||
|
||||
#ifdef CONNECT_DEFAULT
|
||||
# ifdef NAME
|
||||
//# if DEBUG > 0
|
||||
//# echo CONNECT_DEFAULT is psyc://beta.ve.symlynX.com
|
||||
//# define CONNECT "psyc://beta.ve.symlynX.com/@" NAME
|
||||
//# else
|
||||
|
||||
// and after several changes in tagging and forking and dunnowhat
|
||||
// the old master/slave system has died and not returned to life
|
||||
# define REDIRECT DEFAULT_MASTER "/@" NAME
|
||||
//# define CONNECT DEFAULT_MASTER "/@" NAME
|
||||
//# endif
|
||||
# else
|
||||
# echo place.gen: Cannot use CONNECT_DEFAULT without #define NAME
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
|
||||
#ifdef SLAVE
|
||||
//# undef SLAVE // slave system br0ken.. migrating to context slaves
|
||||
// (it cannot deal with missing _tags for local joins etc etc)
|
||||
# ifdef NAME
|
||||
# define REDIRECT CONNECT
|
||||
# ifndef CONNECT
|
||||
# ifdef SERVER_URL
|
||||
# define CONNECT SERVER_URL "@" NAME
|
||||
# else
|
||||
# define CONNECT "psyc://" SERVER_HOST "/@" NAME
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
# echo place.gen: Cannot use SLAVE without #define NAME
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef SLAVE
|
||||
# ifndef CONNECT
|
||||
# ifdef NAME
|
||||
# ifdef SERVER_URL
|
||||
# define CONNECT SERVER_URL "@" NAME
|
||||
# else
|
||||
# define CONNECT "psyc://" SERVER_HOST "/@" NAME
|
||||
# endif
|
||||
# else
|
||||
# echo place.gen: Cannot use SLAVE without #define NAME
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONNECT
|
||||
# ifndef JUNCTION
|
||||
# define SLAVE "local"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(SLAVE) || defined(VOLATILE)
|
||||
# undef CONNECT_IRC
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(MODERATED) && defined(PRO_PATH)
|
||||
# ifdef SLAVE
|
||||
inherit PRO_PATH "place/moslave";
|
||||
# else
|
||||
# ifdef LECTIC
|
||||
inherit PRO_PATH "place/lectic";
|
||||
# else
|
||||
inherit PRO_PATH "place/momaster";
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# if defined(JUNCTION) || (defined(MASTER) && defined(SLAVE))
|
||||
# define ALLOW_FROM_LINKS
|
||||
inherit NET_PATH "place/junction";
|
||||
# else
|
||||
# ifdef SLAVE
|
||||
inherit NET_PATH "place/slave";
|
||||
# else
|
||||
# ifdef CONNECT_IRC
|
||||
# ifdef EMULATE_SERVER
|
||||
inherit NET_PATH "irc/gateway";
|
||||
# else
|
||||
inherit NET_PATH "irc/gatebot";
|
||||
# endif
|
||||
# else
|
||||
# ifdef THREADS
|
||||
inherit NET_PATH "place/threads";
|
||||
# else
|
||||
# ifdef GAMESERV
|
||||
inherit NET_PATH "place/gamespy";
|
||||
# else
|
||||
# ifdef OWNED
|
||||
inherit NET_PATH "place/owned";
|
||||
# else
|
||||
# ifdef NEWSFEED_RSS
|
||||
inherit NET_PATH "place/news";
|
||||
# else
|
||||
# ifdef MASTER
|
||||
inherit NET_PATH "place/master";
|
||||
# else
|
||||
# ifdef HISTORY
|
||||
inherit NET_PATH "place/storic";
|
||||
# else
|
||||
# ifdef MAILCAST
|
||||
inherit NET_PATH "place/mailcast";
|
||||
# else
|
||||
# ifdef PUBLIC
|
||||
inherit NET_PATH "place/public";
|
||||
# else
|
||||
// special case in the archetype options logic, see also the .pl
|
||||
# ifndef PLACE_HISTORY
|
||||
# ifdef PLACE_HISTORY_EXPORT
|
||||
# define PLACE_HISTORY
|
||||
# endif
|
||||
# endif
|
||||
# include "place.i" // archetype model generator code 2007
|
||||
# ifdef PLACE_HISTORY
|
||||
# define HISTORY // compatibility
|
||||
# endif
|
||||
# ifdef PLACE_OWNED
|
||||
# define OWNED PLACE_OWNED // compatibility
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef FETCH_TEXTDB
|
||||
volatile object feed, tob;
|
||||
|
||||
fetched(buffer) {
|
||||
# ifdef FETCH_TEXTPATH
|
||||
P1(("%O fetched: %O bytes\n", ME, strlen(buffer)))
|
||||
// this destruct() should be avoidable, but there is some reason
|
||||
// why it doesn't always work that needs inspection time.
|
||||
if (tob) destruct(tob);
|
||||
tob = (FETCH_TEXTPATH "/text") -> parseDB(buffer, FETCH_TEXTDB);
|
||||
if (tob) castmsg(ME, "_notice_update_database_text",
|
||||
"The text database for [_path] has been refreshed.",
|
||||
([ "_path": FETCH_TEXTPATH ]) );
|
||||
# else
|
||||
P0(("%O fetched: %O bytes.. but what to do with it?\n",
|
||||
ME, strlen(buffer)))
|
||||
# endif
|
||||
}
|
||||
|
||||
// same code in news.c !? simplify!
|
||||
fetchDB() {
|
||||
unless (feed) {
|
||||
feed = FETCH_TEXTDB -> load();
|
||||
feed->content(#'fetched, 1);
|
||||
return 1;
|
||||
} else {
|
||||
feed->refetch(#'fetched);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SILENCE) || defined(NEWSFEED_RSS)
|
||||
# define FILTER_PRESENCE // FILTER_TRAFFIC is also an interesting name
|
||||
# define FILTER_CONVERSATION
|
||||
|
||||
# ifdef NEWSFEED_RSS
|
||||
qNewsfeed() { return NEWSFEED_RSS; }
|
||||
# define BLAME "!newsfeed"
|
||||
# else
|
||||
# define BLAME "!configuration"
|
||||
# endif
|
||||
#else
|
||||
// BLAME contains an "illegal" meta-nickname indicating that something
|
||||
// has been done by admin configuration rather than an interactive user
|
||||
# define BLAME "!configuration"
|
||||
#endif
|
||||
|
||||
#ifdef MAY_HISTORY
|
||||
// only use this hook if PLACE_MAY_HISTORY was defined in the place
|
||||
// blueprint you are using (see archetype.gen). otherwise this hook
|
||||
// will have zero effect, which is the default. i don't know of any
|
||||
// application who needs this. it's more like a proof of concept
|
||||
// how hooks work and how they can be compile time optional.
|
||||
//
|
||||
mayHistory(source, mc, data, vars, b) { MAY_HISTORY; }
|
||||
#endif
|
||||
|
||||
#ifdef HISTORY_GLIMPSE
|
||||
qHistoryGlimpse() { return HISTORY_GLIMPSE; }
|
||||
#endif
|
||||
|
||||
#ifdef OWNED
|
||||
qOwners() { return ([ OWNED ]); }
|
||||
|
||||
# ifdef HISTORY_PROTECTION
|
||||
// you have to explicitely request this behaviour as we normally
|
||||
// consider it a user's privacy right to delete the history
|
||||
histClear(a, b, source, mapping vars) {
|
||||
if (b || qAide(SNICKER))
|
||||
return ::histClear(a, b >= 50 ? b : 50, source, vars);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CHAT_CHANNEL
|
||||
qChatChannel() { return CHAT_CHANNEL; }
|
||||
#else
|
||||
qChatChannel() { return "PSYC"; }
|
||||
#endif
|
||||
|
||||
#if defined(RESET) || defined(CRESET) || defined(NEWSFEED_RSS) \
|
||||
|| defined(RESET_INTERVAL)
|
||||
void reset(int again) {
|
||||
# ifdef CRESET
|
||||
CRESET
|
||||
# endif
|
||||
# if defined(HISTORY) || defined(PLACE_HISTORY)
|
||||
// basic.c currently has no reset to call
|
||||
::reset(again);
|
||||
# endif
|
||||
# ifdef CONNECT_IRC
|
||||
// if (!interactive(ME)) call_out(#'connect, 3, CONNECT_IRC);
|
||||
# endif
|
||||
# if __EFUN_DEFINED__(set_next_reset)
|
||||
# ifdef RESET_INTERVAL
|
||||
set_next_reset(RESET_INTERVAL * 60);
|
||||
# else
|
||||
// apparently this is needed for place/news not to
|
||||
// fall into deep sleep. strange.
|
||||
set_next_reset(24 * 60 * 60);
|
||||
# endif
|
||||
# endif
|
||||
if (again) {
|
||||
# ifdef RESET_INTERVAL
|
||||
# if ! __EFUN_DEFINED__(set_next_reset)
|
||||
if (time() < v("lastreset") + RESET_INTERVAL * 60) return;
|
||||
vSet("lastreset", time());
|
||||
# endif
|
||||
# endif
|
||||
# ifdef RESET
|
||||
RESET
|
||||
# endif
|
||||
# ifdef NEWSFEED_RSS
|
||||
connect();
|
||||
# endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void create() {
|
||||
::create();
|
||||
#ifdef CRESET
|
||||
CRESET
|
||||
#endif
|
||||
#ifdef LINK
|
||||
P1(("%O - ignoring old-fashioned #define LINK %O\n", ME, LINK))
|
||||
#endif
|
||||
#ifdef CONNECT
|
||||
# ifdef IDENTIFICATION
|
||||
P1(("PLACE %O SLAVE of %O with MASTER %O\n", ME, CONNECT, IDENTIFICATION))
|
||||
# else
|
||||
# ifdef SLAVE
|
||||
P1(("PLACE %O SLAVE of %O\n", ME, CONNECT))
|
||||
# else
|
||||
P1(("PLACE %O MASTER\n", ME))
|
||||
# endif
|
||||
# endif
|
||||
# ifdef SERVER_URL
|
||||
# if CONNECT == SERVER_URL
|
||||
D1(D("link [" CONNECT "] == host ["+ SERVER_URL +"]\n");)
|
||||
# else
|
||||
D1(D("link [" CONNECT "] != host ["+ SERVER_URL +"]\n");)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if 0 //def CONNECT
|
||||
P0(("..\nPLACE %O initiating connection to %O\n", ME, CONNECT))
|
||||
clone_object(PSYC_PATH "active") -> connect(CONNECT);
|
||||
#endif
|
||||
#ifdef NAME
|
||||
// double load happens only with certain room types
|
||||
// this load() is important to set identification var
|
||||
// replacing it is no solution
|
||||
//sName(NAME); vSet("name", NAME);
|
||||
load(NAME, 1);
|
||||
#else
|
||||
load();
|
||||
#endif
|
||||
|
||||
#if defined(FILTER_PRESENCE) || defined(QUIET)
|
||||
vSet("_filter_presence", BLAME);
|
||||
#endif
|
||||
#if defined(FILTER_CONVERSATION) || defined(SILENT)
|
||||
vSet("_filter_conversation", BLAME);
|
||||
#endif
|
||||
#ifdef RESTRICTED
|
||||
vSet("_restrict_invitation", BLAME);
|
||||
#else
|
||||
vDel("_restrict_invitation");
|
||||
#endif
|
||||
#ifdef UNIFORM_STYLE
|
||||
vSet("_uniform_style", UNIFORM_STYLE);
|
||||
#endif
|
||||
//#ifdef IRCGATE_NAME
|
||||
// vSet("_gateway_name", IRCGATE_NAME);
|
||||
//#endif
|
||||
|
||||
#ifdef SLAVE
|
||||
# ifdef CONNECT
|
||||
// this needs to happen before sIdentification
|
||||
sMaster(CONNECT);
|
||||
# endif
|
||||
# if defined(IDENTIFICATION)
|
||||
sIdentification(IDENTIFICATION);
|
||||
# endif
|
||||
#endif
|
||||
#ifdef CONNECT_IRC
|
||||
link(CONNECT_IRC);
|
||||
#endif
|
||||
#if defined(NEWSFEED_RSS) && defined(DEVELOPMENT)
|
||||
// do not connect newsfeeds immediately if running in production mode
|
||||
connect();
|
||||
#endif
|
||||
#ifdef MODERATED
|
||||
# define ALLOW_EXTERNAL // FROM_LINKS?
|
||||
# ifdef PRO_PATH
|
||||
sModeratable(1);
|
||||
# endif
|
||||
#endif
|
||||
// exits currently not supported
|
||||
#ifdef EXITS
|
||||
// sExits( EXITS );
|
||||
#endif
|
||||
#ifdef CREATE
|
||||
CREATE
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PRIVATE
|
||||
//qPublic() { return 0; }
|
||||
#else
|
||||
qPublicName() { return MYNICK; }
|
||||
qPublic() { return BLAME; }
|
||||
#endif
|
||||
|
||||
#ifdef ALLOW_EXTERNAL
|
||||
qAllowExternal() { return 1; }
|
||||
#else
|
||||
# if defined(ALLOW_EXTERNAL_FROM) || defined(ALLOW_FROM_LINKS) \
|
||||
|| defined(ALLOW_EXTERNAL_HOST) || defined(ALLOW_METHOD) \
|
||||
|| defined(ALLOW_EXTERNAL_LOCALS) || defined(ALLOW_TRUSTED)
|
||||
qAllowExternal(source, mc, vars) {
|
||||
P2(("qAllowExternal(%O,%O,%O)\n", source,mc,vars))
|
||||
// only one #define of ALLOW_* type makes sense
|
||||
// unless (abbrev("_notice_news", mc)) return 0;
|
||||
// unless (abbrev("_notice_software", mc)) return 0;
|
||||
# ifdef ALLOW_TRUSTED
|
||||
if (vars["_INTERNAL_trust"] > 5) return 1;
|
||||
# endif
|
||||
# ifdef ALLOW_METHOD
|
||||
unless (abbrev(ALLOW_METHOD, mc)) return 0;
|
||||
# endif
|
||||
if (stringp(source)) {
|
||||
# ifdef ALLOW_FROM_LINKS
|
||||
// does this make things spoofable?
|
||||
if (isLink(source) || isLink(vars["_source_relay"])) return 1;
|
||||
# endif
|
||||
# ifdef ALLOW_EXTERNAL_FROM
|
||||
if (abbrev(ALLOW_EXTERNAL_FROM, source)) return 1;
|
||||
# endif
|
||||
# ifdef ALLOW_EXTERNAL_HOST
|
||||
string *u = parse_uniform(source);
|
||||
if (u && same_host(ALLOW_EXTERNAL_HOST, u[UHost])) return 1;
|
||||
# endif
|
||||
return 0;
|
||||
}
|
||||
# ifdef ALLOW_EXTERNAL_HOST
|
||||
// does anyone need this?
|
||||
//else if (same_host(ALLOW_EXTERNAL_HOST, query_ip_number(source))) return 1;
|
||||
# endif
|
||||
# ifdef ALLOW_EXTERNAL_LOCALS
|
||||
// this is equivalent to irc/mode -n for local ircers. thx fip.
|
||||
return 1;
|
||||
# else
|
||||
return 0;
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef LAYOUT
|
||||
viewHead() { return LAYOUT; }
|
||||
#endif
|
||||
|
||||
#if defined(REQUEST_ENTER) || defined(REGISTERED) || defined(SECURE) ||\
|
||||
defined(RESTRICTED) || defined(TRUSTED) || defined(NICKLESS) ||\
|
||||
defined(LOCAL)
|
||||
volatile mixed lastTry;
|
||||
|
||||
# if defined(SECURE) && defined(HISTORY) && defined(PLACE_HISTORY_EXPORT)
|
||||
# undef PLACE_HISTORY_EXPORT
|
||||
# endif
|
||||
|
||||
enter(source, mc, data, vars) {
|
||||
# ifdef TRUSTED
|
||||
if (vars["_INTERNAL_trust"] > 5) return 1;
|
||||
# endif
|
||||
# ifdef LOCAL
|
||||
unless (objectp(source)) {
|
||||
sendmsg(source, "_error_place_enter_restricted_local",
|
||||
"Sorry, [_nick_place] is only accessible for users of the same server.",
|
||||
([ "_nick_place" : MYNICK ]) );
|
||||
if (source != lastTry) {
|
||||
vars["_source_relay"] = source;
|
||||
castmsg(ME, "_failure_place_enter_restricted_local",
|
||||
"Admission into [_nick_place] denied for remote user [_source_relay].",
|
||||
vars);
|
||||
lastTry = source;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
# ifdef RESTRICTED
|
||||
unless (qAide(SNICKER)) {
|
||||
sendmsg(source, "_error_place_enter_necessary_invitation",
|
||||
"[_nick_place] can only be entered upon invitation.",
|
||||
([ "_nick_place" : qName() ]) );
|
||||
if (source != lastTry) {
|
||||
castmsg(ME, "_failure_place_enter_necessary_invitation",
|
||||
"Admission into [_nick_place] denied for uninvited user [_nick].",
|
||||
vars);
|
||||
lastTry = source;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
# if defined(SECURE)
|
||||
// let people in who are either connected via a SSL/TLS
|
||||
// protocol or are coming from the localhost (probably SSH users).
|
||||
//
|
||||
// both cases are no absolute guarantee for safety.. it is still
|
||||
// in the hands of each user in the room to safeguard true secrecy
|
||||
//
|
||||
// SECURE by itself also doesn't enforce that people are registered
|
||||
// or belong to a certain group, so you have to use the respective
|
||||
// #defines to also ensure that, if that's what you want.
|
||||
//
|
||||
// -lynX 2004
|
||||
|
||||
if (!((objectp(source) &&
|
||||
// should use trustworthy level 9 instead? if so.. how?
|
||||
(query_ip_number(source) == "127.0.0.1"
|
||||
|| query_ip_number(source) == __HOST_IP_NUMBER__ ))
|
||||
# if __EFUN_DEFINED__(tls_query_connection_state)
|
||||
// psyc client.. may also one day be a psyc server, in that
|
||||
// case we have to hope the rest of the link is secured, too
|
||||
|| (objectp(vars["_INTERNAL_origin"])
|
||||
&& interactive(vars["_INTERNAL_origin"])
|
||||
&& tls_query_connection_state(vars["_INTERNAL_origin"]))
|
||||
// tls connection, be it telnet irc jabber or https
|
||||
// shouldn't this check happen before "_INTERNAL_origin"? -lynX
|
||||
|| (objectp(source) && interactive(source)
|
||||
&& tls_query_connection_state(source))
|
||||
# endif
|
||||
)) {
|
||||
sendmsg(source, "_error_place_enter_necessary_encryption",
|
||||
"[_nick_place] may only be accessed by clients with enabled encryption.",
|
||||
([ "_nick_place" : qName() ]) );
|
||||
if (source != lastTry) {
|
||||
castmsg(ME, "_failure_place_enter_necessary_encryption",
|
||||
"Admission into [_nick_place] denied for insecure user [_nick].",
|
||||
vars);
|
||||
lastTry = source;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
# if defined(REGISTERED)
|
||||
if (objectp(source) && source->isNewbie()) {
|
||||
sendmsg(source, "_error_place_enter_necessary_registration",
|
||||
"We want you to be a registered PSYC user before entering [_nick_place].",
|
||||
([ "_nick_place" : MYNICK ]) );
|
||||
if (source != lastTry) {
|
||||
castmsg(ME, "_failure_place_enter_necessary_registration",
|
||||
"Admission into [_nick_place] denied for unregistered user \"[_nick]\".",
|
||||
vars);
|
||||
lastTry = source;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
# if defined(REQUEST_ENTER)
|
||||
REQUEST_ENTER
|
||||
# endif
|
||||
# ifdef NICKLESS
|
||||
return 1; // LEGAL_NICK_IN_ENTER
|
||||
# else
|
||||
return ::enter(source, mc, data, vars);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ON_STATUS)
|
||||
showStatus(verbosity, al, source, mc, data, vars) {
|
||||
ON_STATUS
|
||||
return ::showStatus(verbosity, al, source, mc, data, vars);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ON_ANY) || defined(ON_CONVERSE) || defined(REDIRECT)
|
||||
msg(source, mc, data, vars) {
|
||||
# ifdef ON_ANY
|
||||
ON_ANY
|
||||
# endif
|
||||
# ifdef REDIRECT
|
||||
sendmsg(source, "_failure_redirect_temporary",
|
||||
"[_nick_place] is currently unable to fulfil this operation. Please direct your request to [_source_redirect]",
|
||||
([ "_method_relay": mc,
|
||||
"_tag_reply" : vars["_tag"] || 0,
|
||||
// "_data_relay" : data,
|
||||
# ifdef NAME
|
||||
"_nick_place" : NAME,
|
||||
# else
|
||||
"_nick_place" : MYNICK,
|
||||
# endif
|
||||
"_source_redirect": REDIRECT ]));
|
||||
return 0;
|
||||
# else
|
||||
::msg(source, mc, data, vars);
|
||||
# ifdef ON_CONVERSE
|
||||
if (abbrev("_message", mc)) {
|
||||
ON_CONVERSE
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ON_ENTER
|
||||
onEnter(source, mc, data, vars) {
|
||||
ON_ENTER
|
||||
return ::onEnter(source, mc, data, vars);
|
||||
}
|
||||
#endif
|
||||
|
||||
// obsolete for new code.. use PLACE_HISTORY_EXPORT or not
|
||||
#ifdef HISTORY_PRIVATE
|
||||
# echo HISTORY_PRIVATE is obsolete. Unset PLACE_HISTORY_EXPORT instead.
|
||||
// disables web-export of HISTORY in a somewhat drastic way, i admit
|
||||
htget(prot, query, headers, qs) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HISTORY
|
||||
# if defined(HISTORY_METHOD) || defined(HISTORY_MAY_LOG)
|
||||
mayLog(mc) {
|
||||
# ifdef HISTORY_MAY_LOG
|
||||
HISTORY_MAY_LOG
|
||||
# endif
|
||||
# ifdef HISTORY_METHOD
|
||||
return abbrev(HISTORY_METHOD, mc);
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef ON_ERROR
|
||||
error(source, mc, data, vars) {
|
||||
ON_ERROR
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ON_COMMAND
|
||||
cmd(command, args, privilege, source, vars) {
|
||||
ON_COMMAND
|
||||
return ::cmd(command, args, privilege, source, vars);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PASS_IRC) || defined(ON_CONNECT)
|
||||
logon(failure) {
|
||||
int rc = ::logon(failure);
|
||||
unless (rc) return 0;
|
||||
# ifdef PASS_IRC
|
||||
emit("PASS :"+ PASS_IRC +"\r\n");
|
||||
# endif
|
||||
# ifdef ON_CONNECT
|
||||
ON_CONNECT
|
||||
# endif
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NEWS_PUBLISH
|
||||
publish(link, headline, channel) {
|
||||
unless (NEWS_PUBLISH(link, headline, channel))
|
||||
::publish(link, headline, channel);
|
||||
}
|
||||
#endif
|
33
world/net/include/place.i
Normal file
33
world/net/include/place.i
Normal file
|
@ -0,0 +1,33 @@
|
|||
// generated by '/home/lynx/bin/psyconf': place.i for place.gen
|
||||
|
||||
#ifdef PLACE_HISTORY
|
||||
# define Oh "h"
|
||||
#else
|
||||
# define Oh ""
|
||||
#endif
|
||||
|
||||
#ifdef PLACE_HISTORY_EXPORT
|
||||
# define Oe "e"
|
||||
#else
|
||||
# define Oe ""
|
||||
#endif
|
||||
|
||||
#ifdef PLACE_SCRATCHPAD
|
||||
# define Os "s"
|
||||
#else
|
||||
# define Os ""
|
||||
#endif
|
||||
|
||||
#ifdef PLACE_MASQUERADE
|
||||
# define Om "m"
|
||||
#else
|
||||
# define Om ""
|
||||
#endif
|
||||
|
||||
#ifdef PLACE_OWNED
|
||||
# define Oo "o"
|
||||
#else
|
||||
# define Oo ""
|
||||
#endif
|
||||
|
||||
inherit NET_PATH "place/_" Oh Oe Os Om Oo;
|
31
world/net/include/presence.h
Normal file
31
world/net/include/presence.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
// $Id: presence.h,v 1.9 2007/07/25 09:57:32 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
#ifndef _INCLUDE_PRESENCE_H
|
||||
#define _INCLUDE_PRESENCE_H
|
||||
|
||||
// similar to what is defined as "availability"
|
||||
// in http://www.psyc.eu/presence
|
||||
// yeah! we WILL be getting there one happy day.
|
||||
|
||||
#define AVAILABILITY_EXPIRED 0 // as yet unused.
|
||||
#define AVAILABILITY_UNKNOWN 0 // in use internally.
|
||||
#define AVAILABILITY_OFFLINE 1 // in use.
|
||||
#define AVAILABILITY_VACATION 2 // activated, better name?
|
||||
#define AVAILABILITY_AWAY 3 // in use.
|
||||
// UNAVAILABLE ?
|
||||
#define AVAILABILITY_DO_NOT_DISTURB 4 // activated, better name?
|
||||
#define AVAILABILITY_NEARBY 5 // activated.
|
||||
#define AVAILABILITY_BUSY 6 // in use.
|
||||
#define AVAILABILITY_HERE 7 // in use.
|
||||
// AVAILABLE ?
|
||||
#define AVAILABILITY_TALKATIVE 8 // activated, name?
|
||||
#define AVAILABILITY_REALTIME 9 // as yet unused, name?
|
||||
|
||||
// more unused stuff from http://www.psyc.eu/presence
|
||||
#define MOOD_JUCHEI 8
|
||||
#define MOOD_BASSTSCHO 6
|
||||
#define MOOD_NAJA 4
|
||||
#define MOOD_LEXTSMIAMOARSCHI 2
|
||||
// see also english wording currently in net/library/share.c
|
||||
|
||||
#endif
|
58
world/net/include/proto.h
Normal file
58
world/net/include/proto.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
// $Id: proto.h,v 1.20 2007/09/30 17:06:11 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
// sometimes prototypes are needed. i keep them here and include
|
||||
// them also in the files that *define* the function so that the
|
||||
// compiler will recognize any misdefinitions.
|
||||
|
||||
#ifndef _INCLUDE_PROTO_H
|
||||
#define _INCLUDE_PROTO_H
|
||||
|
||||
#ifndef MUD
|
||||
|
||||
// alphabetical order.
|
||||
#ifndef __PIKE__
|
||||
void dns_resolve(string hostname, closure callback, varargs array(mixed) extra);
|
||||
void dns_rresolve(string ip, closure callback, varargs array(mixed) extra);
|
||||
#endif
|
||||
int hex2int(string hex);
|
||||
varargs string isotime(mixed ctim, int long);
|
||||
int legal_host(string ip, int port, string scheme, int udpflag);
|
||||
#ifdef varargs
|
||||
void log_file(string file,string str,
|
||||
vamixed a,vamixed b,vamixed c,vamixed d,
|
||||
vamixed e,vamixed f,vamixed g,vamixed h);
|
||||
#else
|
||||
void log_file(string file, string str, varargs array(mixed) args);
|
||||
#endif
|
||||
string make_json(mixed d);
|
||||
void monitor_report(string mc, string text);
|
||||
array(object) objects_people();
|
||||
varargs string psyc_name(mixed source, vastring localpart);
|
||||
string query_server_unl();
|
||||
varargs mixed sendmsg(mixed target, string mc, mixed data, mapping vars,
|
||||
mixed source, int showingLog, closure callback, varargs array(mixed) extra);
|
||||
varargs void shout(mixed who, string what, string text, mapping vars);
|
||||
varargs int server_shutdown(string reason, int restart, int pass);
|
||||
string timedelta(int secs);
|
||||
|
||||
#else
|
||||
|
||||
// danny, do you really need this?
|
||||
void _psyc_dns_resolve(string hostname, closure callback, varargs array(mixed) extra);
|
||||
void _psyc_dns_rresolve(string ip, closure callback, varargs array(mixed) extra);
|
||||
int _psyc_legal_host(string ip, int port, string scheme, int udpflag);
|
||||
#ifdef varargs
|
||||
void _psyc_log_file(string file,string str,
|
||||
mixed a,mixed b,mixed c,mixed d,mixed e,mixed f,mixed g,mixed h);
|
||||
#else
|
||||
void _psyc_log_file(string file, string str, varargs array(mixed) args);
|
||||
#endif
|
||||
void _psyc_monitor_report(string mc, string text);
|
||||
object* _psyc_objects_people();
|
||||
string _psyc_query_server_unl();
|
||||
varargs mixed _psyc_sendmsg(mixed target, string mc, mixed data, mapping vars,
|
||||
mixed source, int showingLog, closure callback, varargs array(mixed) extra);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
74
world/net/include/psyc.h
Normal file
74
world/net/include/psyc.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
#ifndef PSYC_H
|
||||
#define PSYC_H
|
||||
|
||||
/* psyc.h: Unlike other files in this directory, this file is licensed under
|
||||
* the MIT license as documented in detail in ../psyc/LICENSE.
|
||||
*/
|
||||
|
||||
#ifndef PSYC_LIST_SIZE_LIMIT
|
||||
# define PSYC_LIST_SIZE_LIMIT 404
|
||||
#endif
|
||||
|
||||
#ifdef SPYC
|
||||
# define C_GLYPH_PACKET_DELIMITER '|'
|
||||
# define S_GLYPH_PACKET_DELIMITER "|"
|
||||
#else
|
||||
# define C_GLYPH_PACKET_DELIMITER '.'
|
||||
# define S_GLYPH_PACKET_DELIMITER "."
|
||||
#endif
|
||||
|
||||
#define C_GLYPH_SEPARATOR_KEYWORD '_'
|
||||
#define S_GLYPH_SEPARATOR_KEYWORD "_"
|
||||
|
||||
#define C_GLYPH_MODIFIER_SET ':'
|
||||
#define S_GLYPH_MODIFIER_SET ":"
|
||||
|
||||
#define C_GLYPH_MODIFIER_ASSIGN '='
|
||||
#define S_GLYPH_MODIFIER_ASSIGN "="
|
||||
|
||||
#define C_GLYPH_MODIFIER_AUGMENT '+'
|
||||
#define S_GLYPH_MODIFIER_AUGMENT "+"
|
||||
|
||||
#define C_GLYPH_MODIFIER_DIMINISH '-'
|
||||
#define S_GLYPH_MODIFIER_DIMINISH "-"
|
||||
|
||||
#define C_GLYPH_MODIFIER_QUERY '?'
|
||||
#define S_GLYPH_MODIFIER_QUERY "?"
|
||||
|
||||
#define PSYC_ROUTING 1
|
||||
#define PSYC_ROUTING_MERGE 2
|
||||
#define PSYC_ROUTING_RENDER 4
|
||||
|
||||
// I thought about changing all occurrencies of these chars in parse.i
|
||||
// but it only makes parse.i less readable and changes of these
|
||||
// modifiers are just not to be expected. It is however recommended
|
||||
// to use these macros if you look at the psyc syntax anywhere outside
|
||||
// the core psyc parser, like when splitting methods by '_'.
|
||||
//
|
||||
// here are the macros to implement method inheritance in a loop around
|
||||
// a switch (see http://about.psyc.eu/Inheritance and "try and slice")
|
||||
|
||||
#ifdef EXPERIMENTAL
|
||||
# define PSYC_TRY(mc) \
|
||||
family = mc; \
|
||||
while (family) { \
|
||||
glyph = -4; \
|
||||
switch(family)
|
||||
|
||||
# define PSYC_SLICE_AND_REPEAT \
|
||||
default: \
|
||||
log_file("SLICE", "%s:%O slicing %O in %O\n", \
|
||||
__FILE__, __LINE__, family, ME); \
|
||||
glyph = rmember(family, C_GLYPH_SEPARATOR_KEYWORD); \
|
||||
if (glyph > 1) family = family[.. glyph-1]; \
|
||||
else family = 0; \
|
||||
} \
|
||||
if (glyph == -4) family = 0; // got here by break;
|
||||
|
||||
#else
|
||||
// this disables method inheritance
|
||||
# define PSYC_TRY(mc) switch(mc)
|
||||
# define PSYC_SLICE_AND_REPEAT
|
||||
#endif
|
||||
|
||||
#endif /* PSYC_H */
|
47
world/net/include/sandbox.h
Normal file
47
world/net/include/sandbox.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
// vim:syntax=lpc
|
||||
#ifndef _SANDBOX_H
|
||||
# define _SANDBOX_H
|
||||
# ifdef SANDBOX
|
||||
|
||||
# define MASK(name, bname) nomask mixed name (varargs array(mixed) args) {\
|
||||
if (extern_call()) {\
|
||||
if (!geteuid(previous_object()) || stringp(geteuid(previous_object()))\
|
||||
&& geteuid(previous_object())[0] != '/') {\
|
||||
raise_error(sprintf("INVALID " bname " by %O(%O)\n",\
|
||||
previous_object(),\
|
||||
geteuid(previous_object())));\
|
||||
}\
|
||||
set_this_object(previous_object());\
|
||||
}\
|
||||
return efun::name (args...) ;\
|
||||
}
|
||||
|
||||
# define MASK2(type, name, args, args2, bname) nomask type name args {\
|
||||
if (extern_call()) {\
|
||||
if (!geteuid(previous_object()) || stringp(geteuid(previous_object()))\
|
||||
&& geteuid(previous_object())[0] != '/') {\
|
||||
raise_error(sprintf("INVALID " bname " by %O(%O)\n",\
|
||||
previous_object(),\
|
||||
geteuid(previous_object())));\
|
||||
}\
|
||||
set_this_object(previous_object());\
|
||||
}\
|
||||
return efun::name args2 ;\
|
||||
}
|
||||
|
||||
# define PROTECT(name) if (extern_call()) {\
|
||||
if (!geteuid(previous_object()) || stringp(geteuid(previous_object()))\
|
||||
&& geteuid(previous_object())[0] != '/') {\
|
||||
raise_error(sprintf("INVALID " name " by %O(%O)\n", previous_object(),\
|
||||
geteuid(previous_object())));\
|
||||
}\
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
# define PROTECT(name)
|
||||
# define MASK(name, bname)
|
||||
# define MASK2(type, name, args, args2, bname)
|
||||
|
||||
# endif
|
||||
#endif
|
17
world/net/include/server.h
Normal file
17
world/net/include/server.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
// $Id: server.h,v 1.5 2006/08/24 11:43:36 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
|
||||
#ifdef NO_INHERIT
|
||||
# include <text.h>
|
||||
#else
|
||||
# define NO_INHERIT
|
||||
# include <text.h>
|
||||
# undef NO_INHERIT
|
||||
|
||||
inherit NET_PATH "server";
|
||||
#endif
|
||||
|
||||
#define QUIT destruct(ME); return 0;
|
||||
|
||||
#ifndef TIME_LOGIN_IDLE
|
||||
# define TIME_LOGIN_IDLE 44
|
||||
#endif
|
33
world/net/include/services.h
Normal file
33
world/net/include/services.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#ifndef _INCLUDE_SERVICES_H
|
||||
#define _INCLUDE_SERVICES_H
|
||||
|
||||
// like /etc/services
|
||||
|
||||
// reserved for MSP == http://www.faqs.org/rfcs/rfc1312.html
|
||||
#define MSP_SERVICE 18 // PSYC port of lords again.. maybe?
|
||||
#define FTP_DATA_SERVICE 20
|
||||
#define FTP_SERVICE 21
|
||||
#define SSH_SERVICE 22
|
||||
#define TELNET_SERVICE 23
|
||||
#define SMTP_SERVICE 25
|
||||
#define DOMAIN_SERVICE 53 // DNS name service
|
||||
#define GOPHER_SERVICE 70
|
||||
#define FINGER_SERVICE 79
|
||||
#define HTTP_SERVICE 80
|
||||
#define POP2_SERVICE 109
|
||||
#define POP3_SERVICE 110
|
||||
#define NNTP_SERVICE 119
|
||||
#define EXTRA_IRC_SERVICE 194 // the official but unused irc port
|
||||
#define HTTPS_SERVICE 443 // http over TLS/SSL
|
||||
#define SMTPS_SERVICE 465
|
||||
#define NNTPS_SERVICE 563 // nntp over TLS/SSL
|
||||
#define TELNETS_SERVICE 992
|
||||
#define IRCS_SERVICE 994 // irc protocol over TLS/SSL
|
||||
#define POP3S_SERVICE 995
|
||||
#define PSYC_SERVICE 4404 // PSYC port of commons
|
||||
#define JABBER_SERVICE 5222
|
||||
#define JABBER_S2S_SERVICE 5269 // obscene interserver jabber port
|
||||
#define IRC_SERVICE 6667 // de facto irc port
|
||||
#define PSYCS_SERVICE 9404 // PSYC interim port of lords
|
||||
|
||||
#endif
|
16
world/net/include/signature.h
Normal file
16
world/net/include/signature.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
// $Id: signature.h,v 1.1 2007/08/09 22:10:29 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
|
||||
#ifndef _SIGNATURE_H
|
||||
#define _SIGNATURE_H
|
||||
|
||||
#define SHandler 0
|
||||
#define SPreset 1
|
||||
#define SKeys 2
|
||||
|
||||
#define Signature array(mixed)
|
||||
#define new_Signature ({ })
|
||||
#define cast_Signature
|
||||
|
||||
#define signaturep(node) pointerp(node)
|
||||
|
||||
#endif // _SIGNATURE_H
|
73
world/net/include/status.h
Normal file
73
world/net/include/status.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
#ifndef _INCLUDE_STATUS_H
|
||||
#define _INCLUDE_STATUS_H
|
||||
|
||||
#include <storage.h>
|
||||
|
||||
#define SNICKER (objectp(source) ? vars["_nick"] : source)
|
||||
|
||||
// 'verbosity' is an internal selection scheme to select aspects of a place
|
||||
// status. the place status however should probably become its description
|
||||
// as provided by /x or /surf, and the description data should in long term
|
||||
// be multicast to all cslaves. thus all we really need is a way to ask our
|
||||
// local cslave for the data we want to see. that's why we come full circle
|
||||
// back to the current implementation of verbosity: since it is a local
|
||||
// operation, it is not useful to define a generic key selector protocol
|
||||
// for _request_description, but rather act out of current status of things
|
||||
// and maybe mc extensions, which is what 'verbosity' does.
|
||||
|
||||
// place status flags
|
||||
#define VERBOSITY_MEMBERS 1
|
||||
#define VERBOSITY_TOPIC 2
|
||||
#define VERBOSITY_HISTORY 4
|
||||
#define VERBOSITY_UNIFORMS 8
|
||||
#define VERBOSITY_NEWSFEED 16
|
||||
#define VERBOSITY_MASQUERADE 32
|
||||
#define VERBOSITY_FILTER 64
|
||||
#define VERBOSITY_LOGGING 128
|
||||
#define VERBOSITY_PUBLICIZED 256
|
||||
// user status flags
|
||||
#define VERBOSITY_FRIENDS 512
|
||||
#define VERBOSITY_FRIENDS_DETAILS 1024 // idle times of friends
|
||||
#define VERBOSITY_PLACE 2048 // info about current place
|
||||
#define VERBOSITY_EVENTS 4096 // last invitation etc.
|
||||
#define VERBOSITY_PRESENCE 8192 // showMyPresence(0)
|
||||
#define VERBOSITY_PRESENCE_DETAILS 16384 // showMyPresence(1)
|
||||
|
||||
// special case. never use in masks etc.
|
||||
#define VERBOSITY_AUTOMATIC 65536 // NOT in ALL!
|
||||
|
||||
#define VERBOSITY_MEDIUM VERBOSITY_TERSE | VERBOSITY_TOPIC
|
||||
#define VERBOSITY_ALL (32768-1)
|
||||
|
||||
// masks for various occasions
|
||||
#if 1 //def ENTER_MEMBERS
|
||||
# define VERBOSITY_TERSE 0
|
||||
# define VERBOSITY_BIG VERBOSITY_MEDIUM
|
||||
#else
|
||||
# define VERBOSITY_TERSE VERBOSITY_MEMBERS
|
||||
# define VERBOSITY_BIG VERBOSITY_MEDIUM | VERBOSITY_HISTORY
|
||||
#endif
|
||||
|
||||
// each occasion has its mask or selection
|
||||
// these are for places
|
||||
#define VERBOSITY_REQUEST_MEMBERS VERBOSITY_MEMBERS
|
||||
#define VERBOSITY_ENTER_AUTOMATIC VERBOSITY_TERSE
|
||||
#define VERBOSITY_ENTER VERBOSITY_BIG
|
||||
#define VERBOSITY_STATUS_TERSE VERBOSITY_TERSE
|
||||
#define VERBOSITY_STATUS VERBOSITY_ALL - VERBOSITY_HISTORY
|
||||
#define VERBOSITY_IRCGATE_LOGON VERBOSITY_TERSE | VERBOSITY_UNIFORMS
|
||||
#define VERBOSITY_IRCGATE_USER VERBOSITY_ALL
|
||||
|
||||
// automatic user status in telnet & mud interfaces
|
||||
#define VERBOSITY_STATUS_AUTOMATIC VERBOSITY_PRESENCE | VERBOSITY_FRIENDS | VERBOSITY_MEMBERS
|
||||
|
||||
// these come from usercmd.i
|
||||
#define VERBOSITY_COMMAND_STATUS VERBOSITY_ALL
|
||||
#define VERBOSITY_COMMAND_STATUS_TERSE VERBOSITY_STATUS_AUTOMATIC
|
||||
#define VERBOSITY_COMMAND_STATUS_INFO VERBOSITY_PRESENCE_DETAILS | VERBOSITY_FRIENDS_DETAILS | VERBOSITY_EVENTS
|
||||
#define VERBOSITY_COMMAND_FRIENDS VERBOSITY_FRIENDS_DETAILS
|
||||
// currently not necessary:
|
||||
//efine VERBOSITY_COMMAND_PRESENCE VERBOSITY_PRESENCE_DETAILS
|
||||
//efine VERBOSITY_COMMAND_MEMBERS VERBOSITY_MEMBERS
|
||||
|
||||
#endif
|
11
world/net/include/storage.h
Normal file
11
world/net/include/storage.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef _INCLUDE_STORAGE_H
|
||||
#define _INCLUDE_STORAGE_H
|
||||
|
||||
|
||||
// this is only for user and place objects really -
|
||||
// an inline wrapping around a mapping access, just in case
|
||||
// i should one day decide to change how data is kept in memory
|
||||
#define v(KEY) _v[KEY]
|
||||
|
||||
|
||||
#endif
|
21
world/net/include/text.h
Normal file
21
world/net/include/text.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef _INCLUDE_TEXT_H
|
||||
#define _INCLUDE_TEXT_H
|
||||
#ifndef __PIKE__
|
||||
|
||||
#ifndef NO_INHERIT
|
||||
virtual inherit NET_PATH "textc";
|
||||
#endif
|
||||
|
||||
|
||||
// #ifndef DEBUG
|
||||
#if 1
|
||||
# define T(mc, fmt) \
|
||||
((objectp(_tob) && member(_tdb, mc)) ? _tdb[mc] : getText(mc, fmt))
|
||||
#else
|
||||
# define T(mc, fmt) \
|
||||
S("\n<<< %O >>>\n%s", _tdb, getText(mc, fmt))
|
||||
#endif
|
||||
// #endif
|
||||
|
||||
#endif // __PIKE__
|
||||
#endif
|
26
world/net/include/url.h
Normal file
26
world/net/include/url.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef URL
|
||||
#define URL(urlstr) parse_uniform(urlstr)
|
||||
|
||||
// essential parts, also used by render_uniform
|
||||
#define UScheme 0
|
||||
#define UUser 1
|
||||
#define UPass 2
|
||||
#define UHost 3
|
||||
#define UPort 4
|
||||
#define UTransport 5
|
||||
#define UResource 6
|
||||
#define UQuery 7
|
||||
#define UChannel 8
|
||||
|
||||
// convenient snippets of the URL
|
||||
#define UString 9 // the URL as such
|
||||
#define UBody 10 // the URL without scheme and '//'
|
||||
#define UUserAtHost 11 // mailto and xmpp style
|
||||
#define UHostPort 12 // just host:port (and transport)
|
||||
#define URoot 13 // root UNI of peer/server
|
||||
#define USlashes 14 // the // if the protocol has them
|
||||
//efine UCircuit 15 // scheme:host:port
|
||||
// (not provided by parse_uniform)
|
||||
#define USize 15
|
||||
|
||||
#endif
|
32
world/net/include/user.h
Normal file
32
world/net/include/user.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
// $Id: user.h,v 1.15 2007/06/26 15:50:30 lynx Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
// if you are including this, you are in some way implementing
|
||||
// the user object or a derivate of the user object. that's
|
||||
// what this macro is for.
|
||||
#define USER_PROGRAM
|
||||
|
||||
#include <storage.h>
|
||||
#include <peers.h>
|
||||
|
||||
#ifdef NO_INHERIT
|
||||
# include <text.h>
|
||||
#else
|
||||
# define NO_INHERIT
|
||||
# include <text.h>
|
||||
# undef NO_INHERIT
|
||||
inherit OPT_PATH "user";
|
||||
#endif
|
||||
|
||||
#define FILTER_NONE "off"
|
||||
#define FILTER_STRANGERS "strangers"
|
||||
|
||||
#ifdef _flag_filter_strangers
|
||||
# define FILTERED(ENTITY) v("filter") != FILTER_NONE
|
||||
#else
|
||||
# define FILTERED(ENTITY) v("filter") == FILTER_STRANGERS
|
||||
#endif
|
||||
|
||||
#define SUBSCRIBE_NOT 0
|
||||
#define SUBSCRIBE_TEMPORARY 1
|
||||
#define SUBSCRIBE_PERMANENT 2
|
||||
|
43
world/net/include/xml.h
Normal file
43
world/net/include/xml.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
// $Id: xml.h,v 1.12 2006/09/23 17:32:36 fippo Exp $ // vim:syntax=lpc:ts=8
|
||||
//
|
||||
// this shows how one could have done xml using structs
|
||||
// and furtherly, how to use structs or arrays depending
|
||||
// on availability.. but in the end we decided to stick
|
||||
// to good old tagged arrays ... :)
|
||||
//
|
||||
#ifndef _XML_H
|
||||
#define _XML_H
|
||||
#if 0 //def __LPC_STRUCTS__
|
||||
|
||||
struct XMLNode {
|
||||
struct XMLNode parent;
|
||||
string tag;
|
||||
string cdata;
|
||||
mapping param;
|
||||
mapping child;
|
||||
};
|
||||
|
||||
# define XMLNode struct XMLNode
|
||||
# define new_XMLNode (<XMLNode> 0, "", "", ([]), ([]))
|
||||
# define cast_XMLNode (struct XMLNode)
|
||||
|
||||
# define parent(n) n->parent
|
||||
# define tag(n) n->tag
|
||||
# define cdata(n) n->cdata
|
||||
# define param(n) n->param
|
||||
# define child(n) n->child
|
||||
|
||||
#else
|
||||
# define Parent 0
|
||||
# define NodeLen 1
|
||||
# define Tag 2
|
||||
# define Cdata 3
|
||||
|
||||
# define XMLNode mixed
|
||||
# define new_XMLNode ([ ])
|
||||
# define cast_XMLNode
|
||||
|
||||
# define nodelistp(node) pointerp(node)
|
||||
|
||||
#endif
|
||||
#endif // _XML_H
|
Loading…
Add table
Add a link
Reference in a new issue