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

81 lines
2.4 KiB
C
Raw Normal View History

2009-01-26 20:12:53 +00:00
// $Id: person.h,v 1.29 2008/07/26 10:54:30 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
2009-01-26 20:12:53 +00:00
#if !defined(VOLATILE) && !defined(RELAY) && !defined(_flag_disable_module_nickspace)
# 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)]\
2009-01-29 16:31:32 +00:00
|| (aliases[t] ? SERVER_UNIFORM +"~"+ from : from);\
}
#endif
#ifdef RELAY
# define ONLINE (availability != 0)
#else
2010-02-14 01:58:06 +00:00
# define ONLINE (ME && (interactive(ME) || (member(v("locations"), 0) && sizeof(v("locations")[0]))))
#endif
2011-07-26 12:30:41 +00:00
#ifdef _flag_disable_authorization
# 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);
2009-01-26 20:12:53 +00:00
// used by myLogAppend below:
#ifndef _limit_amount_log
# define _limit_amount_log 777
#endif
#ifndef _limit_amount_log_persistent
# define _limit_amount_log_persistent 100
#endif
// 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