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

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