irc: update buflen if irc-sending-text changed the text to send release-2.x.y

Thu, 06 Apr 2017 03:26:50 -0300

author
dx <dx@dxzone.com.ar>
date
Thu, 06 Apr 2017 03:26:50 -0300
branch
release-2.x.y
changeset 38300
d1911127d944
parent 38253
f45b9766e165
child 38301
0dfbc197206c

irc: update buflen if irc-sending-text changed the text to send

Fixes issues with the irc more plugin, which extended the part and quit
messages but their lengths weren't updated, which resulted in those parts/quits
getting sent to the server without ending newlines.

libpurple/protocols/irc/irc.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/irc/irc.c	Wed Apr 05 23:18:30 2017 -0300
+++ b/libpurple/protocols/irc/irc.c	Thu Apr 06 03:26:50 2017 -0300
@@ -154,13 +154,17 @@
 int irc_send_len(struct irc_conn *irc, const char *buf, int buflen)
 {
 	int ret;
- 	char *tosend= g_strdup(buf);
+ 	char *tosend = g_strdup(buf);
 
 	purple_signal_emit(_irc_plugin, "irc-sending-text", purple_account_get_connection(irc->account), &tosend);
 	
 	if (tosend == NULL)
 		return 0;
 
+	if (!purple_strequal(tosend, buf)) {
+		buflen = strlen(tosend);
+	}
+
 	/* If we're not buffering writes, try to send immediately */
 	if (!irc->writeh)
 		ret = do_send(irc, tosend, buflen);

mercurial