changeset 3787:aed40c72c818

[gaim-migrate @ 3927] more bugs in typing notificatin (surprise surprise) fixed by faceprint committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 22 Oct 2002 16:21:55 +0000
parents 4c9356a5231c
children 56e555b72873
files src/conversation.c src/server.c src/ui.h
diffstat 3 files changed, 23 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Tue Oct 22 13:41:40 2002 +0000
+++ b/src/conversation.c	Tue Oct 22 16:21:55 2002 +0000
@@ -2077,6 +2077,9 @@
 	if ((c->unseen == 2) || ((c->unseen == 1) && !(flags & WFLAG_NICK)))
 		return;
 
+	if (flags & WFLAG_RECV)
+		c->typing_state = NOT_TYPING;
+
 
 	if (c->is_chat) {
 		int offs;
@@ -2100,7 +2103,7 @@
 	} else {
 		c->unseen = 0;
 	}
-	update_convo_status(c, FALSE);
+	update_convo_status(c);
 }
 
 void update_progress(struct conversation *c, float percent) {
@@ -2622,7 +2625,6 @@
 		gtk_window_set_focus(GTK_WINDOW(c->window), c->entry);
 	if (!GTK_WIDGET_REALIZED(label))
 		return;
-	if (c->unseen == -1) return;
 	style = gtk_style_new();
 	gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
 	gtk_widget_set_style(label, style);
@@ -2635,7 +2637,7 @@
 			GtkWidget *parent = convo_notebook->parent;
 
 			gtk_widget_freeze_child_notify(GTK_WIDGET(c->window));
-	
+
 			if (convo_menubar != NULL)
 					gtk_widget_destroy(convo_menubar);
 
@@ -2650,10 +2652,12 @@
 		convo_menubar = NULL;
 	}
 
+	update_convo_status(c);
+
 	gtk_imhtml_to_bottom(c->text);
 }
 
-void update_convo_status(struct conversation *c, int typing_state) {
+void update_convo_status(struct conversation *c) {
 	if(!c)
 		return;
 	debug_printf("update_convo_status called for %s\n", c->name);
@@ -2671,11 +2675,11 @@
 		if (!GTK_WIDGET_REALIZED(label))
 			gtk_widget_realize(label);
 		gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
-		if(typing_state == TYPING) {
+		if(c->typing_state == TYPING) {
 			style->fg[0].red = 0x0000;
 			style->fg[0].green = 0x9999;
 			style->fg[0].blue = 0x0000;
-		} else if(typing_state == TYPED) {
+		} else if(c->typing_state == TYPED) {
 			style->fg[0].red = 0xfffff;
 			style->fg[0].green = 0xbbbb;
 			style->fg[0].blue = 0x2222;
@@ -2707,11 +2711,11 @@
 		}
 		buf = g_malloc(len+1);
 		g_snprintf(buf, len+1, win->title);
-		if(typing_state == TYPING) {
+		if(c->typing_state == TYPING) {
 			buf2 = g_strconcat(buf,_(" [TYPING]"), NULL);
 			g_free(buf);
 			buf = buf2;
-		} else if(typing_state == TYPED) {
+		} else if(c->typing_state == TYPED) {
 			buf2 = g_strconcat(buf,_(" [TYPED]"), NULL);
 			g_free(buf);
 			buf = buf2;
@@ -2730,7 +2734,8 @@
 	}
 
 	/* Reset the title (if necessary) */
-	update_convo_status(c, FALSE);
+	c->typing_state = NOT_TYPING;
+	update_convo_status(c);
 
 	g_free(name);
 	c->typing_timeout = 0;
--- a/src/server.c	Tue Oct 22 13:41:40 2002 +0000
+++ b/src/server.c	Tue Oct 22 16:21:55 2002 +0000
@@ -860,7 +860,8 @@
 	struct conversation *cnv = find_conversation(name);
 	 if (cnv) {
 		 set_convo_gc(cnv, gc);
-		 update_convo_status(cnv, state);
+		 cnv->typing_state = state;
+		 update_convo_status(cnv);
 	} else return;
 	 plugin_event(event_got_typing, gc, name);
 	 do_pounce(gc, name, OPT_POUNCE_TYPING);
@@ -874,10 +875,13 @@
 
 void serv_got_typing_stopped(struct gaim_connection *gc, char *name) {
 	struct conversation *c = find_conversation(name);
-	if (c && c->typing_timeout) {
+	if(!c)
+		return;
+	if (c->typing_timeout) {
 		gtk_timeout_remove (c->typing_timeout);
 	}
-	update_convo_status(c, NOT_TYPING);
+	c->typing_state = NOT_TYPING;
+	update_convo_status(c);
 }
 
 static void close_invite(GtkWidget *w, GtkWidget *w2)
--- a/src/ui.h	Tue Oct 22 13:41:40 2002 +0000
+++ b/src/ui.h	Tue Oct 22 16:21:55 2002 +0000
@@ -155,6 +155,7 @@
 	GtkWidget *progress;
 	GSList    *images;  /* A list of filenames to embed */
 	gint unseen;
+	int typing_state;
 	guint typing_timeout;
 	time_t type_again;
 	guint type_again_timeout;
@@ -419,7 +420,7 @@
 extern void set_hide_icons();
 extern void set_convo_titles();
 extern void update_progress(struct conversation *, float);
-extern void update_convo_status(struct conversation *, int);
+extern void update_convo_status(struct conversation *);
 extern gboolean reset_typing(char *);
 extern void set_anim();