From 2ca086f50e084d8b52cee16e5e32e1778c155f96 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Fri, 1 Apr 2011 16:54:26 -0700 Subject: [PATCH] add application name and crash id to the dbus sent signal Signed-off-by: Chris Leech --- corewatcher.c | 12 +++++++++++- corewatcher.h | 2 +- submit.c | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/corewatcher.c b/corewatcher.c index 9549527..86c8bbc 100644 --- a/corewatcher.c +++ b/corewatcher.c @@ -22,6 +22,7 @@ * Arjan van de Ven */ +#define _GNU_SOURCE #include #include #include @@ -147,9 +148,13 @@ void dbus_ask_permission(char * detail_file_name) dbus_message_unref(message); } -void dbus_say_thanks(char *url) + +void dbus_say_thanks(struct oops *oops, char *url) { DBusMessage *message; + unsigned int crash_id = 0; + char *dbus_msg_arg; + if (!bus) return; if (url && strlen(url)) { @@ -163,8 +168,13 @@ void dbus_say_thanks(char *url) message = dbus_message_new_signal("/org/corewatcher/submit/sent", "org.corewatcher.submit.sent", "sent"); + sscanf(url, "%*[^?]?number=%u", &crash_id); + asprintf(&dbus_msg_arg, "crash report #%u\n", crash_id); + dbus_message_append_args(message, DBUS_TYPE_STRING, &oops->application, + DBUS_TYPE_STRING, &dbus_msg_arg, DBUS_TYPE_INVALID); dbus_connection_send(bus, message, NULL); dbus_message_unref(message); + free(dbus_msg_arg); } int main(int argc, char**argv) diff --git a/corewatcher.h b/corewatcher.h index 0ffac0a..3cefe34 100644 --- a/corewatcher.h +++ b/corewatcher.h @@ -48,7 +48,7 @@ extern void read_config_file(char *filename); extern void ask_permission(void); extern void dbus_ask_permission(char * detail_file_name); -extern void dbus_say_thanks(char *url); +extern void dbus_say_thanks(struct oops *oops, char *url); extern int opted_in; extern int allow_distro_to_pass_on; diff --git a/submit.c b/submit.c index 300f2b0..ac639ec 100644 --- a/submit.c +++ b/submit.c @@ -235,7 +235,7 @@ void submit_queue_with_url(char *wsubmit_url) result = curl_easy_perform(handle); curl_formfree(post); - dbus_say_thanks(result_url); + dbus_say_thanks(oops, result_url); next = oops->next; free(oops->text); -- 2.7.4