changeset 1310:365229e92169

Actually, replace the hooks with a different kind of reminder bell functionality.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 05 Feb 2011 18:25:06 +0200
parents 6f2b46da0934
children 85ea9dff9538
files ggrtf.tf gm-rais.tf
diffstat 2 files changed, 38 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ggrtf.tf	Sat Feb 05 18:04:20 2011 +0200
+++ b/ggrtf.tf	Sat Feb 05 18:25:06 2011 +0200
@@ -712,14 +712,14 @@
 	/let _bval_t=$[prgetval(strcat("bind_",{1},"_t"))]%;\
 	/let _bval_c=$[prgetval(strcat("bind_",{1},"_c"))]%;\
 	/let _bval_n=$[prgetval(strcat("bind_",{1},"_n"))]%;\
-	/if (_bval_n==0)		/let _ttc=Cred%;/let _tt=No%;\
-	/elseif (_bval_n==1)	/let _ttc=Cgreen%;/let _tt=Yes%;\
-	/else			/let _ttc=Ccyan%;/let _tt=?%;\
+	/if (_bval_n==0)        /let _ttc=Cred%;/let _tt=No%;\
+	/elseif (_bval_n==1)    /let _ttc=Cgreen%;/let _tt=Yes%;\
+	/else                   /let _ttc=Ccyan%;/let _tt=?%;\
 	/endif%;\
-	/if (_bval_t=~"G")	/let _tc=BCred%;\
-	/elseif (_bval_t=~"S")	/let _tc=BCgreen%;\
-	/elseif (_bval_t=~"C")	/let _tc=BCcyan%;\
-	/else			/let _tc=%{BCwhite}%;\
+	/if (_bval_t=~"G")      /let _tc=BCred%;\
+	/elseif (_bval_t=~"S")  /let _tc=BCgreen%;\
+	/elseif (_bval_t=~"C")  /let _tc=BCcyan%;\
+	/else                   /let _tc=%{BCwhite}%;\
 	/endif%;\
 	/msw | @{BCyellow}$[prsubipad({1},14)]@{n} | @{%{_tc}}%{_bval_t}@{n} | @{BCmagenta}$[prsubipad(_bval_c,40)]@{n} | @{%{_ttc}}$[pad(_tt,3)]@{n} |%;\
 	/shift%;\
--- a/gm-rais.tf	Sat Feb 05 18:04:20 2011 +0200
+++ b/gm-rais.tf	Sat Feb 05 18:25:06 2011 +0200
@@ -13,7 +13,11 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Bindings etc
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-/prdeftoggle -n"acptbell" -d"Bell when someone accepts rais/reinc/etc."
+;@command /acptbell <off|once|persist>
+;@desc Bell when someone has accepted raise/ress/reinc/etc from you.
+;@desc "Once" means to bell only once, "persist" keeps on belling until all
+;@desc current accepts have been dealt with, or the list is cleared.
+/prdefsetting -n"acptbell" -d"Bell when someone accepts rais/reinc/etc." -s"off once persist"
 
 /prdefgbind -s"cclear"	-c"/acclear"
 /prdefgbind -s"acc"	-c"/aclist"
@@ -24,16 +28,14 @@
 ;; Helper functions and initialization
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 /set lst_accepted=
-/set event_rais_added=
-/set event_rais_removed=
 
 
 /def -i gacpt_list_add =\
 	/gacpt_list_rm_do $[prconvto({1})] %{lst_accepted}%;\
 	/msq @{BCyellow}%{1}@{n} accepted @{BCgreen}%{2}@{n}!%;\
-	/if (opt_acptbell=~"on") /echo -p @{b}%;/endif%;\
 	/set lst_accepted=$[prconvto({1})] $[prconvto({2})] $[time()] %{lst_accepted}%;\
-	/prexecfuncs %{event_rais_added}
+	/gacpt_remind
+	
 
 /def -i gacpt_list_rm_do =\
 	/let _atmp=%{1}%;/shift%;\
@@ -47,8 +49,7 @@
 
 /def -i gacpt_list_rm =\
 	/msq Removing @{BCyellow}%{1}@{n} from list ...%;\
-	/gacpt_list_rm_do $[prconvto({1})] %{lst_accepted}%;\
-	/prexecfuncs %{event_rais_removed}
+	/gacpt_list_rm_do $[prconvto({1})] %{lst_accepted}
 
 
 /def -i gacpt_list_get =\
@@ -157,3 +158,26 @@
 	/msq @{BCgreen}%{P1}@{n} @{BCwhite}accepted from someone else!@{n}%;\
 	/test gacpt_list_rm({P1})
 
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Reminder bell functionality
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+/def -i gacpt_dobell =\
+	/set acpt_counter=$[acpt_counter + 1]%;\
+	/if (acpt_list!~"" & acpt_counter < 15)\
+		/echo -p @{b}%;\
+	/else \
+	/kill %{acpt_pid}%;\
+	/set acpt_pid=-1
+	/endif
+
+/def -i gacpt_remind =\
+	/if (opt_acptbell=~"once")\
+		/gacpt_dobell%;\
+	/elseif (opt_acptbell=~"persist")\
+		/set acpt_counter=0%;\
+		/if (acpt_pid > 0)\
+		/else \
+			/set acpt_pid=$(/grepeat -n -15 i /gacpt_dobell)%;\
+		/endif%;\
+	/endif