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

@ -145,6 +145,10 @@ inherit NET_PATH "place/mailcast";
# else # else
# ifdef PUBLIC # ifdef PUBLIC
inherit NET_PATH "place/public"; inherit NET_PATH "place/public";
# else
# ifdef ON_UNKNOWN
// special place type that supports unknownmsg()
inherit NET_PATH "place/intercept";
# else # else
// special case in the archetype options logic, see also psyconf // special case in the archetype options logic, see also psyconf
# ifndef PLACE_HISTORY # ifndef PLACE_HISTORY
@ -170,6 +174,7 @@ inherit NET_PATH "place/public";
# endif # endif
# endif # endif
# endif # endif
# endif
#endif #endif
#ifdef FETCH_TEXTDB #ifdef FETCH_TEXTDB
@ -583,6 +588,14 @@ msg(source, mc, data, vars) {
} }
#endif #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 #ifdef ON_ENTER
onEnter(source, mc, data, vars) { onEnter(source, mc, data, vars) {
ON_ENTER ON_ENTER

View File

@ -38,6 +38,7 @@
# define PLACE_TOPIC // [+] provide a topic function # define PLACE_TOPIC // [+] provide a topic function
# define PLACE_TOPIC_COMMAND // [+] provide a /topic command # define PLACE_TOPIC_COMMAND // [+] provide a /topic command
//# define PLACE_TOPIC_FOR_ALL // allow anybody to set the topic //# define PLACE_TOPIC_FOR_ALL // allow anybody to set the topic
//# define PLACE_UNKNOWN_HOOK // provide a handler for ON_UNKNOWN
#endif #endif
// things that every archetype auto-model gets. // things that every archetype auto-model gets.
@ -1448,8 +1449,13 @@ msg(source, mc, data, mapping vars) {
if (mc == "_message_private") mc = "_message_public"; if (mc == "_message_private") mc = "_message_public";
// vorsicht mit _message_public_question und _message_video // 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 /* 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 * psycName instead of the source
* yes, I admit it, afaik this only fixes bugs in net/jabber! * 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"