[ekg2-commit] ekg2: bindings.c (HEAD) main.c (HEAD) old.c (HEAD) [peres]
CVS commit
cvs w toxygen.net
Nie, 21 Paź 2007, 00:01:07 CEST
Module name: ekg2
Changes by: peres 2007-10-21 00:01:05
Modified files:
bindings.c main.c old.c
Log message:
Sacrifice another w->act bit to my beloved chatstates. Now we should be
even better, because:
1) we send <composing/> ONLY after receiving incoming chat message,
i.e. no spamming to incorrect JID,
2) we also send <active/> after opening 'not-active' window with incoming
messages in it (i.e. we inform sender that we did it; and we no longer
send <gone/> as the only chatstate in conversation).
Index: bindings.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/bindings.c,v
diff -d -u -r1.74 -r1.75
--- bindings.c 8 Oct 2007 09:04:01 -0000 1.74
+++ bindings.c 20 Oct 2007 22:01:04 -0000 1.75
@@ -132,7 +132,7 @@
ncurses_typing_mod = 1;
else {
ncurses_typing_win = NULL;
- window_current->act |= 8;
+ window_current->act |= 16;
}
curs_set(1);
@@ -263,7 +263,7 @@
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 */
+ window_current->act |= 16; /* but also remember that is should have set <active/> chatstate */
}
if (xwcscmp(line, TEXT(""))) {
Index: main.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/main.c,v
diff -d -u -r1.103 -r1.104
--- main.c 16 Oct 2007 18:35:49 -0000 1.103
+++ main.c 20 Oct 2007 22:01:04 -0000 1.104
@@ -62,6 +62,7 @@
int ncurses_plugin_destroyed;
QUERY(ncurses_password_input); /* old.c */
+void ncurses_window_gone(window_t *w);
/**
* ncurses_beep()
@@ -157,8 +158,11 @@
ncurses_redraw_input(0); /* redraw prompt... */
ncurses_commit();
- if (w->act & 2) /* set <active/> also on incoming chat message receival */
+ if (w->act & 2) { /* enable <composing/> on incoming chat message receival */
w->act |= 8;
+ if (!(w->act & 16)) /* send <active/>, as we showed interest in chat */
+ ncurses_window_gone(w);
+ }
return 0;
}
Index: old.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/old.c,v
diff -d -u -r1.161 -r1.162
--- old.c 16 Oct 2007 18:35:49 -0000 1.161
+++ old.c 20 Oct 2007 22:01:04 -0000 1.162
@@ -230,7 +230,7 @@
return 0;
}
-static void ncurses_window_gone(window_t *w) {
+void ncurses_window_gone(window_t *w) {
if (w == ncurses_typing_win) { /* don't allow timer to touch removed window */
const int tmp = ncurses_typing_mod;
@@ -240,13 +240,14 @@
ncurses_typing(0, NULL);
ncurses_typing_mod = tmp;
- } else if (w->act & 8) { /* <gone/> without <composing/>, but with <active/> */
+ } else if (w->act & 24) { /* <gone/> or <active/> */
window_t *tmp = ncurses_typing_win;
ncurses_typing_win = w;
- ncurses_typingsend(0, 3);
+ ncurses_typingsend(0, !(w->act & 16) ? 4 : 3);
ncurses_typing_win = tmp;
+ w->act ^= 16;
}
}
Więcej informacji o liście dyskusyjnej ekg2-commit