summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovs@redhat.com>2011-05-16 17:30:32 +0200
committerNikola Pajkovsky <npajkovs@redhat.com>2011-05-16 17:31:17 +0200
commitcac4561e6f5aa814d725406043a7091addf4407c (patch)
tree71c6b38c0e8963be135d57d1b3f02889e3d51a9e /src/plugins
parentf44933abe753b26634b636e6a0c4a231b7e5b60b (diff)
downloadabrt-cac4561e6f5aa814d725406043a7091addf4407c.tar.gz
abrt-cac4561e6f5aa814d725406043a7091addf4407c.tar.xz
abrt-cac4561e6f5aa814d725406043a7091addf4407c.zip
suppress mails for cc and attachments
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/abrt-action-bugzilla.c12
-rw-r--r--src/plugins/rhbz.c38
-rw-r--r--src/plugins/rhbz.h12
3 files changed, 40 insertions, 22 deletions
diff --git a/src/plugins/abrt-action-bugzilla.c b/src/plugins/abrt-action-bugzilla.c
index 91bc26f8..98a47043 100644
--- a/src/plugins/abrt-action-bugzilla.c
+++ b/src/plugins/abrt-action-bugzilla.c
@@ -201,7 +201,7 @@ static void report_to_bugzilla(const char *dump_dir_name, map_string_h *settings
char bug_id_str[sizeof(int)*3 + 2];
sprintf(bug_id_str, "%i", bug_id);
- rhbz_attachments(client, bug_id_str, problem_data);
+ rhbz_attachments(client, bug_id_str, problem_data, RHBZ_NOMAIL_NOTIFY);
log(_("Logging out"));
rhbz_logout(client);
@@ -231,7 +231,7 @@ static void report_to_bugzilla(const char *dump_dir_name, map_string_h *settings
&& (!g_list_find_custom(bz->bi_cc_list, login, (GCompareFunc)g_strcmp0)))
{
log(_("Add %s to CC list"), login);
- rhbz_mail_to_cc(client, bz->bi_id, login);
+ rhbz_mail_to_cc(client, bz->bi_id, login, RHBZ_NOMAIL_NOTIFY);
}
char *dsc = make_description_comment(problem_data);
@@ -245,8 +245,6 @@ static void report_to_bugzilla(const char *dump_dir_name, map_string_h *settings
release = get_problem_item_content_or_NULL(problem_data, "release");
const char *arch = get_problem_item_content_or_NULL(problem_data,
FILENAME_ARCHITECTURE);
- const char *is_private = get_problem_item_content_or_NULL(problem_data,
- "is_private");
char *full_dsc = xasprintf("Package: %s\n"
"Architecture: %s\n"
@@ -256,8 +254,12 @@ static void report_to_bugzilla(const char *dump_dir_name, map_string_h *settings
log(_("Adding new comment to bug %d"), bz->bi_id);
free(dsc);
+ /* unused code, enable it when gui/cli will be ready
int is_priv = is_private && string_to_bool(is_private);
- rhbz_add_comment(client, bz->bi_id, full_dsc, is_priv);
+ const char *is_private = get_problem_item_content_or_NULL(problem_data,
+ "is_private");
+ */
+ rhbz_add_comment(client, bz->bi_id, full_dsc, 0);
free(full_dsc);
}
}
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 90587e5e..d7d583dd 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -382,17 +382,21 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data,
/* suppress mail notify by {s:i} (nomail:1) (driven by flag) */
int rhbz_attachment(struct abrt_xmlrpc *ax, const char *filename,
- const char *bug_id, const char *data)
+ const char *bug_id, const char *data, int flags)
{
char *encoded64 = encode_base64(data, strlen(data));
char *fn = xasprintf("File: %s", filename);
xmlrpc_value* result;
- result= abrt_xmlrpc_call(ax, "bugzilla.addAttachment", "(s{s:s,s:s,s:s,s:s})",
+ int nomail_notify = IS_NOMAIL_NOTIFY(flags);
+
+ result= abrt_xmlrpc_call(ax, "bugzilla.addAttachment", "(s{s:s,s:s,s:s,s:s,s:i})",
bug_id,
"description", fn,
"filename", filename,
"contenttype", "text/plain",
- "data", encoded64);
+ "data", encoded64,
+ "nomail", nomail_notify);
+
free(encoded64);
free(fn);
if (!result)
@@ -405,7 +409,7 @@ int rhbz_attachment(struct abrt_xmlrpc *ax, const char *filename,
/* suppress mail notify by {s:i} (nomail:1) (driven by flag) */
int rhbz_attachments(struct abrt_xmlrpc *ax, const char *bug_id,
- problem_data_t *problem_data)
+ problem_data_t *problem_data, int flags)
{
GHashTableIter iter;
char *name;
@@ -421,7 +425,7 @@ int rhbz_attachments(struct abrt_xmlrpc *ax, const char *bug_id,
&& (strlen(content) > CD_TEXT_ATT_SIZE /*|| (strcmp(name, FILENAME_BACKTRACE) == 0)*/)
) {
/* check if the attachment failed and try it once more */
- rhbz_attachment(ax, name, bug_id, content);
+ rhbz_attachment(ax, name, bug_id, content, flags);
}
}
@@ -462,21 +466,29 @@ struct bug_info *rhbz_find_origin_bug_closed_duplicate(struct abrt_xmlrpc *ax,
}
/* suppress mail notify by {s:i} (nomail:1) */
-void rhbz_mail_to_cc(struct abrt_xmlrpc *ax, int bug_id, const char *mail)
+void rhbz_mail_to_cc(struct abrt_xmlrpc *ax, int bug_id, const char *mail, int flags)
{
- xmlrpc_value *result = abrt_xmlrpc_call(ax, "Bug.update", "({s:i,s:{s:(s)}})",
- "ids", bug_id, "updates", "add_cc", mail);
+ xmlrpc_value *result;
+ int nomail_notify = IS_NOMAIL_NOTIFY(flags);
+ result = abrt_xmlrpc_call(ax, "Bug.update", "({s:i,s:{s:(s),s:i}})",
+ "ids", bug_id, "updates", "add_cc", mail,
+ "nomail", nomail_notify);
+
if (result)
xmlrpc_DECREF(result);
}
void rhbz_add_comment(struct abrt_xmlrpc *ax, int bug_id, const char *comment,
- int is_private)
+ int flags)
{
- xmlrpc_value *result = abrt_xmlrpc_call(ax, "Bug.add_comment", "({s:i,s:s,s:b})",
- "id", bug_id,
- "comment", comment,
- "private", is_private);
+ int private = IS_PRIVATE(flags);
+ int nomail_notify = IS_NOMAIL_NOTIFY(flags);
+
+ xmlrpc_value *result;
+ result = abrt_xmlrpc_call(ax, "Bug.add_comment", "({s:i,s:s,s:b,s:i})",
+ "id", bug_id, "comment", comment,
+ "private", private, "nomail", nomail_notify);
+
if (result)
xmlrpc_DECREF(result);
}
diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h
index 73d76f0a..f44ca191 100644
--- a/src/plugins/rhbz.h
+++ b/src/plugins/rhbz.h
@@ -35,11 +35,15 @@ enum {
RHBZ_MANDATORY_MEMB = (1 << 0),
RHBZ_READ_STR = (1 << 1),
RHBZ_READ_INT = (1 << 2),
+ RHBZ_NOMAIL_NOTIFY = (1 << 3),
+ RHBZ_PRIVATE = (1 << 4),
};
#define IS_MANDATORY(flags) ((flags) & RHBZ_MANDATORY_MEMB)
#define IS_READ_STR(flags) ((flags) & RHBZ_READ_STR)
#define IS_READ_INT(flags) ((flags) & RHBZ_READ_INT)
+#define IS_NOMAIL_NOTIFY(flags) ((flags) & RHBZ_NOMAIL_NOTIFY)
+#define IS_PRIVATE(flags) ((flags) & RHBZ_PRIVATE)
struct bug_info {
int bi_id;
@@ -58,10 +62,10 @@ void free_bug_info(struct bug_info *bz);
void rhbz_login(struct abrt_xmlrpc *ax, const char *login, const char *passwd);
-void rhbz_mail_to_cc(struct abrt_xmlrpc *ax, int bug_id, const char *mail);
+void rhbz_mail_to_cc(struct abrt_xmlrpc *ax, int bug_id, const char *mail, int flags);
void rhbz_add_comment(struct abrt_xmlrpc *ax, int bug_id, const char *comment,
- int is_private);
+ int flags);
void *rhbz_bug_read_item(const char *memb, xmlrpc_value *xml, int flags);
@@ -80,10 +84,10 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data,
int depend_on_bug);
int rhbz_attachments(struct abrt_xmlrpc *ax, const char *bug_id,
- problem_data_t *problem_data);
+ problem_data_t *problem_data, int flags);
int rhbz_attachment(struct abrt_xmlrpc *ax, const char *filename,
- const char *bug_id, const char *data);
+ const char *bug_id, const char *data, int flags);
GList *rhbz_bug_cc(xmlrpc_value *result_xml);