/WHO and routing fixes

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@670 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
brain 2004-04-19 09:40:41 +00:00
parent d25c8309ce
commit b308d00aaa
3 changed files with 31 additions and 24 deletions

View File

@ -13,9 +13,9 @@ LeftChar=1
[Editor_1] [Editor_1]
Open=1 Open=1
Top=1 Top=1
CursorCol=10 CursorCol=1
CursorRow=5358 CursorRow=2762
TopLine=3349 TopLine=2726
LeftChar=1 LeftChar=1
[Editor_2] [Editor_2]
@ -197,9 +197,9 @@ LeftChar=1
[Editor_24] [Editor_24]
Open=1 Open=1
Top=0 Top=0
CursorCol=2 CursorCol=50
CursorRow=206 CursorRow=348
TopLine=161 TopLine=320
LeftChar=1 LeftChar=1
[Editor_25] [Editor_25]
Open=1 Open=1
@ -303,8 +303,8 @@ LeftChar=1
Open=1 Open=1
Top=0 Top=0
CursorCol=1 CursorCol=1
CursorRow=39 CursorRow=37
TopLine=1 TopLine=103
LeftChar=1 LeftChar=1
[Editor_40] [Editor_40]
Open=1 Open=1
@ -324,6 +324,6 @@ LeftChar=1
Open=1 Open=1
Top=0 Top=0
CursorCol=1 CursorCol=1
CursorRow=1733 CursorRow=37
TopLine=1679 TopLine=1
LeftChar=1 LeftChar=1

View File

@ -345,19 +345,23 @@ bool connection::SendPacket(char *message, const char* host)
if (cn->GetState() == STATE_DISCONNECTED) if (cn->GetState() == STATE_DISCONNECTED)
{ {
log(DEBUG,"Main route to %s is down, seeking alternative",host); log(DEBUG,"Main route to %s is down, seeking alternative",host);
// this route is down, we must re-route the packet through an available point in the mesh. // fix: can only route one hop to avoid a loop
for (int k = 0; k < this->connectors.size(); k++) if (strncat(message,"R ",2))
{ {
// search for another point in the mesh which can 'reach' where we want to go // this route is down, we must re-route the packet through an available point in the mesh.
for (int m = 0; m < this->connectors[k].routes.size(); m++) for (int k = 0; k < this->connectors.size(); k++)
{ {
if (!strcasecmp(this->connectors[k].routes[m].c_str(),host)) // search for another point in the mesh which can 'reach' where we want to go
for (int m = 0; m < this->connectors[k].routes.size(); m++)
{ {
log(DEBUG,"Found alternative route for packet: %s",this->connectors[k].GetServerName().c_str()); if (!strcasecmp(this->connectors[k].routes[m].c_str(),host))
char buffer[MAXBUF]; {
snprintf(buffer,MAXBUF,"R %s %s",host,message); log(DEBUG,"Found alternative route for packet: %s",this->connectors[k].GetServerName().c_str());
this->SendPacket(buffer,this->connectors[k].GetServerName().c_str()); char buffer[MAXBUF];
return true; snprintf(buffer,MAXBUF,"R %s %s",host,message);
this->SendPacket(buffer,this->connectors[k].GetServerName().c_str());
return true;
}
} }
} }
} }

View File

@ -2750,25 +2750,28 @@ void handle_who(char **parameters, int pcnt, userrec *user)
else else
{ {
userrec* u = Find(parameters[0]); userrec* u = Find(parameters[0]);
WriteServ(user->fd,"352 %s %s %s %s %s %s Hr@ :0 %s",user->nick, u->nick, u->ident, u->dhost, u->server, u->nick, u->fullname); if (u)
{
WriteServ(user->fd,"352 %s %s %s %s %s %s Hr@ :0 %s",user->nick, u->nick, u->ident, u->dhost, u->server, u->nick, u->fullname);
}
WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, parameters[0]);
} }
} }
if (pcnt == 2) if (pcnt == 2)
{ {
if ((!strcmp(parameters[0],"0")) || (!strcmp(parameters[0],"*")) && (!strcmp(parameters[1],"o"))) if ((!strcmp(parameters[0],"0")) || (!strcmp(parameters[0],"*")) && (!strcmp(parameters[1],"o")))
{ {
Ptr = user->chans[0].channel;
for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
{ {
if ((common_channels(user,i->second)) && (isnick(i->second->nick))) if ((common_channels(user,i->second)) && (isnick(i->second->nick)))
{ {
if (strchr(i->second->modes,'o')) if (strchr(i->second->modes,'o'))
{ {
WriteServ(user->fd,"352 %s %s %s %s %s %s Hr@ :0 %s",user->nick, Ptr->name, i->second->ident, i->second->dhost, i->second->server, i->second->nick, i->second->fullname); WriteServ(user->fd,"352 %s %s %s %s %s %s Hr@ :0 %s",user->nick, user->nick, i->second->ident, i->second->dhost, i->second->server, i->second->nick, i->second->fullname);
} }
} }
} }
WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, Ptr->name); WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, user->nick);
return; return;
} }
} }