Update of /cvsroot/gaim/gaim/src
In directory usw-pr-cvs1:/tmp/cvs-serv16191/src
Modified Files:
conversation.c ui.h
Log Message:
Send History
Index: conversation.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/conversation.c,v
retrieving revision 1.346
retrieving revision 1.347
diff -u -d -r1.346 -r1.347
--- conversation.c 28 Mar 2002 17:44:48 -0000 1.346
+++ conversation.c 3 Apr 2002 03:02:02 -0000 1.347
@@ -183,6 +183,7 @@
if (connections)
c->gc = (struct gaim_connection *)connections->data;
c->history = g_string_new("");
+ c->send_history = g_list_append(NULL, NULL);
conversations = g_list_append(conversations, c);
show_conv(c);
update_icon(c);
@@ -270,6 +271,13 @@
if (c->save_icon)
gtk_widget_destroy(c->save_icon);
#endif
+ c->send_history = g_list_first(c->send_history);
+ while (c->send_history) {
+ if (c->send_history->data)
+ g_free(c->send_history->data);
+ c->send_history = c->send_history->next;
+ }
+ g_list_free(c->send_history);
if (c->typing_timeout)
gtk_timeout_remove(c->typing_timeout);
g_string_free(c->history, TRUE);
@@ -841,6 +849,44 @@
if (oldpos == pos)
gtk_editable_set_position(GTK_EDITABLE(entry), pos + 1);
} else if (event->state & GDK_CONTROL_MASK) {
+ int pos = 0;
+ switch (event->keyval) {
+ case GDK_Up:
+ debug_printf("YOU HIT UP!\n");
+ if (!c->send_history)
+ break;
+ debug_printf("history exists\n");
+ if (!c->send_history->prev) {
+ debug_printf("at curent\n");
+ if (c->send_history->data)
+ g_free(c->send_history->data);
+ c->send_history->data = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
+ }
+ if (c->send_history->next && c->send_history->next->data) {
+ debug_printf("going to ->next\n");
+ c->send_history = c->send_history->next;
+ gtk_editable_delete_text (GTK_EDITABLE(entry),0,-1);
+ gtk_editable_insert_text(GTK_EDITABLE(entry),
+ c->send_history->data,
+ strlen(c->send_history->data),
+ &pos);
+ }
+
+ break;
+ case GDK_Down:
+ if (!c->send_history)
+ break;
+ if (c->send_history->prev) {
+ c->send_history = c->send_history->prev;
+ if (c->send_history->data) {
+ gtk_editable_delete_text (GTK_EDITABLE(entry),0,-1);
+ gtk_editable_insert_text (GTK_EDITABLE(entry), c->send_history->data,
+ strlen(c->send_history->data), &pos);
+
+ }
+ }
+ break;
+ }
if (convo_options & OPT_CONVO_CTL_CHARS) {
switch (event->keyval) {
case 'i':
@@ -1003,6 +1049,7 @@
int limit;
gulong length=0;
int err = 0;
+ GList *first;
if (!c->gc)
return;
@@ -1018,6 +1065,12 @@
return;
}
+ first = g_list_first(c->send_history);
+ if (first->data)
+ g_free(first->data);
+ first->data = g_strdup(buf);
+ c->send_history = g_list_prepend(first, NULL);
+
buf2 = g_malloc(limit);
if (c->gc->flags & OPT_CONN_HTML) {
Index: ui.h
===================================================================
RCS file: /cvsroot/gaim/gaim/src/ui.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- ui.h 14 Mar 2002 07:44:43 -0000 1.33
+++ ui.h 3 Apr 2002 03:02:02 -0000 1.34
@@ -138,6 +138,7 @@
GdkColor fgcol;
int hasfg;
+ GList *send_history;
GString *history;
GtkWidget *send;
|