Mercurial > pidgin
diff libpurple/protocols/msn/msn.c @ 29276:a0668fbf2483
Manual merge
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Mon, 02 Mar 2009 21:53:53 +0000 |
parents | 4561aa5b368c |
children | 68f6de7d1408 |
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c Mon Mar 02 21:52:16 2009 +0000 +++ b/libpurple/protocols/msn/msn.c Mon Mar 02 21:53:53 2009 +0000 @@ -162,9 +162,7 @@ username = purple_conversation_get_name(conv); purple_prpl_send_attention(gc, username, MSN_NUDGE); - purple_conversation_attention(conv, username, 0, PURPLE_MESSAGE_SEND, - time(NULL)); - + return PURPLE_CMD_RET_OK; } @@ -459,23 +457,27 @@ PurpleConnection *gc; MsnSession *session; MsnMobileData *data; + PurpleAccount *account; + const char *name; g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); + name = purple_buddy_get_name(buddy); session = gc->proto_data; data = g_new0(MsnMobileData, 1); data->gc = gc; - data->passport = buddy->name; + data->passport = name; purple_request_input(gc, NULL, _("Send a mobile message."), NULL, NULL, TRUE, FALSE, NULL, _("Page"), G_CALLBACK(send_to_mobile_cb), _("Close"), G_CALLBACK(close_mobile_page_cb), - purple_connection_get_account(gc), purple_buddy_get_name(buddy), NULL, + account, name, NULL, data); } @@ -507,6 +509,7 @@ { PurpleBuddy *buddy; PurpleConnection *gc; + PurpleAccount *account; MsnSession *session; MsnSwitchBoard *swboard; @@ -516,13 +519,14 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); session = gc->proto_data; swboard = msn_switchboard_new(session); msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, buddy->name); + msn_switchboard_request_add_user(swboard, purple_buddy_get_name(buddy)); /* TODO: This might move somewhere else, after USR might be */ swboard->chat_id = msn_switchboard_get_chat_id(); @@ -530,9 +534,9 @@ swboard->flag = MSN_SB_FLAG_IM; /* Local alias > Display name > Username */ - if ((alias = purple_account_get_alias(buddy->account)) == NULL) + if ((alias = purple_account_get_alias(account)) == NULL) if ((alias = purple_connection_get_display_name(gc)) == NULL) - alias = purple_account_get_username(buddy->account); + alias = purple_account_get_username(account); purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), alias, NULL, PURPLE_CBFLAGS_NONE, TRUE); @@ -615,7 +619,7 @@ static const char * msn_list_emblems(PurpleBuddy *b) { - MsnUser *user = b->proto_data; + MsnUser *user = purple_buddy_get_protocol_data(b); if (user != NULL) { if (user->clientid & MSN_CLIENT_CAP_BOT) @@ -696,7 +700,7 @@ PurplePresence *presence = purple_buddy_get_presence(buddy); PurpleStatus *status = purple_presence_get_active_status(presence); - user = buddy->proto_data; + user = purple_buddy_get_protocol_data(buddy); if (purple_presence_is_online(presence)) { @@ -939,7 +943,7 @@ g_return_val_if_fail(buddy != NULL, NULL); - user = buddy->proto_data; + user = purple_buddy_get_protocol_data(buddy); if (user != NULL) { @@ -952,8 +956,8 @@ } } - if (g_ascii_strcasecmp(buddy->name, - purple_account_get_username(buddy->account))) + if (g_ascii_strcasecmp(purple_buddy_get_name(buddy), + purple_account_get_username(purple_buddy_get_account(buddy)))) { act = purple_menu_action_new(_("Initiate _Chat"), PURPLE_CALLBACK(initiate_chat_cb), @@ -1432,14 +1436,15 @@ { MsnSession *session; MsnUserList *userlist; - const char *who; + const char *who, *gname; MsnUser *user; session = gc->proto_data; userlist = session->userlist; - who = msn_normalize(gc->account, buddy->name); - - purple_debug_info("msn", "Add user:%s to group:%s\n", who, (group && group->name) ? group->name : "(null)"); + who = msn_normalize(purple_connection_get_account(gc), purple_buddy_get_name(buddy)); + + gname = group ? purple_group_get_name(group) : NULL; + purple_debug_info("msn", "Add user:%s to group:%s\n", who, gname ? gname : "(null)"); if (!session->logged_in) { #if 0 @@ -1466,11 +1471,20 @@ if ((user != NULL) && (user->networkid != MSN_NETWORK_UNKNOWN)) { /* We already know this buddy and their network. This function knows what to do with users already in the list and stuff... */ - msn_userlist_add_buddy(userlist, who, group ? group->name : NULL); + msn_userlist_add_buddy(userlist, who, gname); } else { + char **tokens; + char *fqy; /* We need to check the network for this buddy first */ - msn_userlist_save_pending_buddy(userlist, who, group ? group->name : NULL); - msn_notification_send_fqy(session, who); + msn_userlist_save_pending_buddy(userlist, who, gname); + tokens = g_strsplit(who, "@", 2); + fqy = g_strdup_printf("<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>", + tokens[1], + tokens[0]); + msn_notification_send_fqy(session, fqy, strlen(fqy), + (MsnFqyCb)msn_userlist_add_pending_buddy); + g_free(fqy); + g_strfreev(tokens); } } @@ -1487,7 +1501,7 @@ return; /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */ - msn_userlist_rem_buddy(userlist, buddy->name); + msn_userlist_rem_buddy(userlist, purple_buddy_get_name(buddy)); } static void @@ -1740,20 +1754,22 @@ PurpleGroup *group, GList *moved_buddies) { MsnSession *session; + const char *gname; session = gc->proto_data; g_return_if_fail(session != NULL); g_return_if_fail(session->userlist != NULL); + gname = purple_group_get_name(group); if (msn_userlist_find_group_with_name(session->userlist, old_name) != NULL) { - msn_contact_rename_group(session, old_name, group->name); + msn_contact_rename_group(session, old_name, gname); } else { /* not found */ - msn_add_group(session, NULL, group->name); + msn_add_group(session, NULL, gname); } } @@ -1813,20 +1829,22 @@ { MsnSession *session; MsnCmdProc *cmdproc; + const char *gname; session = gc->proto_data; cmdproc = session->notification->cmdproc; - - purple_debug_info("msn", "Remove group %s\n", group->name); + gname = purple_group_get_name(group); + + purple_debug_info("msn", "Remove group %s\n", gname); /*we can't delete the default group*/ - if(!strcmp(group->name, MSN_INDIVIDUALS_GROUP_NAME)|| - !strcmp(group->name, MSN_NON_IM_GROUP_NAME)) + if(!strcmp(gname, MSN_INDIVIDUALS_GROUP_NAME)|| + !strcmp(gname, MSN_NON_IM_GROUP_NAME)) { purple_debug_info("msn", "This group can't be removed, returning.\n"); return ; } - msn_del_group(session, group->name); + msn_del_group(session, gname); } /** @@ -1843,17 +1861,19 @@ if (b) { char *tmp; - - if (b->alias && b->alias[0]) + const char *alias; + + alias = purple_buddy_get_local_buddy_alias(b); + if (alias && alias[0]) { - char *aliastext = g_markup_escape_text(b->alias, -1); + char *aliastext = g_markup_escape_text(alias, -1); purple_notify_user_info_add_pair(user_info, _("Alias"), aliastext); g_free(aliastext); } - if (b->server_alias) + if ((alias = purple_buddy_get_server_alias(b)) != NULL) { - char *nicktext = g_markup_escape_text(b->server_alias, -1); + char *nicktext = g_markup_escape_text(alias, -1); tmp = g_strdup_printf("<font sml=\"msn\">%s</font>", nicktext); purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); g_free(tmp);