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

CVS commit cvs w toxygen.net
Nie, 21 Paź 2007, 12:50:55 CEST


Module name:	ekg2
Changes by:	peres	2007-10-21 12:50:53

Modified files:
	old.c

Log message:
PROTOCOL_TYPING_OUT should return 0 if everything works fine,
or -1, if user has disabled such a chatstate. That is, if user
doesn't want to send <active/> on switching to newly-opened window
with incoming messages, we won't send <gone/> after closing such
window anymore (unless user writes something).

Index: old.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/old.c,v
diff -d -u -r1.163 -r1.164
--- old.c	20 Oct 2007 22:26:31 -0000	1.163
+++ old.c	21 Oct 2007 10:50:53 -0000	1.164
@@ -173,12 +173,14 @@
 		return (ncurses_line[0] == '/' ? 0 : xwcslen(ncurses_line));
 }
 
-inline void ncurses_typingsend(const int len, const int first) {
+inline int ncurses_typingsend(const int len, const int first) {
 	const char *sid	= session_uid_get(ncurses_typing_win->session);
 	const char *uid	= get_uid(ncurses_typing_win->session, ncurses_typing_win->target);
 	
 	if (((first > 1) || (ncurses_typing_win->act & 8)) && uid)
-		query_emit_id(NULL, PROTOCOL_TYPING_OUT, &sid, &uid, &len, &first);
+		return query_emit_id(NULL, PROTOCOL_TYPING_OUT, &sid, &uid, &len, &first);
+	else
+		return -1;
 }
 
 TIMER(ncurses_typing) {
@@ -244,10 +246,10 @@
 		window_t *tmp		= ncurses_typing_win;
 		ncurses_typing_win	= w;
 
-		ncurses_typingsend(0, !(w->act & 16) ? 4 : 3);
+		if (!ncurses_typingsend(0, !(w->act & 16) ? 4 : 3) || (w->act & 16))
+			w->act		^= 16;
 
 		ncurses_typing_win	= tmp;
-		w->act			^= 16;
 	}
 }
 


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