[Commits] [SCM] claws branch, master, updated. 3.13.2-102-g08ed404
ticho at claws-mail.org
ticho at claws-mail.org
Sat Apr 2 17:02:42 CEST 2016
The branch, master has been updated
via 08ed4047b275f8ad702fb964a5218e95d66ea821 (commit)
via 7789c3acba0430b06d39e1d0d002318477d98855 (commit)
from a1bb5a00040354c00c73384de6b389096c8391dc (commit)
Summary of changes:
src/plugins/rssyl/plugin.c | 4 ++--
src/plugins/rssyl/rssyl.c | 17 +++++------------
src/plugins/rssyl/rssyl.h | 10 +++++++++-
src/plugins/rssyl/rssyl_feed_props.c | 15 +++++++--------
src/plugins/rssyl/rssyl_gtk.c | 4 ++--
src/plugins/rssyl/rssyl_prefs.c | 2 +-
src/plugins/rssyl/rssyl_update_feed.c | 8 ++++++++
7 files changed, 34 insertions(+), 26 deletions(-)
- Log -----------------------------------------------------------------
commit 08ed4047b275f8ad702fb964a5218e95d66ea821
Author: Andrej Kacian <ticho at claws-mail.org>
Date: Sat Apr 2 17:00:43 2016 +0200
Make RSSyl plugin use the password store.
diff --git a/src/plugins/rssyl/rssyl.c b/src/plugins/rssyl/rssyl.c
index b60bffe..22f2260 100644
--- a/src/plugins/rssyl/rssyl.c
+++ b/src/plugins/rssyl/rssyl.c
@@ -286,12 +286,11 @@ static void rssyl_item_set_xml(Folder *folder, FolderItem *item, XMLTag *tag)
g_free(ritem->auth->username);
ritem->auth->username = g_strdup(attr->value);
}
- /* (str) Auth pass */
+ /* (str) Auth pass - save directly to password store */
if (!strcmp(attr->name, "auth_pass")) {
gsize len = 0;
guchar *pwd = g_base64_decode(attr->value, &len);
- g_free(ritem->auth->password);
- ritem->auth->password = (gchar *)pwd;
+ rssyl_passwd_set(ritem, (gchar *)pwd);
}
/* (str) Official title */
if( !strcmp(attr->name, "official_title")) {
@@ -346,12 +345,6 @@ static XMLTag *rssyl_item_get_xml(Folder *folder, FolderItem *item)
/* (str) Auth user */
if (ri->auth->username != NULL)
xml_tag_add_attr(tag, xml_attr_new("auth_user", ri->auth->username));
- /* (str) Auth pass */
- if (ri->auth->password != NULL) {
- gchar *pwd = g_base64_encode(ri->auth->password, strlen(ri->auth->password));
- xml_tag_add_attr(tag, xml_attr_new("auth_pass", pwd));
- g_free(pwd);
- }
/* (str) Official title */
if( ri->official_title != NULL )
xml_tag_add_attr(tag, xml_attr_new("official_title", ri->official_title));
diff --git a/src/plugins/rssyl/rssyl.h b/src/plugins/rssyl/rssyl.h
index 5b890bd..3a9e25d 100644
--- a/src/plugins/rssyl/rssyl.h
+++ b/src/plugins/rssyl/rssyl.h
@@ -4,6 +4,7 @@
#include <glib.h>
#include <folder.h>
+#include <passwordstore.h>
#include "libfeed/feed.h"
@@ -99,4 +100,9 @@ FolderItem *rssyl_get_root_folderitem(FolderItem *item);
#define IS_RSSYL_FOLDER_ITEM(item) \
(item->folder->klass == rssyl_folder_get_class())
+#define rssyl_passwd_set(ritem, pwd) \
+ passwd_store_set(PWS_PLUGIN, PLUGIN_NAME, ritem->url, pwd, FALSE)
+#define rssyl_passwd_get(ritem) \
+ passwd_store_get(PWS_PLUGIN, PLUGIN_NAME, ritem->url)
+
#endif /* __RSSYL_H */
diff --git a/src/plugins/rssyl/rssyl_feed_props.c b/src/plugins/rssyl/rssyl_feed_props.c
index 1f5e673..7145e02 100644
--- a/src/plugins/rssyl/rssyl_feed_props.c
+++ b/src/plugins/rssyl/rssyl_feed_props.c
@@ -70,12 +70,7 @@ static void rssyl_gtk_prop_store(RFolderItem *ritem)
}
auth_pass = (gchar *)gtk_entry_get_text(GTK_ENTRY(ritem->feedprop->auth_password));
- if (auth_pass != NULL) {
- if (ritem->auth->password) {
- g_free(ritem->auth->password);
- }
- ritem->auth->password = g_strdup(auth_pass);
- }
+ rssyl_passwd_set(ritem, auth_pass);
use_default_ri = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(ritem->feedprop->default_refresh_interval));
@@ -282,8 +277,12 @@ void rssyl_gtk_prop(RFolderItem *ritem)
/* Auth password */
feedprop->auth_password = gtk_entry_new();
gtk_entry_set_visibility(GTK_ENTRY(feedprop->auth_password), FALSE);
- gtk_entry_set_text(GTK_ENTRY(feedprop->auth_password),
- ritem->auth->password);
+ gchar *pwd = rssyl_passwd_get(ritem);
+ gtk_entry_set_text(GTK_ENTRY(feedprop->auth_password), pwd);
+ if (pwd != NULL) {
+ memset(pwd, 0, strlen(pwd));
+ g_free(pwd);
+ }
/* "Use default refresh interval" checkbutton */
feedprop->default_refresh_interval = gtk_check_button_new_with_mnemonic(
diff --git a/src/plugins/rssyl/rssyl_update_feed.c b/src/plugins/rssyl/rssyl_update_feed.c
index eef5753..1cf651b 100644
--- a/src/plugins/rssyl/rssyl_update_feed.c
+++ b/src/plugins/rssyl/rssyl_update_feed.c
@@ -169,6 +169,9 @@ RFetchCtx *rssyl_prep_fetchctx_from_item(RFolderItem *ritem)
ctx->success = TRUE;
ctx->ready = FALSE;
+ if (ritem->auth->type != FEED_AUTH_NONE)
+ ritem->auth->password = rssyl_passwd_get(ritem);
+
feed_set_timeout(ctx->feed, prefs_common_get_prefs()->io_timeout_secs);
feed_set_cookies_path(ctx->feed, rssyl_prefs_get()->cookies_path);
feed_set_ssl_verify_peer(ctx->feed, ritem->ssl_verify_peer);
@@ -238,6 +241,11 @@ gboolean rssyl_update_feed(RFolderItem *ritem, gboolean verbose)
/* Fetch the feed file */
rssyl_fetch_feed(ctx, verbose);
+ if (ritem->auth != NULL && ritem->auth->password != NULL) {
+ memset(ritem->auth->password, 0, strlen(ritem->auth->password));
+ g_free(ritem->auth->password);
+ }
+
debug_print("RSSyl: fetch done; success == %s\n",
ctx->success ? "TRUE" : "FALSE");
commit 7789c3acba0430b06d39e1d0d002318477d98855
Author: Andrej Kacian <ticho at claws-mail.org>
Date: Sat Apr 2 15:57:50 2016 +0200
Move RSSyl plugin name to a macro.
diff --git a/src/plugins/rssyl/plugin.c b/src/plugins/rssyl/plugin.c
index 7ade914..3dd6436 100644
--- a/src/plugins/rssyl/plugin.c
+++ b/src/plugins/rssyl/plugin.c
@@ -40,7 +40,7 @@
gint plugin_init(gchar **error)
{
if( !check_plugin_version(MAKE_NUMERIC_VERSION(3, 7, 8, 31),
- VERSION_NUMERIC, "RSSyl", error) )
+ VERSION_NUMERIC, PLUGIN_NAME, error) )
return -1;
curl_global_init(CURL_GLOBAL_DEFAULT);
@@ -57,7 +57,7 @@ gboolean plugin_done(void)
const gchar *plugin_name(void)
{
- return "RSSyl";
+ return PLUGIN_NAME;
}
const gchar *plugin_desc(void)
diff --git a/src/plugins/rssyl/rssyl.c b/src/plugins/rssyl/rssyl.c
index ecb01dd..b60bffe 100644
--- a/src/plugins/rssyl/rssyl.c
+++ b/src/plugins/rssyl/rssyl.c
@@ -152,7 +152,7 @@ void rssyl_init(void)
else
rssyl_update_format();
- prefs_toolbar_register_plugin_item(TOOLBAR_MAIN, "RSSyl", _("Refresh all feeds"), rssyl_toolbar_cb_refresh_all_feeds, NULL);
+ prefs_toolbar_register_plugin_item(TOOLBAR_MAIN, PLUGIN_NAME, _("Refresh all feeds"), rssyl_toolbar_cb_refresh_all_feeds, NULL);
if( rssyl_prefs_get()->refresh_on_startup &&
claws_is_starting() )
@@ -163,7 +163,7 @@ void rssyl_done(void)
{
rssyl_opml_export();
- prefs_toolbar_unregister_plugin_item(TOOLBAR_MAIN, "RSSyl", _("Refresh all feeds"));
+ prefs_toolbar_unregister_plugin_item(TOOLBAR_MAIN, PLUGIN_NAME, _("Refresh all feeds"));
rssyl_prefs_done();
rssyl_gtk_done();
@@ -945,7 +945,7 @@ FolderClass *rssyl_folder_get_class()
if( rssyl_class.idstr == NULL ) {
rssyl_class.type = F_UNKNOWN;
rssyl_class.idstr = "rssyl";
- rssyl_class.uistr = "RSSyl";
+ rssyl_class.uistr = PLUGIN_NAME;
/* Folder functions */
rssyl_class.new_folder = rssyl_new_folder;
diff --git a/src/plugins/rssyl/rssyl.h b/src/plugins/rssyl/rssyl.h
index 6ded099..5b890bd 100644
--- a/src/plugins/rssyl/rssyl.h
+++ b/src/plugins/rssyl/rssyl.h
@@ -7,8 +7,10 @@
#include "libfeed/feed.h"
+#define PLUGIN_NAME "RSSyl"
+
/* Name of directory in rcdir where RSSyl will store its data. */
-#define RSSYL_DIR "RSSyl"
+#define RSSYL_DIR PLUGIN_NAME
/* Folder name for a new feed, before it is parsed for the first time. */
#define RSSYL_NEW_FOLDER_NAME "NewFeed"
diff --git a/src/plugins/rssyl/rssyl_gtk.c b/src/plugins/rssyl/rssyl_gtk.c
index dc6e72a..7ed6692 100644
--- a/src/plugins/rssyl/rssyl_gtk.c
+++ b/src/plugins/rssyl/rssyl_gtk.c
@@ -174,8 +174,8 @@ void rssyl_gtk_init(void)
MainWindow *mainwin = mainwindow_get_mainwindow();
gtk_action_group_add_actions(mainwin->action_group, mainwindow_add_mailbox,
1, (gpointer)mainwin);
- MENUITEM_ADDUI_ID_MANAGER(mainwin->ui_manager, "/Menu/File/AddMailbox", "RSSyl",
- "File/AddMailbox/RSSyl", GTK_UI_MANAGER_MENUITEM,
+ MENUITEM_ADDUI_ID_MANAGER(mainwin->ui_manager, "/Menu/File/AddMailbox", PLUGIN_NAME,
+ "File/AddMailbox/"PLUGIN_NAME, GTK_UI_MANAGER_MENUITEM,
main_menu_id);
rssyl_fill_popup_menu_labels();
folderview_register_popup(&rssyl_popup);
diff --git a/src/plugins/rssyl/rssyl_prefs.c b/src/plugins/rssyl/rssyl_prefs.c
index 181a65f..16d41a4 100644
--- a/src/plugins/rssyl/rssyl_prefs.c
+++ b/src/plugins/rssyl/rssyl_prefs.c
@@ -68,7 +68,7 @@ void rssyl_prefs_init(void)
gchar *rcpath;
path[0] = _("Plugins");
- path[1] = "RSSyl"; /* We don't need this translated */
+ path[1] = PLUGIN_NAME; /* We don't need this translated */
path[2] = NULL;
prefs_set_default(param);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list