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

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


Module name:	ekg2
Changes by:	peres	2007-10-21 12:52:16

Modified files:
	jabber.c

Log message:
First part of chatstate sending disabling.

Index: jabber.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/jabber.c,v
diff -d -u -r1.353 -r1.354
--- jabber.c	20 Oct 2007 22:02:32 -0000	1.353
+++ jabber.c	21 Oct 2007 10:52:16 -0000	1.354
@@ -75,6 +75,7 @@
 char *jabber_default_search_server = NULL;
 char *jabber_default_pubsub_server = NULL;
 int config_jabber_beep_mail = 0;
+int config_jabber_disable_chatstates = 0;
 const char *jabber_authtypes[] = { "none", "from", "to", "both" };
 
 static int session_postinit;
@@ -1472,11 +1473,15 @@
 
 	const char *jid		= uid + 5;
 	session_t *s		= session_find(session);
+	const int confbit	= 1 << (first <= 2 ? 0 : first - 2);
 	jabber_private_t *j;
 
 	if (!first || !s || s->plugin != &jabber_plugin)
 		return 0;
 
+	if (config_jabber_disable_chatstates & confbit)
+		return -1;
+
 	j = jabber_private(s);
 
 	if (j->istlen)
@@ -1492,10 +1497,8 @@
 			 first == 3 ? "gone" :
 			 first == 2 ? "inactive" :
 			 "paused"));
-#if 0
-	session_set(s, "__last_typing", len ? jid : NULL);
-#endif
-	return -1;
+
+	return 0;
 }
 
 	/* KEEP IT SORTED, MEN! */
@@ -1583,6 +1586,8 @@
 	variable_add(&jabber_plugin, ("dcc_ip"), VAR_STR, 1, &jabber_dcc_ip, NULL, NULL, NULL);
 	variable_add(&jabber_plugin, ("default_pubsub_server"), VAR_STR, 1, &jabber_default_pubsub_server, NULL, NULL, NULL);
 	variable_add(&jabber_plugin, ("default_search_server"), VAR_STR, 1, &jabber_default_search_server, NULL, NULL, NULL);
+	variable_add(&jabber_plugin, ("disable_chatstates"), VAR_MAP, 1, &config_jabber_disable_chatstates, NULL,
+			variable_map(4, 0, 0, "none", 1, 0, "composing", 2, 0, "gone", 4, 0, "active"), NULL); 
 
         jabber_register_commands();
 #ifdef JABBER_HAVE_SSL


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