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

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