diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/channels.h | 12 | ||||
-rw-r--r-- | include/modules.h | 36 | ||||
-rw-r--r-- | include/users.h | 14 |
3 files changed, 54 insertions, 8 deletions
diff --git a/include/channels.h b/include/channels.h index aa34ceb3c..32f28c751 100644 --- a/include/channels.h +++ b/include/channels.h @@ -142,6 +142,8 @@ class ucrec : public classbase virtual ~ucrec() { /* stub */ } }; +class InspIRCd; + /** Holds all relevent information for a channel. * This class represents a channel, and contains its name, modes, time created, topic, topic set time, @@ -151,9 +153,13 @@ class chanrec : public Extensible { private: + /** Pointer to creator object + */ + InspIRCd* ServerInstance; + /** Connect a chanrec to a userrec */ - static chanrec* ForceChan(chanrec* Ptr,ucrec *a,userrec* user, int created); + static chanrec* ForceChan(InspIRCd* Instance, chanrec* Ptr,ucrec *a,userrec* user, int created); public: /** The channels name. @@ -341,7 +347,7 @@ class chanrec : public Extensible /** Creates a channel record and initialises it with default values * @throw Nothing at present. */ - chanrec(); + chanrec(InspIRCd* Instance); /** Make src kick user from this channel with the given reason. * @param src The source of the kick @@ -379,7 +385,7 @@ class chanrec : public Extensible * been created if the channel did not exist before the user was joined to it. * If the user could not be joined to a channel, the return value may be NULL. */ - static chanrec* JoinUser(userrec *user, const char* cn, bool override, const char* key = ""); + static chanrec* JoinUser(InspIRCd* ServerInstance, userrec *user, const char* cn, bool override, const char* key = ""); /** Write to a channel, from a user, using va_args for text * @param user User whos details to prefix the line with diff --git a/include/modules.h b/include/modules.h index 6f9ebf9e9..b0d249c7c 100644 --- a/include/modules.h +++ b/include/modules.h @@ -103,6 +103,19 @@ typedef std::map<std::string,Module*> featurelist; } \ } +#define FOREACH_MOD_I(z,y,x) if (z->Config->global_implementation[y] > 0) { \ + for (int _i = 0; _i <= MODCOUNT; _i++) { \ + if (z->Config->implement_lists[_i][y]) \ + try \ + { \ + modules[_i]->x ; \ + } \ + catch (ModuleException& modexcept) \ + { \ + log(DEBUG,"Module exception caught: %s",modexcept.GetReason()); \ + } \ + } \ +} /** * This define is similar to the one above but returns a result in MOD_RESULT. * The first module to return a nonzero result is the value to be accepted, @@ -111,7 +124,7 @@ typedef std::map<std::string,Module*> featurelist; #define FOREACH_RESULT(y,x) { if (ServerInstance->Config->global_implementation[y] > 0) { \ MOD_RESULT = 0; \ for (int _i = 0; _i <= MODCOUNT; _i++) { \ - if (ServerInstance->Config->implement_lists[_i][y]) {\ + if (ServerInstance->Config->implement_lists[_i][y]) { \ try \ { \ int res = modules[_i]->x ; \ @@ -129,6 +142,27 @@ typedef std::map<std::string,Module*> featurelist; } \ } +#define FOREACH_RESULT_I(z,y,x) { if (z->Config->global_implementation[y] > 0) { \ + MOD_RESULT = 0; \ + for (int _i = 0; _i <= MODCOUNT; _i++) { \ + if (z->Config->implement_lists[_i][y]) { \ + try \ + { \ + int res = modules[_i]->x ; \ + if (res != 0) { \ + MOD_RESULT = res; \ + break; \ + } \ + } \ + catch (ModuleException& modexcept) \ + { \ + log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); \ + } \ + } \ + } \ + } \ +} + #define FD_MAGIC_NUMBER -42 // useful macros diff --git a/include/users.h b/include/users.h index 6e5a60b23..8e3fddfcd 100644 --- a/include/users.h +++ b/include/users.h @@ -66,6 +66,8 @@ class Invited : public classbase +class InspIRCd; + /** Derived from Resolver, and performs user forward/reverse lookups. */ class UserResolver : public Resolver @@ -76,8 +78,9 @@ class UserResolver : public Resolver userrec* bound_user; int bound_fd; bool fwd; + InspIRCd* ServerInstance; public: - UserResolver(userrec* user, std::string to_resolve, bool forward); + UserResolver(InspIRCd* Instance, userrec* user, std::string to_resolve, bool forward); void OnLookupComplete(const std::string &result); void OnError(ResolverError e, const std::string &errormessage); @@ -156,6 +159,9 @@ typedef std::vector<ucrec*> UserChanList; class userrec : public connection { private: + /** Pointer to creator + */ + InspIRCd* ServerInstance; /** A list of channels the user has a pending invite to. */ @@ -324,7 +330,7 @@ class userrec : public connection /** Default constructor * @throw Nothing at present */ - userrec(); + userrec(InspIRCd* Instance); /** Returns the full displayed host of the user * This member function returns the hostname of the user as seen by other users @@ -500,7 +506,7 @@ class userrec : public connection * @param user The user to remove * @param r The quit reason */ - static void QuitUser(userrec *user, const std::string &r); + static void QuitUser(InspIRCd* Instance, userrec *user, const std::string &r); /** Add the user to WHOWAS system */ @@ -542,7 +548,7 @@ class userrec : public connection * This will create a new userrec, insert it into the user_hash, * initialize it as not yet registered, and add it to the socket engine. */ - static void AddClient(int socket, int port, bool iscached, insp_inaddr ip); + static void AddClient(InspIRCd* Instance, int socket, int port, bool iscached, insp_inaddr ip); /** Oper down. * This will clear the +o usermode and unset the user's oper type |