diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-02 22:57:28 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-02 22:57:28 +0000 |
commit | 8509727e16f1d9ce6c9719c8d62c7715d3699858 (patch) | |
tree | 68343ec18f5d0738c5fedaafc25d79fe5014edd0 /src | |
parent | 7f7e508640db92ce3535afe498bc1cc5a70a1cdd (diff) |
Cache User::GetIPString()
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8795 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/configreader.cpp | 1 | ||||
-rw-r--r-- | src/modes/cmode_v.cpp | 4 | ||||
-rw-r--r-- | src/users.cpp | 11 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 945780a54..dea6a7a7d 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -830,6 +830,7 @@ void ServerConfig::Read(bool bail, User* user, int pass) {"options", "netbuffersize","10240", new ValueContainerInt (&this->NetBufferSize), DT_INTEGER, ValidateNetBufferSize}, {"options", "maxwho", "128", new ValueContainerInt (&this->MaxWhoResults), DT_INTEGER, ValidateMaxWho}, {"options", "allowhalfop", "0", new ValueContainerBool (&this->AllowHalfop), DT_BOOLEAN, NoValidation}, + {"options", "allowdevoiceself", "0", new ValueContainerBool (&this->AllowDevoiceSelf), DT_BOOLEAN, NoValidation}, {"dns", "server", "", new ValueContainerChar (this->DNSServer), DT_IPADDRESS,DNSServerValidator}, {"dns", "timeout", "5", new ValueContainerInt (&this->dns_timeout), DT_INTEGER, NoValidation}, {"options", "moduledir", MOD_PATH, new ValueContainerChar (this->ModPath), DT_CHARPTR, NoValidation}, diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 66e58a479..8b94caf08 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -136,7 +136,9 @@ std::string ModeChannelVoice::DelVoice(User *user,const char *dest,Channel *chan return ""; if (MOD_RESULT == ACR_DEFAULT) { - if ((status < STATUS_HOP) && (!ServerInstance->ULine(user->server))) + if ((status < STATUS_HOP) && (!ServerInstance->ULine(user->server)) || + user == d && ServerInstance->Config->AllowDevoiceSelf + ) { user->WriteServ("482 %s %s :You are not a channel (half)operator",user->nick, chan->name); return ""; diff --git a/src/users.cpp b/src/users.cpp index 6b2aebfc7..7847d8281 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -926,6 +926,8 @@ bool User::ForceNickChange(const char* newnick) void User::SetSockAddr(int protocol_family, const char* ip, int port) { + this->cachedip = ""; + switch (protocol_family) { #ifdef SUPPORT_IP6LINKS @@ -1001,6 +1003,9 @@ const char* User::GetIPString() if (this->ip == NULL) return ""; + if (!this->cachedip.empty()) + return this->cachedip.c_str(); + switch (this->GetProtocolFamily()) { #ifdef SUPPORT_IP6LINKS @@ -1015,8 +1020,11 @@ const char* User::GetIPString() { strlcpy(&temp[1], buf, sizeof(temp) - 1); *temp = '0'; + this->cachedip = temp; return temp; } + + this->cachedip = buf; return buf; } break; @@ -1025,12 +1033,15 @@ const char* User::GetIPString() { sockaddr_in* sin = (sockaddr_in*)this->ip; inet_ntop(sin->sin_family, &sin->sin_addr, buf, sizeof(buf)); + this->cachedip = buf; return buf; } break; default: break; } + + // Unreachable, probably return ""; } |