Mercurial > pidgin
view src/protocols/msn/session.c @ 9969:cc2e6dd43613
[gaim-migrate @ 10879]
(21:35:19) nosnilmot: LSchiere: gaim_blist_add_group() should not really be
#if 0'd out... does that need a patch?
(21:35:38) LSchiere: why is it #if 0'ed?
(21:35:50) nosnilmot: merging error afaict
(21:35:52) interalia: datallah: talking to yourself is OK. it's when you
answer that it becomes a problem...
(21:35:54) LSchiere: i'm assuming it was done for a reason, temporary as
that reason might be
(21:36:04) nosnilmot: it's not #if 0'd in chip's svn tree
(21:36:08) LSchiere: oddness
(21:36:16) interalia: cvs annotate to the rescue!
(21:36:23) LSchiere: was that part of datallah's patch failure handle
patch?
(21:36:49) datallah: yeah... i'm confused as to how it happened, but the
first part happened during the plain merge and the #endif i added during
the .rej cleanup iirc
(21:37:31) nosnilmot: yup, datallah's right :) I suspect the #if 0 came in
because "patch" was trying to "help"
(21:37:47) LSchiere: okay, let's see what happens without that
(21:38:11) nosnilmot: "it works a lot better and doesn't eat as many buddy
lists for breakfast"
(21:38:12) datallah: it definitely needs to not be commented out
it compiles uncommented, so we'll go with their opinion
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Wed, 08 Sep 2004 01:38:38 +0000 |
| parents | ab6636c5a136 |
| children | 86a6d78b070b |
line wrap: on
line source
/** * @file session.c MSN session functions * * gaim * * Gaim is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * source distribution. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "msn.h" #include "session.h" #include "notification.h" #include "slplink.h" MsnSession * msn_session_new(GaimAccount *account, const char *host, int port, gboolean http_method) { MsnSession *session; g_return_val_if_fail(account != NULL, NULL); session = g_new0(MsnSession, 1); session->account = account; session->dispatch_host = g_strdup(host); session->dispatch_port = port; session->http_method = http_method; session->notification = msn_notification_new(session); session->userlist = msn_userlist_new(session); session->protocol_ver = 9; return session; } void msn_session_destroy(MsnSession *session) { g_return_if_fail(session != NULL); if (session->connected) msn_session_disconnect(session); if (session->dispatch_host != NULL) g_free(session->dispatch_host); 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); if (session->passport_info.kv != NULL) g_free(session->passport_info.kv); if (session->passport_info.sid != NULL) g_free(session->passport_info.sid); if (session->passport_info.mspauth != NULL) g_free(session->passport_info.mspauth); if (session->passport_info.file != NULL) g_free(session->passport_info.file); if (session->sync != NULL) msn_sync_destroy(session->sync); if (session->nexus != NULL) msn_nexus_destroy(session->nexus); g_free(session); } gboolean msn_session_connect(MsnSession *session) { g_return_val_if_fail(session != NULL, FALSE); g_return_val_if_fail(!session->connected, TRUE); session->connected = TRUE; if (msn_notification_connect(session->notification, session->dispatch_host, session->dispatch_port)) { return TRUE; } return FALSE; } void msn_session_disconnect(MsnSession *session) { g_return_if_fail(session != NULL); g_return_if_fail(session->connected); while (session->switches != NULL) msn_switchboard_destroy(session->switches->data); if (session->notification != NULL) msn_notification_disconnect(session->notification); } /* TODO: This must go away when conversation is redesigned */ MsnSwitchBoard * msn_session_find_swboard(MsnSession *session, const char *username) { GList *l; g_return_val_if_fail(session != NULL, NULL); g_return_val_if_fail(username != NULL, NULL); for (l = session->switches; l != NULL; l = l->next) { MsnSwitchBoard *swboard; swboard = l->data; if (swboard->im_user != NULL) if (!strcmp(username, swboard->im_user)) return swboard; } return NULL; } MsnSwitchBoard * msn_session_find_switch_with_id(const MsnSession *session, int chat_id) { GList *l; g_return_val_if_fail(session != NULL, NULL); g_return_val_if_fail(chat_id >= 0, NULL); for (l = session->switches; l != NULL; l = l->next) { MsnSwitchBoard *swboard; swboard = l->data; if (swboard->chat_id == chat_id) return swboard; } return NULL; } MsnSwitchBoard * msn_session_get_swboard(MsnSession *session, const char *username) { MsnSwitchBoard *swboard; swboard = msn_session_find_swboard(session, username); if (swboard == NULL) { swboard = msn_switchboard_new(session); msn_switchboard_request(swboard); msn_switchboard_request_add_user(swboard, username); swboard->im_user = g_strdup(username); } return swboard; }
