Blame SOURCES/0097-rhtsupport-attach-the-contact-email-to-bthash.patch

28bab8
From ca72d27d29253d9f88e33ac72df4a3ad589bd725 Mon Sep 17 00:00:00 2001
28bab8
From: Jakub Filak <jfilak@redhat.com>
28bab8
Date: Wed, 8 Oct 2014 12:10:10 +0200
28bab8
Subject: [LIBREPORT PATCH 97/97] rhtsupport: attach the contact email to
28bab8
 bthash
28bab8
28bab8
Resolves #1150388
28bab8
28bab8
Signed-off-by: Jakub Filak <jfilak@redhat.com>
28bab8
---
28bab8
 src/plugins/reporter-rhtsupport.c | 26 +++++++++++++++++++++-----
28bab8
 1 file changed, 21 insertions(+), 5 deletions(-)
28bab8
28bab8
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
28bab8
index c063f3f..56daf78 100644
28bab8
--- a/src/plugins/reporter-rhtsupport.c
28bab8
+++ b/src/plugins/reporter-rhtsupport.c
28bab8
@@ -263,6 +263,16 @@ char *submit_ureport(const char *dump_dir_name, struct ureport_server_config *co
28bab8
 }
28bab8
 
28bab8
 static
28bab8
+void attach_to_ureport(struct ureport_server_config *conf,
28bab8
+        const char *bthash, const char *attach_id, const char *data)
28bab8
+{
28bab8
+    char *json = ureport_json_attachment_new(bthash, attach_id, data);
28bab8
+    struct ureport_server_response *resp = ureport_do_post_credentials(json, conf, UREPORT_ATTACH_ACTION);
28bab8
+    ureport_server_response_free(resp);
28bab8
+    free(json);
28bab8
+}
28bab8
+
28bab8
+static
28bab8
 bool check_for_hints(const char *url, char **login, char **password, bool ssl_verify, const char *tempfile)
28bab8
 {
28bab8
     rhts_result_t *result = NULL;
28bab8
@@ -741,11 +751,17 @@ int main(int argc, char **argv)
28bab8
             /* Make sure we use the current credentials */
28bab8
             ureport_server_config_set_basic_auth(&urconf, login, password);
28bab8
 
28bab8
-            /* Do attach */
28bab8
-            char *json = ureport_json_attachment_new(bthash, "RHCID", result->url);
28bab8
-            struct ureport_server_response *resp = ureport_do_post_credentials(json, &urconf, UREPORT_ATTACH_ACTION);
28bab8
-            ureport_server_response_free(resp);
28bab8
-            free(json);
28bab8
+            /* Attach Customer Case ID*/
28bab8
+            attach_to_ureport(&urconf, bthash, "RHCID", result->url);
28bab8
+
28bab8
+            /* Attach Contact e-mail if configured */
28bab8
+            const char *email = NULL;
28bab8
+            UREPORT_OPTION_VALUE_FROM_CONF(ursettings, "ContactEmail", email, (const char *));
28bab8
+            if (email != NULL)
28bab8
+            {
28bab8
+                log(_("Linking ABRT crash statistics record with contact email: '%s'"), email);
28bab8
+                attach_to_ureport(&urconf, bthash, "email", email);
28bab8
+            }
28bab8
 
28bab8
             /* Update the credentials */
28bab8
             STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
28bab8
-- 
28bab8
1.8.3.1
28bab8