Compare commits
	
		
			No commits in common. "45aa0e8dfba2a51d26b6a4fe4990a1686ab4af65" and "88a7b1a2d98d318d32f74d0dc5ef53b95ee5bde0" have entirely different histories.
		
	
	
		
			45aa0e8dfb
			...
			88a7b1a2d9
		
	
		
							
								
								
									
										2
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								NEWS
									
									
									
									
									
								
							| @ -12,8 +12,6 @@ Unreleased | |||||||
| 
 | 
 | ||||||
|  * xC: improved pager integration capabilities |  * xC: improved pager integration capabilities | ||||||
| 
 | 
 | ||||||
|  * xC: unsolicited JOINs will no longer automatically activate the buffer |  | ||||||
| 
 |  | ||||||
|  * xC: normalized editline's history behaviour, making it a viable frontend |  * xC: normalized editline's history behaviour, making it a viable frontend | ||||||
| 
 | 
 | ||||||
|  * xC: various bugfixes |  * xC: various bugfixes | ||||||
|  | |||||||
							
								
								
									
										49
									
								
								xC.c
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								xC.c
									
									
									
									
									
								
							| @ -1801,8 +1801,6 @@ struct server | |||||||
| 	char *irc_user_host;                ///< Our current user@host
 | 	char *irc_user_host;                ///< Our current user@host
 | ||||||
| 	bool autoaway_active;               ///< Autoaway is currently active
 | 	bool autoaway_active;               ///< Autoaway is currently active
 | ||||||
| 
 | 
 | ||||||
| 	struct strv outstanding_joins;      ///< JOINs we expect a response to
 |  | ||||||
| 
 |  | ||||||
| 	struct strv cap_ls_buf;             ///< Buffer for IRCv3.2 CAP LS
 | 	struct strv cap_ls_buf;             ///< Buffer for IRCv3.2 CAP LS
 | ||||||
| 	bool cap_echo_message;              ///< Whether the server echoes messages
 | 	bool cap_echo_message;              ///< Whether the server echoes messages
 | ||||||
| 	bool cap_away_notify;               ///< Whether we get AWAY notifications
 | 	bool cap_away_notify;               ///< Whether we get AWAY notifications
 | ||||||
| @ -1936,7 +1934,6 @@ server_new (struct poller *poller) | |||||||
| 
 | 
 | ||||||
| 	self->irc_user_mode = str_make (); | 	self->irc_user_mode = str_make (); | ||||||
| 
 | 
 | ||||||
| 	self->outstanding_joins = strv_make (); |  | ||||||
| 	self->cap_ls_buf = strv_make (); | 	self->cap_ls_buf = strv_make (); | ||||||
| 	server_init_specifics (self); | 	server_init_specifics (self); | ||||||
| 	return self; | 	return self; | ||||||
| @ -1984,7 +1981,6 @@ server_destroy (struct server *self) | |||||||
| 	str_free (&self->irc_user_mode); | 	str_free (&self->irc_user_mode); | ||||||
| 	free (self->irc_user_host); | 	free (self->irc_user_host); | ||||||
| 
 | 
 | ||||||
| 	strv_free (&self->outstanding_joins); |  | ||||||
| 	strv_free (&self->cap_ls_buf); | 	strv_free (&self->cap_ls_buf); | ||||||
| 	server_free_specifics (self); | 	server_free_specifics (self); | ||||||
| 	free (self); | 	free (self); | ||||||
| @ -5674,7 +5670,6 @@ irc_destroy_state (struct server *s) | |||||||
| 	str_reset (&s->irc_user_mode); | 	str_reset (&s->irc_user_mode); | ||||||
| 	cstr_set (&s->irc_user_host, NULL); | 	cstr_set (&s->irc_user_host, NULL); | ||||||
| 
 | 
 | ||||||
| 	strv_reset (&s->outstanding_joins); |  | ||||||
| 	strv_reset (&s->cap_ls_buf); | 	strv_reset (&s->cap_ls_buf); | ||||||
| 	s->cap_away_notify = false; | 	s->cap_away_notify = false; | ||||||
| 	s->cap_echo_message = false; | 	s->cap_echo_message = false; | ||||||
| @ -7108,16 +7103,6 @@ irc_handle_sent_cap (struct server *s, const struct irc_message *msg) | |||||||
| 			"#s: #S", "Capabilities requested", args); | 			"#s: #S", "Capabilities requested", args); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void |  | ||||||
| irc_handle_sent_join (struct server *s, const struct irc_message *msg) |  | ||||||
| { |  | ||||||
| 	if (msg->params.len < 1) |  | ||||||
| 		return; |  | ||||||
| 
 |  | ||||||
| 	if (strcmp (msg->params.vector[0], "0")) |  | ||||||
| 		cstr_split (msg->params.vector[0], ",", true, &s->outstanding_joins); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void | static void | ||||||
| irc_handle_sent_notice_text (struct server *s, | irc_handle_sent_notice_text (struct server *s, | ||||||
| 	const struct irc_message *msg, struct str *text) | 	const struct irc_message *msg, struct str *text) | ||||||
| @ -7201,7 +7186,6 @@ g_irc_sent_handlers[] = | |||||||
| { | { | ||||||
| 	// This list needs to stay sorted
 | 	// This list needs to stay sorted
 | ||||||
| 	{ "CAP",     irc_handle_sent_cap     }, | 	{ "CAP",     irc_handle_sent_cap     }, | ||||||
| 	{ "JOIN",    irc_handle_sent_join    }, |  | ||||||
| 	{ "NOTICE",  irc_handle_sent_notice  }, | 	{ "NOTICE",  irc_handle_sent_notice  }, | ||||||
| 	{ "PRIVMSG", irc_handle_sent_privmsg }, | 	{ "PRIVMSG", irc_handle_sent_privmsg }, | ||||||
| }; | }; | ||||||
| @ -7451,27 +7435,12 @@ irc_handle_invite (struct server *s, const struct irc_message *msg) | |||||||
| 			"#n has invited #n to #S", msg->prefix, target, channel_name); | 			"#n has invited #n to #S", msg->prefix, target, channel_name); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static bool |  | ||||||
| irc_satisfy_join (struct server *s, const char *target) |  | ||||||
| { |  | ||||||
| 	// This queue could use some garbage collection,
 |  | ||||||
| 	// but it's unlikely to pose problems.
 |  | ||||||
| 	for (size_t i = 0; i < s->outstanding_joins.len; i++) |  | ||||||
| 		if (!irc_server_strcmp (s, target, s->outstanding_joins.vector[i])) |  | ||||||
| 		{ |  | ||||||
| 			strv_remove (&s->outstanding_joins, i); |  | ||||||
| 			return true; |  | ||||||
| 		} |  | ||||||
| 	return false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void | static void | ||||||
| irc_handle_join (struct server *s, const struct irc_message *msg) | irc_handle_join (struct server *s, const struct irc_message *msg) | ||||||
| { | { | ||||||
| 	if (!msg->prefix || msg->params.len < 1) | 	if (!msg->prefix || msg->params.len < 1) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	// TODO: RFC 2812 doesn't guarantee that the argument isn't a target list.
 |  | ||||||
| 	const char *channel_name = msg->params.vector[0]; | 	const char *channel_name = msg->params.vector[0]; | ||||||
| 	if (!irc_is_channel (s, channel_name)) | 	if (!irc_is_channel (s, channel_name)) | ||||||
| 		return; | 		return; | ||||||
| @ -7497,7 +7466,7 @@ irc_handle_join (struct server *s, const struct irc_message *msg) | |||||||
| 		buffer_add (s->ctx, buffer); | 		buffer_add (s->ctx, buffer); | ||||||
| 
 | 
 | ||||||
| 		char *input = CALL_ (s->ctx->input, get_line, NULL); | 		char *input = CALL_ (s->ctx->input, get_line, NULL); | ||||||
| 		if (irc_satisfy_join (s, channel_name) && !*input) | 		if (!*input) | ||||||
| 			buffer_activate (s->ctx, buffer); | 			buffer_activate (s->ctx, buffer); | ||||||
| 		else | 		else | ||||||
| 			buffer->highlighted = true; | 			buffer->highlighted = true; | ||||||
| @ -8872,16 +8841,12 @@ irc_process_numeric (struct server *s, | |||||||
| 		// TODO: whitelist/blacklist a lot more replies in here.
 | 		// TODO: whitelist/blacklist a lot more replies in here.
 | ||||||
| 		// TODO: we should either strip the first parameter from the resulting
 | 		// TODO: we should either strip the first parameter from the resulting
 | ||||||
| 		//   buffer line, or at least put it in brackets
 | 		//   buffer line, or at least put it in brackets
 | ||||||
| 		if (msg->params.len < 2) | 		if (msg->params.len > 1) | ||||||
| 			break; | 		{ | ||||||
| 
 | 			struct buffer *x; | ||||||
| 		struct buffer *x; | 			if ((x = str_map_find (&s->irc_buffer_map, msg->params.vector[1]))) | ||||||
| 		if ((x = str_map_find (&s->irc_buffer_map, msg->params.vector[1]))) | 				buffer = x; | ||||||
| 			buffer = x; | 		} | ||||||
| 
 |  | ||||||
| 		// A JOIN request should be split at commas,
 |  | ||||||
| 		// then for each element produce either a JOIN response, or a numeric.
 |  | ||||||
| 		(void) irc_satisfy_join (s, msg->params.vector[1]); |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (buffer) | 	if (buffer) | ||||||
|  | |||||||
| @ -253,7 +253,7 @@ let Toolbar = { | |||||||
| 	view: vnode => { | 	view: vnode => { | ||||||
| 		return m('.toolbar', {}, [ | 		return m('.toolbar', {}, [ | ||||||
| 			m('button', {onclick: Toolbar.toggleAutoscroll}, | 			m('button', {onclick: Toolbar.toggleAutoscroll}, | ||||||
| 				bufferAutoscroll ? 'Scroll lock' : 'Scroll unlock'), | 				bufferAutoscroll ? 'Pause autoscroll' : 'Unpause autoscroll'), | ||||||
| 			m('button', {onclick: Toolbar.toggleLog}, | 			m('button', {onclick: Toolbar.toggleLog}, | ||||||
| 				bufferLog === undefined ? 'Show log' : 'Hide log'), | 				bufferLog === undefined ? 'Show log' : 'Hide log'), | ||||||
| 		]) | 		]) | ||||||
| @ -402,10 +402,6 @@ let Buffer = { | |||||||
| 			lines.push(m('.time', {...attrs}, date.toLocaleTimeString())) | 			lines.push(m('.time', {...attrs}, date.toLocaleTimeString())) | ||||||
| 			lines.push(m(Content, {...attrs}, line)) | 			lines.push(m(Content, {...attrs}, line)) | ||||||
| 		}) | 		}) | ||||||
| 
 |  | ||||||
| 		let dateMark = new Date().toLocaleDateString() |  | ||||||
| 		if (dateMark !== lastDateMark) |  | ||||||
| 			lines.push(m('.date', {}, dateMark)) |  | ||||||
| 		return m('.buffer', {}, lines) | 		return m('.buffer', {}, lines) | ||||||
| 	}, | 	}, | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user