summary refs log tree commit diff
diff options
context:
space:
mode:
authornoa@gaiwan.org2024-06-29 09:32:05 +0000
committernoa@gaiwan.org2024-06-29 09:32:05 +0000
commit85eb0551a90cc75427221a4671f7f86724c7a6bc (patch)
tree78e7fd66e289175fbe47f5ddd124aa21e7f59b9a
parent117e3b5a5d09c946bc1c716a58fdf58f3a1232ae (diff)
Use a user-defined function for filtering xmpp chats in header line
-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