| 2846 void |
2846 void |
| 2847 msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
2847 msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
| 2848 { |
2848 { |
| 2849 MsimSession *session; |
2849 MsimSession *session; |
| 2850 MsimMessage *msg; |
2850 MsimMessage *msg; |
| 2851 MsimMessage *msg_blocklist; |
2851 MsimMessage *msg_persist; |
| 2852 MsimMessage *body; |
2852 MsimMessage *body; |
| 2853 |
2853 |
| 2854 session = (MsimSession *)gc->proto_data; |
2854 session = (MsimSession *)gc->proto_data; |
| 2855 purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", |
2855 purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", |
| 2856 buddy->name, (group && group->name) ? group->name : "(no group)"); |
2856 buddy->name, (group && group->name) ? group->name : "(no group)"); |
| 2880 "Visibility", MSIM_TYPE_INTEGER, 1, |
2880 "Visibility", MSIM_TYPE_INTEGER, 1, |
| 2881 "NickName", MSIM_TYPE_STRING, g_strdup(""), |
2881 "NickName", MSIM_TYPE_STRING, g_strdup(""), |
| 2882 "NameSelect", MSIM_TYPE_INTEGER, 0, |
2882 "NameSelect", MSIM_TYPE_INTEGER, 0, |
| 2883 NULL); |
2883 NULL); |
| 2884 |
2884 |
| 2885 /* Update blocklist. */ |
2885 /* TODO: Update blocklist. */ |
| 2886 msg_blocklist = msim_msg_new(TRUE, |
2886 |
| |
2887 #if 0 |
| |
2888 msg_persist = msim_msg_new(TRUE, |
| 2887 "persist", MSIM_TYPE_INTEGER, 1, |
2889 "persist", MSIM_TYPE_INTEGER, 1, |
| 2888 "sesskey", MSIM_TYPE_INTEGER, session->sesskey, |
2890 "sesskey", MSIM_TYPE_INTEGER, session->sesskey, |
| 2889 "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_PUT, |
2891 "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_PUT, |
| 2890 "dsn", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_DSN, |
2892 "dsn", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_DSN, |
| 2891 "lid", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_LID, |
2893 "lid", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_LID, |
| 2892 /* TODO: Use msim_new_reply_callback to get rid. */ |
2894 /* TODO: Use msim_new_reply_callback to get rid. */ |
| 2893 "rid", MSIM_TYPE_INTEGER, session->next_rid++, |
2895 "rid", MSIM_TYPE_INTEGER, session->next_rid++, |
| 2894 "body", MSIM_TYPE_DICTIONARY, body, |
2896 "body", MSIM_TYPE_DICTIONARY, body, |
| 2895 NULL); |
2897 NULL); |
| 2896 |
2898 |
| 2897 if (!msim_postprocess_outgoing(session, msg, buddy->name, "body", NULL)) |
2899 if (!msim_postprocess_outgoing(session, msg_persist, buddy->name, "body", NULL)) |
| 2898 { |
2900 { |
| 2899 purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("persist command failed")); |
2901 purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("persist command failed")); |
| 2900 msim_msg_free(msg_blocklist); |
2902 msim_msg_free(msg_persist); |
| 2901 return; |
2903 return; |
| 2902 } |
2904 } |
| 2903 msim_msg_free(msg_blocklist); |
2905 msim_msg_free(msg_persist); |
| |
2906 #endif |
| |
2907 |
| 2904 } |
2908 } |
| 2905 |
2909 |
| 2906 /** Perform actual postprocessing on a message, adding userid as specified. |
2910 /** Perform actual postprocessing on a message, adding userid as specified. |
| 2907 * |
2911 * |
| 2908 * @param msg The message to postprocess. |
2912 * @param msg The message to postprocess. |