pidgin: f05555f0: Small changes to how we format oscar scr...
markdoliner at pidgin.im
markdoliner at pidgin.im
Sun Feb 13 22:56:02 EST 2011
----------------------------------------------------------------------
Revision: f05555f0024e1dab2d9c4f3f3e1b250ae4595afe
Parent: 6fa5711ed4fe6e958f6cb9beff4fdb20c26b037d
Author: markdoliner at pidgin.im
Date: 02/13/11 22:51:05
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f05555f0024e1dab2d9c4f3f3e1b250ae4595afe
Changelog:
Small changes to how we format oscar screen names. We now
1. Don't attempt to format a screen name
2. Unless it's @aim.com (or possibly other AOL-owned domains), in which
case we strip off the domain and format the basename only
Hopefully fixes #13043, fixes #12376, fixes #11740
Changes against parent 6fa5711ed4fe6e958f6cb9beff4fdb20c26b037d
patched libpurple/protocols/oscar/oscar.c
patched libpurple/protocols/oscar/oscarcommon.h
-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c 6a87c0f2de22c9978eb823850e1c9e8b5d67b00f
+++ libpurple/protocols/oscar/oscar.c d6659f3e25448a5ea39e6ee2f09f81287a29b71d
@@ -2828,6 +2828,52 @@ static int purple_parse_buddyrights(Osca
return 1;
}
+static void oscar_format_username(PurpleConnection *gc, const char *new_display_name)
+{
+ OscarData *od;
+ const char *old_display_name, *username;
+ char *tmp, *at_sign;
+
+ old_display_name = purple_connection_get_display_name(gc);
+ if (old_display_name && strchr(old_display_name, '@')) {
+ purple_debug_info("oscar", "Cowardly refusing to attempt to format "
+ "screen name because the current formatting according to "
+ "the server (%s) appears to be an email address\n",
+ old_display_name);
+ return;
+ }
+
+ username = purple_account_get_username(purple_connection_get_account(gc));
+ if (oscar_util_name_compare(username, new_display_name)) {
+ purple_notify_error(gc, NULL, _("The new formatting is invalid."),
+ _("Username formatting can change only capitalization and whitespace."));
+ return;
+ }
+
+ tmp = g_strdup(new_display_name);
+
+ /*
+ * If our local username is an email address then strip off the domain.
+ * This allows formatting to work if the user entered their username as
+ * 'something at aim.com' or possibly other AOL-owned domains.
+ */
+ at_sign = strchr(tmp, '@');
+ if (at_sign)
+ at_sign[0] = '\0';
+
+ od = purple_connection_get_protocol_data(gc);
+ if (!flap_connection_getbytype(od, SNAC_FAMILY_ADMIN)) {
+ /* We don't have a connection to an "admin" server. Make one. */
+ od->setnick = TRUE;
+ g_free(od->newformatting);
+ od->newformatting = tmp;
+ aim_srv_requestnew(od, SNAC_FAMILY_ADMIN);
+ } else {
+ aim_admin_setnick(od, flap_connection_getbytype(od, SNAC_FAMILY_ADMIN), tmp);
+ g_free(tmp);
+ }
+}
+
static int purple_bosrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
PurpleConnection *gc;
PurpleAccount *account;
@@ -2860,12 +2906,13 @@ static int purple_bosrights(OscarData *o
serv_set_info(gc, purple_account_get_user_info(account));
username = purple_account_get_username(account);
- if (!od->icq && strcmp(username, purple_connection_get_display_name(gc)) != 0)
+ if (!od->icq && strcmp(username, purple_connection_get_display_name(gc)) != 0) {
/*
* Format the username for AIM accounts if it's different
* than what's currently set.
*/
oscar_format_username(gc, username);
+ }
/* Set our available message based on the current status */
status = purple_account_get_active_status(account);
@@ -5196,23 +5243,6 @@ oscar_show_icq_privacy_opts(PurplePlugin
gc);
}
-void oscar_format_username(PurpleConnection *gc, const char *nick) {
- OscarData *od = purple_connection_get_protocol_data(gc);
- if (!oscar_util_name_compare(purple_account_get_username(purple_connection_get_account(gc)), nick)) {
- if (!flap_connection_getbytype(od, SNAC_FAMILY_ADMIN)) {
- od->setnick = TRUE;
- g_free(od->newformatting);
- od->newformatting = g_strdup(nick);
- aim_srv_requestnew(od, SNAC_FAMILY_ADMIN);
- } else {
- aim_admin_setnick(od, flap_connection_getbytype(od, SNAC_FAMILY_ADMIN), nick);
- }
- } else {
- purple_notify_error(gc, NULL, _("The new formatting is invalid."),
- _("Username formatting can change only capitalization and whitespace."));
- }
-}
-
static void oscar_confirm_account(PurplePluginAction *action)
{
PurpleConnection *gc;
============================================================
--- libpurple/protocols/oscar/oscarcommon.h 0050276cd26a9c73649aa6f6837387eab4abe7f4
+++ libpurple/protocols/oscar/oscarcommon.h 0423983406abfc42493e28d62e09ecf9b5168856
@@ -102,6 +102,5 @@ gboolean oscar_offline_message(const Pur
void oscar_send_file(PurpleConnection *gc, const char *who, const char *file);
PurpleXfer *oscar_new_xfer(PurpleConnection *gc, const char *who);
gboolean oscar_offline_message(const PurpleBuddy *buddy);
-void oscar_format_username(PurpleConnection *gc, const char *nick);
GList *oscar_actions(PurplePlugin *plugin, gpointer context);
void oscar_init(PurplePlugin *plugin, gboolean is_icq);
More information about the Commits
mailing list