Added context parameter to STATUS command

This commit is contained in:
John Reese 2011-01-18 16:14:16 -05:00
parent c85cb39c12
commit de4c84a36b
2 changed files with 36 additions and 3 deletions

View File

@ -66,9 +66,10 @@ Commands
Allows you to reset a configuration option back to the default value. Allows you to reset a configuration option back to the default value.
* `status` * `status [<context>]`
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 <message>` * `send <message>`

View File

@ -620,12 +620,44 @@ class CNotifoMod : public CModule
table.SetCell("Condition", "client_count"); table.SetCell("Condition", "client_count");
table.SetCell("Status", CString(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.AddRow();
table.SetCell("Condition", "idle"); table.SetCell("Condition", "idle");
table.SetCell("Status", CString(ago) + " seconds"); 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); PutModule(table);
} }
// SEND command // SEND command