channel part implemented
This commit is contained in:
		
							parent
							
								
									39816874d2
								
							
						
					
					
						commit
						c4b4e47cdf
					
				
					 1 changed files with 10 additions and 2 deletions
				
			
		
							
								
								
									
										12
									
								
								server.go
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								server.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -255,7 +255,15 @@ func (srv *Server) channelJoin(nick, ch string) {
 | 
			
		|||
	srv.channelBroadcast(ch, irc.M(nick, "JOIN", ch, ""))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (srv *Server) channelPart(nick, ch string) {
 | 
			
		||||
func (srv *Server) channelPart(nick, ch, reason string) {
 | 
			
		||||
	if _, exists := srv.channels[ch]; !exists {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if _, exists := srv.channels[ch][nick]; !exists {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	srv.channelBroadcast(ch, irc.M(nick, "PART", ch, reason))
 | 
			
		||||
	delete(srv.channels[ch][nick])
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type SrvCommandHook struct {
 | 
			
		||||
| 
						 | 
				
			
			@ -304,7 +312,7 @@ func srvHandleCmdJoin(srv *Server, msg *irc.Message) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func srvHandleCmdPart(srv *Server, msg *irc.Message) {
 | 
			
		||||
	srv.channelPart(msg.Pre, msg.Args[0])
 | 
			
		||||
	srv.channelPart(msg.Pre, msg.Args[0], msg.Trailing)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func srvHandleCmdOper(srv *Server, msg *irc.Message) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue