From 30fa63cc5de5240e43846d78e39010a6969fb861 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 18 Apr 2004 15:44:38 +0000 Subject: Fixed server descriptions in /whois and /links (untested) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@644 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/InspIRCd.layout | 8 ++++---- src/inspircd.cpp | 29 ++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 2232312fe..c96e10fa8 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -13,9 +13,9 @@ LeftChar=1 [Editor_1] Open=1 Top=1 -CursorCol=37 -CursorRow=6901 -TopLine=7059 +CursorCol=9 +CursorRow=7052 +TopLine=7007 LeftChar=1 [Editor_2] @@ -199,7 +199,7 @@ Open=1 Top=0 CursorCol=27 CursorRow=134 -TopLine=102 +TopLine=315 LeftChar=1 [Editor_25] Open=1 diff --git a/src/inspircd.cpp b/src/inspircd.cpp index d9e9169cd..851473bf9 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -718,6 +718,26 @@ int c_count(userrec* u) } + +std::string GetServerDescription(char* servername) +{ + for (int j = 0; j < 32; j++) + { + if (me[j] != NULL) + { + for (int k = 0; k < me[j]->connectors.size(); k++) + { + if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),servername)) + { + return me[j]->connectors[k].GetDescription(); + } + } + } + return ""; + } +} + + /* return 0 or 1 depending if users u and u2 share one or more common channels * (used by QUIT, NICK etc which arent channel specific notices) */ @@ -4677,7 +4697,7 @@ void handle_whois(char **parameters, int pcnt, userrec *user) { WriteServ(user->fd,"319 %s %s :%s",user->nick, dest->nick, chlist(dest)); } - WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, ServerDesc); + WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server)); if (strcmp(dest->awaymsg,"")) { WriteServ(user->fd,"301 %s %s :%s",user->nick, dest->nick, dest->awaymsg); @@ -6923,7 +6943,8 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv) if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),udp_host)) { me[j]->connectors[k].SetServerName(servername); - me[j]->connectors[k].SetState(STATE_CONNECTED); + me[j]->connectors[k].SetDescription(serverdesc); + me[j]->connectors[k].SetState(STATE_CONNECTED); NetSendMyRoutingTable(); return; } @@ -6955,6 +6976,7 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv) if (!strcasecmp(serv->connectors[j].GetServerName().c_str(),udp_host)) { serv->connectors[j].SetServerName(servername); + serv->connectors[j].SetDescription(serverdesc); serv->connectors[j].SetServerPort(atoi(myport)); } } @@ -7039,7 +7061,7 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv) // at this point we must begin key exchange and insert this // server into our 'active' table. for (int j = 0; j < 32; j++) - { + { if (me[j] != NULL) { for (int k = 0; k < me[j]->connectors.size(); k++) @@ -7047,6 +7069,7 @@ void handle_link_packet(char* udp_msg, char* udp_host, serverrec *serv) if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),udp_host)) { char buffer[MAXBUF]; + me[j]->connectors[k].SetDescription(serverdesc); me[j]->connectors[k].SetState(STATE_CONNECTED); sprintf(buffer,"X 0"); serv->SendPacket(buffer,udp_host); -- cgit v1.2.3