changeset 2287:1f5f708d58a6

Merge release 1.0.4
author Mikael Berthe <mikael@lilotux.net>
date Mon, 21 Nov 2016 20:58:58 +0100
parents dc1b123d63d5 (diff) 6753d7936217 (current diff)
children ece02eb9c81d
files .hgsigs .hgtags mcabber/ChangeLog mcabber/configure.ac mcabber/doc/mcabber.1 mcabber/doc/mcabber.1.html mcabber/doc/mcabber.1.txt
diffstat 14 files changed, 100 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsigs	Mon Nov 21 20:51:09 2016 +0100
+++ b/.hgsigs	Mon Nov 21 20:58:58 2016 +0100
@@ -12,4 +12,5 @@
 ef35d7458223f10076fbe8da2a5dd79c97a5ba5e 0 iD8DBQBVkFulPCkA3qy3/JURApZrAJ9Nu77HrX071L5EWuuS7GLmFebffwCfcUIOF8fkqIySqyv3Ec2LmcyQXsU=
 d703d6b42b32b1718f39e4fdc188653724c8e40d 0 iD8DBQBWqJgmPCkA3qy3/JURAvxlAJ0UUAszy1VcNmqwaNi1V1ups5WvFACgvR3/n4qLwNXlCY/rhsBCQfGC4YA=
 54a12919cdee141391bb89461ec2d673f3000e21 0 iD8DBQBW0Zp4PCkA3qy3/JURAgZXAJ4hkq05rGPfi0fiPlyXQepyVhEs8ACfUaGG5J4NYTcofIAYRrkoEo5/rPk=
+3d6986784daee106b9143976e7576cb3ecee5380 0 iD8DBQBX3rORPCkA3qy3/JURAgElAKCtALoJ2iyRFJ6bPkcGgjFuNuQNPwCeMSSr3ePeoUyMPrlm9CxZqF0Ipao=
 e20ac5fe419c3cd6b0dd369f0605cb055847888a 0 iD8DBQBYM1AoPCkA3qy3/JURAl80AJ94HmyoAeA8a5IzbJfoxBOPYBAjsQCgwwAVqGlkYBEJZx5O3zuwUlMkZGQ=
--- a/.hgtags	Mon Nov 21 20:51:09 2016 +0100
+++ b/.hgtags	Mon Nov 21 20:58:58 2016 +0100
@@ -43,4 +43,5 @@
 ef35d7458223f10076fbe8da2a5dd79c97a5ba5e 1.0.0
 d703d6b42b32b1718f39e4fdc188653724c8e40d 1.0.1
 54a12919cdee141391bb89461ec2d673f3000e21 1.0.2
+3d6986784daee106b9143976e7576cb3ecee5380 1.0.3
 e20ac5fe419c3cd6b0dd369f0605cb055847888a 1.0.4
--- a/mcabber/ChangeLog	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/ChangeLog	Mon Nov 21 20:58:58 2016 +0100
@@ -1,3 +1,9 @@
+mcabber (1.0.5-dev)
+
+ * 
+
+ -- Mikael, ?
+
 mcabber (1.0.4)
 
  * Bugfix: Check the origin of roster pushes
--- a/mcabber/configure.ac	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/configure.ac	Mon Nov 21 20:58:58 2016 +0100
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([mcabber],[1.0.4],[mcabber@lilotux.net])
+AC_INIT([mcabber],[1.0.5-dev],[mcabber@lilotux.net])
 XC_AUTOMAKE
 AC_CONFIG_SRCDIR([mcabber])
 AC_CONFIG_HEADERS([mcabber/config.h])
@@ -297,7 +297,7 @@
 AM_CONDITIONAL([INSTALL_HEADERS], [test x$enable_modules != xno])
 
 # Prepare some config.h variables
-AC_DEFINE([MCABBER_BRANCH], "1.0.4", [Mcabber branch])
+AC_DEFINE([MCABBER_BRANCH], "dev", [Mcabber branch])
 AC_DEFINE([MCABBER_VERSION], "AC_PACKAGE_VERSION", [Mcabber version string])
 
 # We need _GNU_SOURCE for strptime() and strcasestr()
--- a/mcabber/doc/mcabber.1	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/doc/mcabber.1	Mon Nov 21 20:58:58 2016 +0100
@@ -4,10 +4,10 @@
 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
 .\"      Date: 09/18/2016
 .\"    Manual: \ \&
-.\"    Source: \ \& 1.0.4
+.\"    Source: \ \& 1.0.5-dev
 .\"  Language: English
 .\"
-.TH "MCABBER" "1" "11/21/2016" "\ \& 1\&.0\&.4\" "\ \&"
+.TH "MCABBER" "1" "09/18/2016" "\ \& 1\&.0\&.5\-dev\" "\ \&"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
--- a/mcabber/doc/mcabber.1.html	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/doc/mcabber.1.html	Mon Nov 21 20:58:58 2016 +0100
@@ -2616,8 +2616,8 @@
 <div id="footnotes"><hr /></div>
 <div id="footer">
 <div id="footer-text">
-Version 1.0.4<br />
-Last updated 2016-11-21 10:08:00 CEST
+Version 1.0.5-dev<br />
+Last updated 2016-09-17 20:57:35 CEST
 </div>
 </div>
 </body>
--- a/mcabber/doc/mcabber.1.txt	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/doc/mcabber.1.txt	Mon Nov 21 20:58:58 2016 +0100
@@ -1,7 +1,7 @@
 MCABBER(1)
 ===========
 Mikael BERTHE <mcabber@lilotux.net>
-v1.0.4, November 2016
+v1.0.5-dev, November 2016
 
 NAME
 ----
--- a/mcabber/mcabber/api.h	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/mcabber/api.h	Mon Nov 21 20:58:58 2016 +0100
@@ -4,10 +4,10 @@
 #include <glib.h>
 #include <mcabber/config.h> // For MCABBER_BRANCH
 
-#define MCABBER_API_VERSION 1
-#define MCABBER_API_MIN     1
+#define MCABBER_API_VERSION 41
+#define MCABBER_API_MIN     41
 
-/* #define MCABBER_BRANCH_DEV  0 */
+#define MCABBER_BRANCH_DEV  1
 
 // cmd_add returns gpointer id
 #define MCABBER_API_HAVE_CMD_ID 1
--- a/mcabber/mcabber/hooks.c	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/mcabber/hooks.c	Mon Nov 21 20:58:58 2016 +0100
@@ -44,6 +44,8 @@
   guint     hid;
 } hook_list_data_t;
 
+extern int build_buddylist;
+
 static GHashTable *hk_handler_hash = NULL;
 
 //  _new_hook_id()
@@ -567,8 +569,7 @@
 
   roster_setstatus(bjid, rn, prio, status, status_msg, timestamp,
                    role_none, affil_none, NULL);
-  buddylist_build();
-  scr_draw_roster();
+  build_buddylist = TRUE;
   hlog_write_status(bjid, timestamp, status, status_msg);
 
 #ifdef MODULES_ENABLE
--- a/mcabber/mcabber/main.c	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/mcabber/main.c	Mon Nov 21 20:58:58 2016 +0100
@@ -28,6 +28,7 @@
 #include <glib.h>
 #include <config.h>
 #include <poll.h>
+#include <time.h>
 #include <errno.h>
 
 #include "caps.h"
@@ -66,8 +67,11 @@
 static bool sigwinch;
 #endif
 
+extern int build_buddylist;
+
 static bool terminate_ui;
 GMainContext *main_context;
+static guint refresh_timeout_id;
 
 static struct termios *backup_termios;
 
@@ -377,6 +381,13 @@
   return keyboard_activity();
 }
 
+static gboolean refresh_timeout_cb(gpointer data) {
+   // Only called once, to trigger a refresh if needed
+   // so reset ID and return false.
+  refresh_timeout_id = 0;
+  return FALSE;
+}
+
 static GSourceFuncs mcabber_source_funcs = {
   mcabber_source_prepare,
   mcabber_source_check,
@@ -483,6 +494,10 @@
     }
   }
 
+  /* Initialize buddylist update timestamp */
+  struct timespec last_ui_update;
+  clock_gettime(CLOCK_MONOTONIC, &last_ui_update);
+
   /* Initialize PGP system
      We do it before ncurses initialization because we may need to request
      a passphrase. */
@@ -555,6 +570,9 @@
     scr_LogPrint(LPRINT_DEBUG, "Entering into main loop...");
 
     while(!terminate_ui) {
+      int64_t timediff;
+      struct timespec now;
+
       if (g_main_context_iteration(main_context, TRUE) == FALSE)
         keyboard_activity();
 #ifdef USE_SIGWINCH
@@ -563,9 +581,36 @@
         sigwinch = FALSE;
       }
 #endif
-      if (update_roster)
-        scr_draw_roster();
-      scr_do_update();
+
+      // Compute time in ms since last buddylist/screen update
+      clock_gettime(CLOCK_MONOTONIC, &now);
+      timediff = (((now.tv_sec - last_ui_update.tv_sec)  * 1.0e9) +
+                  (now.tv_nsec - last_ui_update.tv_nsec)) / 1.0e6;
+
+      if (timediff <= 200) {
+        // Trigger a timeout in 1s to make sure no refresh will be missed
+        if (!refresh_timeout_id) {
+          refresh_timeout_id = g_timeout_add_seconds_full(G_PRIORITY_DEFAULT,
+                                     1, refresh_timeout_cb, NULL, NULL);
+        }
+      } else if ((build_buddylist || update_roster)) {
+        // More than 200ms
+        if (build_buddylist || update_roster) {
+          if (build_buddylist) {
+            buddylist_build();
+            update_roster = TRUE;
+          }
+          if (update_roster) {
+            scr_draw_roster();
+            scr_do_update();
+            last_ui_update = now;
+          }
+        } else {
+          // No roster change; minimum screen update
+          update_panels();
+          doupdate();
+        }
+      }
     }
 
     g_source_destroy(mc_source);
--- a/mcabber/mcabber/roster.c	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/mcabber/roster.c	Mon Nov 21 20:58:58 2016 +0100
@@ -23,6 +23,8 @@
 #include "utils.h"
 #include "hooks.h"
 
+int build_buddylist;
+
 extern void hlog_save_state(void);
 
 char *strrole[] = {   /* Should match enum in roster.h */
@@ -1032,6 +1034,8 @@
   // current_buddy initialization
   if (!current_buddy || (g_list_position(buddylist, current_buddy) == -1))
     current_buddy = g_list_first(buddylist);
+
+  build_buddylist = FALSE;
 }
 
 //  buddy_hide_group(roster, hide)
--- a/mcabber/mcabber/screen.c	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/mcabber/screen.c	Mon Nov 21 20:58:58 2016 +0100
@@ -68,6 +68,8 @@
 
 #define DEFAULT_ATTENTION_CHAR '!'
 
+extern int build_buddylist;
+
 const char *LocaleCharSet = "C";
 
 static unsigned short int Log_Win_Height;
@@ -2158,7 +2160,6 @@
     unsigned short ismsg, isgrp, ismuc, ishid, isspe;
     guint isurg;
     gchar *rline_locale;
-    GSList *resources, *p_res;
 
     bflags = buddy_getflags(BUDDATA(buddy));
     btype = buddy_gettype(BUDDATA(buddy));
@@ -2178,17 +2179,22 @@
     status = '?';
     pending = ' ';
 
-    resources = buddy_getresources(BUDDATA(buddy));
-    for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
-      guint events = buddy_resource_getevents(BUDDATA(buddy),
-                                              p_res ? p_res->data : "");
-      if ((events & ROSTER_EVENT_PAUSED) && pending != '+')
-        pending = '.';
-      if (events & ROSTER_EVENT_COMPOSING)
-        pending = '+';
-      g_free(p_res->data);
+    if (!ismuc) {
+      // There is currently no chat state support for MUC
+      GSList *resources = buddy_getresources(BUDDATA(buddy));
+      GSList *p_res;
+
+      for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
+        guint events = buddy_resource_getevents(BUDDATA(buddy),
+                                                p_res ? p_res->data : "");
+        if ((events & ROSTER_EVENT_PAUSED) && pending != '+')
+          pending = '.';
+        if (events & ROSTER_EVENT_COMPOSING)
+          pending = '+';
+        g_free(p_res->data);
+      }
+      g_slist_free(resources);
     }
-    g_slist_free(resources);
 
     // Display message notice if there is a message flag, but not
     // for unfolded groups.
@@ -2534,7 +2540,7 @@
   }
   // We should rebuild the buddylist but not everytime
   if (!(buddylist_get_filter() & 1<<prev_st))
-    buddylist_build();
+    build_buddylist = TRUE;
   update_roster = TRUE;
 }
 
--- a/mcabber/mcabber/xmpp.c	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/mcabber/xmpp.c	Mon Nov 21 20:58:58 2016 +0100
@@ -2119,7 +2119,7 @@
 
 //  send_storage(store)
 // Send the node "store" to update the server.
-// Note: the sender should check we're online.
+// Note: the caller should check we're online.
 void send_storage(LmMessageNode *store)
 {
   LmMessage *iq;
@@ -2333,17 +2333,18 @@
     if (group && *group)
       lm_message_node_add_child(x, "group", group);
     changed = TRUE;
-    scr_LogPrint(LPRINT_LOGNORM, "Updating bookmarks...");
   }
 
   if (!changed)
     return;
 
-  if (xmpp_is_online())
+  if (xmpp_is_online()) {
     send_storage(bookmarks);
-  else
+    scr_LogPrint(LPRINT_LOGNORM, "Bookmarks updated.");
+  } else {
     scr_LogPrint(LPRINT_LOGNORM,
                  "Warning: you're not connected to the server.");
+  }
 }
 
 static struct annotation *parse_storage_rosternote(LmMessageNode *notenode)
--- a/mcabber/mcabber/xmpp_muc.c	Mon Nov 21 20:51:09 2016 +0100
+++ b/mcabber/mcabber/xmpp_muc.c	Mon Nov 21 20:58:58 2016 +0100
@@ -296,7 +296,7 @@
 }
 
 //  muc_get_item_info(...)
-// Get room member's information from xmlndata.
+// Get room member's information from xmldata.
 // The variables must be initialized before calling this function,
 // because they are not touched if the relevant information is missing.
 // Note that *actor should be freed by the caller.
@@ -494,7 +494,7 @@
     scr_WriteIncomingMessage(roomjid, msg, 0, HBB_PREFIX_INFO, 0);
     // Send back an unavailable packet
     xmpp_setstatus(offline, roomjid, "", TRUE);
-    scr_draw_roster();
+    update_roster = TRUE;
     return;
   }
 
@@ -697,7 +697,7 @@
       flagjoins = buddy_getflagjoins(room_elt->data);
       if (flagjoins == flagjoins_default &&
           settings_opt_get_int("muc_flag_joins") == 2)
-	flagjoins = flagjoins_all;
+        flagjoins = flagjoins_all;
       if (!our_presence && flagjoins != flagjoins_all)
         msgflags |= HBB_PREFIX_NOFLAG;
       //silent message if someone else joins, and we care about noone
@@ -748,7 +748,7 @@
     cmd_room_whois(room_elt->data, rname, FALSE);
   }
 
-  scr_draw_roster();
+  update_roster = TRUE;
 }
 
 void roompresence(gpointer room, void *presencedata)