pidgin: 2cabcced: Fix races between irc_send_raw() and nor...
elb at pidgin.im
elb at pidgin.im
Fri Jun 24 22:45:27 EDT 2011
----------------------------------------------------------------------
Revision: 2cabccedebb0366f69f7d3e9c3e16e2f4c6b3aae
Parent: 21f8c956d075901c008e47c028c7b27795cb2843
Author: elb at pidgin.im
Date: 06/24/11 22:42:08
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2cabccedebb0366f69f7d3e9c3e16e2f4c6b3aae
Changelog:
Fix races between irc_send_raw() and normal prpl-internal sends.
Fixes #14263
Changes against parent 21f8c956d075901c008e47c028c7b27795cb2843
patched libpurple/protocols/irc/irc.c
patched libpurple/protocols/irc/irc.h
-------------- next part --------------
============================================================
--- libpurple/protocols/irc/irc.c 34a2f5f55635b8c8b0436670e0b78e6a6b178246
+++ libpurple/protocols/irc/irc.c a81183397eb9dd66e6917dd695f325cc6b634cbe
@@ -101,7 +101,11 @@ static int irc_send_raw(PurpleConnection
static int irc_send_raw(PurpleConnection *gc, const char *buf, int len)
{
struct irc_conn *irc = (struct irc_conn*)gc->proto_data;
- return do_send(irc, buf, len);
+ if (len == -1) {
+ len = strlen(buf);
+ }
+ irc_send_len(irc, buf, len);
+ return len;
}
static void
@@ -144,16 +148,18 @@ int irc_send(struct irc_conn *irc, const
int irc_send(struct irc_conn *irc, const char *buf)
{
- int ret, buflen;
+ return irc_send_len(irc, buf, strlen(buf));
+}
+
+int irc_send_len(struct irc_conn *irc, const char *buf, int buflen)
+{
+ int ret;
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;
- buflen = strlen(tosend);
-
-
/* If we're not buffering writes, try to send immediately */
if (!irc->writeh)
ret = do_send(irc, tosend, buflen);
============================================================
--- libpurple/protocols/irc/irc.h 7e52fe9ba8caa9d1f5a4055123b287b54ef3f599
+++ libpurple/protocols/irc/irc.h 898f5f8b0dda728c4f0465eb2edee4ee55ca519a
@@ -106,6 +106,7 @@ int irc_send(struct irc_conn *irc, const
typedef int (*IRCCmdCallback) (struct irc_conn *irc, const char *cmd, const char *target, const char **args);
int irc_send(struct irc_conn *irc, const char *buf);
+int irc_send_len(struct irc_conn *irc, const char *buf, int len);
gboolean irc_blist_timeout(struct irc_conn *irc);
gboolean irc_who_channel_timeout(struct irc_conn *irc);
void irc_buddy_query(struct irc_conn *irc);
More information about the Commits
mailing list