Browse Source

Implement ini-driven status setting

User can now add handlers to set vatious statuses and launch any command,
either for public announcement like xchat nick, or for own logging.
Alois Mahdal 10 years ago
parent
commit
42d33a3994
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      bin/eeiam.in

+ 12
- 0
bin/eeiam.in View File

@@ -70,6 +70,14 @@ start_familiar() {
70 70
     fi
71 71
 }
72 72
 
73
+set_status() {
74
+    #
75
+    # set public status $1 by command in ini file
76
+    #
77
+    local what=$1
78
+    iniread -p iam.saying.like.this.$what iam.ini | bash
79
+}
80
+
73 81
 
74 82
 #
75 83
 # subcommand handlers
@@ -80,7 +88,9 @@ i_am_afk() {
80 88
     # away from keyboard; blocks until i'm back again
81 89
     #
82 90
     mocp --pause
91
+    set_status "afk"
83 92
     slock
93
+    set_status "atk"
84 94
 }
85 95
 
86 96
 i_am_at() {
@@ -99,6 +109,7 @@ i_am_back() {
99 109
     do
100 110
         start_familiar $f
101 111
     done
112
+    set_status "back"
102 113
     klist || urxvt -e kinit
103 114
 }
104 115
 
@@ -107,6 +118,7 @@ i_am_gone() {
107 118
     # gone fishin'
108 119
     #
109 120
     kdestroy
121
+    set_status "gone"
110 122
     i_am_afk
111 123
     i_am_back
112 124
 }