changeset 1188:ef40688d87bd

Add option 'buddy_me_fulljid' When a contacts sends "/me ", mcabber used to display "*user@server.net ", which can take a lot of space. It now displays only "*user ", but the old behaviour can be kept with the new option.
author Mikael Berthe <mikael@lilotux.net>
date Fri, 20 Apr 2007 18:02:38 +0200
parents 16abe7ec3056
children a0722fce1786
files mcabber/mcabberrc.example mcabber/src/hooks.c
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabberrc.example	Fri Apr 20 17:14:38 2007 +0200
+++ b/mcabber/mcabberrc.example	Fri Apr 20 18:02:38 2007 +0200
@@ -272,6 +272,12 @@
 # - 3: "name" (if the name is the same as the jid, use <jid/res>)
 #set buddy_format = 2
 #
+# When a contacts sends "/me ", mcabber displays "*user ", where user
+# is the local part of the contact's jid.
+# If you want mcabber to display the complete bare jid (user@server.com),
+# set "buddy_me_fulljid" to 1 (default: 0)
+#set buddy_me_fulljid = 1
+#
 # Display the status changes in the chat buffers (default: 0, never)
 # Values:  0: never  1: only connect/disconnect  2: all
 #set show_status_in_buffer = 1
--- a/mcabber/src/hooks.c	Fri Apr 20 17:14:38 2007 +0200
+++ b/mcabber/src/hooks.c	Fri Apr 20 18:02:38 2007 +0200
@@ -67,9 +67,16 @@
     }
   } else {
     bmsg = g_strdup(msg);
-    if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME)))
-      wmsg = mmsg = g_strdup_printf("*%s %s", bjid, msg+4);
-    else
+    if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) {
+      gchar *shortid = g_strdup(bjid);
+      if (settings_opt_get_int("buddy_me_fulljid") == FALSE) {
+        gchar *p = strchr(shortid, '@'); // Truncate the jid
+        if (p)
+          *p = '\0';
+      }
+      wmsg = mmsg = g_strdup_printf("*%s %s", shortid, msg+4);
+      g_free(shortid);
+    } else
       wmsg = (char*) msg;
   }