X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusers.cpp;h=01a973deae90a7b444736f0572cdc25b78377a8b;hb=46f89e12959945a94f6ad81265351600badca723;hp=affd898150169bb08bf1a6d792964817e849df49;hpb=11e2a3e2ebc04801099384e13c2bc5fc3e504b48;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/users.cpp b/src/users.cpp index affd89815..01a973dea 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -99,6 +99,7 @@ void User::StartDNSLookup() { bool cached = false; const char* sip = this->GetIPString(false); + UserResolver *res_reverse; /* Special case for 4in6 (Have i mentioned i HATE 4in6?) */ if (!strncmp(sip, "0::ffff:", 8)) @@ -157,16 +158,28 @@ void User::SetMode(unsigned char m, bool value) modes[m-65] = value; } -const char* User::FormatModes() +const char* User::FormatModes(bool showparameters) { static char data[MAXBUF]; + std::string params; int offset = 0; - for (int n = 0; n < 64; n++) + + for (unsigned char n = 0; n < 64; n++) { if (modes[n]) - data[offset++] = n+65; + { + data[offset++] = n + 65; + ModeHandler* mh = ServerInstance->Modes->FindMode(n + 65, MODETYPE_USER); + if (showparameters && mh && mh->GetNumParams(true)) + { + std::string p = mh->GetUserParameter(this); + if (p.length()) + params.append(" ").append(p); + } + } } data[offset] = 0; + strlcat(data, params.c_str(), MAXBUF); return data; } @@ -200,11 +213,9 @@ User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance fd = -1; recvq.clear(); sendq.clear(); - res_forward = res_reverse = NULL; Visibility = NULL; ip = NULL; MyClass = NULL; - io = NULL; AllowedUserModes = NULL; AllowedChanModes = NULL; AllowedOperCommands = NULL; @@ -1268,14 +1279,14 @@ void User::Write(std::string text) return; } - if (this->io) + if (this->GetIOHook()) { /* XXX: The lack of buffering here is NOT a bug, modules implementing this interface have to * implement their own buffering mechanisms */ try { - this->io->OnRawSocketWrite(this->fd, text.data(), text.length()); + this->GetIOHook()->OnRawSocketWrite(this->fd, text.data(), text.length()); } catch (CoreException& modexcept) {