summaryrefslogtreecommitdiffstats
path: root/src/warn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/warn.c')
-rw-r--r--src/warn.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/warn.c b/src/warn.c
index 6dfd427..7b1ec8e 100644
--- a/src/warn.c
+++ b/src/warn.c
@@ -57,6 +57,11 @@ void warnUser( struct user *usr, enum Warning what, int seconds )
seconds %= 60;
char buffer[1000];
snprintf( buffer, sizeof(buffer), warning->message, minutes, seconds, minutes, seconds );
+ showWarning( usr, warning->title, buffer );
+}
+
+void showWarning( const struct user *usr, const char *title, const char *body )
+{
// Text or X11 warning
if ( *usr->display ) {
// notify-send
@@ -66,7 +71,7 @@ void warnUser( struct user *usr, enum Warning what, int seconds )
if ( usr->xauth[0] != '\0' && usr->xauth[0] != '-' ) {
setenv( "XAUTHORITY", usr->xauth, 1 );
}
- run( false, "notify-send", "-t", "15000", warning->title, buffer, (char*)NULL );
+ run( false, "notify-send", "-t", "15000", title, body, (char*)NULL );
}
} else {
// write to device
@@ -76,9 +81,9 @@ void warnUser( struct user *usr, enum Warning what, int seconds )
if ( fh == NULL )
return;
fputs( "\n\n****************************\n", fh );
- fputs( warning->title, fh );
+ fputs( title, fh );
fputs( "\n****************************\n", fh );
- fputs( buffer, fh );
+ fputs( body, fh );
fputs( "\n****************************\n\n", fh );
fclose( fh );
}