|
@@ -287,11 +287,11 @@ func (s *Server) tryRegister(c *Client) {
|
287
|
287
|
// send welcome text
|
288
|
288
|
//NOTE(dan): we specifically use the NICK here instead of the nickmask
|
289
|
289
|
// see http://modern.ircdocs.horse/#rplwelcome-001 for details on why we avoid using the nickmask
|
290
|
|
- c.Send(nil, s.nameString, RPL_WELCOME, fmt.Sprintf("Welcome to the Internet Relay Network %s", c.nickString))
|
291
|
|
- c.Send(nil, s.nameString, RPL_YOURHOST, fmt.Sprintf("Your host is %s, running version %s", s.nameString, SEM_VER))
|
292
|
|
- c.Send(nil, s.nameString, RPL_CREATED, fmt.Sprintf("This server was created %s", s.ctime.Format(time.RFC1123)))
|
|
290
|
+ c.Send(nil, s.nameString, RPL_WELCOME, c.nickString, fmt.Sprintf("Welcome to the Internet Relay Network %s", c.nickString))
|
|
291
|
+ c.Send(nil, s.nameString, RPL_YOURHOST, c.nickString, fmt.Sprintf("Your host is %s, running version %s", s.nameString, SEM_VER))
|
|
292
|
+ c.Send(nil, s.nameString, RPL_CREATED, c.nickString, fmt.Sprintf("This server was created %s", s.ctime.Format(time.RFC1123)))
|
293
|
293
|
//TODO(dan): Look at adding last optional [<channel modes with a parameter>] parameter
|
294
|
|
- c.Send(nil, s.nameString, RPL_MYINFO, s.nameString, SEM_VER, supportedUserModesString, supportedChannelModesString)
|
|
294
|
+ c.Send(nil, s.nameString, RPL_MYINFO, c.nickString, s.nameString, SEM_VER, supportedUserModesString, supportedChannelModesString)
|
295
|
295
|
c.RplISupport()
|
296
|
296
|
s.MOTD(c)
|
297
|
297
|
}
|
|
@@ -332,6 +332,12 @@ func passHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
332
|
332
|
return false
|
333
|
333
|
}
|
334
|
334
|
|
|
335
|
+ // if no password exists, skip checking
|
|
336
|
+ if len(server.password) == 0 {
|
|
337
|
+ client.authorized = true
|
|
338
|
+ return false
|
|
339
|
+ }
|
|
340
|
+
|
335
|
341
|
// check the provided password
|
336
|
342
|
password := []byte(msg.Params[0])
|
337
|
343
|
if ComparePassword(server.password, password) != nil {
|
|
@@ -383,8 +389,8 @@ func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
383
|
389
|
// we do it this way to ONLY replace what hasn't already been set
|
384
|
390
|
server.clients.Remove(client)
|
385
|
391
|
|
386
|
|
- if client.username != "" {
|
387
|
|
- client.username = Name(msg.Params[0])
|
|
392
|
+ if !client.HasUsername() {
|
|
393
|
+ client.username = Name("~" + msg.Params[0])
|
388
|
394
|
client.updateNickMask()
|
389
|
395
|
}
|
390
|
396
|
if client.realname != "" {
|
|
@@ -446,6 +452,7 @@ func joinHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
446
|
452
|
for i, nameString := range channels {
|
447
|
453
|
name = Name(nameString)
|
448
|
454
|
if !name.IsChannel() {
|
|
455
|
+ fmt.Println("ISN'T CHANNEL NAME:", nameString)
|
449
|
456
|
client.Send(nil, server.nameString, ERR_NOSUCHCHANNEL, client.nickString, nameString, "No such channel")
|
450
|
457
|
continue
|
451
|
458
|
}
|
|
@@ -551,10 +558,10 @@ func (client *Client) WhoisChannelsNames(target *Client) []string {
|
551
|
558
|
// WHOIS [ <target> ] <mask> *( "," <mask> )
|
552
|
559
|
func whoisHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
553
|
560
|
var masksString string
|
554
|
|
- var target string
|
|
561
|
+ //var target string
|
555
|
562
|
|
556
|
563
|
if len(msg.Params) > 1 {
|
557
|
|
- target = msg.Params[0]
|
|
564
|
+ //target = msg.Params[0]
|
558
|
565
|
masksString = msg.Params[1]
|
559
|
566
|
} else {
|
560
|
567
|
masksString = msg.Params[0]
|
|
@@ -639,10 +646,10 @@ func whoHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
639
|
646
|
|
640
|
647
|
//TODO(dan): is this used and would I put this param in the Modern doc?
|
641
|
648
|
// if not, can we remove it?
|
642
|
|
- var operatorOnly bool
|
643
|
|
- if len(msg.Params) > 1 && msg.Params[1] == "o" {
|
644
|
|
- operatorOnly = true
|
645
|
|
- }
|
|
649
|
+ //var operatorOnly bool
|
|
650
|
+ //if len(msg.Params) > 1 && msg.Params[1] == "o" {
|
|
651
|
+ // operatorOnly = true
|
|
652
|
+ //}
|
646
|
653
|
|
647
|
654
|
if mask == "" {
|
648
|
655
|
for _, channel := range server.channels {
|
|
@@ -679,7 +686,7 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
679
|
686
|
}
|
680
|
687
|
|
681
|
688
|
client.flags[Operator] = true
|
682
|
|
- client.Send(nil, server.nameString, RPL_YOUREOPER, client.nickString, "You are not an IRC operator")
|
|
689
|
+ client.Send(nil, server.nameString, RPL_YOUREOPER, client.nickString, "You are now an IRC operator")
|
683
|
690
|
//TODO(dan): Should this be sent automagically as part of setting the flag/mode?
|
684
|
691
|
modech := ModeChanges{&ModeChange{
|
685
|
692
|
mode: Operator,
|
|
@@ -740,10 +747,10 @@ func isonHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
740
|
747
|
// MOTD [<target>]
|
741
|
748
|
func motdHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
742
|
749
|
//TODO(dan): hook this up when we have multiple servers I guess???
|
743
|
|
- var target string
|
744
|
|
- if len(msg.Params) > 0 {
|
745
|
|
- target = msg.Params[0]
|
746
|
|
- }
|
|
750
|
+ //var target string
|
|
751
|
+ //if len(msg.Params) > 0 {
|
|
752
|
+ // target = msg.Params[0]
|
|
753
|
+ //}
|
747
|
754
|
|
748
|
755
|
server.MOTD(client)
|
749
|
756
|
return false
|
|
@@ -902,10 +909,10 @@ func namesHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
902
|
909
|
if len(msg.Params) > 0 {
|
903
|
910
|
channels = strings.Split(msg.Params[0], ",")
|
904
|
911
|
}
|
905
|
|
- var target string
|
906
|
|
- if len(msg.Params) > 1 {
|
907
|
|
- target = msg.Params[1]
|
908
|
|
- }
|
|
912
|
+ //var target string
|
|
913
|
+ //if len(msg.Params) > 1 {
|
|
914
|
+ // target = msg.Params[1]
|
|
915
|
+ //}
|
909
|
916
|
|
910
|
917
|
if len(channels) == 0 {
|
911
|
918
|
for _, channel := range server.channels {
|
|
@@ -1002,10 +1009,10 @@ func whowasHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
1002
|
1009
|
if len(msg.Params) > 1 {
|
1003
|
1010
|
count, _ = strconv.ParseInt(msg.Params[1], 10, 64)
|
1004
|
1011
|
}
|
1005
|
|
- var target string
|
1006
|
|
- if len(msg.Params) > 2 {
|
1007
|
|
- target = msg.Params[2]
|
1008
|
|
- }
|
|
1012
|
+ //var target string
|
|
1013
|
+ //if len(msg.Params) > 2 {
|
|
1014
|
+ // target = msg.Params[2]
|
|
1015
|
+ //}
|
1009
|
1016
|
for _, nickname := range nicknames {
|
1010
|
1017
|
results := server.whoWas.Find(Name(nickname), count)
|
1011
|
1018
|
if len(results) == 0 {
|