diff src/gtkconv.c @ 9374:e4654f277514

[gaim-migrate @ 10182] this makes /cmds show up in ctrl-up and stuff. previously only things sent showed up. This might be considered an API change, at least for libgaim users, since the ui now adds the stuff to send_history. I also ChangeLogged switching back to web messenger. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Thu, 24 Jun 2004 04:58:34 +0000
parents 222eb83af4d3
children 3584cdab1d0b
line wrap: on
line diff
--- a/src/gtkconv.c	Thu Jun 24 04:44:36 2004 +0000
+++ b/src/gtkconv.c	Thu Jun 24 04:58:34 2004 +0000
@@ -429,6 +429,21 @@
 }
 
 static void
+send_history_add(GaimConversation *conv, const char *message)
+{
+	GList *first;
+
+	first = g_list_first(conv->send_history);
+
+	if (first->data)
+		g_free(first->data);
+
+	first->data = g_strdup(message);
+
+	conv->send_history = g_list_prepend(first, NULL);
+}
+
+static void
 send_cb(GtkWidget *widget, GaimConversation *conv)
 {
 	GaimGtkConversation *gtkconv;
@@ -446,9 +461,13 @@
 		cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL);
 		if(cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0)) {
 			GaimCmdStatus status;
-			char *error, *cmdline, *markup;
+			char *error, *cmdline, *markup, *send_history;
 			GtkTextIter start, end;
 
+			send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry));
+			send_history_add(conv, send_history);
+			g_free(send_history);
+
 			cmdline = cmd + strlen(prefix);
 			gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start);
 			gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1));
@@ -524,6 +543,7 @@
 
 		bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry));
 		for (i = 0; bufs[i]; i++) {
+			send_history_add(conv, bufs[i]);
 			if (gaim_conversation_get_type(conv) == GAIM_CONV_IM)
 				gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]);
 			else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)
@@ -533,6 +553,7 @@
 		g_strfreev(bufs);
 
 	} else {
+		send_history_add(conv, buf);
 		if (gaim_conversation_get_type(conv) == GAIM_CONV_IM)
 			gaim_conv_im_send(GAIM_CONV_IM(conv), buf);
 		else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)