aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-12-17 05:08:03 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-12-17 05:14:06 +0800
commitf1ca58d40a5a005aa5fa751959edbe4ec5f2d22f (patch)
tree027c6d3d2cdf4b5fa3bd6bea7d94f06a055f8d1a
parent58f30d377695e9ef03443f5e4cc1ae32ff44b272 (diff)
downloadgsoc2013-evolution-f1ca58d40a5a005aa5fa751959edbe4ec5f2d22f.tar.gz
gsoc2013-evolution-f1ca58d40a5a005aa5fa751959edbe4ec5f2d22f.tar.zst
gsoc2013-evolution-f1ca58d40a5a005aa5fa751959edbe4ec5f2d22f.zip
e-passwords: Remove unused functions.
e_passwords_cancel() e_passwords_clear_passwords() e_passwords_forget_passwords() e_passwords_shutdown()
-rw-r--r--doc/reference/libeutil/libeutil-sections.txt4
-rw-r--r--e-util/e-passwords.c91
-rw-r--r--e-util/e-passwords.h8
3 files changed, 1 insertions, 102 deletions
diff --git a/doc/reference/libeutil/libeutil-sections.txt b/doc/reference/libeutil/libeutil-sections.txt
index 2c0ef0a813..05194a8452 100644
--- a/doc/reference/libeutil/libeutil-sections.txt
+++ b/doc/reference/libeutil/libeutil-sections.txt
@@ -2375,15 +2375,11 @@ EPanedPrivate
<FILE>e-passwords</FILE>
<TITLE>Password Utilities (Legacy)</TITLE>
e_passwords_init
-e_passwords_shutdown
-e_passwords_cancel
e_passwords_set_online
e_passwords_remember_password
e_passwords_add_password
e_passwords_get_password
e_passwords_forget_password
-e_passwords_forget_passwords
-e_passwords_clear_passwords
EPasswordsRememberType
e_passwords_ask_password
</SECTION>
diff --git a/e-util/e-passwords.c b/e-util/e-passwords.c
index bf4cfc1e7f..1f2d3b2e89 100644
--- a/e-util/e-passwords.c
+++ b/e-util/e-passwords.c
@@ -211,23 +211,6 @@ ep_msg_send (EPassMsg *msg)
/* the functions that actually do the work */
static void
-ep_clear_passwords (EPassMsg *msg)
-{
- GError *error = NULL;
-
- /* Find all Evolution passwords and delete them. */
- secret_password_clear_sync (
- &e_passwords_schema, NULL, &error,
- "application", "Evolution", NULL);
-
- if (error != NULL)
- g_propagate_error (&msg->error, error);
-
- if (!msg->noreply)
- e_flag_set (msg->done);
-}
-
-static void
ep_remember_password (EPassMsg *msg)
{
gchar *password;
@@ -652,52 +635,6 @@ e_passwords_init (void)
}
/**
- * e_passwords_cancel:
- *
- * Cancel any outstanding password operations and close any dialogues
- * currently being shown.
- **/
-void
-e_passwords_cancel (void)
-{
- EPassMsg *msg;
-
- G_LOCK (passwords);
- while ((msg = g_queue_pop_head (&message_queue)) != NULL)
- e_flag_set (msg->done);
- G_UNLOCK (passwords);
-
- if (password_dialog)
- gtk_dialog_response (password_dialog, GTK_RESPONSE_CANCEL);
-}
-
-/**
- * e_passwords_shutdown:
- *
- * Cleanup routine to call before exiting.
- **/
-void
-e_passwords_shutdown (void)
-{
- EPassMsg *msg;
-
- G_LOCK (passwords);
-
- while ((msg = g_queue_pop_head (&message_queue)) != NULL)
- e_flag_set (msg->done);
-
- if (password_cache != NULL) {
- g_hash_table_destroy (password_cache);
- password_cache = NULL;
- }
-
- G_UNLOCK (passwords);
-
- if (password_dialog != NULL)
- gtk_dialog_response (password_dialog, GTK_RESPONSE_CANCEL);
-}
-
-/**
* e_passwords_set_online:
* @state:
*
@@ -715,34 +652,6 @@ e_passwords_set_online (gint state)
}
/**
- * e_passwords_forget_passwords:
- *
- * Forgets all cached passwords, in memory and on disk.
- **/
-void
-e_passwords_forget_passwords (void)
-{
- EPassMsg *msg = ep_msg_new (ep_clear_passwords);
-
- ep_msg_send (msg);
- ep_msg_free (msg);
-}
-
-/**
- * e_passwords_clear_passwords:
- *
- * Forgets all disk cached passwords for the component.
- **/
-void
-e_passwords_clear_passwords (const gchar *unused)
-{
- EPassMsg *msg = ep_msg_new (ep_clear_passwords);
-
- ep_msg_send (msg);
- ep_msg_free (msg);
-}
-
-/**
* e_passwords_remember_password:
* @key: the key
*
diff --git a/e-util/e-passwords.h b/e-util/e-passwords.h
index 83a4a7eaec..2fa345839e 100644
--- a/e-util/e-passwords.h
+++ b/e-util/e-passwords.h
@@ -37,20 +37,14 @@ G_BEGIN_DECLS
* initialization is now implicit when you call any of the functions
* below, although this is only correct if the functions are called
* from the main thread.
- *
- * e_passwords_shutdown should be called at exit time to synch the
- * password on-disk storage, and to free up in-memory storage. */
+ */
void e_passwords_init (void);
-void e_passwords_shutdown (void);
-void e_passwords_cancel (void);
void e_passwords_set_online (gint state);
void e_passwords_remember_password (const gchar *unused, const gchar *key);
void e_passwords_add_password (const gchar *key, const gchar *passwd);
gchar *e_passwords_get_password (const gchar *unused, const gchar *key);
void e_passwords_forget_password (const gchar *unused, const gchar *key);
-void e_passwords_forget_passwords (void);
-void e_passwords_clear_passwords (const gchar *unused);
typedef enum {
E_PASSWORDS_REMEMBER_NEVER,
2a35">for (unsigned level = 0; level < 3; ++level) { unsigned v = 0; for (; i != end && '0' <= *i && *i <= '9'; ++i) v = v * 10 + (*i - '0'); numbers[level] = v; if (level < 2) { if (i == end || *i != '.') throw SemVerError(); else ++i; } } if (i != end && *i == '-') { auto prereleaseStart = ++i; while (i != end && *i != '+') ++i; prerelease = string(prereleaseStart, i); } if (i != end && *i == '+') { auto buildStart = ++i; while (i != end) ++i; build = string(buildStart, i); } if (i != end) throw SemVerError(); } bool SemVerMatchExpression::MatchComponent::matches(SemVerVersion const& _version) const { if (prefix == Token::BitNot) { MatchComponent comp = *this; comp.prefix = Token::GreaterThanOrEqual; if (!comp.matches(_version)) return false; if (levelsPresent >= 2) comp.levelsPresent = 2; else comp.levelsPresent = 1; comp.prefix = Token::LessThanOrEqual; return comp.matches(_version); } else if (prefix == Token::BitXor) { MatchComponent comp = *this; comp.prefix = Token::GreaterThanOrEqual; if (!comp.matches(_version)) return false; if (comp.version.numbers[0] == 0) comp.levelsPresent = 2; else comp.levelsPresent = 1; comp.prefix = Token::LessThanOrEqual; return comp.matches(_version); } else { int cmp = 0; bool didCompare = false; for (unsigned i = 0; i < levelsPresent && cmp == 0; i++) if (version.numbers[i] != unsigned(-1)) { didCompare = true; cmp = _version.numbers[i] - version.numbers[i]; } if (cmp == 0 && !_version.prerelease.empty() && didCompare) cmp = -1; if (prefix == Token::Assign) return cmp == 0; else if (prefix == Token::LessThan) return cmp < 0; else if (prefix == Token::LessThanOrEqual) return cmp <= 0; else if (prefix == Token::GreaterThan) return cmp > 0; else if (prefix == Token::GreaterThanOrEqual) return cmp >= 0; else solAssert(false, "Invalid SemVer expression"); return false; } } bool SemVerMatchExpression::Conjunction::matches(SemVerVersion const& _version) const { for (auto const& component: components) if (!component.matches(_version)) return false; return true; } bool SemVerMatchExpression::matches(SemVerVersion const& _version) const { if (!isValid()) return false; for (auto const& range: m_disjunction) if (range.matches(_version)) return true; return false; } SemVerMatchExpression SemVerMatchExpressionParser::parse() { reset(); try { while (true) { parseMatchExpression(); if (m_pos >= m_tokens.size()) break; if (currentToken() != Token::Or) throw SemVerError(); nextToken(); } } catch (SemVerError const&) { reset(); } return m_expression; } void SemVerMatchExpressionParser::reset() { m_expression = SemVerMatchExpression(); m_pos = 0; m_posInside = 0; } void SemVerMatchExpressionParser::parseMatchExpression() { // component - component (range) // or component component* (conjunction) SemVerMatchExpression::Conjunction range; range.components.push_back(parseMatchComponent()); if (currentToken() == Token::Sub) { range.components[0].prefix = Token::GreaterThanOrEqual; nextToken(); range.components.push_back(parseMatchComponent()); range.components[1].prefix = Token::LessThanOrEqual; } else while (currentToken() != Token::Or && currentToken() != Token::Illegal) range.components.push_back(parseMatchComponent()); m_expression.m_disjunction.push_back(range); } SemVerMatchExpression::MatchComponent SemVerMatchExpressionParser::parseMatchComponent() { SemVerMatchExpression::MatchComponent component; Token::Value token = currentToken(); if ( token == Token::BitXor || token == Token::BitNot || token == Token::LessThan || token == Token::LessThanOrEqual|| token == Token::GreaterThan || token == Token::GreaterThanOrEqual || token == Token::Assign ) { component.prefix = token; nextToken(); } else component.prefix = Token::Assign; component.levelsPresent = 0; while (component.levelsPresent < 3) { component.version.numbers[component.levelsPresent] = parseVersionPart(); component.levelsPresent++; if (currentChar() == '.') nextChar(); else break; } // TODO we do not support pre and build version qualifiers for now in match expressions // (but we do support them in the actual versions) return component; } unsigned SemVerMatchExpressionParser::parseVersionPart() { auto startPos = m_pos; char c = currentChar(); nextChar(); if (c == 'x' || c == 'X' || c == '*') return unsigned(-1); else if (c == '0') return 0; else if ('1' <= c && c <= '9') { unsigned v = c - '0'; // If we skip to the next token, the current number is terminated. while (m_pos == startPos && '0' <= currentChar() && currentChar() <= '9') { c = currentChar(); if (v * 10 < v || v * 10 + (c - '0') < v * 10) throw SemVerError(); v = v * 10 + c - '0'; nextChar(); } return v; } else throw SemVerError(); } char SemVerMatchExpressionParser::currentChar() const { if (m_pos >= m_literals.size()) return char(-1); if (m_posInside >= m_literals[m_pos].size()) return char(-1); return m_literals[m_pos][m_posInside]; } char SemVerMatchExpressionParser::nextChar() { if (m_pos < m_literals.size()) { if (m_posInside + 1 >= m_literals[m_pos].size()) nextToken(); else ++m_posInside; } return currentChar(); } Token::Value SemVerMatchExpressionParser::currentToken() const { if (m_pos < m_tokens.size()) return m_tokens[m_pos]; else return Token::Illegal; } void SemVerMatchExpressionParser::nextToken() { ++m_pos; m_posInside = 0; }