Add /invite
This commit is contained in:
		
							parent
							
								
									8aa6dd86f6
								
							
						
					
					
						commit
						39a343980b
					
				
							
								
								
									
										11
									
								
								catgirl.1
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								catgirl.1
									
									
									
									
									
								
							@ -242,6 +242,8 @@ can be typed
 | 
			
		||||
.Bl -tag -width Ds
 | 
			
		||||
.It Ic /away Op Ar message
 | 
			
		||||
Set or clear your away status.
 | 
			
		||||
.It Ic /invite Ar nick
 | 
			
		||||
Invite a user to the channel.
 | 
			
		||||
.It Ic /join Ar channel
 | 
			
		||||
Join a channel.
 | 
			
		||||
.It Ic /list Op Ar channel
 | 
			
		||||
@ -558,6 +560,15 @@ join = #ascii.town
 | 
			
		||||
.
 | 
			
		||||
.It
 | 
			
		||||
.Rs
 | 
			
		||||
.%A Attila Molnar
 | 
			
		||||
.%A Adam
 | 
			
		||||
.%T IRCv3.2 invite-notify Extension
 | 
			
		||||
.%I IRCv3 Working Group
 | 
			
		||||
.%U https://ircv3.net/specs/extensions/invite-notify-3.2
 | 
			
		||||
.Re
 | 
			
		||||
.
 | 
			
		||||
.It
 | 
			
		||||
.Rs
 | 
			
		||||
.%A Daniel Oaks
 | 
			
		||||
.%T IRC Formatting
 | 
			
		||||
.%I ircdocs
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								chat.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								chat.h
									
									
									
									
									
								
							@ -71,6 +71,7 @@ static inline enum Color hash(const char *str) {
 | 
			
		||||
 | 
			
		||||
#define ENUM_CAP \
 | 
			
		||||
	X("extended-join", CapExtendedJoin) \
 | 
			
		||||
	X("invite-notify", CapInviteNotify) \
 | 
			
		||||
	X("sasl", CapSASL) \
 | 
			
		||||
	X("server-time", CapServerTime) \
 | 
			
		||||
	X("userhost-in-names", CapUserhostInNames)
 | 
			
		||||
 | 
			
		||||
@ -135,6 +135,12 @@ static void commandNames(size_t id, char *params) {
 | 
			
		||||
	replies.names++;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void commandInvite(size_t id, char *params) {
 | 
			
		||||
	if (!params) return;
 | 
			
		||||
	char *nick = strsep(¶ms, " ");
 | 
			
		||||
	ircFormat("INVITE %s %s\r\n", nick, idNames[id]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void commandList(size_t id, char *params) {
 | 
			
		||||
	(void)id;
 | 
			
		||||
	if (params) {
 | 
			
		||||
@ -251,6 +257,7 @@ static const struct Handler {
 | 
			
		||||
	{ "/debug", .fn = commandDebug, .restricted = true },
 | 
			
		||||
	{ "/exec", .fn = commandExec, .restricted = true },
 | 
			
		||||
	{ "/help", .fn = commandHelp },
 | 
			
		||||
	{ "/invite", .fn = commandInvite },
 | 
			
		||||
	{ "/join", .fn = commandJoin, .restricted = true },
 | 
			
		||||
	{ "/list", .fn = commandList },
 | 
			
		||||
	{ "/me", .fn = commandMe },
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20
									
								
								handle.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								handle.c
									
									
									
									
									
								
							@ -418,6 +418,25 @@ static void handleTopic(struct Message *msg) {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void handleInvite(struct Message *msg) {
 | 
			
		||||
	require(msg, true, 2);
 | 
			
		||||
	if (!strcmp(msg->params[0], self.nick)) {
 | 
			
		||||
		uiFormat(
 | 
			
		||||
			Network, Hot, tagTime(msg),
 | 
			
		||||
			"\3%02d%s\3\tinvites you to \3%02d%s\3",
 | 
			
		||||
			hash(msg->user), msg->nick, hash(msg->params[1]), msg->params[1]
 | 
			
		||||
		);
 | 
			
		||||
	} else {
 | 
			
		||||
		uiFormat(
 | 
			
		||||
			idFor(msg->params[1]), Cold, tagTime(msg),
 | 
			
		||||
			"\3%02d%s\3\tinvites %s to \3%02d%s\3",
 | 
			
		||||
			hash(msg->user), msg->nick,
 | 
			
		||||
			msg->params[0],
 | 
			
		||||
			hash(msg->params[1]), msg->params[1]
 | 
			
		||||
		);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void handleReplyList(struct Message *msg) {
 | 
			
		||||
	require(msg, false, 4);
 | 
			
		||||
	if (!replies.list) return;
 | 
			
		||||
@ -710,6 +729,7 @@ static const struct Handler {
 | 
			
		||||
	{ "AUTHENTICATE", handleAuthenticate },
 | 
			
		||||
	{ "CAP", handleCap },
 | 
			
		||||
	{ "ERROR", handleError },
 | 
			
		||||
	{ "INVITE", handleInvite },
 | 
			
		||||
	{ "JOIN", handleJoin },
 | 
			
		||||
	{ "KICK", handleKick },
 | 
			
		||||
	{ "NICK", handleNick },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user