Mon, 16 Sep 2013 23:02:23 +0530
Use g_object_[sg]et_data in joinpart
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
2 | * One Time Password support plugin for libpurple |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
3 | * |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
4 | * Copyright (C) 2009, Daniel Atallah <datallah@pidgin.im> |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
5 | * |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
6 | * This program is free software; you can redistribute it and/or |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
7 | * modify it under the terms of the GNU General Public License as |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
8 | * published by the Free Software Foundation; either version 2 of the |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
9 | * License, or (at your option) any later version. |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
10 | * |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
11 | * This program is distributed in the hope that it will be useful, but |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
14 | * General Public License for more details. |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
15 | * |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
16 | * You should have received a copy of the GNU General Public License |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
17 | * along with this program; if not, write to the Free Software |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
19 | * 02111-1301, USA. |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
20 | */ |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
21 | #include "internal.h" |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
22 | #include "debug.h" |
|
36367
891eea799578
Renamed plugin.[ch] to plugins.[ch], since we (will) no longer have a PurplePlugin structure.
Ankit Vani <a@nevitus.org>
parents:
34029
diff
changeset
|
23 | #include "plugins.h" |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
24 | #include "version.h" |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
25 | #include "account.h" |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
26 | #include "accountopt.h" |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
27 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
28 | #define PLUGIN_ID "core-one_time_password" |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
29 | #define PREF_NAME PLUGIN_ID "_enabled" |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
30 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
31 | static void |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
32 | signed_on_cb(PurpleConnection *conn, void *data) |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
33 | { |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
34 | PurpleAccount *account = purple_connection_get_account(conn); |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
35 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
36 | if (purple_account_get_bool(account, PREF_NAME, FALSE)) { |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
37 | if(purple_account_get_remember_password(account)) |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
38 | purple_debug_error("One Time Password", |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
39 | "Unable to enforce one time password for account %s (%s).\n" |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
40 | "Account is set to remember the password.\n", |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
41 | purple_account_get_username(account), |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
42 | purple_account_get_protocol_name(account)); |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
43 | else { |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
44 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
45 | purple_debug_info("One Time Password", "Clearing password for account %s (%s).\n", |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
46 | purple_account_get_username(account), |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
47 | purple_account_get_protocol_name(account)); |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
48 | |
|
34029
059c1270db1f
Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34028
diff
changeset
|
49 | purple_account_set_password(account, NULL, NULL, NULL); |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
50 | /* TODO: Do we need to somehow clear conn->password ? */ |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
51 | } |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
52 | } |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
53 | } |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
54 | |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
55 | static PurplePluginInfo * |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
56 | plugin_query(GError **error) |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
57 | { |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
58 | const gchar * const authors[] = { |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
59 | "Daniel Atallah <datallah@pidgin.im>", |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
60 | NULL |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
61 | }; |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
62 | |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
63 | return purple_plugin_info_new( |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
64 | "id", PLUGIN_ID, |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
65 | "name", N_("One Time Password Support"), |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
66 | "version", DISPLAY_VERSION, |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
67 | "category", N_("Security"), |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
68 | "summary", N_("Enforce that passwords are used only once."), |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
69 | "description", N_("Allows you to enforce on a per-account basis that " |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
70 | "passwords not being saved are only used in a " |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
71 | "single successful connection.\n" |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
72 | "Note: The account password must not be saved for " |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
73 | "this to work."), |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
74 | "authors", authors, |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
75 | "website", PURPLE_WEBSITE, |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
76 | "abi-version", PURPLE_ABI_VERSION, |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
77 | NULL |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
78 | ); |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
79 | } |
|
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
80 | |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
81 | static gboolean |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
82 | plugin_load(PurplePlugin *plugin, GError **error) |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
83 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
84 | PurpleProtocol *protocol; |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
85 | PurpleAccountOption *option; |
|
36659
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
86 | GList *list, *l; |
|
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
87 | |
|
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
88 | list = purple_protocols_get_all(); |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
89 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
90 | /* Register protocol preference. */ |
|
36659
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
91 | for (l = list; l != NULL; l = l->next) { |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36607
diff
changeset
|
92 | protocol = PURPLE_PROTOCOL(l->data); |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
93 | if (protocol != NULL && !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD)) { |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
94 | option = purple_account_option_bool_new(_("One Time Password"), |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
95 | PREF_NAME, FALSE); |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
96 | protocol->protocol_options = g_list_append(protocol->protocol_options, option); |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
97 | } |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
98 | } |
|
36659
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
99 | g_list_free(list); |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
100 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
101 | /* Register callback. */ |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
102 | purple_signal_connect(purple_connections_get_handle(), "signed-on", |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
103 | plugin, PURPLE_CALLBACK(signed_on_cb), NULL); |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
104 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
105 | return TRUE; |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
106 | } |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
107 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
108 | static gboolean |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
109 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
110 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
111 | PurpleProtocol *protocol; |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
112 | PurpleAccountOption *option; |
|
36659
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
113 | GList *list, *l, *options; |
|
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
114 | |
|
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
115 | list = purple_protocols_get_all(); |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
116 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
117 | /* Remove protocol preference. */ |
|
36659
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
118 | for (l = list; l != NULL; l = l->next) { |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36607
diff
changeset
|
119 | protocol = PURPLE_PROTOCOL(l->data); |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
120 | if (protocol != NULL && !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD)) { |
|
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
121 | options = purple_protocol_get_protocol_options(protocol); |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
122 | while (options != NULL) { |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
123 | option = (PurpleAccountOption *) options->data; |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
124 | if (strcmp(PREF_NAME, purple_account_option_get_setting(option)) == 0) { |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
125 | protocol->protocol_options = g_list_delete_link(protocol->protocol_options, options); |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
126 | purple_account_option_destroy(option); |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
127 | break; |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
128 | } |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
129 | options = options->next; |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
130 | } |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
131 | } |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
132 | } |
|
36659
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
133 | g_list_free(list); |
|
26060
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
134 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
135 | /* Callback will be automagically unregistered */ |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
136 | |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
137 | return TRUE; |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
138 | } |
|
66e61cd1bc89
Implementation of a plugin to facilitate use of One Time Passwords by
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
139 | |
|
36741
c96edeed7ea7
Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents:
36659
diff
changeset
|
140 | PURPLE_PLUGIN_INIT(one_time_password, plugin_query, plugin_load, plugin_unload); |