diff --git a/README.md b/README.md index 6ce3d84..528857e 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,10 @@ Commands Allows you to reset a configuration option back to the default value. -* `status` +* `status []` - Check the status of current conditions. + Check the status of current conditions. Specifying the "context" of either a channel + or nick name will provide status values specific to that context. * `send ` diff --git a/notifo.cpp b/notifo.cpp index 67c35f8..a250e80 100644 --- a/notifo.cpp +++ b/notifo.cpp @@ -620,12 +620,44 @@ class CNotifoMod : public CModule table.SetCell("Condition", "client_count"); table.SetCell("Status", CString(client_count())); - unsigned int ago = time(NULL) - idle_time; + unsigned int now = time(NULL); + unsigned int ago = now - idle_time; table.AddRow(); table.SetCell("Condition", "idle"); table.SetCell("Status", CString(ago) + " seconds"); + if (token_count > 1) + { + CString context = tokens[1]; + + table.AddRow(); + table.SetCell("Condition", "last_active"); + + if (last_active_time.count(context) < 1) + { + table.SetCell("Status", "n/a"); + } + else + { + ago = now - last_active_time[context]; + table.SetCell("Status", CString(ago) + " seconds"); + } + + table.AddRow(); + table.SetCell("Condition", "last_notification"); + + if (last_notification_time.count(context) < 1) + { + table.SetCell("Status", "n/a"); + } + else + { + ago = now - last_notification_time[context]; + table.SetCell("Status", CString(ago) + " seconds"); + } + } + PutModule(table); } // SEND command