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

CVS commit cvs w toxygen.net
Pon, 8 Paź 2007, 09:42:30 CEST


Module name:	ekg2
Changes by:	peres	2007-10-08 09:42:28

Modified files:
	main.c old.c old.h

Log message:
Use PROTOCOL_DISCONNECTING for <gone/> chatstate (disabling composing),
instead of worrying about it ourself.

Index: main.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/main.c,v
diff -d -u -r1.101 -r1.102
--- main.c	6 Oct 2007 18:25:40 -0000	1.101
+++ main.c	8 Oct 2007 07:42:27 -0000	1.102
@@ -625,6 +625,7 @@
 	query_connect_id(&ncurses_plugin, METACONTACT_ITEM_ADDED, ncurses_all_contacts_changed, NULL);
 	query_connect_id(&ncurses_plugin, METACONTACT_ITEM_REMOVED, ncurses_all_contacts_changed, NULL);
 	query_connect_id(&ncurses_plugin, CONFIG_POSTINIT, ncurses_postinit, NULL);
+	query_connect_id(&ncurses_plugin, PROTOCOL_DISCONNECTING, ncurses_session_disconnect_handler, NULL);
 #ifdef WITH_ASPELL
 	variable_add(&ncurses_plugin, ("aspell"), VAR_BOOL, 1, &config_aspell, ncurses_changed_aspell, NULL, NULL);
         variable_add(&ncurses_plugin, ("aspell_lang"), VAR_STR, 1, &config_aspell_lang, ncurses_changed_aspell, NULL, NULL);

Index: old.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/old.c,v
diff -d -u -r1.157 -r1.158
--- old.c	7 Oct 2007 11:26:07 -0000	1.157
+++ old.c	8 Oct 2007 07:42:27 -0000	1.158
@@ -231,6 +231,18 @@
 	return 0;
 }
 
+	/* this one is meant to check whether we need to send some chatstate to disconnecting session,
+	 * so jabber plugin doesn't need to care about this anymore */
+QUERY(ncurses_session_disconnect_handler) {
+	const char	*session	= *va_arg(ap, const char **);
+	const char	*typing_session	= (ncurses_typing_win ? session_uid_get(ncurses_typing_win->session) : NULL);
+
+	if (session && !xstrcasecmp(session, typing_session))
+		ncurses_typingsend(0, 3);
+
+	return 0;
+}
+
 /* cut prompt to given width and recalculate its' width */
 void ncurses_update_real_prompt(ncurses_window_t *n) {
 	if (!n)

Index: old.h
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/old.h,v
diff -d -u -r1.37 -r1.38
--- old.h	6 Oct 2007 18:25:40 -0000	1.37
+++ old.h	8 Oct 2007 07:42:27 -0000	1.38
@@ -89,6 +89,7 @@
 extern WINDOW *ncurses_input;
 
 TIMER(ncurses_typing);
+QUERY(ncurses_session_disconnect_handler);
 void ncurses_main_window_mouse_handler(int x, int y, int mouse_state);
 
 void ncurses_update_real_prompt(ncurses_window_t *n);


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