Use GLib's implementation of Base64 instead of our own.
[claws.git] / src / plugins / spam_report / spam_report.c
index aa3df22372a132df307ed4ae45d64563e11f8104..9cb43d3efda5401ffe8d79ffe6f5be3f3ee1c36c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Colin Leroy <colin@colino.net>
+ * Copyright (C) 1999-2014 Colin Leroy <colin@colino.net>
  * and the Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
@@ -43,7 +43,6 @@
 #include "plugin.h"
 #include "menu.h"
 #include "defs.h"
-#include "base64.h"
 #include "procheader.h"
 
 #ifdef USE_PTHREAD
@@ -63,13 +62,15 @@ static gboolean check_debian_listid(MsgInfo *msginfo);
 /* this interface struct is probably not enough for the various available 
  * reporting places/methods. It'll be extended as necessary. */
 
+#define SSFR_URL  "https://www.signal-spam.fr/api/signaler"
+#define SSFR_BODY "message=%claws_mail_body_b64%"
+
+#define DEBL_URL  "https://lists.debian.org/cgi-bin/nominate-for-review.pl?Quiet=on&msgid=%claws_mail_msgid%"
+
 ReportInterface spam_interfaces[] = {
-       { "Signal-Spam.fr", INTF_HTTP_AUTH, "https://www.signal-spam.fr/api/signaler",
-               "message=%claws_mail_body_b64%", NULL},
+       { "Signal-Spam.fr", INTF_HTTP_AUTH, SSFR_URL, SSFR_BODY, NULL},
        { "Spamcop.net", INTF_MAIL, NULL, NULL, NULL},
-       { "Debian Lists", INTF_HTTP_GET, 
-               "http://lists.debian.org/cgi-bin/nominate-for-review.pl?Quiet=on&msgid=%claws_mail_msgid%",
-               NULL, check_debian_listid},
+       { "Debian Lists", INTF_HTTP_GET, DEBL_URL, NULL, check_debian_listid},
        { NULL, INTF_NULL, NULL, NULL, NULL}
 };
 
@@ -211,8 +212,7 @@ static void report_spam(gint id, ReportInterface *intf, MsgInfo *msginfo, gchar
        debug_print("reporting via %s\n", intf->name);
        tmp = spamreport_strreplace(intf->body, "%claws_mail_body%", contents);
        len_contents = strlen(contents);
-       b64 = g_malloc0(B64LEN(len_contents) + 1);
-       base64_encode(b64, contents, len_contents);
+       b64 = g_base64_encode(contents, len_contents);
        reqbody = spamreport_strreplace(tmp, "%claws_mail_body_b64%", b64);
        geturl = spamreport_strreplace(intf->url, "%claws_mail_msgid%", msginfo->msgid);
        g_free(b64);