# HG changeset patch # User Paul Aurich # Date 1308970068 0 # Node ID a99a4f9b7171c426cb9f3d856e45bdec9a9d05ab # Parent 54a700cedb38f6568f160bb4981d36ba16ce2198# Parent 4f1bd59cb90ab99ad3a9e9aeefc41a6b9a6b6625 merge of '2cabccedebb0366f69f7d3e9c3e16e2f4c6b3aae' and '964dd46e688370c356b8c9f20a929290f4a00e6d' diff -r 4f1bd59cb90a -r a99a4f9b7171 libpurple/protocols/irc/irc.c --- a/libpurple/protocols/irc/irc.c Sat Jun 25 02:34:24 2011 +0000 +++ b/libpurple/protocols/irc/irc.c Sat Jun 25 02:47:48 2011 +0000 @@ -101,7 +101,11 @@ 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 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); diff -r 4f1bd59cb90a -r a99a4f9b7171 libpurple/protocols/irc/irc.h --- a/libpurple/protocols/irc/irc.h Sat Jun 25 02:34:24 2011 +0000 +++ b/libpurple/protocols/irc/irc.h Sat Jun 25 02:47:48 2011 +0000 @@ -106,6 +106,7 @@ 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);