* Don't mix pragma guards and include guards, prefer classic include
guards since apparently pragma guards are not a standard yet.
* Use the DUNST_FILE_H naming convention for all include guards.
If a notification has a raw icon, icon is set to NULL which was passed
without checking to strcmp. We don't (yet) support comparing raw icons so
if a raw icon is set, we can safely assume the notification is not a
duplicate.
* Fix#281 bad free. Also fix a memory leak.
With `n->icon = r->new_icon` and later `free(n->icon)`
`r->new_icon` is wrongly freed. Fix that with strdup.
Also fix an obvious memory leak by the way.
* Fix a bug that would cause distclean to fail if config.h didn't exist
* Make sure the options target is run when running make dunst
* Remove debug target as the optimization override it was doing was only
applied in the linking phase. Optimizations are applied during
compilation, not linking, and I don't see any easy way to fix that so
let's drop the target entirely.
In my opinion, it's better to crash early when something is wrong than
to pretend it never happened. This change will allow us to catch more
in the long run.
distclean target should restore the directory tree to the state it
originally before make was invoked. In our case it means calling the
clean target to remove the compiled blobs and removing the
auto-generated config.h.
notification_create currently simply allocates memory and zeroes it to
properly initialise a notification. Since we currently have at least 2
places in the code that create notifications(startup notification in
dunst.c and notifications from dbus in dbus.c) the creation should be
handled from a central location in case we ever need to change the
creation procedure later on.
Expand the duplication checking functionality to also check for urgency
and icons. If icons are turned off in the settings the icon check is
skipped.
Icons matching is done based on the given path, if the path differs or
an icon name is used for one notification but an absolute path for
another, the icons are considered different even if they refer to the
same file.
This mostly means using strchr, but I also found:
option_parser.c:load_ini_file:
- replace multiple calls to strstr with strpbrk
notification.c:notification_init:
- replace string_replace in a while loop with a single call to
string_replace_char
redo string replace all