comparison libpurple/protocols/oscar/oscar.c @ 20300:96a6a9eef15b

applied changes from 2ab75e32c52e94c674d0b5a396d224da7e9d509e through 3829f989342d787500e9abe363c89909db102f4b
author Luke Schierer <lschiere@pidgin.im>
date Fri, 19 Oct 2007 16:27:50 +0000
parents d00e53fd9e88
children 233c423d40d3
comparison
equal deleted inserted replaced
20299:62d0c7885618 20300:96a6a9eef15b
2182 static void 2182 static void
2183 purple_auth_request(struct name_data *data, char *msg) 2183 purple_auth_request(struct name_data *data, char *msg)
2184 { 2184 {
2185 PurpleConnection *gc; 2185 PurpleConnection *gc;
2186 OscarData *od; 2186 OscarData *od;
2187 PurpleAccount *account;
2187 PurpleBuddy *buddy; 2188 PurpleBuddy *buddy;
2188 PurpleGroup *group; 2189 PurpleGroup *group;
2189 2190
2190 gc = data->gc; 2191 gc = data->gc;
2191 od = gc->proto_data; 2192 od = gc->proto_data;
2192 buddy = purple_find_buddy(purple_connection_get_account(gc), data->name); 2193 account = purple_connection_get_account(gc);
2194 buddy = purple_find_buddy(account, data->name);
2193 if (buddy != NULL) 2195 if (buddy != NULL)
2194 group = purple_buddy_get_group(buddy); 2196 group = purple_buddy_get_group(buddy);
2195 else 2197 else
2196 group = NULL; 2198 group = NULL;
2197 2199
2199 { 2201 {
2200 purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n", 2202 purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n",
2201 buddy->name, group->name); 2203 buddy->name, group->name);
2202 aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); 2204 aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list."));
2203 if (!aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) 2205 if (!aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))
2206 {
2204 aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE); 2207 aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE);
2208
2209 /* Mobile users should always be online */
2210 if (buddy->name[0] == '+') {
2211 purple_prpl_got_user_status(account,
2212 purple_buddy_get_name(buddy),
2213 OSCAR_STATUS_ID_AVAILABLE, NULL);
2214 purple_prpl_got_user_status(account,
2215 purple_buddy_get_name(buddy),
2216 OSCAR_STATUS_ID_MOBILE, NULL);
2217 }
2218 }
2205 } 2219 }
2206 } 2220 }
2207 2221
2208 static void 2222 static void
2209 purple_auth_dontrequest(struct name_data *data) 2223 purple_auth_dontrequest(struct name_data *data)
4619 } 4633 }
4620 #endif 4634 #endif
4621 4635
4622 void 4636 void
4623 oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { 4637 oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {
4624 OscarData *od = (OscarData *)gc->proto_data; 4638 OscarData *od;
4639 PurpleAccount *account;
4640
4641 od = (OscarData *)gc->proto_data;
4642 account = purple_connection_get_account(gc);
4625 4643
4626 if (!aim_snvalid(buddy->name)) { 4644 if (!aim_snvalid(buddy->name)) {
4627 gchar *buf; 4645 gchar *buf;
4628 buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid. Screen names must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name); 4646 buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid. Screen names must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name);
4629 if (!purple_conv_present_error(buddy->name, purple_connection_get_account(gc), buf)) 4647 if (!purple_conv_present_error(buddy->name, account, buf))
4630 purple_notify_error(gc, NULL, _("Unable To Add"), buf); 4648 purple_notify_error(gc, NULL, _("Unable To Add"), buf);
4631 g_free(buf); 4649 g_free(buf);
4632 4650
4633 /* Remove from local list */ 4651 /* Remove from local list */
4634 purple_blist_remove_buddy(buddy); 4652 purple_blist_remove_buddy(buddy);
4638 4656
4639 if ((od->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))) { 4657 if ((od->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))) {
4640 purple_debug_info("oscar", 4658 purple_debug_info("oscar",
4641 "ssi: adding buddy %s to group %s\n", buddy->name, group->name); 4659 "ssi: adding buddy %s to group %s\n", buddy->name, group->name);
4642 aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); 4660 aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0);
4661
4662 /* Mobile users should always be online */
4663 if (buddy->name[0] == '+') {
4664 purple_prpl_got_user_status(account,
4665 purple_buddy_get_name(buddy),
4666 OSCAR_STATUS_ID_AVAILABLE, NULL);
4667 purple_prpl_got_user_status(account,
4668 purple_buddy_get_name(buddy),
4669 OSCAR_STATUS_ID_MOBILE, NULL);
4670 }
4643 } 4671 }
4644 4672
4645 /* XXX - Should this be done from AIM accounts, as well? */ 4673 /* XXX - Should this be done from AIM accounts, as well? */
4646 if (od->icq) 4674 if (od->icq)
4647 aim_icq_getalias(od, buddy->name); 4675 aim_icq_getalias(od, buddy->name);
4953 { 4981 {
4954 purple_check_comment(od, comment); 4982 purple_check_comment(od, comment);
4955 g_free(comment); 4983 g_free(comment);
4956 } 4984 }
4957 } 4985 }
4986
4987 /* Mobile users should always be online */
4988 if (b->name[0] == '+') {
4989 purple_prpl_got_user_status(account,
4990 purple_buddy_get_name(b),
4991 OSCAR_STATUS_ID_AVAILABLE, NULL);
4992 purple_prpl_got_user_status(account,
4993 purple_buddy_get_name(b),
4994 OSCAR_STATUS_ID_MOBILE, NULL);
4995 }
4996
4958 g_free(gname_utf8); 4997 g_free(gname_utf8);
4959 g_free(alias_utf8); 4998 g_free(alias_utf8);
4960 } 4999 }
4961 } break; 5000 } break;
4962 5001
5143 } 5182 }
5144 5183
5145 purple_debug_info("oscar", 5184 purple_debug_info("oscar",
5146 "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); 5185 "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans"));
5147 purple_blist_add_buddy(b, NULL, g, NULL); 5186 purple_blist_add_buddy(b, NULL, g, NULL);
5187
5188 /* Mobile users should always be online */
5189 if (b->name[0] == '+') {
5190 purple_prpl_got_user_status(account,
5191 purple_buddy_get_name(b),
5192 OSCAR_STATUS_ID_AVAILABLE, NULL);
5193 purple_prpl_got_user_status(account,
5194 purple_buddy_get_name(b),
5195 OSCAR_STATUS_ID_MOBILE, NULL);
5196 }
5197
5148 } 5198 }
5149 5199
5150 g_free(gname_utf8); 5200 g_free(gname_utf8);
5151 g_free(alias_utf8); 5201 g_free(alias_utf8);
5152 5202