send proper message id to client

This commit is contained in:
Sascha Kruse 2012-06-22 18:22:46 +02:00
parent 1410ddc8af
commit 99b482c484
3 changed files with 12 additions and 4 deletions

View File

@ -83,6 +83,8 @@ static XScreenSaverInfo *screensaver_info;
static int font_h;
static char *config_file;
int next_notification_id = 1;
/* notification lists */
list *notification_queue = NULL; /* all new notifications get into here */
list *displayed_notifications = NULL; /* currently displayed notifications */
@ -534,7 +536,7 @@ void history_pop(void)
}
}
void init_notification(notification * n)
int init_notification(notification * n)
{
const char *fg = NULL;
const char *bg = NULL;
@ -573,6 +575,8 @@ void init_notification(notification * n)
n->redisplayed = False;
n->id = ++next_notification_id;
dunst_printf(MSG, "%s\n", n->msg);
dunst_printf(INFO,
"{\n appname: %s\n summary: %s\n body: %s\n icon: %s\n urgency: %d\n timeout: %d\n}",
@ -580,6 +584,8 @@ void init_notification(notification * n)
n->urgency, n->timeout);
l_push(notification_queue, n);
return n->id;
}
rule_t *initrule(void)

View File

@ -42,6 +42,7 @@ typedef struct _notification {
int timeout;
int urgency;
int redisplayed; /* has been displayed before? */
int id;
ColorSet *colors;
char *color_strings[2];
} notification;
@ -56,5 +57,6 @@ typedef struct _dimension_t {
#endif
/* vim: set ts=8 sw=8 tw=0: */
void init_notification(notification * n);
/* return id of notification */
int init_notification(notification * n);
void map_win(void);

View File

@ -251,7 +251,7 @@ void notify(DBusMessage * dmsg)
char *hint_name;
int i;
int id = 23;
int id;
const char *appname = NULL;
const char *summary = NULL;
const char *body = NULL;
@ -324,7 +324,7 @@ void notify(DBusMessage * dmsg)
}
n->color_strings[ColFG] = fgcolor == NULL ? NULL : strdup(fgcolor);
n->color_strings[ColBG] = bgcolor == NULL ? NULL : strdup(bgcolor);
init_notification(n);
id = init_notification(n);
map_win();
reply = dbus_message_new_method_return(dmsg);