From b2f7888b7ac0e72041ceea7dd9e7e6d4c46dcb5c Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 18 Jul 2007 18:03:21 +0000 Subject: Ive tidied up the mode count stuff, but i still cant duplicate negative invisible counts. :( git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7474 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspsocket.cpp | 4 ++-- src/mode.cpp | 3 +++ src/modes/umode_i.cpp | 1 - src/modes/umode_s.cpp | 1 - src/modes/umode_w.cpp | 1 - src/modules/m_spanningtree/main.cpp | 12 ++++++++++-- src/modules/m_spanningtree/treesocket1.cpp | 6 +++++- 7 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index f29366c73..ecf7e0b24 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -356,9 +356,9 @@ void InspSocket::Close() Instance->Log(DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } - this->OnClose(); shutdown(this->fd,2); - close(this->fd); + if (close(this->fd) != -1) + this->OnClose(); if (Instance->SocketCull.find(this) == Instance->SocketCull.end()) Instance->SocketCull[this] = this; diff --git a/src/mode.cpp b/src/mode.cpp index db120cfe5..d04b7df97 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -79,6 +79,7 @@ unsigned int ModeHandler::GetCount() void ModeHandler::ChangeCount(int modifier) { count += modifier; + ServerInstance->Log(DEBUG,"Change count for mode %c is now %d", mode, count); } ModeType ModeHandler::GetModeType() @@ -564,6 +565,8 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool /* Add the mode letter */ output_sequence.push_back(modechar); + modehandlers[handler_id]->ChangeCount(adding ? 1 : -1); + /* Is there a valid parameter for this mode? If so add it to the parameter list */ if ((modehandlers[handler_id]->GetNumParams(adding)) && (!parameter.empty())) { diff --git a/src/modes/umode_i.cpp b/src/modes/umode_i.cpp index 5a9327375..a599f8f6f 100644 --- a/src/modes/umode_i.cpp +++ b/src/modes/umode_i.cpp @@ -31,7 +31,6 @@ ModeAction ModeUserInvisible::OnModeChange(userrec* source, userrec* dest, chanr if (dest->modes[UM_INVISIBLE] != adding) { dest->modes[UM_INVISIBLE] = adding; - this->count += (adding ? 1: -1); return MODEACTION_ALLOW; } diff --git a/src/modes/umode_s.cpp b/src/modes/umode_s.cpp index 4b3179001..faf6348de 100644 --- a/src/modes/umode_s.cpp +++ b/src/modes/umode_s.cpp @@ -31,7 +31,6 @@ ModeAction ModeUserServerNotice::OnModeChange(userrec* source, userrec* dest, ch if (dest->modes[UM_SERVERNOTICE] != adding) { dest->modes[UM_SERVERNOTICE] = adding; - this->count += (adding ? 1: -1); return MODEACTION_ALLOW; } diff --git a/src/modes/umode_w.cpp b/src/modes/umode_w.cpp index 383c91f6e..50000f75f 100644 --- a/src/modes/umode_w.cpp +++ b/src/modes/umode_w.cpp @@ -31,7 +31,6 @@ ModeAction ModeUserWallops::OnModeChange(userrec* source, userrec* dest, chanrec if (dest->modes[UM_WALLOPS] != adding) { dest->modes[UM_WALLOPS] = adding; - this->count += (adding ? 1: -1); return MODEACTION_ALLOW; } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 1cc18dae6..9a678dc5b 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -137,13 +137,20 @@ void ModuleSpanningTree::HandleLusers(const char** parameters, int pcnt, userrec } } } - user->WriteServ("251 %s :There are %d users and %d invisible on %d servers",user->nick,n_users-ServerInstance->InvisibleUserCount(),ServerInstance->InvisibleUserCount(),ulined_count ? this->CountServs() - ulined_count : this->CountServs()); + user->WriteServ("251 %s :There are %d users and %d invisible on %d servers",user->nick, + n_users-ServerInstance->InvisibleUserCount(), + ServerInstance->InvisibleUserCount(), + ulined_count ? this->CountServs() - ulined_count : this->CountServs()); + if (ServerInstance->OperCount()) user->WriteServ("252 %s %d :operator(s) online",user->nick,ServerInstance->OperCount()); + if (ServerInstance->UnregisteredUserCount()) user->WriteServ("253 %s %d :unknown connections",user->nick,ServerInstance->UnregisteredUserCount()); + if (ServerInstance->ChannelCount()) user->WriteServ("254 %s %d :channels formed",user->nick,ServerInstance->ChannelCount()); + user->WriteServ("255 %s :I have %d clients and %d servers",user->nick,ServerInstance->LocalUserCount(),ulined_local_count ? this->CountLocalServs() - ulined_local_count : this->CountLocalServs()); user->WriteServ("265 %s :Current Local Users: %d Max: %d",user->nick,ServerInstance->LocalUserCount(),max_local); user->WriteServ("266 %s :Current Global Users: %d Max: %d",user->nick,n_users,max_global); @@ -487,7 +494,8 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime) /* they didnt answer, boot them */ sock->SendError("Ping timeout"); sock->Squit(serv,"Ping timeout"); - /*** XXX SOCKET CULL ***/ + ServerInstance->SE->DelFd(sock); + sock->Close(); return; } } diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index a907bb440..4d960cf8a 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -918,6 +918,7 @@ bool TreeSocket::IntroduceClient(const std::string &source, std::dequemodes[(*v)-65] = 1; /* For each mode thats set, increase counter */ ModeHandler* mh = Instance->Modes->FindMode(*v, MODETYPE_USER); if (mh) + { + mh->OnModeChange(_new, _new, NULL, empty, true); + _new->SetMode(*v, true); mh->ChangeCount(1); + } } /* now we've done with modes processing, put the + back for remote servers */ -- cgit v1.2.3