comparison src/protocols/oscar/oscar.c @ 13875:eb20e674ccf2

[gaim-migrate @ 16349] Three changes: 1. When you try to sign on with an oscar screen name that is not valid ("123abc" for example), the PRPL will set gc->wants_to_die to TRUE so that the account will not be auto-reconnected. 2. When we get an AIM userinfo packet about someone in our buddy list, if the person has some kind of screen name formatting set ("Mark Doliner" instead of "markdoliner") then we set the buddies server_nick to that formatted name. 3. Add a "Get AIM Info" to the context menu for ICQ buddies who are in the buddy list of an ICQ user. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 26 Jun 2006 09:03:54 +0000
parents 77a50840d9e2
children cab785a7c766
comparison
equal deleted inserted replaced
13874:77b43a898629 13875:eb20e674ccf2
1223 gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc); 1223 gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc);
1224 1224
1225 if (!aim_snvalid(gaim_account_get_username(account))) { 1225 if (!aim_snvalid(gaim_account_get_username(account))) {
1226 gchar *buf; 1226 gchar *buf;
1227 buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), gaim_account_get_username(account)); 1227 buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), gaim_account_get_username(account));
1228 gc->wants_to_die = TRUE;
1228 gaim_connection_error(gc, buf); 1229 gaim_connection_error(gc, buf);
1229 g_free(buf); 1230 g_free(buf);
1230 } 1231 }
1231 1232
1232 if (aim_sn_is_icq((gaim_account_get_username(account)))) { 1233 if (aim_sn_is_icq((gaim_account_get_username(account)))) {
2913 2914
2914 b = gaim_find_buddy(gaim_connection_get_account(gc), userinfo->sn); 2915 b = gaim_find_buddy(gaim_connection_get_account(gc), userinfo->sn);
2915 if (b == NULL) 2916 if (b == NULL)
2916 return 1; 2917 return 1;
2917 2918
2919 if (strcmp(gaim_buddy_get_name(b), userinfo->sn))
2920 serv_got_alias(gc, gaim_buddy_get_name(b), userinfo->sn);
2921 else
2922 serv_got_alias(gc, gaim_buddy_get_name(b), NULL);
2923
2918 presence = gaim_buddy_get_presence(b); 2924 presence = gaim_buddy_get_presence(b);
2919 status = gaim_presence_get_active_status(presence); 2925 status = gaim_presence_get_active_status(presence);
2920 2926
2921 if (!gaim_status_is_available(status) && gaim_status_is_online(status)) 2927 if (!gaim_status_is_available(status) && gaim_status_is_online(status))
2922 { 2928 {
4225 return 1; 4231 return 1;
4226 4232
4227 return ret; 4233 return ret;
4228 } 4234 }
4229 4235
4236 /*
4237 * As of 26 June 2006, ICQ users can request AIM info from
4238 * everyone, and can request ICQ info from ICQ users, and
4239 * AIM users can only request AIM info.
4240 */
4230 static void oscar_get_info(GaimConnection *gc, const char *name) { 4241 static void oscar_get_info(GaimConnection *gc, const char *name) {
4231 OscarData *od = (OscarData *)gc->proto_data; 4242 OscarData *od = (OscarData *)gc->proto_data;
4232 4243
4233 if (od->icq && aim_sn_is_icq(name)) 4244 if (od->icq && aim_sn_is_icq(name))
4234 aim_icq_getallinfo(od, name); 4245 aim_icq_getallinfo(od, name);
5758 _("_Connect"), G_CALLBACK(oscar_ask_directim_yes_cb), 5769 _("_Connect"), G_CALLBACK(oscar_ask_directim_yes_cb),
5759 _("Cancel"), G_CALLBACK(oscar_ask_directim_no_cb)); 5770 _("Cancel"), G_CALLBACK(oscar_ask_directim_no_cb));
5760 g_free(buf); 5771 g_free(buf);
5761 } 5772 }
5762 5773
5774 static void
5775 oscar_get_aim_info_cb(GaimBlistNode *node, gpointer ignore)
5776 {
5777 GaimBuddy *buddy;
5778 GaimConnection *gc;
5779
5780 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
5781
5782 buddy = (GaimBuddy *)node;
5783 gc = gaim_account_get_connection(buddy->account);
5784
5785 aim_locate_getinfoshort(gc->proto_data, gaim_buddy_get_name(buddy), 0x00000003);
5786 }
5787
5763 static GList *oscar_buddy_menu(GaimBuddy *buddy) { 5788 static GList *oscar_buddy_menu(GaimBuddy *buddy) {
5764 5789
5765 GaimConnection *gc; 5790 GaimConnection *gc;
5766 OscarData *od; 5791 OscarData *od;
5767 GList *m; 5792 GList *m;
5770 5795
5771 gc = gaim_account_get_connection(buddy->account); 5796 gc = gaim_account_get_connection(buddy->account);
5772 od = gc->proto_data; 5797 od = gc->proto_data;
5773 userinfo = aim_locate_finduserinfo(od, buddy->name); 5798 userinfo = aim_locate_finduserinfo(od, buddy->name);
5774 m = NULL; 5799 m = NULL;
5800
5801 if (od->icq && aim_sn_is_icq(gaim_buddy_get_name(buddy)))
5802 {
5803 act = gaim_menu_action_new(_("Get AIM Info"),
5804 GAIM_CALLBACK(oscar_get_aim_info_cb),
5805 NULL, NULL);
5806 m = g_list_append(m, act);
5807 }
5775 5808
5776 act = gaim_menu_action_new(_("Edit Buddy Comment"), 5809 act = gaim_menu_action_new(_("Edit Buddy Comment"),
5777 GAIM_CALLBACK(oscar_buddycb_edit_comment), 5810 GAIM_CALLBACK(oscar_buddycb_edit_comment),
5778 NULL, NULL); 5811 NULL, NULL);
5779 m = g_list_append(m, act); 5812 m = g_list_append(m, act);