comparison libpurple/protocols/oscar/oscar.c @ 15680:cad32dba756b

Automatically format screenname to account->username
author Sean Egan <seanegan@gmail.com>
date Thu, 22 Feb 2007 23:32:39 +0000
parents 5ec709327dc6
children f403bc58ba07
comparison
equal deleted inserted replaced
15679:5ec709327dc6 15680:cad32dba756b
199 199
200 static void recent_buddies_cb(const char *name, GaimPrefType type, gconstpointer value, gpointer data); 200 static void recent_buddies_cb(const char *name, GaimPrefType type, gconstpointer value, gpointer data);
201 void oscar_set_info(GaimConnection *gc, const char *info); 201 void oscar_set_info(GaimConnection *gc, const char *info);
202 static void oscar_set_info_and_status(GaimAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, GaimStatus *status); 202 static void oscar_set_info_and_status(GaimAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, GaimStatus *status);
203 static void oscar_set_extendedstatus(GaimConnection *gc); 203 static void oscar_set_extendedstatus(GaimConnection *gc);
204 static void oscar_format_screenname(GaimConnection *gc, const char *nick);
204 static gboolean gaim_ssi_rerequestdata(gpointer data); 205 static gboolean gaim_ssi_rerequestdata(gpointer data);
205 206
206 static void oscar_free_name_data(struct name_data *data) { 207 static void oscar_free_name_data(struct name_data *data) {
207 g_free(data->name); 208 g_free(data->name);
208 g_free(data->nick); 209 g_free(data->nick);
3589 aim_clientready(od, conn); 3590 aim_clientready(od, conn);
3590 3591
3591 if (gaim_account_get_user_info(account) != NULL) 3592 if (gaim_account_get_user_info(account) != NULL)
3592 serv_set_info(gc, gaim_account_get_user_info(account)); 3593 serv_set_info(gc, gaim_account_get_user_info(account));
3593 3594
3595 oscar_format_screenname(gc, account->username);
3596
3594 /* Set our available message based on the current status */ 3597 /* Set our available message based on the current status */
3595 status = gaim_account_get_active_status(account); 3598 status = gaim_account_get_active_status(account);
3596 if (gaim_status_is_available(status)) 3599 if (gaim_status_is_available(status))
3597 message = gaim_status_get_attr_string(status, "message"); 3600 message = gaim_status_get_attr_string(status, "message");
3598 else 3601 else
4002 } 4005 }
4003 gaim_notify_error(gc, NULL, dialog_top, dialog_msg); 4006 gaim_notify_error(gc, NULL, dialog_top, dialog_msg);
4004 g_free(dialog_top); 4007 g_free(dialog_top);
4005 g_free(dialog_msg); 4008 g_free(dialog_msg);
4006 return 1; 4009 return 1;
4007 }
4008
4009 if (sn != NULL) {
4010 char *dialog_msg = g_strdup_printf(_("Your screen name is currently formatted as follows:\n%s"), sn);
4011 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg);
4012 g_free(dialog_msg);
4013 } 4010 }
4014 4011
4015 if (email != NULL) { 4012 if (email != NULL) {
4016 char *dialog_msg = g_strdup_printf(_("The e-mail address for %s is %s"), 4013 char *dialog_msg = g_strdup_printf(_("The e-mail address for %s is %s"),
4017 gaim_account_get_username(gaim_connection_get_account(gc)), email); 4014 gaim_account_get_username(gaim_connection_get_account(gc)), email);
6032 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), 6029 gaim_notify_error(gc, NULL, _("The new formatting is invalid."),
6033 _("Screen name formatting can change only capitalization and whitespace.")); 6030 _("Screen name formatting can change only capitalization and whitespace."));
6034 } 6031 }
6035 } 6032 }
6036 6033
6037 static void oscar_show_format_screenname(GaimPluginAction *action)
6038 {
6039 GaimConnection *gc = (GaimConnection *) action->context;
6040 gaim_request_input(gc, NULL, _("New screen name formatting:"), NULL,
6041 gaim_connection_get_display_name(gc), FALSE, FALSE, NULL,
6042 _("_OK"), G_CALLBACK(oscar_format_screenname),
6043 _("_Cancel"), NULL,
6044 gc);
6045 }
6046
6047 static void oscar_confirm_account(GaimPluginAction *action) 6034 static void oscar_confirm_account(GaimPluginAction *action)
6048 { 6035 {
6049 GaimConnection *gc; 6036 GaimConnection *gc;
6050 OscarData *od; 6037 OscarData *od;
6051 FlapConnection *conn; 6038 FlapConnection *conn;
6363 menu = g_list_prepend(menu, act); 6350 menu = g_list_prepend(menu, act);
6364 } 6351 }
6365 else 6352 else
6366 { 6353 {
6367 /* AIM actions */ 6354 /* AIM actions */
6368 act = gaim_plugin_action_new(_("Format Screen Name..."),
6369 oscar_show_format_screenname);
6370 menu = g_list_prepend(menu, act);
6371
6372 act = gaim_plugin_action_new(_("Confirm Account"), 6355 act = gaim_plugin_action_new(_("Confirm Account"),
6373 oscar_confirm_account); 6356 oscar_confirm_account);
6374 menu = g_list_prepend(menu, act); 6357 menu = g_list_prepend(menu, act);
6375 6358
6376 act = gaim_plugin_action_new(_("Display Currently Registered E-Mail Address"), 6359 act = gaim_plugin_action_new(_("Display Currently Registered E-Mail Address"),