summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-16 21:02:39 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-16 21:02:39 +0000
commitb7dd7d244bb66f194b812126ac88106e60fc798f (patch)
tree2bc6d5421aa2a62f1a5dd9ff892f4fb50f9243b0 /src
parent1635c37dadd8650a7d3ee27a0c003c4e30f1ec4e (diff)
Add a notice on connection close stating server link uptime, and fix a bug in m_opermodes which meant that its modes werent being replicated across servers (it was sending a totally malformed MODE
command with the nick in twice, and has been doing this presumably since early 1.1's) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7034 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_opermodes.cpp4
-rw-r--r--src/modules/m_spanningtree/main.cpp19
-rw-r--r--src/modules/m_spanningtree/main.h4
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp5
4 files changed, 22 insertions, 10 deletions
diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp
index 57eb8ae23..43c271c3d 100644
--- a/src/modules/m_opermodes.cpp
+++ b/src/modules/m_opermodes.cpp
@@ -98,9 +98,7 @@ class ModuleModesOnOper : public Module
}
std::deque<std::string> n;
Event rmode((char *)&n, NULL, "send_mode");
- n.push_back(user->nick);
- n.push_back(modes[0]);
- for (unsigned int j = 1; j < tokens.size(); j++)
+ for (unsigned int j = 0; j < tokens.size(); j++)
{
n.push_back(modes[j]);
}
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 5c6fecc8f..69e032f6a 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -147,19 +147,24 @@ void ModuleSpanningTree::HandleLusers(const char** parameters, int pcnt, userrec
return;
}
-const std::string ModuleSpanningTree::MapOperInfo(TreeServer* Current)
+std::string ModuleSpanningTree::TimeToStr(time_t secs)
{
- time_t secs_up = ServerInstance->Time() - Current->age;
- time_t mins_up = secs_up / 60;
+ time_t mins_up = secs / 60;
time_t hours_up = mins_up / 60;
time_t days_up = hours_up / 24;
- secs_up = secs_up % 60;
+ secs = secs % 60;
mins_up = mins_up % 60;
hours_up = hours_up % 24;
- return (" [Up: "+ (days_up ? (ConvToStr(days_up) + "d") : std::string(""))
+ return ((days_up ? (ConvToStr(days_up) + "d") : std::string(""))
+ (hours_up ? (ConvToStr(hours_up) + "h") : std::string(""))
+ (mins_up ? (ConvToStr(mins_up) + "m") : std::string(""))
- + ConvToStr(secs_up) + "s Lag: "+ConvToStr(Current->rtt)+"s]");
+ + ConvToStr(secs) + "s");
+}
+
+const std::string ModuleSpanningTree::MapOperInfo(TreeServer* Current)
+{
+ time_t secs_up = ServerInstance->Time() - Current->age;
+ return (" [Up: " + TimeToStr(secs_up) + " Lag: "+ConvToStr(Current->rtt)+"s]");
}
// WARNING: NOT THREAD SAFE - DONT GET ANY SMART IDEAS.
@@ -1260,7 +1265,7 @@ void ModuleSpanningTree::OnEvent(Event* event)
if (a)
{
ourTS = a->age;
- Utils->DoOneToMany(ServerInstance->Config->ServerName,"MODE",*params);
+ Utils->DoOneToMany(ServerInstance->Config->ServerName,"FMODE",*params);
return;
}
else
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 17e7af78e..aea1d1a42 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -143,6 +143,10 @@ class ModuleSpanningTree : public Module
*/
const std::string MapOperInfo(TreeServer* Current);
+ /** Display a time as a human readable string
+ */
+ std::string TimeToStr(time_t secs);
+
/**
** *** MODULE EVENTS ***
**/
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 94da9e3b7..b8134f31c 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -1559,7 +1559,12 @@ void TreeSocket::OnClose()
}
if (quitserver != "")
+ {
this->Instance->SNO->WriteToSnoMask('l',"Connection to '\2%s\2' failed.",quitserver.c_str());
+ time_t server_uptime = Instance->Time() - this->age;
+ if (server_uptime)
+ Instance->SNO->WriteToSnoMask('l',"Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str());
+ }
}
int TreeSocket::OnIncomingConnection(int newsock, char* ip)