ON_UNKNOWN hook

This commit is contained in:
psyc://psyced.org/~lynX 2011-07-24 12:12:43 +02:00
parent 2bba51c662
commit 8bdec308f8
3 changed files with 42 additions and 12 deletions

View File

@ -146,18 +146,23 @@ inherit NET_PATH "place/mailcast";
# ifdef PUBLIC
inherit NET_PATH "place/public";
# else
// special case in the archetype options logic, see also psyconf
# ifndef PLACE_HISTORY
# ifdef PLACE_HISTORY_EXPORT
# define PLACE_HISTORY
# ifdef ON_UNKNOWN
// special place type that supports unknownmsg()
inherit NET_PATH "place/intercept";
# else
// special case in the archetype options logic, see also psyconf
# 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
# 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
@ -583,6 +588,14 @@ msg(source, mc, data, vars) {
}
#endif
// this hook only works in archetypes that support it
#ifdef ON_UNKNOWN
unknownmsg(source, mc, data, vars) {
ON_UNKNOWN
::unknownmsg(source, mc, data, vars);
}
#endif
#ifdef ON_ENTER
onEnter(source, mc, data, vars) {
ON_ENTER

View File

@ -38,6 +38,7 @@
# define PLACE_TOPIC // [+] provide a topic function
# define PLACE_TOPIC_COMMAND // [+] provide a /topic command
//# define PLACE_TOPIC_FOR_ALL // allow anybody to set the topic
//# define PLACE_UNKNOWN_HOOK // provide a handler for ON_UNKNOWN
#endif
// things that every archetype auto-model gets.
@ -1448,8 +1449,13 @@ msg(source, mc, data, mapping vars) {
if (mc == "_message_private") mc = "_message_public";
// vorsicht mit _message_public_question und _message_video
}
#ifdef PLACE_UNKNOWN_HOOK
unknownmsg(source, mc, data, vars);
}
unknownmsg(source, mc, data, vars) {
#endif
/* if the source is not a member of the room and was allowed
* because of qAllowExternal* we probably should use the rooms
* because of qAllowExternal* we probably should use the room's
* psycName instead of the source
* yes, I admit it, afaik this only fixes bugs in net/jabber!
*/

View File

@ -0,0 +1,11 @@
// special archetype that supports ON_UNKNOWN
#define PLACE_UNKNOWN_HOOK
#define ESSENTIALS
#define PLACE_HISTORY
//#define PLACE_HISTORY_EXPORT
//#define PLACE_SCRATCHPAD
//#define PLACE_MASQUERADE
//#define PLACE_OWNED
#include "archetype.gen"