changeset 993:0759f4c7da68

Add option 'disable_chatstates'
author Mikael Berthe <mikael@lilotux.net>
date Wed, 01 Nov 2006 21:36:50 +0100
parents b37348c2aa79
children eb416c9633b5
files mcabber/mcabberrc.example mcabber/src/jabglue.c mcabber/src/main.c mcabber/src/screen.c mcabber/src/screen.h
diffstat 5 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabberrc.example	Wed Nov 01 17:47:30 2006 +0100
+++ b/mcabber/mcabberrc.example	Wed Nov 01 21:36:50 2006 +0100
@@ -67,6 +67,11 @@
 # in the roster.
 #set hide_offline_buddies = 0
 
+# Typing notifications, Chat States, Events (JEP-22/85)
+# Set disable_chatstates to 1 if you don't want to use typing notifications.
+# Note: changing this option once mcabber is running has no effect.
+#set disable_chatstates = 0
+
 # History logging
 # You can save the messages history: set logging = 1
 # You can load (read) the messages history: set load_logs = 1
--- a/mcabber/src/jabglue.c	Wed Nov 01 17:47:30 2006 +0100
+++ b/mcabber/src/jabglue.c	Wed Nov 01 21:36:50 2006 +0100
@@ -461,6 +461,10 @@
   }
 
 #if defined JEP0022 || defined JEP0085
+  // If typing notifications are disabled, we can skip all this stuff...
+  if (chatstates_disabled)
+    goto jb_send_msg_no_chatstates;
+
   rname = strchr(jid, JID_RESOURCE_SEPARATOR);
   barejid = jidtodisp(jid);
   sl_buddy = roster_find(barejid, jidsearch, ROSTER_TYPE_USER);
@@ -523,6 +527,7 @@
   }
 #endif
 
+jb_send_msg_no_chatstates:
   xmlnode_put_attrib(x, "id", msgid);
 
   jab_send(jc, x);
@@ -668,7 +673,6 @@
 #ifdef JEP0085
   jep85 = buddy_resource_jep85(buddy, NULL);
   if (jep85 && jep85->support == CHATSTATES_SUPPORT_OK) {
-    // FIXME: compare w/ last state sent...
     jb_send_jep85_chatstate(jid, chatstate);
     return;
   }
@@ -676,7 +680,6 @@
 #ifdef JEP0022
   jep22 = buddy_resource_jep22(buddy, NULL);
   if (jep22 && jep22->support == CHATSTATES_SUPPORT_OK) {
-    // FIXME: compare w/ last state sent...
     jb_send_jep22_event(jid, chatstate);
   }
 #endif
--- a/mcabber/src/main.c	Wed Nov 01 17:47:30 2006 +0100
+++ b/mcabber/src/main.c	Wed Nov 01 21:36:50 2006 +0100
@@ -317,6 +317,8 @@
   if (settings_opt_get_int("hide_offline_buddies") > 0)
     buddylist_set_hide_offline_buddies(TRUE);
 
+  chatstates_disabled = settings_opt_get_int("disable_chatstates");
+
   if (ret < 0) {
     scr_LogPrint(LPRINT_NORMAL, "No configuration file has been found.");
     scr_ShowBuddyWindow();
--- a/mcabber/src/screen.c	Wed Nov 01 17:47:30 2006 +0100
+++ b/mcabber/src/screen.c	Wed Nov 01 21:36:50 2006 +0100
@@ -98,6 +98,7 @@
 static int    chatstate; /* (0=active, 1=composing, 2=paused) */
 static bool   lock_chatstate;
 static time_t chatstate_timestamp;
+int chatstates_disabled;
 
 #define MAX_KEYSEQ_LENGTH 8
 
@@ -1397,6 +1398,8 @@
 static inline void set_chatstate(int state)
 {
 #if defined JEP0022 || defined JEP0085
+  if (chatstates_disabled)
+    return;
   if (!chatmode)
     state = 0;
   if (state != chatstate) {
--- a/mcabber/src/screen.h	Wed Nov 01 17:47:30 2006 +0100
+++ b/mcabber/src/screen.h	Wed Nov 01 21:36:50 2006 +0100
@@ -102,6 +102,7 @@
 #if defined JEP0022 || defined JEP0085
 long int scr_GetChatStatesTimeout(time_t now);
 #endif
+int chatstates_disabled;
 
 // For commands...
 void scr_RosterTop(void);