mirror of
				https://github.com/fluffle/goirc
				synced 2025-11-04 03:58:03 +00:00 
			
		
		
		
	Handle the reverse case of servers screwing up :
This commit is contained in:
		
							parent
							
								
									c185010e08
								
							
						
					
					
						commit
						8ce6c4e32e
					
				
					 2 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -222,9 +222,13 @@ func (conn *Conn) recv() {
 | 
			
		|||
		if len(args) > 1 {
 | 
			
		||||
			line.Args = args[1:len(args)]
 | 
			
		||||
			// some servers (Gamesurge) don't use : properly
 | 
			
		||||
			// so duplicate Args[0] into Text
 | 
			
		||||
			if line.Text == "" {
 | 
			
		||||
				line.Text = args[len(args)-1]
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			// now duplicate Text into Args[0] if no args
 | 
			
		||||
			line.Args = []string{line.Text}
 | 
			
		||||
		}
 | 
			
		||||
		conn.in <- line
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -186,12 +186,15 @@ func (conn *Conn) setupEvents() {
 | 
			
		|||
 | 
			
		||||
	// Handle PARTs from channels to maintain state
 | 
			
		||||
	conn.AddHandler("PART", func(conn *Conn, line *Line) {
 | 
			
		||||
		ch := conn.GetChannel(line.Args[0])
 | 
			
		||||
		var ch *Channel
 | 
			
		||||
		if len(line.Args) > 0 {
 | 
			
		||||
			ch = conn.GetChannel(line.Args[0])
 | 
			
		||||
		}
 | 
			
		||||
		n := conn.GetNick(line.Nick)
 | 
			
		||||
		if ch != nil && n != nil {
 | 
			
		||||
			ch.DelNick(n)
 | 
			
		||||
		} else {
 | 
			
		||||
			conn.error("irc.PART(): buh? PART of channel %s by nick %s", line.Args[0], line.Nick)
 | 
			
		||||
			conn.error("irc.PART(): buh? %s", line.Raw)
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue