changeset 3627:639411e6a4cd

[gaim-migrate @ 3750] javabsp's fix for typing notification committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 11 Oct 2002 01:56:45 +0000
parents 468dc12b5ee8
children 74ed52a818a1
files src/conversation.c
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Fri Oct 11 01:52:43 2002 +0000
+++ b/src/conversation.c	Fri Oct 11 01:56:45 2002 +0000
@@ -838,21 +838,27 @@
 gboolean keypress_callback(GtkWidget *entry, GdkEventKey * event, struct conversation *c)
 {
 	int pos;
+	gboolean key_is_typing = TRUE;
+
 	if (event->keyval == GDK_Escape) {
+		key_is_typing = FALSE;
 		if (convo_options & OPT_CONVO_ESC_CAN_CLOSE) {
 			gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 			close_callback(c->close, c);
 			c = NULL;
 		}
 	} else if (event->keyval == GDK_Page_Up) {
+		key_is_typing = FALSE;
 		gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 		if(!(event->state & GDK_CONTROL_MASK))
 			gtk_imhtml_page_up(GTK_IMHTML(c->text));
 	} else if (event->keyval == GDK_Page_Down) {
+		key_is_typing = FALSE;
 		gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 		if(!(event->state & GDK_CONTROL_MASK))
 			gtk_imhtml_page_down(GTK_IMHTML(c->text));
 	} else if ((event->keyval == GDK_F2) && (convo_options & OPT_CONVO_F2_TOGGLES)) {
+		key_is_typing = FALSE;
 		gtk_imhtml_show_comments(GTK_IMHTML(c->text), !GTK_IMHTML(c->text)->comments);
 	} else if ((event->keyval == GDK_Return) || (event->keyval == GDK_KP_Enter)) {
 		if ((event->state & GDK_CONTROL_MASK) && (convo_options & OPT_CONVO_CTL_ENTER)) {
@@ -1035,18 +1041,22 @@
 			}
 		}
 		if (event->keyval == 'l') {
+			key_is_typing = FALSE;
 			gtk_imhtml_clear(GTK_IMHTML(c->text));
 			g_string_free(c->history, TRUE);
 			c->history = g_string_new("");
 		} else if ((event->keyval == 'w') && (convo_options & OPT_CONVO_CTL_W_CLOSES)) {
+			key_is_typing = FALSE;
 			gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 			close_callback(c->close, c);
 			c = NULL;
 			return TRUE;
 		} else if (event->keyval == 'n') {
+			key_is_typing = FALSE;
 			gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 			show_im_dialog();
 		} else if (event->keyval == 'z') {
+			key_is_typing = FALSE;
 			gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 			XIconifyWindow(GDK_DISPLAY(),
 				       GDK_WINDOW_XWINDOW(c->window->window),
@@ -1058,12 +1068,15 @@
 		    (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) {
 			GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook);
 			if (event->keyval == '[') {
+				key_is_typing = FALSE;
 				gtk_notebook_prev_page(GTK_NOTEBOOK(notebook));
 				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 			} else if (event->keyval == ']') {
+				key_is_typing = FALSE;
 				gtk_notebook_next_page(GTK_NOTEBOOK(notebook));
 				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 			} else if (event->keyval == GDK_Tab) {
+				key_is_typing = FALSE;
 				move_next_tab(GTK_NOTEBOOK(notebook), c->is_chat);
 				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 				return TRUE;
@@ -1076,6 +1089,7 @@
 	} else if (((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) ||
 		    (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) &&
 		   (event->state & GDK_MOD1_MASK) && (event->keyval > '0') && (event->keyval <= '9')) {
+		key_is_typing = FALSE;
 		GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook);
 		gtk_notebook_set_page(GTK_NOTEBOOK(notebook), event->keyval - '1');
 		gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
@@ -1095,7 +1109,7 @@
 			serv_send_typing(c->gc, c->name, NOT_TYPING);
 		}
 		else if (gdk_keyval_to_unicode(event->keyval) || event->keyval == GDK_BackSpace || event->keyval == GDK_Delete)  {
-			if (strlen(txt) == 0 || (c->type_again != 0 && time(NULL) > c->type_again)) {
+			if (key_is_typing && (strlen(txt) == 0 || (c->type_again != 0 && time(NULL) > c->type_again))) {
 				int timeout = serv_send_typing(c->gc, c->name, TYPING);
 				if (timeout)
 					c->type_again = time(NULL) + timeout;