Add /list
This commit is contained in:
		
							parent
							
								
									456713e561
								
							
						
					
					
						commit
						489df70c37
					
				| @ -179,6 +179,8 @@ can be typed | ||||
| .Bl -tag -width Ds | ||||
| .It Ic /join Ar channel | ||||
| Join a channel. | ||||
| .It Ic /list Op Ar channel | ||||
| List channels. | ||||
| .It Ic /me Op Ar action | ||||
| Send an action message. | ||||
| .It Ic /msg Ar nick message | ||||
|  | ||||
							
								
								
									
										3
									
								
								chat.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								chat.h
									
									
									
									
									
								
							| @ -133,8 +133,9 @@ void ircFormat(const char *format, ...) | ||||
| 
 | ||||
| extern struct Replies { | ||||
| 	size_t join; | ||||
| 	size_t topic; | ||||
| 	size_t list; | ||||
| 	size_t names; | ||||
| 	size_t topic; | ||||
| 	size_t whois; | ||||
| } replies; | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										11
									
								
								command.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								command.c
									
									
									
									
									
								
							| @ -125,6 +125,16 @@ static void commandNames(size_t id, char *params) { | ||||
| 	replies.names++; | ||||
| } | ||||
| 
 | ||||
| static void commandList(size_t id, char *params) { | ||||
| 	(void)id; | ||||
| 	if (params) { | ||||
| 		ircFormat("LIST :%s\r\n", params); | ||||
| 	} else { | ||||
| 		ircFormat("LIST\r\n"); | ||||
| 	} | ||||
| 	replies.list++; | ||||
| } | ||||
| 
 | ||||
| static void commandWhois(size_t id, char *params) { | ||||
| 	(void)id; | ||||
| 	if (!params) return; | ||||
| @ -201,6 +211,7 @@ static const struct Handler { | ||||
| 	{ "/debug", .fn = commandDebug, .restricted = true }, | ||||
| 	{ "/help", .fn = commandHelp }, | ||||
| 	{ "/join", .fn = commandJoin, .restricted = true }, | ||||
| 	{ "/list", .fn = commandList }, | ||||
| 	{ "/me", .fn = commandMe }, | ||||
| 	{ "/msg", .fn = commandMsg, .restricted = true }, | ||||
| 	{ "/names", .fn = commandNames }, | ||||
|  | ||||
							
								
								
									
										20
									
								
								handle.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								handle.c
									
									
									
									
									
								
							| @ -411,6 +411,24 @@ static void handleTopic(struct Message *msg) { | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static void handleReplyList(struct Message *msg) { | ||||
| 	require(msg, false, 4); | ||||
| 	if (!replies.list) return; | ||||
| 	uiFormat( | ||||
| 		Network, Warm, tagTime(msg), | ||||
| 		"In \3%02d%s\3 are %ld under the banner: %s", | ||||
| 		hash(msg->params[1]), msg->params[1], | ||||
| 		strtol(msg->params[2], NULL, 10), | ||||
| 		msg->params[3] | ||||
| 	); | ||||
| } | ||||
| 
 | ||||
| static void handleReplyListEnd(struct Message *msg) { | ||||
| 	(void)msg; | ||||
| 	if (!replies.list) return; | ||||
| 	replies.list--; | ||||
| } | ||||
| 
 | ||||
| static void handleReplyWhoisUser(struct Message *msg) { | ||||
| 	require(msg, false, 6); | ||||
| 	if (!replies.whois) return; | ||||
| @ -657,6 +675,8 @@ static const struct Handler { | ||||
| 	{ "317", handleReplyWhoisIdle }, | ||||
| 	{ "318", handleReplyEndOfWhois }, | ||||
| 	{ "319", handleReplyWhoisChannels }, | ||||
| 	{ "322", handleReplyList }, | ||||
| 	{ "323", handleReplyListEnd }, | ||||
| 	{ "330", handleReplyWhoisGeneric }, | ||||
| 	{ "331", handleReplyNoTopic }, | ||||
| 	{ "332", handleReplyTopic }, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user