mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-10-30 13:57:20 +01:00 
			
		
		
		
	Modified IRC Session events to receive the Session instance as first argument. Remeved leftover file and minor change in IDE sandbox project.
This commit is contained in:
		| @@ -50,7 +50,7 @@ | ||||
| 		</Build> | ||||
| 		<Compiler> | ||||
| 			<Add option="-Wall" /> | ||||
| 			<Add option="-std=c++14" /> | ||||
| 			<Add option="-std=c++11" /> | ||||
| 			<Add option="-DFMT_USE_VARIADIC_TEMPLATES" /> | ||||
| 			<Add option="-DFMT_USE_RVALUE_REFERENCES" /> | ||||
| 			<Add directory="../include" /> | ||||
|   | ||||
| @@ -1,250 +0,0 @@ | ||||
| // | ||||
| // SqratClassType: Type Translators | ||||
| // | ||||
|  | ||||
| // | ||||
| // Copyright (c) 2009 Brandon Jones | ||||
| // | ||||
| // This software is provided 'as-is', without any express or implied | ||||
| // warranty. In no event will the authors be held liable for any damages | ||||
| // arising from the use of this software. | ||||
| // | ||||
| // Permission is granted to anyone to use this software for any purpose, | ||||
| // including commercial applications, and to alter it and redistribute it | ||||
| // freely, subject to the following restrictions: | ||||
| // | ||||
| //    1. The origin of this software must not be misrepresented; you must not | ||||
| //    claim that you wrote the original software. If you use this software | ||||
| //    in a product, an acknowledgment in the product documentation would be | ||||
| //    appreciated but is not required. | ||||
| // | ||||
| //    2. Altered source versions must be plainly marked as such, and must not be | ||||
| //    misrepresented as being the original software. | ||||
| // | ||||
| //    3. This notice may not be removed or altered from any source | ||||
| //    distribution. | ||||
| // | ||||
|  | ||||
| #if !defined(_SCRAT_CLASSTYPE_H_) | ||||
| #define _SCRAT_CLASSTYPE_H_ | ||||
|  | ||||
| #include <squirrel.h> | ||||
| #include <typeinfo> | ||||
|  | ||||
| #include "sqratUtil.h" | ||||
|  | ||||
| namespace Sqrat | ||||
| { | ||||
|  | ||||
| /// @cond DEV | ||||
|  | ||||
| // The copy function for a class | ||||
| typedef SQInteger (*COPYFUNC)(HSQUIRRELVM, SQInteger, const void*); | ||||
|  | ||||
| // Every Squirrel class instance made by Sqrat has its type tag set to a AbstractStaticClassData object that is unique per C++ class | ||||
| struct AbstractStaticClassData { | ||||
|     AbstractStaticClassData() {} | ||||
|     virtual ~AbstractStaticClassData() {} | ||||
|     virtual SQUserPointer Cast(SQUserPointer ptr, SQUserPointer classType) { printf("Pure Virtual!"); return 0; } | ||||
|     AbstractStaticClassData* baseClass; | ||||
|     string                   className; | ||||
|     COPYFUNC                 copyFunc; | ||||
| }; | ||||
|  | ||||
| // StaticClassData keeps track of the nearest base class B and the class associated with itself C in order to cast C++ pointers to the right base class | ||||
| template<class C, class B> | ||||
| struct StaticClassData : public AbstractStaticClassData { | ||||
|     virtual SQUserPointer Cast(SQUserPointer ptr, SQUserPointer classType) { | ||||
|         if (classType != this) { | ||||
|             ptr = baseClass->Cast(static_cast<B*>(static_cast<C*>(ptr)), classType); | ||||
|         } | ||||
|         return ptr; | ||||
|     } | ||||
| }; | ||||
|  | ||||
| // Every Squirrel class object created by Sqrat in every VM has its own unique ClassData object stored in the registry table of the VM | ||||
| template<class C> | ||||
| struct ClassData { | ||||
|     HSQOBJECT classObj; | ||||
|     HSQOBJECT getTable; | ||||
|     HSQOBJECT setTable; | ||||
|     SharedPtr<typename unordered_map<C*, HSQOBJECT>::type> instances; | ||||
|     SharedPtr<AbstractStaticClassData> staticData; | ||||
| }; | ||||
|  | ||||
| // Lookup static class data by type_info rather than a template because C++ cannot export generic templates | ||||
| class _ClassType_helper { | ||||
| public: | ||||
| #if defined(SCRAT_IMPORT) | ||||
|     static SQRAT_API WeakPtr<AbstractStaticClassData>& _getStaticClassData(const std::type_info* type); | ||||
| #else | ||||
|     struct compare_type_info { | ||||
|         bool operator ()(const std::type_info* left, const std::type_info* right) const { | ||||
|             return left->before(*right) != 0; | ||||
|         } | ||||
|     }; | ||||
|     static SQRAT_API WeakPtr<AbstractStaticClassData>& _getStaticClassData(const std::type_info* type) { | ||||
|         static std::map<const std::type_info*, WeakPtr<AbstractStaticClassData>, compare_type_info> data; | ||||
|         return data[type]; | ||||
|     } | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| // Internal helper class for managing classes | ||||
| template<class C> | ||||
| class ClassType { | ||||
| public: | ||||
|  | ||||
|     static inline ClassData<C>* getClassData(HSQUIRRELVM vm) { | ||||
|         sq_pushregistrytable(vm); | ||||
|         sq_pushstring(vm, "__classes", -1); | ||||
| #ifndef NDEBUG | ||||
|         SQRESULT r = sq_rawget(vm, -2); | ||||
|         assert(SQ_SUCCEEDED(r)); // fails if getClassData is called when the data does not exist for the given VM yet (bind the class) | ||||
| #else | ||||
|         sq_rawget(vm, -2); | ||||
| #endif | ||||
|         sq_pushstring(vm, ClassName().c_str(), -1); | ||||
| #ifndef NDEBUG | ||||
|         r = sq_rawget(vm, -2); | ||||
|         assert(SQ_SUCCEEDED(r)); // fails if getClassData is called when the data does not exist for the given VM yet (bind the class) | ||||
| #else | ||||
|         sq_rawget(vm, -2); | ||||
| #endif | ||||
|         ClassData<C>** ud; | ||||
|         sq_getuserdata(vm, -1, (SQUserPointer*)&ud, NULL); | ||||
|         sq_pop(vm, 3); | ||||
|         return *ud; | ||||
|     } | ||||
|  | ||||
|     static WeakPtr<AbstractStaticClassData>& getStaticClassData() { | ||||
|         return _ClassType_helper::_getStaticClassData(&typeid(C)); | ||||
|     } | ||||
|  | ||||
|     static inline bool hasClassData(HSQUIRRELVM vm) { | ||||
|         if (!getStaticClassData().Expired()) { | ||||
|             sq_pushregistrytable(vm); | ||||
|             sq_pushstring(vm, "__classes", -1); | ||||
|             if (SQ_SUCCEEDED(sq_rawget(vm, -2))) { | ||||
|                 sq_pushstring(vm, ClassName().c_str(), -1); | ||||
|                 if (SQ_SUCCEEDED(sq_rawget(vm, -2))) { | ||||
|                     sq_pop(vm, 3); | ||||
|                     return true; | ||||
|                 } | ||||
|                 sq_pop(vm, 1); | ||||
|             } | ||||
|             sq_pop(vm, 1); | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     static inline AbstractStaticClassData*& BaseClass() { | ||||
|         assert(getStaticClassData().Expired() == false); // fails because called before a Sqrat::Class for this type exists | ||||
|         return getStaticClassData().Lock()->baseClass; | ||||
|     } | ||||
|  | ||||
|     static inline string& ClassName() { | ||||
|         assert(getStaticClassData().Expired() == false); // fails because called before a Sqrat::Class for this type exists | ||||
|         return getStaticClassData().Lock()->className; | ||||
|     } | ||||
|  | ||||
|     static inline COPYFUNC& CopyFunc() { | ||||
|         assert(getStaticClassData().Expired() == false); // fails because called before a Sqrat::Class for this type exists | ||||
|         return getStaticClassData().Lock()->copyFunc; | ||||
|     } | ||||
|  | ||||
|     static SQInteger DeleteInstance(SQUserPointer ptr, SQInteger size) { | ||||
|         SQUNUSED(size); | ||||
|         std::pair<C*, SharedPtr<typename unordered_map<C*, HSQOBJECT>::type> >* instance = reinterpret_cast<std::pair<C*, SharedPtr<typename unordered_map<C*, HSQOBJECT>::type> >*>(ptr); | ||||
|         instance->second->erase(instance->first); | ||||
|         delete instance; | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     static void PushInstance(HSQUIRRELVM vm, C* ptr) { | ||||
|         if (!ptr) { | ||||
|             sq_pushnull(vm); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         ClassData<C>* cd = getClassData(vm); | ||||
|  | ||||
|         typename unordered_map<C*, HSQOBJECT>::type::iterator it = cd->instances->find(ptr); | ||||
|         if (it != cd->instances->end()) { | ||||
|             sq_pushobject(vm, it->second); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         sq_pushobject(vm, cd->classObj); | ||||
|         sq_createinstance(vm, -1); | ||||
|         sq_remove(vm, -2); | ||||
|         sq_setinstanceup(vm, -1, new std::pair<C*, SharedPtr<typename unordered_map<C*, HSQOBJECT>::type> >(ptr, cd->instances)); | ||||
|         sq_setreleasehook(vm, -1, &DeleteInstance); | ||||
|         sq_getstackobj(vm, -1, &((*cd->instances)[ptr])); | ||||
|     } | ||||
|  | ||||
|     static void PushInstanceCopy(HSQUIRRELVM vm, const C& value) { | ||||
|         sq_pushobject(vm, getClassData(vm)->classObj); | ||||
|         sq_createinstance(vm, -1); | ||||
|         sq_remove(vm, -2); | ||||
| #ifndef NDEBUG | ||||
|         SQRESULT result = CopyFunc()(vm, -1, &value); | ||||
|         assert(SQ_SUCCEEDED(result)); // fails when trying to copy an object defined as non-copyable | ||||
| #else | ||||
|         CopyFunc()(vm, -1, &value); | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     static C* GetInstance(HSQUIRRELVM vm, SQInteger idx, bool nullAllowed = false) { | ||||
|         AbstractStaticClassData* classType = NULL; | ||||
|         std::pair<C*, SharedPtr<typename unordered_map<C*, HSQOBJECT>::type> >* instance = NULL; | ||||
|         if (hasClassData(vm)) /* type checking only done if the value has type data else it may be enum */ | ||||
|         { | ||||
|             if (nullAllowed && sq_gettype(vm, idx) == OT_NULL) { | ||||
|                 return NULL; | ||||
|             } | ||||
|  | ||||
|             classType = getStaticClassData().Lock().Get(); | ||||
|  | ||||
| #if !defined (SCRAT_NO_ERROR_CHECKING) | ||||
|             if (SQ_FAILED(sq_getinstanceup(vm, idx, (SQUserPointer*)&instance, classType))) { | ||||
|                 SQTHROW(vm, FormatTypeError(vm, idx, ClassName())); | ||||
|                 return NULL; | ||||
|             } | ||||
|  | ||||
|             if (instance == NULL) { | ||||
|                 SQTHROW(vm, _SC("got unconstructed native class (call base.constructor in the constructor of Squirrel classes that extend native classes)")); | ||||
|                 return NULL; | ||||
|             } | ||||
| #else | ||||
|             sq_getinstanceup(vm, idx, (SQUserPointer*)&instance, 0); | ||||
| #endif | ||||
|         } | ||||
|         else /* value is likely of integral type like enums, cannot return a pointer */ | ||||
|         { | ||||
|             SQTHROW(vm, FormatTypeError(vm, idx, _SC("unknown"))); | ||||
|             return NULL; | ||||
|         } | ||||
|         AbstractStaticClassData* actualType; | ||||
|         sq_gettypetag(vm, idx, (SQUserPointer*)&actualType); | ||||
|         if (actualType == NULL) { | ||||
|             SQInteger top = sq_gettop(vm); | ||||
|             sq_getclass(vm, idx); | ||||
|             while (actualType == NULL) { | ||||
|                 sq_getbase(vm, -1); | ||||
|                 sq_gettypetag(vm, -1, (SQUserPointer*)&actualType); | ||||
|             } | ||||
|             sq_settop(vm, top); | ||||
|         } | ||||
|         if (classType != actualType) { | ||||
|             return static_cast<C*>(actualType->Cast(instance->first, classType)); | ||||
|         } | ||||
|         return static_cast<C*>(instance->first); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| /// @endcond | ||||
|  | ||||
| } | ||||
|  | ||||
| #endif | ||||
| @@ -154,50 +154,69 @@ irc_callbacks_t * Session::GetCallbacks() | ||||
| } | ||||
|  | ||||
| // ------------------------------------------------------------------------------------------------ | ||||
| void Session::ForwardEvent(Function & listener, const char * event, const char * origin, const char ** params, unsigned int count) | ||||
| void Session::ForwardEvent(Session * session, Function & listener, const char * event, | ||||
|                             const char * origin, const char ** params, unsigned int count) | ||||
| { | ||||
|     // Is there anyone even listening to this event? | ||||
|     if (listener.IsNull()) | ||||
|     { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     // Each event must have an array of parameters (empty or not) | ||||
|     Array parameters(DefaultVM::Get(), count); | ||||
|  | ||||
|     // Are the any parameters? | ||||
|     if (params && count > 0) | ||||
|     { | ||||
|     // Transofrm the parameters into a squirrel array | ||||
|         for (unsigned int i = 0; i < count; ++i) | ||||
|         { | ||||
|             parameters.SetValue(i, params[i]); | ||||
|         } | ||||
|     } | ||||
|     // Obtain an object to this session instance without creating a new reference counter! | ||||
|     ClassType< Session >::PushInstance(DefaultVM::Get(), session); | ||||
|     // Obtain the pushed object from the stack | ||||
|     Var< Object > var(DefaultVM::Get(), -1); | ||||
|     // Call the event with the obtaine values | ||||
|     listener.Execute< Object &, const SQChar *, const SQChar *, Array >(var.value, event, | ||||
|         origin ? origin : _SC(""), parameters); | ||||
| } | ||||
|  | ||||
| // ------------------------------------------------------------------------------------------------ | ||||
| void Session::ForwardEvent(Session * session, Function & listener, unsigned int event, | ||||
|                             const char * origin, const char ** params, unsigned int count) | ||||
| { | ||||
|     // Is there anyone even listening to this event? | ||||
|     if (listener.IsNull()) | ||||
|     { | ||||
|         return; | ||||
|     } | ||||
|     // Each event must have an array of parameters (empty or not) | ||||
|     Array parameters(DefaultVM::Get(), count); | ||||
|     // Are the any parameters? | ||||
|     if (params && count > 0) | ||||
|     { | ||||
|         // Transofrm the parameters into a squirrel array | ||||
|         for (unsigned int i = 0; i < count; ++i) | ||||
|         { | ||||
|             parameters.SetValue(i, params[i]); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     listener.Execute< const SQChar *, const SQChar *, Array >(event, origin ? origin : _SC(""), parameters); | ||||
|     // Obtain an object to this session instance without creating a new reference counter! | ||||
|     ClassType< Session >::PushInstance(DefaultVM::Get(), session); | ||||
|     // Obtain the pushed object from the stack | ||||
|     Var< Object > var(DefaultVM::Get(), -1); | ||||
|     // Call the event with the obtaine values | ||||
|     listener.Execute< Object &, unsigned int, const SQChar *, Array >(var.value, event, | ||||
|         origin ? origin : _SC(""), parameters); | ||||
| } | ||||
|  | ||||
| // ------------------------------------------------------------------------------------------------ | ||||
| void Session::ForwardEvent(Function & listener, unsigned int event, const char * origin, const char ** params, unsigned int count) | ||||
| { | ||||
|     if (listener.IsNull()) | ||||
|     { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     Array parameters(DefaultVM::Get(), count); | ||||
|  | ||||
|     if (params && count > 0) | ||||
|     { | ||||
|         for (unsigned int i = 0; i < count; ++i) | ||||
|         { | ||||
|             parameters.SetValue(i, params[i]); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     listener.Execute< unsigned int, const SQChar *, Array >(event, origin ? origin : _SC(""), parameters); | ||||
| } | ||||
|  | ||||
| // ------------------------------------------------------------------------------------------------ | ||||
| void Session::ForwardEvent(Function & listener, const char * nick, const char * addr, irc_dcc_t dccid) | ||||
| void Session::ForwardEvent(Session * session, Function & listener, const char * nick, | ||||
|                             const char * addr, irc_dcc_t dccid) | ||||
| { | ||||
|     SQMOD_UNUSED_VAR(session); | ||||
|     SQMOD_UNUSED_VAR(listener); | ||||
|     SQMOD_UNUSED_VAR(nick); | ||||
|     SQMOD_UNUSED_VAR(addr); | ||||
| @@ -206,8 +225,10 @@ void Session::ForwardEvent(Function & listener, const char * nick, const char * | ||||
| } | ||||
|  | ||||
| // ------------------------------------------------------------------------------------------------ | ||||
| void Session::ForwardEvent(Function & listener, const char * nick, const char * addr, const char * filename, unsigned long size, irc_dcc_t dccid) | ||||
| void Session::ForwardEvent(Session * session, Function & listener, const char * nick, const char * addr, | ||||
|                             const char * filename, unsigned long size, irc_dcc_t dccid) | ||||
| { | ||||
|     SQMOD_UNUSED_VAR(session); | ||||
|     SQMOD_UNUSED_VAR(listener); | ||||
|     SQMOD_UNUSED_VAR(nick); | ||||
|     SQMOD_UNUSED_VAR(addr); | ||||
| @@ -1268,7 +1289,7 @@ void Session::OnConnect(irc_session_t * session, const char * event, const char | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnConnect, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnConnect, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1283,7 +1304,7 @@ void Session::OnNick(irc_session_t * session, const char * event, const char * o | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnNick, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnNick, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1298,7 +1319,7 @@ void Session::OnQuit(irc_session_t * session, const char * event, const char * o | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnQuit, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnQuit, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1313,7 +1334,7 @@ void Session::OnJoin(irc_session_t * session, const char * event, const char * o | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnJoin, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnJoin, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1328,7 +1349,7 @@ void Session::OnPart(irc_session_t * session, const char * event, const char * o | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnPart, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnPart, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1343,7 +1364,7 @@ void Session::OnMode(irc_session_t * session, const char * event, const char * o | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnMode, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnMode, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1358,7 +1379,7 @@ void Session::OnUmode(irc_session_t * session, const char * event, const char * | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnUmode, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnUmode, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1373,7 +1394,7 @@ void Session::OnTopic(irc_session_t * session, const char * event, const char * | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnTopic, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnTopic, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1388,7 +1409,7 @@ void Session::OnKick(irc_session_t * session, const char * event, const char * o | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnKick, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnKick, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1403,7 +1424,7 @@ void Session::OnChannel(irc_session_t * session, const char * event, const char | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnChannel, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnChannel, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1418,7 +1439,7 @@ void Session::OnPrivMSG(irc_session_t * session, const char * event, const char | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnPrivMSG, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnPrivMSG, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1433,7 +1454,7 @@ void Session::OnNotice(irc_session_t * session, const char * event, const char * | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnNotice, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnNotice, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1448,7 +1469,7 @@ void Session::OnChannel_Notice(irc_session_t * session, const char * event, cons | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnChannel_Notice, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnChannel_Notice, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1463,7 +1484,7 @@ void Session::OnInvite(irc_session_t * session, const char * event, const char * | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnInvite, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnInvite, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1478,7 +1499,7 @@ void Session::OnCTCP_Req(irc_session_t * session, const char * event, const char | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnCTCP_Req, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnCTCP_Req, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1493,7 +1514,7 @@ void Session::OnCTCP_Rep(irc_session_t * session, const char * event, const char | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnCTCP_Rep, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnCTCP_Rep, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1508,7 +1529,7 @@ void Session::OnCTCP_Action(irc_session_t * session, const char * event, const c | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnCTCP_Action, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnCTCP_Action, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1523,7 +1544,7 @@ void Session::OnUnknown(irc_session_t * session, const char * event, const char | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnUnknown, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnUnknown, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1538,7 +1559,7 @@ void Session::OnNumeric(irc_session_t * session, unsigned int event, const char | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnNumeric, event, origin, params, count); | ||||
|         ForwardEvent(inst, inst->m_OnNumeric, event, origin, params, count); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1553,7 +1574,7 @@ void Session::OnDcc_Chat_Req(irc_session_t * session, const char * nick, const c | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnConnect, nick, addr, dccid); | ||||
|         ForwardEvent(inst, inst->m_OnDcc_Chat_Req, nick, addr, dccid); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1568,7 +1589,7 @@ void Session::OnDcc_Send_Req(irc_session_t * session, const char * nick, const c | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         ForwardEvent(inst->m_OnConnect, nick, addr, filename, size, dccid); | ||||
|         ForwardEvent(inst, inst->m_OnDcc_Send_Req, nick, addr, filename, size, dccid); | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -37,22 +37,26 @@ protected: | ||||
|     /* -------------------------------------------------------------------------------------------- | ||||
|      * ... | ||||
|     */ | ||||
|     static void ForwardEvent(Function & listener, const char * event, const char * origin, const char ** params, unsigned int count); | ||||
|     static void ForwardEvent(Session * session, Function & listener, const char * event, | ||||
|                                 const char * origin, const char ** params, unsigned int count); | ||||
|  | ||||
|     /* -------------------------------------------------------------------------------------------- | ||||
|      * ... | ||||
|     */ | ||||
|     static void ForwardEvent(Function & listener, unsigned int event, const char * origin, const char ** params, unsigned int count); | ||||
|     static void ForwardEvent(Session * session, Function & listener, unsigned int event, | ||||
|                                 const char * origin, const char ** params, unsigned int count); | ||||
|  | ||||
|     /* -------------------------------------------------------------------------------------------- | ||||
|      * ... | ||||
|     */ | ||||
|     static void ForwardEvent(Function & listener, const char * nick, const char * addr, irc_dcc_t dccid); | ||||
|     static void ForwardEvent(Session * session, Function & listener, const char * nick, | ||||
|                                 const char * addr, irc_dcc_t dccid); | ||||
|  | ||||
|     /* -------------------------------------------------------------------------------------------- | ||||
|      * ... | ||||
|     */ | ||||
|     static void ForwardEvent(Function & listener, const char * nick, const char * addr, const char * filename, unsigned long size, irc_dcc_t dccid); | ||||
|     static void ForwardEvent(Session * session, Function & listener, const char * nick, | ||||
|                                 const char * addr, const char * filename, unsigned long size, irc_dcc_t dccid); | ||||
|  | ||||
| public: | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user