mirror of
				https://github.com/fluffle/goirc
				synced 2025-11-04 03:58:03 +00:00 
			
		
		
		
	Add support to join a channel with a given key
This commit is contained in:
		
							parent
							
								
									5e5f5f0253
								
							
						
					
					
						commit
						3fc8380afb
					
				
					 2 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -99,6 +99,9 @@ func (conn *Conn) User(ident, name string) {
 | 
				
			||||||
// Join() sends a JOIN command to the server
 | 
					// Join() sends a JOIN command to the server
 | 
				
			||||||
func (conn *Conn) Join(channel string) { conn.Raw(JOIN + " " + channel) }
 | 
					func (conn *Conn) Join(channel string) { conn.Raw(JOIN + " " + channel) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// JoinKey() sends a JOIN command to the server with a key
 | 
				
			||||||
 | 
					func (conn *Conn) JoinKey(channel string, key string) { conn.Raw(JOIN + " " + channel + " " + key) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Part() sends a PART command to the server with an optional part message
 | 
					// Part() sends a PART command to the server with an optional part message
 | 
				
			||||||
func (conn *Conn) Part(channel string, message ...string) {
 | 
					func (conn *Conn) Part(channel string, message ...string) {
 | 
				
			||||||
	msg := strings.Join(message, " ")
 | 
						msg := strings.Join(message, " ")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -98,6 +98,9 @@ func TestClientCommands(t *testing.T) {
 | 
				
			||||||
	c.Join("#foo")
 | 
						c.Join("#foo")
 | 
				
			||||||
	s.nc.Expect("JOIN #foo")
 | 
						s.nc.Expect("JOIN #foo")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						c.JoinKey("#foo", "bar")
 | 
				
			||||||
 | 
						s.nc.Expect("JOIN #foo bar")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c.Part("#foo")
 | 
						c.Part("#foo")
 | 
				
			||||||
	s.nc.Expect("PART #foo")
 | 
						s.nc.Expect("PART #foo")
 | 
				
			||||||
	c.Part("#foo", "Screw you guys...")
 | 
						c.Part("#foo", "Screw you guys...")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue