summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/base.h15
-rw-r--r--include/modules.h10
-rw-r--r--include/socket.h2
-rw-r--r--include/users.h6
4 files changed, 30 insertions, 3 deletions
diff --git a/include/base.h b/include/base.h
index 45c60802c..230ed1db4 100644
--- a/include/base.h
+++ b/include/base.h
@@ -142,6 +142,21 @@ class CoreExport reference
if (value && value->refcount_dec())
delete value;
}
+
+ inline reference<T>& operator=(T* other)
+ {
+ if (value != other)
+ {
+ if (value && value->refcount_dec())
+ delete value;
+ value = other;
+ if (value)
+ value->refcount_inc();
+ }
+
+ return *this;
+ }
+
inline operator bool() const { return value; }
inline operator T*() const { return value; }
inline T* operator->() const { return value; }
diff --git a/include/modules.h b/include/modules.h
index 49c16ae61..281da2705 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -116,7 +116,7 @@ struct ModResult {
* and numerical comparisons in preprocessor macros if they wish to support
* multiple versions of InspIRCd in one file.
*/
-#define INSPIRCD_VERSION_API 1
+#define INSPIRCD_VERSION_API 2
/**
* This #define allows us to call a method in all
@@ -338,7 +338,7 @@ enum Implementation
I_OnPostOper, I_OnSyncNetwork, I_OnSetAway, I_OnPostCommand, I_OnPostJoin,
I_OnWhoisLine, I_OnBuildNeighborList, I_OnGarbageCollect, I_OnSetConnectClass,
I_OnText, I_OnPassCompare, I_OnRunTestSuite, I_OnNamesListItem, I_OnNumeric, I_OnHookIO,
- I_OnPreRehash, I_OnModuleRehash, I_OnSendWhoLine, I_OnChangeIdent,
+ I_OnPreRehash, I_OnModuleRehash, I_OnSendWhoLine, I_OnChangeIdent, I_OnSetUserIP,
I_END
};
@@ -1288,6 +1288,12 @@ class CoreExport Module : public classbase, public usecountbase
* @param line The raw line to send; modifiable, if empty no line will be returned.
*/
virtual void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line);
+
+ /** Called whenever a local user's IP is set for the first time, or when a local user's IP changes due to
+ * a module like m_cgiirc changing it.
+ * @param user The user whose IP is being set
+ */
+ virtual void OnSetUserIP(LocalUser* user);
};
diff --git a/include/socket.h b/include/socket.h
index 16809c3f8..e868af93e 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -146,7 +146,7 @@ namespace irc
class CoreExport ListenSocket : public EventHandler
{
public:
- const reference<ConfigTag> bind_tag;
+ reference<ConfigTag> bind_tag;
std::string bind_addr;
int bind_port;
/** Human-readable bind description */
diff --git a/include/users.h b/include/users.h
index 57dea3fa5..5a8864cdd 100644
--- a/include/users.h
+++ b/include/users.h
@@ -395,6 +395,8 @@ class CoreExport User : public Extensible
*/
bool SetClientIP(const char* sip);
+ void SetClientIP(const irc::sockets::sockaddrs& sa);
+
/** Constructor
* @throw CoreException if the UID allocated to the user already exists
*/
@@ -819,6 +821,10 @@ class CoreExport LocalUser : public User, public InviteBase
*/
void SetClass(const std::string &explicit_name = "");
+ bool SetClientIP(const char* sip);
+
+ void SetClientIP(const irc::sockets::sockaddrs& sa);
+
void SendText(const std::string& line);
void Write(const std::string& text);
void Write(const char*, ...) CUSTOM_PRINTF(2, 3);