diff --git a/ChangeLog b/ChangeLog index 5713fc7..f852c90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Jul 5 00:12:03 2004 Mike Hearn + * tools/notify-send.c (main): Treat expiry times < current time + as timeouts from current instant + Sun Jul 4 22:54:44 GMT 2004 Mike Hearn * libnotify/notify.c: Use a direct hash rather than an int hash diff --git a/tools/notify-send.c b/tools/notify-send.c index b5f21bb..9e1b793 100644 --- a/tools/notify-send.c +++ b/tools/notify-send.c @@ -48,7 +48,7 @@ main(int argc, const char **argv) 0, N_("Specifies the urgency level (low, normal, high, critical)"), NULL }, { "expire-time", 't', POPT_ARG_INT | POPT_ARGFLAG_STRIP, &expire_time, - 0, N_("Specifies the timestamp at which to expire the notification"), + 0, N_("Specifies the timestamp at which to expire the notification, or if < current time, specifies timeout in seconds from current time"), NULL }, { "sound", 's', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, &sound, 0, N_("Specifies a sound file to play on notification."), NULL }, @@ -127,6 +127,9 @@ main(int argc, const char **argv) exit(1); } + /* if the given time is < current time, treat it as a timeout in seconds (ie 5 seconds) */ + if (expire_time < time(NULL)) expire_time += time(NULL); + notify_send_notification(urgency, summary, description, icon, TRUE, expire_time, NULL, 0);