summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authormisdre <misdre@gmail.com>2013-04-06 01:11:28 +0200
committermisdre <misdre@gmail.com>2013-04-06 01:11:28 +0200
commit08d948435d29f2e78633299876c130c4b8702c2d (patch)
treebc856e8e7486801589f5cd2cddb7bad88f5ddeba /src/common
parent5004f69b5e68afa19c67d90207fa8e2d57332606 (diff)
split cmd_msg too
Diffstat (limited to 'src/common')
-rw-r--r--src/common/outbound.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/common/outbound.c b/src/common/outbound.c
index c167ec77..d6ce1488 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -2723,6 +2723,10 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 	char *msg = word_eol[3];
 	struct session *newsess;
 
+	char *split_text = NULL;
+	int cmd_length = 13; /* " PRIVMSG ", " ", :, \r, \n */
+	int offset = 0;
+
 	if (*nick)
 	{
 		if (*msg)
@@ -2751,14 +2755,37 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 					notc_msg (sess);
 					return TRUE;
 				}
-				sess->server->p_message (sess->server, nick, msg);
+
+				while ((split_text = split_up_text (sess, msg + offset, cmd_length, split_text)))
+				{
+					sess->server->p_message (sess->server, nick, split_text);
+
+					if (*split_text)
+						offset += strlen(split_text);
+
+					g_free(split_text);
+				}
+				sess->server->p_message (sess->server, nick, msg + offset);
+				offset = 0;
 			}
 			newsess = find_dialog (sess->server, nick);
 			if (!newsess)
 				newsess = find_channel (sess->server, nick);
 			if (newsess)
+			{
+				while ((split_text = split_up_text (sess, msg + offset, cmd_length, split_text)))
+				{
+					inbound_chanmsg (newsess->server, NULL, newsess->channel,
+										  newsess->server->nick, split_text, TRUE, FALSE);
+
+					if (*split_text)
+						offset += strlen(split_text);
+
+					g_free(split_text);
+				}
 				inbound_chanmsg (newsess->server, NULL, newsess->channel,
-									  newsess->server->nick, msg, TRUE, FALSE);
+									  newsess->server->nick, msg + offset, TRUE, FALSE);
+			}
 			else
 			{
 				/* mask out passwords */