Mon, 11 Jan 2021 00:06:00 -0600
Remove the account check email option.
It was only used by google talk and that's supposed to be fully shutdown in june
Testing Done:
Compiled and ran locally.
Reviewed at https://reviews.imfreedom.org/r/412/
| ChangeLog.API | file | annotate | diff | comparison | revisions | |
| finch/gntaccount.c | file | annotate | diff | comparison | revisions | |
| libpurple/account.c | file | annotate | diff | comparison | revisions | |
| libpurple/account.h | file | annotate | diff | comparison | revisions | |
| libpurple/protocols/jabber/disco.c | file | annotate | diff | comparison | revisions | |
| libpurple/protocols/jabber/google/gmail.c | file | annotate | diff | comparison | revisions | |
| libpurple/protocols/jabber/google/gmail.h | file | annotate | diff | comparison | revisions | |
| libpurple/protocols/jabber/iq.c | file | annotate | diff | comparison | revisions | |
| libpurple/protocols/jabber/meson.build | file | annotate | diff | comparison | revisions | |
| pidgin/gtkaccount.c | file | annotate | diff | comparison | revisions |
--- a/ChangeLog.API Mon Jan 11 00:05:29 2021 -0600 +++ b/ChangeLog.API Mon Jan 11 00:06:00 2021 -0600 @@ -326,8 +326,10 @@ * PurpleAccountPrefsUiOps * purple_account_add_buddies_with_invite * purple_account_add_buddy_with_invite + * purple_account_get_check_mail * purple_account_get_password. Use purple_credential_manager_read_password_async instead. + * purple_account_set_check_mail * purple_account_set_password. Use purple_credential_manager_write_password_async instead. * purple_account_set_current_error
--- a/finch/gntaccount.c Mon Jan 11 00:05:29 2021 -0600 +++ b/finch/gntaccount.c Mon Jan 11 00:06:00 2021 -0600 @@ -57,7 +57,6 @@ GList *protocol_entries; GntWidget *protocols; - GntWidget *newmail; GntWidget *remember; GntWidget *regserver; } AccountEditDialog; @@ -197,10 +196,6 @@ NULL, NULL); } - /* Mail notification */ - purple_account_set_check_mail(account, - gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->newmail))); - /* Protocol options */ if (protocol) { @@ -498,17 +493,6 @@ if (!protocol) return; - if (dialog->newmail == NULL) - dialog->newmail = gnt_check_box_new(_("New mail notifications")); - if (dialog->account) - gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->newmail), - purple_account_get_check_mail(dialog->account)); - if (!(purple_protocol_get_options(protocol) & OPT_PROTO_MAIL_CHECK)) { - gnt_widget_set_visible(dialog->newmail, FALSE); - } else { - gnt_widget_set_visible(dialog->newmail, TRUE); - } - if (dialog->remember == NULL) dialog->remember = gnt_check_box_new(_("Remember password")); if (dialog->account) @@ -633,7 +617,6 @@ /* User options */ update_user_options(dialog); gnt_box_add_widget(GNT_BOX(window), dialog->remember); - gnt_box_add_widget(GNT_BOX(window), dialog->newmail); /* Register checkbox */ dialog->regserver = gnt_check_box_new(_("Create this account on the server"));
--- a/libpurple/account.c Mon Jan 11 00:05:29 2021 -0600 +++ b/libpurple/account.c Mon Jan 11 00:06:00 2021 -0600 @@ -135,7 +135,6 @@ PROP_USER_INFO, PROP_BUDDY_ICON_PATH, PROP_REMEMBER_PASSWORD, - PROP_CHECK_MAIL, PROP_LAST }; @@ -961,9 +960,6 @@ purple_account_set_remember_password(account, g_value_get_boolean(value)); break; - case PROP_CHECK_MAIL: - purple_account_set_check_mail(account, g_value_get_boolean(value)); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); break; @@ -1004,9 +1000,6 @@ g_value_set_boolean(value, purple_account_get_remember_password(account)); break; - case PROP_CHECK_MAIL: - g_value_set_boolean(value, purple_account_get_check_mail(account)); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); break; @@ -1178,11 +1171,6 @@ "Whether to remember and store the password for this account.", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - properties[PROP_CHECK_MAIL] = g_param_spec_boolean("check-mail", - "Check mail", - "Whether to check mails for this account.", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - properties[PROP_CONNECTION] = g_param_spec_object("connection", "Connection", "The connection for the account.", PURPLE_TYPE_CONNECTION, @@ -1733,16 +1721,6 @@ } void -purple_account_set_check_mail(PurpleAccount *account, gboolean value) -{ - g_return_if_fail(PURPLE_IS_ACCOUNT(account)); - - purple_account_set_bool(account, "check-mail", value); - - g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_CHECK_MAIL]); -} - -void purple_account_set_enabled(PurpleAccount *account, const char *ui, gboolean value) { @@ -2236,14 +2214,6 @@ } gboolean -purple_account_get_check_mail(PurpleAccount *account) -{ - g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE); - - return purple_account_get_bool(account, "check-mail", FALSE); -} - -gboolean purple_account_get_enabled(PurpleAccount *account, const char *ui) { g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
--- a/libpurple/account.h Mon Jan 11 00:05:29 2021 -0600 +++ b/libpurple/account.h Mon Jan 11 00:06:00 2021 -0600 @@ -366,15 +366,6 @@ void purple_account_set_remember_password(PurpleAccount *account, gboolean value); /** - * purple_account_set_check_mail: - * @account: The account. - * @value: %TRUE if it should check for mail. - * - * Sets whether or not this account should check for mail. - */ -void purple_account_set_check_mail(PurpleAccount *account, gboolean value); - -/** * purple_account_set_enabled: * @account: The account. * @ui: The UI. @@ -719,16 +710,6 @@ gboolean purple_account_get_remember_password(PurpleAccount *account); /** - * purple_account_get_check_mail: - * @account: The account. - * - * Returns whether or not this account should check for mail. - * - * Returns: %TRUE if it should check for mail. - */ -gboolean purple_account_get_check_mail(PurpleAccount *account); - -/** * purple_account_get_enabled: * @account: The account. * @ui: The UI.
--- a/libpurple/protocols/jabber/disco.c Mon Jan 11 00:05:29 2021 -0600 +++ b/libpurple/protocols/jabber/disco.c Mon Jan 11 00:06:00 2021 -0600 @@ -27,7 +27,6 @@ #include "buddy.h" #include "disco.h" #include "google/google.h" -#include "google/gmail.h" #include "google/jingleinfo.h" #include "iq.h" #include "jabber.h" @@ -539,10 +538,7 @@ if (!var) continue; - if (purple_strequal(NS_GOOGLE_MAIL_NOTIFY, var)) { - js->server_caps |= JABBER_CAP_GMAIL_NOTIFY; - jabber_gmail_init(js); - } else if (purple_strequal(NS_GOOGLE_ROSTER, var)) { + if (purple_strequal(NS_GOOGLE_ROSTER, var)) { js->server_caps |= JABBER_CAP_GOOGLE_ROSTER; } else if (purple_strequal("http://jabber.org/protocol/commands", var)) { js->server_caps |= JABBER_CAP_ADHOC;
--- a/libpurple/protocols/jabber/google/gmail.c Mon Jan 11 00:05:29 2021 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,205 +0,0 @@ -/** - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include <purple.h> - -#include "jabber.h" -#include "gmail.h" - -static void -jabber_gmail_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - PurpleXmlNode *packet, gpointer nul) -{ - PurpleXmlNode *child; - PurpleXmlNode *message; - const char *to, *url; - const char *in_str; - char *to_name; - - int i, count = 1, returned_count; - - const char **tos, **froms, **urls; - char **subjects; - - if (type == JABBER_IQ_ERROR) - return; - - child = purple_xmlnode_get_child(packet, "mailbox"); - if (!child) - return; - - in_str = purple_xmlnode_get_attrib(child, "total-matched"); - if (in_str && *in_str) - count = atoi(in_str); - - /* If Gmail doesn't tell us who the mail is to, let's use our JID */ - to = purple_xmlnode_get_attrib(packet, "to"); - - message = purple_xmlnode_get_child(child, "mail-thread-info"); - - if (count == 0 || !message) { - if (count > 0) { - char *bare_jid = jabber_get_bare_jid(to); - const char *default_tos[2] = { bare_jid }; - - purple_notify_emails(js->gc, count, FALSE, NULL, NULL, default_tos, NULL, NULL, NULL); - g_free(bare_jid); - } else { - purple_notify_emails(js->gc, count, FALSE, NULL, NULL, NULL, NULL, NULL, NULL); - } - - return; - } - - /* Loop once to see how many messages were returned so we can allocate arrays - * accordingly */ - for (returned_count = 0; message; returned_count++, message=purple_xmlnode_get_next_twin(message)); - - froms = g_new0(const char* , returned_count + 1); - tos = g_new0(const char* , returned_count + 1); - subjects = g_new0(char* , returned_count + 1); - urls = g_new0(const char* , returned_count + 1); - - to = purple_xmlnode_get_attrib(packet, "to"); - to_name = jabber_get_bare_jid(to); - url = purple_xmlnode_get_attrib(child, "url"); - if (!url || !*url) - url = "http://www.gmail.com"; - - message= purple_xmlnode_get_child(child, "mail-thread-info"); - for (i=0; message; message = purple_xmlnode_get_next_twin(message), i++) { - PurpleXmlNode *sender_node, *subject_node; - const char *from, *tid; - char *subject; - - subject_node = purple_xmlnode_get_child(message, "subject"); - sender_node = purple_xmlnode_get_child(message, "senders"); - sender_node = purple_xmlnode_get_child(sender_node, "sender"); - - while (sender_node && (!purple_xmlnode_get_attrib(sender_node, "unread") || - purple_strequal(purple_xmlnode_get_attrib(sender_node, "unread"),"0"))) - sender_node = purple_xmlnode_get_next_twin(sender_node); - - if (!sender_node) { - i--; - continue; - } - - from = purple_xmlnode_get_attrib(sender_node, "name"); - if (!from || !*from) - from = purple_xmlnode_get_attrib(sender_node, "address"); - subject = purple_xmlnode_get_data(subject_node); - /* - * url = purple_xmlnode_get_attrib(message, "url"); - */ - tos[i] = (to_name != NULL ? to_name : ""); - froms[i] = (from != NULL ? from : ""); - subjects[i] = (subject != NULL ? subject : g_strdup("")); - urls[i] = url; - - tid = purple_xmlnode_get_attrib(message, "tid"); - if (g_strcmp0(tid, js->gmail_last_tid) > 0) { - g_free(js->gmail_last_tid); - js->gmail_last_tid = g_strdup(tid); - } - } - - if (i>0) - purple_notify_emails(js->gc, count, count == i, (const char**) subjects, froms, tos, - urls, NULL, NULL); - - g_free(to_name); - g_free(tos); - g_free(froms); - for (i = 0; i < returned_count; i++) - g_free(subjects[i]); - g_free(subjects); - g_free(urls); - - in_str = purple_xmlnode_get_attrib(child, "result-time"); - if (in_str && *in_str) { - g_free(js->gmail_last_time); - js->gmail_last_time = g_strdup(in_str); - } -} - -void -jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, - const char *id, PurpleXmlNode *new_mail) -{ - PurpleXmlNode *query; - JabberIq *iq; - - /* bail if the user isn't interested */ - if (!purple_account_get_check_mail(purple_connection_get_account(js->gc))) - return; - - /* Is this an initial incoming mail notification? If so, send a request for more info */ - if (type != JABBER_IQ_SET) - return; - - /* Acknowledge the notification */ - iq = jabber_iq_new(js, JABBER_IQ_RESULT); - if (from) - purple_xmlnode_set_attrib(iq->node, "to", from); - purple_xmlnode_set_attrib(iq->node, "id", id); - jabber_iq_send(iq); - - purple_debug_misc("jabber", - "Got new mail notification. Sending request for more info\n"); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY); - jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); - query = purple_xmlnode_get_child(iq->node, "query"); - - if (js->gmail_last_time) - purple_xmlnode_set_attrib(query, "newer-than-time", js->gmail_last_time); - if (js->gmail_last_tid) - purple_xmlnode_set_attrib(query, "newer-than-tid", js->gmail_last_tid); - - jabber_iq_send(iq); -} - -void jabber_gmail_init(JabberStream *js) { - JabberIq *iq; - PurpleXmlNode *usersetting, *mailnotifications; - - if (!purple_account_get_check_mail(purple_connection_get_account(js->gc))) - return; - - /* - * Quoting https://developers.google.com/talk/jep_extensions/usersettings: - * To ensure better compatibility with other clients, rather than - * setting this value to "false" to turn off notifications, it is - * recommended that a client set this to "true" and filter incoming - * email notifications itself. - */ - iq = jabber_iq_new(js, JABBER_IQ_SET); - usersetting = purple_xmlnode_new_child(iq->node, "usersetting"); - purple_xmlnode_set_namespace(usersetting, "google:setting"); - mailnotifications = purple_xmlnode_new_child(usersetting, "mailnotifications"); - purple_xmlnode_set_attrib(mailnotifications, "value", "true"); - jabber_iq_send(iq); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY); - jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); - jabber_iq_send(iq); -}
--- a/libpurple/protocols/jabber/google/gmail.h Mon Jan 11 00:05:29 2021 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/** - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_GOOGLE_GMAIL_H_ -#define PURPLE_JABBER_GOOGLE_GMAIL_H_ - -#include "jabber.h" - -void jabber_gmail_init(JabberStream *js); -void jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, - const char *id, PurpleXmlNode *new_mail); - -#endif /* PURPLE_JABBER_GOOGLE_GMAIL_H_ */
--- a/libpurple/protocols/jabber/iq.c Mon Jan 11 00:05:29 2021 -0600 +++ b/libpurple/protocols/jabber/iq.c Mon Jan 11 00:06:00 2021 -0600 @@ -26,7 +26,6 @@ #include "buddy.h" #include "disco.h" -#include "google/gmail.h" #include "google/google.h" #include "google/jingleinfo.h" #include "google/google_session.h" @@ -546,10 +545,6 @@ signal_iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); jabber_iq_register_handler("jingle", JINGLE, jingle_parse); - jabber_iq_register_handler("mailbox", NS_GOOGLE_MAIL_NOTIFY, - jabber_gmail_poke); - jabber_iq_register_handler("new-mail", NS_GOOGLE_MAIL_NOTIFY, - jabber_gmail_poke); jabber_iq_register_handler("ping", NS_PING, jabber_ping_parse); jabber_iq_register_handler("query", NS_GOOGLE_JINGLE_INFO, jabber_google_handle_jingle_info);
--- a/libpurple/protocols/jabber/meson.build Mon Jan 11 00:05:29 2021 -0600 +++ b/libpurple/protocols/jabber/meson.build Mon Jan 11 00:06:00 2021 -0600 @@ -25,8 +25,6 @@ 'data.h', 'disco.c', 'disco.h', - 'google/gmail.c', - 'google/gmail.h', 'google/google.c', 'google/google.h', 'google/google_p2p.c',
--- a/pidgin/gtkaccount.c Mon Jan 11 00:05:29 2021 -0600 +++ b/pidgin/gtkaccount.c Mon Jan 11 00:06:00 2021 -0600 @@ -114,7 +114,6 @@ /* User Options */ GtkWidget *user_frame; - GtkWidget *new_mail_check; GtkWidget *icon_hbox; GtkWidget *icon_check; GtkWidget *icon_entry; @@ -660,12 +659,6 @@ dialog->alias_entry = gtk_entry_new(); add_pref_box(dialog, vbox, _("_Local alias:"), dialog->alias_entry); - /* New mail notifications */ - dialog->new_mail_check = - gtk_check_button_new_with_mnemonic(_("New _mail notifications")); - gtk_box_pack_start(GTK_BOX(vbox), dialog->new_mail_check, FALSE, FALSE, 0); - gtk_widget_show(dialog->new_mail_check); - /* Buddy icon */ dialog->icon_check = gtk_check_button_new_with_mnemonic(_("Use this buddy _icon for this account:")); g_signal_connect(G_OBJECT(dialog->icon_check), "toggled", G_CALLBACK(icon_check_cb), dialog); @@ -713,8 +706,6 @@ if (dialog->protocol != NULL) { PurpleBuddyIconSpec *icon_spec = purple_protocol_get_icon_spec(dialog->protocol); - if (!(purple_protocol_get_options(dialog->protocol) & OPT_PROTO_MAIL_CHECK)) - gtk_widget_hide(dialog->new_mail_check); if (!icon_spec || icon_spec->format == NULL) { gtk_widget_hide(dialog->icon_check); @@ -731,9 +722,6 @@ gtk_entry_set_text(GTK_ENTRY(dialog->alias_entry), purple_account_get_private_alias(dialog->account)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->new_mail_check), - purple_account_get_check_mail(dialog->account)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->icon_check), !purple_account_get_bool(dialog->account, "use-global-buddyicon", TRUE)); @@ -1417,12 +1405,6 @@ purple_account_set_remember_password(account, remember); - /* Check Mail */ - if (dialog->protocol && purple_protocol_get_options(dialog->protocol) & OPT_PROTO_MAIL_CHECK) - purple_account_set_check_mail(account, - gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(dialog->new_mail_check))); - /* Password */ value = gtk_entry_get_text(GTK_ENTRY(dialog->password_entry));