void msn_session_destroy (MsnSession *session) { if (!session) return; pn_oim_session_free (session->oim_session); purple_signal_disconnect (purple_conversations_get_handle(), "conversation-created", session, PURPLE_CALLBACK (conversation_created_cb)); if (session->connected) msn_session_disconnect (session); #if defined(PECAN_CVR) g_hash_table_destroy (session->links); #endif /* defined(PECAN_CVR) */ msn_notification_destroy (session->notification); pn_dp_manager_free (session->dp_manager); g_hash_table_destroy (session->conversations); g_hash_table_destroy (session->chats); pn_contactlist_destroy (session->contactlist); g_free (session->passport_info.kv); g_free (session->passport_info.sid); g_free (session->passport_info.mspauth); g_free (session->passport_info.client_ip); g_free (session->passport_info.mail_url); g_free (session->passport_cookie.t); g_free (session->passport_cookie.p); if (session->autoupdate_tune.timer) g_source_remove (session->autoupdate_tune.timer); if (session->sync) msn_sync_destroy (session->sync); if (session->nexus) msn_nexus_destroy (session->nexus); pn_contact_free (session->user); g_hash_table_destroy (session->config); g_free (session->username); g_free (session->password); #ifdef INTERNAL_MAINLOOP purple_timeout_remove (session->g_main_loop_timer); g_main_loop_unref (session->g_main_loop); #endif g_free (session); }
void msn_session_destroy(MsnSession *session) { g_return_if_fail(session != NULL); session->destroying = TRUE; if (session->connected) msn_session_disconnect(session); if (session->soap_cleanup_handle) purple_timeout_remove(session->soap_cleanup_handle); if (session->soap_table != NULL) g_hash_table_destroy(session->soap_table); while (session->slplinks != NULL) msn_slplink_destroy(session->slplinks->data); while (session->switches != NULL) msn_switchboard_destroy(session->switches->data); if (session->sync != NULL) msn_sync_destroy(session->sync); if (session->oim != NULL) msn_oim_destroy(session->oim); if (session->nexus != NULL) msn_nexus_destroy(session->nexus); if (session->user != NULL) msn_user_destroy(session->user); if (session->notification != NULL) msn_notification_destroy(session->notification); msn_userlist_destroy(session->userlist); g_free(session->psm); g_free(session->abch_cachekey); #if 0 g_free(session->blocked_text); #endif g_free(session->passport_info.kv); g_free(session->passport_info.sid); g_free(session->passport_info.mspauth); g_free(session->passport_info.client_ip); g_free(session->passport_info.mail_url); g_free(session); }
void msn_session_destroy(MsnSession *session) { g_return_if_fail(session != NULL); session->destroying = TRUE; if (session->connected) msn_session_disconnect(session); if (session->notification != NULL) msn_notification_destroy(session->notification); while (session->switches != NULL) msn_switchboard_destroy(session->switches->data); while (session->slplinks != NULL) msn_slplink_destroy(session->slplinks->data); msn_userlist_destroy(session->userlist); g_free(session->passport_info.kv); g_free(session->passport_info.sid); g_free(session->passport_info.mspauth); g_free(session->passport_info.client_ip); if (session->passport_info.file != NULL) { g_unlink(session->passport_info.file); g_free(session->passport_info.file); } if (session->sync != NULL) msn_sync_destroy(session->sync); if (session->nexus != NULL) msn_nexus_destroy(session->nexus); if (session->user != NULL) msn_user_destroy(session->user); g_free(session); }
static void lsg_cmd (MsnCmdProc *cmdproc, MsnCommand *cmd) { MsnSession *session = cmdproc->session; char *name; const gchar *group_guid; name = pn_url_decode (cmd->params[0]); group_guid = cmd->params[1]; if (strcmp(name, MSN_NULL_GROUP_NAME) == 0) { pn_error("Invalid group name, ignoring"); goto leave; } pn_group_new (session->contactlist, name, group_guid); if (!purple_find_group (name)) { PurpleGroup *g = purple_group_new (name); purple_blist_add_group (g, NULL); } /* Group of ungroupped buddies */ if (!group_guid) { if (session->sync->total_users == 0) { cmdproc->cbs_table = session->sync->old_cbs_table; msn_session_finish_login (session); msn_sync_destroy (session->sync); session->sync = NULL; } } leave: g_free (name); }
static void lsg_cmd (MsnCmdProc *cmdproc, MsnCommand *cmd) { MsnSession *session = cmdproc->session; char *name; const gchar *group_guid; name = pn_url_decode (cmd->params[0]); group_guid = cmd->params[1]; pn_group_new (session->contactlist, name, group_guid); if (!purple_find_group (name)) { PurpleGroup *g = purple_group_new (name); purple_blist_add_group (g, NULL); } g_free (name); /* Group of ungroupped buddies */ if (!group_guid) { if (session->sync->total_users == 0) { cmdproc->cbs_table = session->sync->old_cbs_table; msn_session_finish_login (session); msn_sync_destroy (session->sync); session->sync = NULL; } return; } }
static void lst_cmd (MsnCmdProc *cmdproc, MsnCommand *cmd) { MsnSession *session = cmdproc->session; const gchar *passport = NULL; struct pn_contact *user; gchar *friendly = NULL; const gchar *user_guid = NULL; int list_op = -1; gint type; guint i; for (i = 0; i < cmd->param_count; i++) { const char *chopped_str; chopped_str = cmd->params[i] + 2; /* Check for Name/email. */ if (strncmp (cmd->params[i], "N=", 2) == 0) passport = chopped_str; /* Check for Friendlyname. */ else if (strncmp (cmd->params[i], "F=", 2) == 0) friendly = pn_url_decode (chopped_str); /* Check for Contact GUID. */ else if (strncmp (cmd->params[i], "C=", 2) == 0) user_guid = chopped_str; else break; } list_op = g_ascii_strtod (cmd->params[i++], NULL); type = g_ascii_strtod (cmd->params[i++], NULL); user = pn_contact_new (session->contactlist); pn_contact_set_passport (user, passport); pn_contact_set_guid (user, user_guid); session->sync->last_user = user; /* TODO: This can be improved */ if (list_op & MSN_LIST_FL_OP) { if (cmd->params[i]) { gchar **c; gchar **tokens; const gchar *group_guids; GSList *group_ids; group_guids = cmd->params[i]; group_ids = NULL; tokens = g_strsplit (group_guids, ",", -1); for (c = tokens; *c; c++) { group_ids = g_slist_append (group_ids, g_strdup (*c)); } g_strfreev (tokens); msn_got_lst_contact (session, user, friendly, list_op, group_ids); g_slist_foreach (group_ids, (GFunc) g_free, NULL); g_slist_free (group_ids); } else { msn_got_lst_contact (session, user, friendly, list_op, NULL); } } else { msn_got_lst_contact (session, user, friendly, list_op, NULL); } g_free (friendly); session->sync->num_users++; if (session->sync->num_users == session->sync->total_users) { cmdproc->cbs_table = session->sync->old_cbs_table; msn_session_finish_login (session); msn_sync_destroy (session->sync); session->sync = NULL; } }
static void lst_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { MsnSession *session = cmdproc->session; char *passport = NULL; const char *friend = NULL; int list_op; MsnUser *user; passport = cmd->params[0]; friend = gaim_url_decode(cmd->params[1]); list_op = atoi(cmd->params[2]); user = msn_user_new(session->userlist, passport, friend); msn_userlist_add_user(session->userlist, user); session->sync->last_user = user; /* TODO: This can be improved */ if (list_op & MSN_LIST_FL_OP) { char **c; char **tokens; const char *group_nums; GSList *group_ids; group_nums = cmd->params[3]; group_ids = NULL; tokens = g_strsplit(group_nums, ",", -1); for (c = tokens; *c != NULL; c++) { int id; id = atoi(*c); group_ids = g_slist_append(group_ids, GINT_TO_POINTER(id)); } g_strfreev(tokens); msn_got_lst_user(session, user, list_op, group_ids); g_slist_free(group_ids); } else { msn_got_lst_user(session, user, list_op, NULL); } session->sync->num_users++; if (session->sync->num_users == session->sync->total_users) { cmdproc->cbs_table = session->sync->old_cbs_table; msn_session_finish_login(session); msn_sync_destroy(session->sync); session->sync = NULL; } }