changeset 2009:a859ed648638

Replace the option « no_space_before_items » with « roster_no_leading_space ».
author Simon Jacquin <simon@jacquin.me>
date Tue, 28 Feb 2012 20:26:22 +0100
parents 0d5ece2324c6 (current diff) fa6694a193ec (diff)
children a73ce708c2c9
files mcabber/mcabber/screen.c mcabber/mcabberrc.example
diffstat 3 files changed, 39 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/screen.c	Fri Jan 27 22:09:26 2012 +0100
+++ b/mcabber/mcabber/screen.c	Tue Feb 28 20:26:22 2012 +0100
@@ -127,7 +127,7 @@
 static int chatmode;
 static int multimode;
 static char *multiline, *multimode_subj;
-static int no_space_before_items;
+static int roster_no_leading_space;
 
 static bool Curses;
 static bool log_win_on_top;
@@ -1545,7 +1545,7 @@
   int chat_y_pos, chatstatus_y_pos, log_y_pos;
   int roster_x_pos, chat_x_pos;
 
-  no_space_before_items = settings_opt_get_int("no_space_before_items");
+  roster_no_leading_space = settings_opt_get_int("roster_no_leading_space");
 
   Log_Win_Height = DEFAULT_LOG_WIN_HEIGHT;
   requested_size = settings_opt_get_int("log_win_height");
@@ -2005,7 +2005,7 @@
     x_pos = 0;
 
   space = g_new0(char, 2);
-  if (no_space_before_items) {
+  if (roster_no_leading_space) {
     space[0] = '\0';
     prefix_length = 6;
   } else {
--- a/mcabber/mcabber/xmpp_muc.c	Fri Jan 27 22:09:26 2012 +0100
+++ b/mcabber/mcabber/xmpp_muc.c	Tue Feb 28 20:26:22 2012 +0100
@@ -350,11 +350,26 @@
 static bool muc_handle_join(const GSList *room_elt, const char *rname,
                             const char *roomjid, const char *ournick,
                             enum room_printstatus printstatus,
-                            time_t usttime, int log_muc_conf)
+                            time_t usttime, int log_muc_conf,
+                            enum room_autowhois autowhois, const char *mbjid)
 {
   bool new_member = FALSE; // True if somebody else joins the room (not us)
+  gchar *nickjid;
   gchar *mbuf;
   enum room_flagjoins flagjoins;
+  char *tmp = NULL;
+  int printjid;
+
+  printjid = settings_opt_get_int("muc_print_jid");
+  if (mbjid && autowhois == autowhois_off && printjid) {
+    if (printjid == 1)
+      tmp = strchr(mbjid, JID_RESOURCE_SEPARATOR);
+    if (tmp) *tmp = '\0';
+    nickjid = g_strdup_printf("%s <%s>", rname, mbjid);
+    if (tmp) *tmp = JID_RESOURCE_SEPARATOR;
+  } else {
+    nickjid = g_strdup(rname);
+  }
 
   if (!buddy_getinsideroom(room_elt->data)) {
     // We weren't inside the room yet.  Now we are.
@@ -380,7 +395,7 @@
         hlog_write_message(roomjid, 0, -1, mbuf);
       g_free(mbuf);
       if (printstatus != status_none)
-        mbuf = g_strdup_printf("%s has joined", rname);
+        mbuf = g_strdup_printf("%s has joined", nickjid);
       else
         mbuf = NULL;
       new_member = TRUE;
@@ -389,11 +404,13 @@
     mbuf = NULL;
     if (strcmp(ournick, rname)) {
       if (printstatus != status_none)
-        mbuf = g_strdup_printf("%s has joined", rname);
+        mbuf = g_strdup_printf("%s has joined", nickjid);
       new_member = TRUE;
     }
   }
 
+  g_free(nickjid);
+
   if (mbuf) {
     guint msgflags = HBB_PREFIX_INFO;
     flagjoins = buddy_getflagjoins(room_elt->data);
@@ -574,6 +591,11 @@
     nickchange = TRUE;
   }
 
+  autowhois = buddy_getautowhois(room_elt->data);
+  if (autowhois == autowhois_default)
+    autowhois = (settings_opt_get_int("muc_auto_whois") ?
+                 autowhois_on : autowhois_off);
+
   // Check for departure/arrival
   if (statuscode != 303 && ust == offline) {
     // Somebody is leaving
@@ -680,7 +702,8 @@
     if (old_ust == offline && ust != offline) {
       // Somebody is joining
       new_member = muc_handle_join(room_elt, rname, roomjid, ournick,
-                                   printstatus, usttime, log_muc_conf);
+                                   printstatus, usttime, log_muc_conf,
+                                   autowhois, mbjid);
     } else {
       // This is a simple member status change
 
@@ -705,11 +728,6 @@
   roster_setstatus(roomjid, rname, bpprio, ust, ustmsg, usttime,
                    mbrole, mbaffil, mbjid);
 
-  autowhois = buddy_getautowhois(room_elt->data);
-  if (autowhois == autowhois_default)
-    autowhois = (settings_opt_get_int("muc_auto_whois") ?
-                 autowhois_on : autowhois_off);
-
   if (new_member && autowhois == autowhois_on) {
     cmd_room_whois(room_elt->data, rname, FALSE);
   }
--- a/mcabber/mcabberrc.example	Fri Jan 27 22:09:26 2012 +0100
+++ b/mcabber/mcabberrc.example	Tue Feb 28 20:26:22 2012 +0100
@@ -129,9 +129,9 @@
 # running you can use "/roster display").
 #set roster_display_filter = ofdna_
 
-# By default, mcabber adds an extra space before each buddy in the roster
-# window for aesthetic purposes. You can remove it to gain a little space.
-#set no_space_before_items = 0
+# By default, mcabber adds a leading space before each buddy in the roster. You
+# can remove it to gain a little space.
+#set roster_no_leading_space = 0
 
 # By default command line completion is case-sensitive; this can be changed
 # by setting the option 'completion_ignore_case' to 1.
@@ -327,6 +327,12 @@
 # Set 'muc_auto_whois' to 1 if you want to call /room whois each time
 # somebody joins a room. (default: 0)
 #set muc_auto_whois = 0
+# Set 'muc_print_jid' to see real jid in non-anonynmous room when somebody
+# joins. This setting will be ignored when auto_whois is enabled.
+# 0: only nick (don't print jid even if available)
+# 1: nick and bare jid
+# 2: nick and full jid with resource
+#set muc_print_jid = 1
 #
 # Set 'muc_disable_nick_hl' to 1 if you don't want mcabber to color lines
 # containing your nickname in a MUC room.