summary refs log tree commit diff
path: root/config.org
diff options
context:
space:
mode:
Diffstat (limited to 'config.org')
-rw-r--r--config.org20
1 files changed, 20 insertions, 0 deletions
diff --git a/config.org b/config.org
index 112a5d0..3edae50 100644
--- a/config.org
+++ b/config.org
@@ -459,6 +459,26 @@ So now what we're going to do is get it to stop showing a bunch of channels in t
 		    (cl-return t)))))))(setopt jabber-activity-show-p #'noa/jabber-activity-show-p)
 #+end_src
 
+Because i have a lot of irc channels shown, a lot of the jids are quite long and ugly.  Mostly i know what irc server a channel belongs to, so i want to cut off the parts after the percentage symbol.
+
+I might want to look at the jabber-jid-username function which seems to do this.
+
+#+begin_src elisp
+  (defun noa/jabber-activity-make-string (jid)
+    "Return the nick of the JID.
+  If no nick is available, return the user name part of the JID. In
+  private MUC conversations, return the user's nickname."
+    (if (jabber-muc-sender-p jid)
+	(jabber-jid-resource jid)
+      (let ((nick (jabber-jid-displayname jid))
+	    (user (jabber-jid-user jid))
+	    (username (jabber-jid-username jid)))
+	(if (and username (string= nick user))
+	    username
+	  nick))))
+  (setopt jabber-activity-make-string #'noa/jabber-activity-make-string)
+#+end_src
+
 I'm on a laptop, so whenever i shut it i get disconnected.  Jabber can query auth-source for my password, so automatically reconnecting is useful and doesn't need me to do anything.
 
 #+begin_src elisp