summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-09 14:49:13 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-09 14:49:13 +0000
commitb3fe8a5c30920c41381bc6d25cc55557e5eac79c (patch)
treee2e3fc1f2763064b4fddcab31e96f085e2f85a2a
parent6b0f8c6fbfe715c7588b79b740a9806cb2b015ed (diff)
/WHO fixes and additions (wouldnt WHO a nickname)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@467 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/InspIRCd.layout50
-rw-r--r--src/inspircd.cpp57
2 files changed, 76 insertions, 31 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index f4a7b0528..77ece5f58 100644
--- a/src/InspIRCd.layout
+++ b/src/InspIRCd.layout
@@ -1,6 +1,6 @@
[Editors]
Focused=1
-Order=1,2,-1,4,6,3
+Order=1,2,-1,4,6,3,7,25,5
[Editor_0]
Open=0
@@ -13,9 +13,9 @@ LeftChar=1
[Editor_1]
Open=1
Top=1
-CursorCol=83
-CursorRow=4049
-TopLine=4018
+CursorCol=1
+CursorRow=4021
+TopLine=3955
LeftChar=1
[Editor_2]
@@ -29,9 +29,9 @@ LeftChar=1
[Editor_3]
Open=1
Top=0
-CursorCol=1
-CursorRow=69
-TopLine=21
+CursorCol=3
+CursorRow=81
+TopLine=26
LeftChar=1
[Editor_4]
@@ -43,10 +43,10 @@ TopLine=293
LeftChar=1
[Editor_5]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=1
+CursorCol=2
+CursorRow=26
TopLine=1
LeftChar=1
@@ -59,7 +59,7 @@ TopLine=37
LeftChar=1
[Editor_7]
-Open=0
+Open=1
Top=0
CursorCol=20
CursorRow=15
@@ -99,11 +99,11 @@ TopLine=1
LeftChar=1
[Editor_12]
-Open=0
+Open=1
Top=0
-CursorCol=18
-CursorRow=10
-TopLine=64
+CursorCol=12
+CursorRow=104
+TopLine=1
LeftChar=1
[Editor_13]
@@ -131,7 +131,7 @@ TopLine=50
LeftChar=1
[Editor_16]
-Open=0
+Open=1
Top=0
CursorCol=34
CursorRow=29
@@ -139,7 +139,7 @@ TopLine=1
LeftChar=1
[Editor_17]
-Open=0
+Open=1
Top=0
CursorCol=1
CursorRow=115
@@ -157,7 +157,7 @@ LeftChar=1
[Editor_19]
Open=1
Top=0
-CursorCol=39
+CursorCol=21
CursorRow=7
TopLine=1
LeftChar=1
@@ -171,23 +171,23 @@ TopLine=472
LeftChar=1
[Editor_21]
-Open=0
+Open=1
Top=0
CursorCol=1
CursorRow=25
-TopLine=1
+TopLine=7
LeftChar=1
[Editor_22]
Open=1
Top=0
-CursorCol=5
-CursorRow=137
-TopLine=101
+CursorCol=15
+CursorRow=121
+TopLine=83
LeftChar=1
[Editor_23]
-Open=0
+Open=1
Top=0
CursorCol=1
CursorRow=1
@@ -202,7 +202,7 @@ CursorRow=1
TopLine=1
LeftChar=1
[Editor_25]
-Open=0
+Open=1
Top=0
CursorCol=6
CursorRow=10
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 6c7e4ef32..9c70e5c76 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -3965,7 +3965,7 @@ void handle_who(char **parameters, int pcnt, userrec *user)
{
if ((common_channels(user,i->second)) && (isnick(i->second->nick)))
{
- WriteServ(user->fd,"352 %s %s %s %s %s %s Hr@ :0 %s",user->nick, Ptr->name, i->second->ident, i->second->dhost, ServerName, i->second->nick, i->second->fullname);
+ 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);
}
}
}
@@ -3979,7 +3979,7 @@ void handle_who(char **parameters, int pcnt, userrec *user)
}
return;
}
- if (parameters[0][0] = '#')
+ if (parameters[0][0] == '#')
{
Ptr = FindChan(parameters[0]);
if (Ptr)
@@ -3988,7 +3988,7 @@ void handle_who(char **parameters, int pcnt, userrec *user)
{
if ((has_channel(i->second,Ptr)) && (isnick(i->second->nick)))
{
- WriteServ(user->fd,"352 %s %s %s %s %s %s Hr@ :0 %s",user->nick, Ptr->name, i->second->ident, i->second->dhost, ServerName, i->second->nick, i->second->fullname);
+ 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,"315 %s %s :End of /WHO list.",user->nick, Ptr->name);
@@ -3998,6 +3998,11 @@ void handle_who(char **parameters, int pcnt, userrec *user)
WriteServ(user->fd,"401 %s %s :No suck nick/channel",user->nick, parameters[0]);
}
}
+ else
+ {
+ 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 (pcnt == 2)
{
@@ -4010,7 +4015,7 @@ void handle_who(char **parameters, int pcnt, userrec *user)
{
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, ServerName, i->second->nick, i->second->fullname);
+ 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);
}
}
}
@@ -5042,6 +5047,46 @@ void process_buffer(const char* cmdbuf,userrec *user)
}
}
+void DoSync(serverrec* serv, char* udp_host,int udp_port, long MyKey)
+{
+ char data[MAXBUF];
+ // send start of sync marker: Y <timestamp>
+ snprintf(data,MAXBUF,"Y %d",time(NULL));
+ serv->SendPacket(data,udp_host,udp_port,MyKey);
+ // send users and channels
+ for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
+ {
+ snprintf(data,MAXBUF,"N %d %s %s %s %s %s %s :%s",u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->modes,u->second->server,u->second->fullname);
+ serv->SendPacket(data,udp_host,udp_port,MyKey);
+ if (strcmp(chlist(u->second),""))
+ {
+ snprintf(data,MAXBUF,"J %s :%s",u->second->nick,chlist(u->second));
+ serv->SendPacket(data,udp_host,udp_port,MyKey);
+ }
+ }
+ // send channel modes, topics etc...
+ for (chan_hash::iterator c = chanlist.begin(); c != chanlist.end(); c++)
+ {
+ snprintf(data,MAXBUF,"C %s %d %s :%s",c->second->name,c->second->created,c->second->setby,chanmodes(c->second));
+ serv->SendPacket(data,udp_host,udp_port,MyKey);
+ if (strcmp(c->second->topic),"")
+ {
+ snprintf(data,MAXBUF,"T %d %s :%s",c->second->topicset,c->second->name,c->second->topic);
+ }
+ serv->SendPacket(data,udp_host,udp_port,MyKey);
+ // send current banlist
+
+ for (BanList::iterator b = c->second->bans.begin(); b != c->second->bans.end(); b++)
+ {
+ snprintf(data,MAXBUF,"M %d %s +b %s",b->set_time,c->second->name,b->data);
+ serv->SendPacket(data,udp_host,udp_port,MyKey);
+ }
+ }
+ // send end of sync marker: E <timestamp>
+ snprintf(data,MAXBUF,"F %d",time(NULL));
+ serv->SendPacket(data,udp_host,udp_port,MyKey);
+}
+
void process_restricted_commands(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port)
{
WriteOpers("Secure-UDP-Channel: Token='%c', Params='%s'",token,params);
@@ -5099,6 +5144,7 @@ void handle_link_packet(long theirkey, char* udp_msg, char* udp_host, int udp_po
// create a server record for this server
snprintf(response,10240,"O %d",MyKey);
serv->SendPacket(response,udp_host,udp_port,0);
+ DoSync(serv,udp_host,udp_port,MyKey);
return;
}
}
@@ -5131,7 +5177,7 @@ void handle_link_packet(long theirkey, char* udp_msg, char* udp_host, int udp_po
if (!strcasecmp(servers[i]->internal_addr,udp_host)) {
servers[i]->key = atoi(params);
log(DEBUG,"Key for this server is now %d",servers[i]->key);
- serv->SendPacket("Z blah blah",udp_host,udp_port,MyKey);
+ DoSync(serv,udp_host,udp_port,MyKey);
return;
}
}
@@ -5234,7 +5280,6 @@ void handle_link_packet(long theirkey, char* udp_msg, char* udp_host, int udp_po
if (servers[j]->key == theirkey) {
// found a valid key for this server, can process restricted stuff here
process_restricted_commands(token,params,servers[j],serv,udp_host,udp_port);
-
return;
}
}