Use new UNREAD parameters (mcabber 0.10.0)
authorMikael Berthe <mikael@lilotux.net>
Sun, 28 Mar 2010 18:02:43 +0200
changeset 13 4db51cfb9e15
parent 12 5f16a0f3124c
child 14 02d532e70dfb
Use new UNREAD parameters (mcabber 0.10.0)
mcevent.py
--- a/mcevent.py	Mon Jul 14 18:21:16 2008 +0200
+++ b/mcevent.py	Sun Mar 28 18:02:43 2010 +0200
@@ -12,7 +12,7 @@
 and creates events accordingly.  Examples:
 STATUS O user2@domain.org
 MSG IN user@domain.org
-UNREAD 1
+UNREAD 1 0 1 0
 """
 
 import sys, getopt
@@ -240,9 +240,15 @@
 
     elif event == 'UNREAD':
         # arg1 is the number of unread buffers
+        unread_all, unread_attn, unread_muc, unread_muc_attn = args[1:5]
+        unread = int(unread_all) - (int(unread_muc) - int(unread_muc_attn))
+        if unread == int(unread_all):
+            unread_str = unread_all
+        else:
+            unread_str = str(unread) + "/" + unread_all
         if OPT['unread_file'] != '':
             fileh = open(OPT['unread_file'], 'w')
-            fileh.write(arg1)
+            fileh.write(unread_str)
             fileh.close()