[ekg2-commit] ekg2: bindings.c (HEAD) old.c (HEAD) [peres]

CVS commit cvs w toxygen.net
Pon, 8 Paź 2007, 11:04:04 CEST


Module name:	ekg2
Changes by:	peres	2007-10-08 11:04:01

Modified files:
	bindings.c old.c

Log message:
More XEP-0085: use fourth w->act bit, to mark whether we are in <active/>
conversation state and if we are, then send <gone/> on window close:
i.e. annoy Psi users more and more!

Index: bindings.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/bindings.c,v
diff -d -u -r1.73 -r1.74
--- bindings.c	8 Sep 2007 23:01:11 -0000	1.73
+++ bindings.c	8 Oct 2007 09:04:01 -0000	1.74
@@ -129,9 +129,11 @@
 		command_exec(window_current->target, window_current->session, tmp, 0);
 
 		if (!tmp[0] || tmp[0] == '/' || !window_current->target)
-			ncurses_typing_mod = 1;
-		else
-			ncurses_typing_win = NULL;
+			ncurses_typing_mod	= 1;
+		else {
+			ncurses_typing_win	= NULL;
+			window_current->act	|= 8;
+		}
 
 		curs_set(1);
 		xfree(tmp);
@@ -258,9 +260,11 @@
 	if (ncurses_plugin_destroyed)
 		return;
 	if (!line[0] || line[0] == '/' || !window_current->target) /* if empty or command, just mark as modified */
-		ncurses_typing_mod = 1;
-	else /* if message, assume that its' handler has already disabled typing */
-		ncurses_typing_win = NULL;
+		ncurses_typing_mod	= 1;
+	else { /* if message, assume that its' handler has already disabled <composing/> */
+		ncurses_typing_win	= NULL;
+		window_current->act	|= 8; /* but also remember that is should have set <active/> chatstate */
+	}
 
 	if (xwcscmp(line, TEXT(""))) {
 		if (history[0] != line)

Index: old.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/old.c,v
diff -d -u -r1.158 -r1.159
--- old.c	8 Oct 2007 07:42:27 -0000	1.158
+++ old.c	8 Oct 2007 09:04:01 -0000	1.159
@@ -1467,7 +1467,7 @@
 			char tmp[33];
 			window_t *w = l->data;
 
-			if (!w->act || !w->id || (w == window_current)) 
+			if (!(w->act & 7) || !w->id || (w == window_current)) 
 				continue;
 
 			if (act)
@@ -1630,12 +1630,21 @@
 //	ncurses_resize();
 
 	if (w == ncurses_typing_win) { /* don't allow timer to touch removed window */
-		const int tmp = ncurses_typing_mod;
+		const int tmp		= ncurses_typing_mod;
 
 		ncurses_typing_time	= 0;
 		ncurses_typing_mod	= -1; /* prevent ncurses_typing_time modification & main loop behavior */
+
 		ncurses_typing(0, NULL);
-		ncurses_typing_mod = tmp;
+
+		ncurses_typing_mod	= tmp;
+	} else if (w->act & 8) { /* <gone/> without <composing/>, but with <active/> */
+		const window_t *tmp	= ncurses_typing_win;
+		ncurses_typing_win	= w;
+
+		ncurses_typingsend(0, 3);
+
+		ncurses_typing_win	= tmp;
 	}
 
 	return 0;


Więcej informacji o liście dyskusyjnej ekg2-commit