comparison mod_statistics/top.lua @ 1083:6685ebe6f8cf

mod_statistics: top: Make sessions temporarily bold when they are updated
author Matthew Wild <mwild1@gmail.com>
date Sat, 15 Jun 2013 22:26:48 +0100
parents 6c555e7dc942
children 9612cea92503
comparison
equal deleted inserted replaced
1082:6c555e7dc942 1083:6685ebe6f8cf
135 v = padright(v, width); 135 v = padright(v, width);
136 end 136 end
137 end 137 end
138 table.insert(row, v); 138 table.insert(row, v);
139 end 139 end
140 if session.updated then
141 self.listwin:attron(curses.A_BOLD);
142 end
140 self.listwin:mvaddstr(index, 0, " "..table.concat(row)); 143 self.listwin:mvaddstr(index, 0, " "..table.concat(row));
144 if session.updated then
145 session.updated = false;
146 self.listwin:attroff(curses.A_BOLD);
147 end
141 end 148 end
142 else 149 else
143 -- FIXME: How to clear a line? It's 5am and I don't feel like reading docs. 150 -- FIXME: How to clear a line? It's 5am and I don't feel like reading docs.
144 self.listwin:move(index, 0); 151 self.listwin:move(index, 0);
145 self.listwin:clrtoeol(); 152 self.listwin:clrtoeol();
160 self.prosody[stanza_type.."_out_per_second"] = (self.prosody[stanza_type.."_out_per_second"] or 0) + stats[stanza_type.."_out"]; 167 self.prosody[stanza_type.."_out_per_second"] = (self.prosody[stanza_type.."_out_per_second"] or 0) + stats[stanza_type.."_out"];
161 end 168 end
162 stats.total_stanzas_in = stats.message_in + stats.presence_in + stats.iq_in; 169 stats.total_stanzas_in = stats.message_in + stats.presence_in + stats.iq_in;
163 stats.total_stanzas_out = stats.message_out + stats.presence_out + stats.iq_out; 170 stats.total_stanzas_out = stats.message_out + stats.presence_out + stats.iq_out;
164 stats.last_update = time(); 171 stats.last_update = time();
172 stats.updated = true;
165 end 173 end
166 174
167 function new(base) 175 function new(base)
168 setmetatable(base, top); 176 setmetatable(base, top);
169 base.data = setmetatable({}, { 177 base.data = setmetatable({}, {