summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDiogo Sousa <diogogsousa@gmail.com>2013-10-10 19:51:33 +0100
committerTingPing <tingping@tingping.se>2013-10-13 14:38:26 -0400
commitcf370d7e79d897f1d41e0b949385dbf3e595d3ed (patch)
tree28063eca35a566fccf43d74b87df9e91e83f1f32
parentfd13e4046f508e9ebe4eb463966ff2858f053cdd (diff)
When opening a query dialog with /query nick msg, the message was not shown in
the newly opened dialog. This fixes that issue.
-rw-r--r--src/common/outbound.c18
-rw-r--r--src/common/outbound.h4
2 files changed, 18 insertions, 4 deletions
diff --git a/src/common/outbound.c b/src/common/outbound.c
index 72273a14..b4a8f4d4 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -2986,16 +2986,18 @@ cmd_ping (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 	return TRUE;
 }
 
-void
+session *
 open_query (server *serv, char *nick, gboolean focus_existing)
 {
 	session *sess;
 
 	sess = find_dialog (serv, nick);
 	if (!sess)
-		new_ircwindow (serv, nick, SESS_DIALOG, focus_existing);
+		sess = new_ircwindow (serv, nick, SESS_DIALOG, focus_existing);
 	else if (focus_existing)
 		fe_ctrl_gui (sess, 2, 0);	/* bring-to-front */
+
+	return sess;
 }
 
 static int
@@ -3017,10 +3019,14 @@ cmd_query (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 
 	if (*nick && !is_channel (sess->server, nick))
 	{
-		open_query (sess->server, nick, focus);
+		struct session *nick_sess;
+
+		nick_sess = open_query (sess->server, nick, focus);
 
 		if (*msg)
 		{
+			message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
+
 			if (!sess->server->connected)
 			{
 				notc_msg (sess);
@@ -3030,6 +3036,9 @@ cmd_query (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 			while ((split_text = split_up_text (sess, msg + offset, cmd_length, split_text)))
 			{
 				sess->server->p_message (sess->server, nick, split_text);
+				inbound_chanmsg (nick_sess->server, nick_sess, nick_sess->channel,
+								 nick_sess->server->nick, split_text, TRUE, FALSE,
+								 &no_tags);
 
 				if (*split_text)
 					offset += strlen(split_text);
@@ -3037,6 +3046,9 @@ cmd_query (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 				g_free(split_text);
 			}
 			sess->server->p_message (sess->server, nick, msg + offset);
+			inbound_chanmsg (nick_sess->server, nick_sess, nick_sess->channel,
+							 nick_sess->server->nick, msg + offset, TRUE, FALSE,
+							 &no_tags);
 		}
 
 		return TRUE;
diff --git a/src/common/outbound.h b/src/common/outbound.h
index 81a98666..b9fe6331 100644
--- a/src/common/outbound.h
+++ b/src/common/outbound.h
@@ -20,6 +20,8 @@
 #ifndef HEXCHAT_OUTBOUND_H
 #define HEXCHAT_OUTBOUND_H
 
+#include "hexchat.h"
+
 extern const struct commands xc_cmds[];
 extern GSList *menu_list;
 
@@ -34,7 +36,7 @@ void notc_msg (session *sess);
 void server_sendpart (server * serv, char *channel, char *reason);
 void server_sendquit (session * sess);
 int menu_streq (const char *s1, const char *s2, int def);
-void open_query (server *serv, char *nick, gboolean focus_existing);
+session *open_query (server *serv, char *nick, gboolean focus_existing);
 gboolean load_perform_file (session *sess, char *file);
 
 #endif