mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-21 02:41:11 +00:00
improve reminder message
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@36477 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bd465b2dd2
commit
e5fe440516
1 changed files with 33 additions and 4 deletions
37
EcControl.m
37
EcControl.m
|
@ -1746,6 +1746,7 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
NSString *instance;
|
||||
NSString *message;
|
||||
NSString *repair;
|
||||
NSString *severity;
|
||||
NSString *spacing1;
|
||||
NSString *spacing2;
|
||||
|
||||
|
@ -1792,13 +1793,22 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
spacing2 = @", ";
|
||||
}
|
||||
|
||||
if ([alarm perceivedSeverity] == EcAlarmSeverityCritical)
|
||||
{
|
||||
severity = @"Critical";
|
||||
}
|
||||
else
|
||||
{
|
||||
severity = @"Major";
|
||||
}
|
||||
|
||||
identifier = [NSString stringWithFormat: @"%d", [alarm notificationID]];
|
||||
|
||||
if (YES == clear)
|
||||
{
|
||||
message = [NSString stringWithFormat:
|
||||
@"Clear %@\n%@%@%@%@%@ - '%@%@%@%@' on %@",
|
||||
identifier,
|
||||
@"Clear %@ (%@)\n%@%@%@%@%@ - '%@%@%@%@' on %@",
|
||||
identifier, severity,
|
||||
[alarm specificProblem], spacing1,
|
||||
additional, spacing2, repair,
|
||||
[alarm moProcess], connector, instance,
|
||||
|
@ -1806,13 +1816,32 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
}
|
||||
else
|
||||
{
|
||||
NSTimeInterval ti;
|
||||
|
||||
message = [NSString stringWithFormat:
|
||||
@"Alarm %@\n%@%@%@%@%@ - '%@%@%@%@' on %@",
|
||||
identifier,
|
||||
@"Alarm %@ (%@)\n%@%@%@%@%@ - '%@%@%@%@' on %@",
|
||||
identifier, severity,
|
||||
[alarm specificProblem], spacing1,
|
||||
additional, spacing2, repair,
|
||||
[alarm moProcess], connector, instance,
|
||||
component, [alarm moHost]];
|
||||
|
||||
ti = 0.0 - [[alarm eventDate] timeIntervalSinceNow];
|
||||
if (ti > 300.0)
|
||||
{
|
||||
if (ti >= 3600.0)
|
||||
{
|
||||
message = [message stringByAppendingFormat:
|
||||
@"%@\nNot cleared after %d hours!",
|
||||
(int)(ti / 3600.0)];
|
||||
}
|
||||
else
|
||||
{
|
||||
message = [message stringByAppendingFormat:
|
||||
@"%@\nNot cleared after %d minutes.",
|
||||
(int)(ti / 60.0)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[alerter handleEvent: message
|
||||
|
|
Loading…
Reference in a new issue