Mercurial > pidgin.yaz
changeset 26002:996a453ff7d7
propagate from branch 'im.pidgin.pidgin' (head 972457aa8f4a246318025cf2c479a57e1bb70848)
to branch 'im.pidgin.cpw.malu.xmpp.idle' (head b8321bcfa000ebddaa78c87d8cdc733dbe4b292e)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Wed, 04 Mar 2009 21:52:12 +0000 |
parents | 971b89243a20 (diff) 13541e130064 (current diff) |
children | 12c2f11bb113 |
files | |
diffstat | 9 files changed, 309 insertions(+), 93 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Mon Mar 02 21:25:31 2009 +0000 +++ b/COPYRIGHT Wed Mar 04 21:52:12 2009 +0000 @@ -57,6 +57,7 @@ Philip Brown Dan Bruce Norbert Buchmuller +Johannes Buchner Sean Burke Thomas Butter Trevor Caira
--- a/doc/funniest_home_convos.txt Mon Mar 02 21:25:31 2009 +0000 +++ b/doc/funniest_home_convos.txt Wed Mar 04 21:52:12 2009 +0000 @@ -565,3 +565,10 @@ for using pidgen 22:36 <user> why do they think this is a bad client? does it have history? +-- + +15:45 <deryni> We've had a Grand Plugin Database Plan for approximately forever. +15:45 <SimGuy> ah, the GPDP +15:46 <khc> well, there was a Grand Smiley Theme Database +15:47 <SimGuy> the GSTD sounds like a bad acronym +15:47 <khc> I realized after typing that
--- a/libpurple/connection.h Mon Mar 02 21:25:31 2009 +0000 +++ b/libpurple/connection.h Wed Mar 04 21:52:12 2009 +0000 @@ -72,7 +72,7 @@ PURPLE_CONNECTION_ERROR_INVALID_USERNAME = 1, /** The username, password or some other credential was incorrect. Use * #PURPLE_CONNECTION_ERROR_INVALID_USERNAME instead if the username - * is known to be invalid. + * is known to be invalid. */ PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED = 2, /** libpurple doesn't speak any of the authentication methods the
--- a/libpurple/plugins/Makefile.am Mon Mar 02 21:25:31 2009 +0000 +++ b/libpurple/plugins/Makefile.am Wed Mar 04 21:52:12 2009 +0000 @@ -36,6 +36,7 @@ newline_la_LDFLAGS = -module -avoid-version notify_example_la_LDFLAGS = -module -avoid-version offlinemsg_la_LDFLAGS = -module -avoid-version +one_time_password_la_LDFLAGS = -module -avoid-version pluginpref_example_la_LDFLAGS = -module -avoid-version psychic_la_LDFLAGS = -module -avoid-version signals_test_la_LDFLAGS = -module -avoid-version @@ -65,6 +66,7 @@ debug_example.la \ helloworld.la \ notify_example.la \ + one_time_password.la \ pluginpref_example.la \ signals_test.la \ simple.la @@ -81,6 +83,7 @@ newline_la_SOURCES = newline.c notify_example_la_SOURCES = notify_example.c offlinemsg_la_SOURCES = offlinemsg.c +one_time_password_la_SOURCES = one_time_password.c pluginpref_example_la_SOURCES = pluginpref_example.c psychic_la_SOURCES = psychic.c signals_test_la_SOURCES = signals-test.c @@ -97,6 +100,7 @@ newline_la_LIBADD = $(GLIB_LIBS) notify_example_la_LIBADD = $(GLIB_LIBS) offlinemsg_la_LIBADD = $(GLIB_LIBS) +one_time_password_la_LIBADD = $(GLIB_LIBS) pluginpref_example_la_LIBADD = $(GLIB_LIBS) psychic_la_LIBADD = $(GLIB_LIBS) signals_test_la_LIBADD = $(GLIB_LIBS)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libpurple/plugins/one_time_password.c Wed Mar 04 21:52:12 2009 +0000 @@ -0,0 +1,151 @@ +/* + * One Time Password support plugin for libpurple + * + * Copyright (C) 2009, Daniel Atallah <datallah@pidgin.im> + * + * 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 "internal.h" +#include "debug.h" +#include "plugin.h" +#include "version.h" +#include "account.h" +#include "accountopt.h" + +#define PLUGIN_ID "core-one_time_password" +#define PREF_NAME PLUGIN_ID "_enabled" + +static void +signed_on_cb(PurpleConnection *conn, void *data) +{ + PurpleAccount *account = purple_connection_get_account(conn); + + if (purple_account_get_bool(account, PREF_NAME, FALSE)) { + if(purple_account_get_remember_password(account)) + purple_debug_error("One Time Password", + "Unable to enforce one time password for account %s (%s).\n" + "Account is set to remember the password.\n", + purple_account_get_username(account), + purple_account_get_protocol_name(account)); + else { + + purple_debug_info("One Time Password", "Clearing password for account %s (%s).\n", + purple_account_get_username(account), + purple_account_get_protocol_name(account)); + + purple_account_set_password(account, NULL); + /* TODO: Do we need to somehow clear conn->password ? */ + } + } +} + +static gboolean +plugin_load(PurplePlugin *plugin) +{ + PurplePlugin *prpl; + PurplePluginProtocolInfo *prpl_info; + PurpleAccountOption *option; + GList *l; + + /* Register protocol preference. */ + for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) { + prpl = (PurplePlugin *)l->data; + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + if (prpl_info != NULL && !(prpl_info->options & OPT_PROTO_NO_PASSWORD)) { + option = purple_account_option_bool_new(_("One Time Password"), + PREF_NAME, FALSE); + prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); + } + } + + /* Register callback. */ + purple_signal_connect(purple_connections_get_handle(), "signed-on", + plugin, PURPLE_CALLBACK(signed_on_cb), NULL); + + return TRUE; +} + +static gboolean +plugin_unload(PurplePlugin *plugin) +{ + PurplePlugin *prpl; + PurplePluginProtocolInfo *prpl_info; + PurpleAccountOption *option; + GList *l, *options; + + /* Remove protocol preference. */ + for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) { + prpl = (PurplePlugin *)l->data; + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + if (prpl_info != NULL && !(prpl_info->options & OPT_PROTO_NO_PASSWORD)) { + options = prpl_info->protocol_options; + while (options != NULL) { + option = (PurpleAccountOption *) options->data; + if (strcmp(PREF_NAME, purple_account_option_get_setting(option)) == 0) { + prpl_info->protocol_options = g_list_delete_link(prpl_info->protocol_options, options); + purple_account_option_destroy(option); + break; + } + options = options->next; + } + } + } + + /* Callback will be automagically unregistered */ + + return TRUE; +} + +static PurplePluginInfo info = +{ + PURPLE_PLUGIN_MAGIC, + PURPLE_MAJOR_VERSION, + PURPLE_MINOR_VERSION, + PURPLE_PLUGIN_STANDARD, /**< type */ + NULL, /**< ui_requirement */ + 0, /**< flags */ + NULL, /**< dependencies */ + PURPLE_PRIORITY_DEFAULT, /**< priority */ + PLUGIN_ID, /**< id */ + N_("One Time Password Support"), /**< name */ + DISPLAY_VERSION, /**< version */ + /** summary */ + N_("Enforce that passwords are used only once."), + /** description */ + N_("Allows you to enforce on a per-account basis that passwords not " + "being saved are only used in a single successful connection.\n" + "Note: The account password must not be saved for this to work."), + "Daniel Atallah <datallah@pidgin.im>", /**< author */ + PURPLE_WEBSITE, /**< homepage */ + plugin_load, /**< load */ + plugin_unload, /**< unload */ + NULL, /**< destroy */ + NULL, /**< ui_info */ + NULL, /**< extra_info */ + NULL, /**< prefs_info */ + NULL, /**< actions */ + NULL, /**< reserved 1 */ + NULL, /**< reserved 2 */ + NULL, /**< reserved 3 */ + NULL /**< reserved 4 */ +}; + +static void +init_plugin(PurplePlugin *plugin) +{ +} + +PURPLE_INIT_PLUGIN(one_time_password, init_plugin, info)
--- a/libpurple/protocols/msn/notification.c Mon Mar 02 21:25:31 2009 +0000 +++ b/libpurple/protocols/msn/notification.c Wed Mar 04 21:52:12 2009 +0000 @@ -665,13 +665,14 @@ if (user->passport && !strcmp(user->passport, "messenger@microsoft.com")) continue; - if ((user->list_op & MSN_LIST_OP_MASK) == (MSN_LIST_AL_OP | MSN_LIST_BL_OP)) { + if ((user->list_op & MSN_LIST_OP_MASK & ~MSN_LIST_FL_OP) + == (MSN_LIST_AL_OP | MSN_LIST_BL_OP)) { /* The server will complain if we send it a user on both the Allow and Block lists. So assume they're on the Block list and remove them from the Allow list in the membership lists to stop this from happening again. */ purple_debug_warning("msn", - "User %s is on both Allow and Block list," + "User %s is on both Allow and Block list; " "removing from Allow list.\n", user->passport); msn_userlist_rem_buddy_from_list(session->userlist, user->passport, MSN_LIST_AL);
--- a/libpurple/protocols/oscar/oscar.c Mon Mar 02 21:25:31 2009 +0000 +++ b/libpurple/protocols/oscar/oscar.c Wed Mar 04 21:52:12 2009 +0000 @@ -4812,16 +4812,19 @@ } else { - char *status_text = NULL; - + gchar *linkified; + htmlaway = purple_status_get_attr_string(status, "message"); if ((htmlaway == NULL) || (*htmlaway == '\0')) htmlaway = purple_status_type_get_name(status_type); - + /* ICQ 6.x seems to use an available message for all statuses so set one */ - if (od->icq) + if (od->icq) { + char *status_text; + status_text = purple_markup_strip_html(htmlaway); + /* If the status_text is longer than 251 characters then truncate it */ if (strlen(status_text) > MAXAVAILMSGLEN) { @@ -4829,12 +4832,13 @@ strcpy(tmp, "..."); } aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text, NULL); + g_free(status_text); } - g_free(status_text); /* Set a proper away message for icq too so that they work for old third party clients */ - - away = purple_prpl_oscar_convert_to_infotext(htmlaway, &awaylen, &away_encoding); + linkified = purple_markup_linkify(htmlaway); + away = purple_prpl_oscar_convert_to_infotext(linkified, &awaylen, &away_encoding); + g_free(linkified); if (awaylen > od->rights.maxawaymsglen) { @@ -4860,24 +4864,18 @@ } static void -oscar_set_status_icq(PurpleAccount *account, PurpleStatus *status) +oscar_set_status_icq(PurpleAccount *account) { PurpleConnection *gc = purple_account_get_connection(account); - OscarData *od = NULL; - - if (gc) - od = purple_connection_get_protocol_data(gc); - if (!od) - return; - - if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_INVISIBLE) - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - else - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - - if ((od->ssi.received_data) && (aim_ssi_getpermdeny(od->ssi.local) != account->perm_deny)) - aim_ssi_setpermdeny(od, account->perm_deny, 0xffffffff); - + + /* Our permit/deny setting affects our invisibility */ + oscar_set_permit_deny(gc); + + /* + * TODO: I guess we should probably wait and do this after we get + * confirmation from the above SSI call? Right now other people + * see our status blip to "invisible" before we appear offline. + */ oscar_set_extendedstatus(gc); } @@ -4897,7 +4895,7 @@ /* Set the ICQ status for ICQ accounts only */ if (oscar_util_valid_name_icq(purple_account_get_username(account))) - oscar_set_status_icq(account, status); + oscar_set_status_icq(account); } #ifdef CRAZY_WARN @@ -5053,7 +5051,7 @@ return 1; } - oscar_set_extendedstatus(gc); + oscar_set_status_icq(purple_connection_get_account(gc)); return 1; } @@ -5345,15 +5343,19 @@ } break; case 0x0004: { /* Permit/deny setting */ - if (curitem->data) { - guint8 permdeny; - if ((permdeny = aim_ssi_getpermdeny(od->ssi.local)) && (permdeny != account->perm_deny)) { + /* + * We don't inherit the permit/deny setting from the server + * for ICQ because, for ICQ, this setting controls who can + * see your online status when you are invisible. Thus it is + * a part of your status and not really related to blocking. + */ + if (!od->icq && curitem->data) { + guint8 perm_deny = aim_ssi_getpermdeny(od->ssi.local); + if (perm_deny != 0 && perm_deny != account->perm_deny) + { purple_debug_info("oscar", - "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); - account->perm_deny = permdeny; - if (od->icq && account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) { - purple_presence_set_status_active(purple_account_get_presence(account), OSCAR_STATUS_ID_INVISIBLE, TRUE); - } + "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, perm_deny); + account->perm_deny = perm_deny; } } } break; @@ -5364,7 +5366,7 @@ } /* End of switch on curitem->type */ } /* End of for loop */ - oscar_set_extendedstatus(gc); + oscar_set_status_icq(account); /* Activate SSI */ /* Sending the enable causes other people to be able to see you, and you to see them */ @@ -6045,29 +6047,36 @@ void oscar_set_permit_deny(PurpleConnection *gc) { PurpleAccount *account = purple_connection_get_account(gc); OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->ssi.received_data) { - switch (account->perm_deny) { - case PURPLE_PRIVACY_ALLOW_ALL: - aim_ssi_setpermdeny(od, 0x01, 0xffffffff); - break; - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - aim_ssi_setpermdeny(od, 0x05, 0xffffffff); - break; - case PURPLE_PRIVACY_ALLOW_USERS: - aim_ssi_setpermdeny(od, 0x03, 0xffffffff); - break; - case PURPLE_PRIVACY_DENY_ALL: - aim_ssi_setpermdeny(od, 0x02, 0xffffffff); - break; - case PURPLE_PRIVACY_DENY_USERS: - aim_ssi_setpermdeny(od, 0x04, 0xffffffff); - break; - default: - aim_ssi_setpermdeny(od, 0x01, 0xffffffff); - break; - } - } + PurplePrivacyType perm_deny; + + /* + * For ICQ the permit/deny setting controls who you can see you + * online when you set your status to "invisible." If we're ICQ + * and we're invisible then we need to use one of + * PURPLE_PRIVACY_ALLOW_USERS or PURPLE_PRIVACY_ALLOW_BUDDYLIST or + * PURPLE_PRIVACY_DENY_USERS if we actually want to be invisible + * to anyone. + * + * These three permit/deny settings correspond to: + * 1. Invisible to everyone except the people on my "permit" list + * 2. Invisible to everyone except the people on my buddy list + * 3. Invisible only to the people on my "deny" list + * + * It would be nice to allow cases 2 and 3, but our UI doesn't have + * a nice way to do it. For now we just force case 1. + */ + if (od->icq && purple_account_is_status_active(account, OSCAR_STATUS_ID_INVISIBLE)) + perm_deny = PURPLE_PRIVACY_ALLOW_USERS; + else + perm_deny = account->perm_deny; + + if (od->ssi.received_data) + /* + * Conveniently there is a one-to-one mapping between the + * values of libpurple's PurplePrivacyType and the values used + * by the oscar protocol. + */ + aim_ssi_setpermdeny(od, perm_deny, 0xffffffff); } void oscar_add_permit(PurpleConnection *gc, const char *who) {
--- a/libpurple/purple-url-handler Mon Mar 02 21:25:31 2009 +0000 +++ b/libpurple/purple-url-handler Wed Mar 04 21:52:12 2009 +0000 @@ -207,11 +207,7 @@ def correct_server(account): username = cpurple.PurpleAccountGetUsername(account) - user_split = (username.split("@")) - # Not all accounts have a split, so append an empty string so the - # [1] doesn't throw an IndexError. - user_split.append("") - return (server == user_split[1]) + return ("@" in username) and (server == (username.split("@"))[1]) account = findaccount(protocol, matcher=correct_server)
--- a/pidgin/gtkblist.c Mon Mar 02 21:25:31 2009 +0000 +++ b/pidgin/gtkblist.c Wed Mar 04 21:52:12 2009 +0000 @@ -3996,7 +3996,7 @@ } else if (!purple_presence_is_online(presence)) { if (theme) pair = pidgin_blist_theme_get_offline_text_info(theme); - name_color = (pair != NULL && pair->color != NULL) ? pair->color : "black"; + name_color = (pair != NULL && pair->color != NULL) ? pair->color : NULL; name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; if (theme) @@ -4007,7 +4007,7 @@ } else if (purple_presence_is_available(presence)) { if (theme) pair = pidgin_blist_theme_get_online_text_info(theme); - name_color = (pair != NULL && pair->color != NULL) ? pair->color : "black"; + name_color = (pair != NULL && pair->color != NULL) ? pair->color : NULL; name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; if (theme) @@ -4018,7 +4018,7 @@ } else { if (theme) pair = pidgin_blist_theme_get_away_text_info(theme); - name_color = (pair != NULL && pair->color != NULL) ? pair->color : "black"; + name_color = (pair != NULL && pair->color != NULL) ? pair->color : NULL; name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; if (theme) @@ -4028,23 +4028,49 @@ } if (aliased && selected) { - name_color = "black"; - status_color = "black"; + if (theme) { + name_color = "black"; + status_color = "black"; + } else { + name_color = NULL; + status_color = NULL; + } } /* Put it all together */ if (aliased && biglist && (statustext || idletime)) { /* using <span size='smaller'> breaks the status, so it must be seperated into <small><span>*/ - text = g_strdup_printf("<span font_desc='%s' foreground='%s'>%s</span>\n" - "<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>", - name_font, name_color, nametext, status_font, status_color, - idletime != NULL ? idletime : "", - (idletime != NULL && statustext != NULL) ? " - " : "", - statustext != NULL ? statustext : ""); - - } else - text = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>", name_font, name_color, nametext); - + if (name_color) { + text = g_strdup_printf("<span font_desc='%s' foreground='%s'>%s</span>\n" + "<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>", + name_font, name_color, nametext, status_font, status_color, + idletime != NULL ? idletime : "", + (idletime != NULL && statustext != NULL) ? " - " : "", + statustext != NULL ? statustext : ""); + } else if (status_color) { + text = g_strdup_printf("<span font_desc='%s'>%s</span>\n" + "<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>", + name_font, nametext, status_font, status_color, + idletime != NULL ? idletime : "", + (idletime != NULL && statustext != NULL) ? " - " : "", + statustext != NULL ? statustext : ""); + } else { + text = g_strdup_printf("<span font_desc='%s'>%s</span>\n" + "<small><span font_desc='%s'>%s%s%s</span></small>", + name_font, nametext, status_font, + idletime != NULL ? idletime : "", + (idletime != NULL && statustext != NULL) ? " - " : "", + statustext != NULL ? statustext : ""); + } + } else { + if (name_color) { + text = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>", + name_font, name_color, nametext); + } else { + text = g_strdup_printf("<span font_desc='%s'>%s</span>", name_font, + nametext); + } + } g_free(nametext); g_free(statustext); g_free(idletime); @@ -6159,12 +6185,17 @@ pair = pidgin_blist_theme_get_collapsed_text_info(theme); - text_color = (selected || pair == NULL || pair->color == NULL) ? "black" : pair->color; + text_color = (selected || pair == NULL || pair->color == NULL) ? NULL : pair->color; text_font = (pair == NULL || pair->font == NULL) ? "" : pair->font; esc = g_markup_escape_text(group->name, -1); - mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s</span>", + if (text_color) { + mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s</span>", text_color, text_font, esc ? esc : "", group_count); + } else { + mark = g_strdup_printf("<span font_desc='%s'><b>%s</b>%s</span>", + text_font, esc ? esc : "", group_count); + } g_free(esc); return mark; @@ -6225,10 +6256,17 @@ if (!selected && theme != NULL && (pair = pidgin_blist_theme_get_idle_text_info(theme)) != NULL && pair->color != NULL) textcolor = pair->color; else - textcolor = "black"; - - idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>", textcolor, - (pair == NULL || pair->font == NULL) ? "" : pair->font, ihrs, imin); + textcolor = NULL; + + if (textcolor) { + idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>", + textcolor, (pair == NULL || pair->font == NULL) ? "" : pair->font, + ihrs, imin); + } else { + idle = g_strdup_printf("<span font_desc='%s'>%d:%02d</span>", + (pair == NULL || pair->font == NULL) ? "" : pair->font, + ihrs, imin); + } } } @@ -6325,10 +6363,15 @@ } font = (pair == NULL || pair->font == NULL) ? "" : pair->font; - fg_color = (selected || pair == NULL || pair->color == NULL) ? "black" : pair->color; - - tmp = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>", + fg_color = (selected || pair == NULL || pair->color == NULL) ? NULL : pair->color; + + if (fg_color) { + tmp = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>", font, fg_color, mark); + } else { + tmp = g_strdup_printf("<span font_desc='%s'>%s</span>", font, + mark); + } g_free(mark); mark = tmp; @@ -6458,13 +6501,17 @@ font = (pair == NULL || pair->font == NULL) ? "" : pair->font; if (selected || pair == NULL || pair->color == NULL) /* nick_said color is the same as gtkconv:tab-label-attention */ - color = (nick_said ? "#006aff" : "black"); + color = (nick_said ? "#006aff" : NULL); else color = pair->color; - tmp = g_strdup_printf("<span font_desc='%s' color='%s' weight='%s'>%s</span>", - font, color, hidden ? "bold" : "normal", mark); - + if (color) { + tmp = g_strdup_printf("<span font_desc='%s' color='%s' weight='%s'>%s</span>", + font, color, hidden ? "bold" : "normal", mark); + } else { + tmp = g_strdup_printf("<span font_desc='%s' weight='%s'>%s</span>", + font, hidden ? "bold" : "normal", mark); + } g_free(mark); mark = tmp;