Mercurial > pidgin
changeset 10658:61930cadca7c
[gaim-migrate @ 12190]
sf patch #1108846, from Richard Laager
This patch allows one to create protocol plugin options which
are masked. This is useful for storing passwords, etc. This
patch implements functions similar to the masking functions for
general plugin preferences.
I'm submitting this for inclusion in Gaim because I've written a
plugin which hides the NickServ or Q (for QuakeNet)
authentication details from the user. It makes IRC feel more
like the other protocols in Gaim. I'd like to have the
passwords masked in the preferences to match other
password fields in Gaim. This is the only change to Gaim I
need for my plugin to work.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 06 Mar 2005 06:14:26 +0000 |
parents | 3f7508b1531f |
children | 861ae6ee7b6c |
files | src/accountopt.c src/accountopt.h src/gtkaccount.c |
diffstat | 3 files changed, 42 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/accountopt.c Sun Mar 06 02:23:03 2005 +0000 +++ b/src/accountopt.c Sun Mar 06 06:14:26 2005 +0000 @@ -169,6 +169,16 @@ } void +gaim_account_option_set_masked(GaimAccountOption *option, gboolean masked) +{ + g_return_if_fail(option != NULL); + g_return_if_fail(option->type == GAIM_PREF_STRING); + + option->masked = masked; +} + + +void gaim_account_option_set_list(GaimAccountOption *option, GList *values) { g_return_if_fail(option != NULL); @@ -249,6 +259,15 @@ return option->default_value.string; } +gboolean +gaim_account_option_get_masked(const GaimAccountOption *option) +{ + g_return_val_if_fail(option != NULL, FALSE); + g_return_val_if_fail(option->type == GAIM_PREF_STRING, FALSE); + + return option->masked; +} + const GList * gaim_account_option_get_list(const GaimAccountOption *option) {
--- a/src/accountopt.h Sun Mar 06 02:23:03 2005 +0000 +++ b/src/accountopt.h Sun Mar 06 06:14:26 2005 +0000 @@ -49,6 +49,8 @@ } default_value; + gboolean masked; + } GaimAccountOption; /** @@ -179,6 +181,15 @@ const char *value); /** + * Sets the masking for an account option. + * + * @param option The account option. + * @param masked The masking. + */ +void +gaim_account_option_set_masked(GaimAccountOption *option, gboolean masked); + +/** * Sets the list values for an account option. * * The list passed will be owned by the account option, and the @@ -258,6 +269,16 @@ const GaimAccountOption *option); /** + * Returns the masking for an account option. + * + * @param option The account option. + * + * @return The masking. + */ +gboolean +gaim_account_option_get_masked(const GaimAccountOption *option); + +/** * Returns the list values for an account option. * * @param option The account option.
--- a/src/gtkaccount.c Sun Mar 06 02:23:03 2005 +0000 +++ b/src/gtkaccount.c Sun Mar 06 06:14:26 2005 +0000 @@ -1019,6 +1019,8 @@ } entry = gtk_entry_new(); + if (gaim_account_option_get_masked(option)) + gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); if (str_value != NULL) gtk_entry_set_text(GTK_ENTRY(entry), str_value);