13255
|
1 /*
|
|
2 * Gaim's oscar protocol plugin
|
|
3 * This file is the legal property of its developers.
|
|
4 * Please see the AUTHORS file distributed alongside this file.
|
|
5 *
|
|
6 * This library is free software; you can redistribute it and/or
|
|
7 * modify it under the terms of the GNU Lesser General Public
|
|
8 * License as published by the Free Software Foundation; either
|
|
9 * version 2 of the License, or (at your option) any later version.
|
|
10 *
|
|
11 * This library is distributed in the hope that it will be useful,
|
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 * Lesser General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU Lesser General Public
|
|
17 * License along with this library; if not, write to the Free Software
|
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 */
|
|
20
|
|
21 #include "oscar.h"
|
|
22
|
|
23 /**
|
|
24 * Allocates a new OscarSession and initializes it with default values.
|
|
25 */
|
|
26 OscarSession *
|
|
27 oscar_session_new(void)
|
|
28 {
|
|
29 OscarSession *sess;
|
|
30
|
13261
|
31 sess = g_new0(OscarSession, 1);
|
13255
|
32
|
|
33 aim_initsnachash(sess);
|
|
34 sess->snacid_next = 0x00000001;
|
|
35
|
|
36 /*
|
|
37 * This must always be set. Default to the queue-based
|
|
38 * version for back-compatibility.
|
|
39 */
|
|
40 aim_tx_setenqueue(sess, AIM_TX_QUEUED, NULL);
|
|
41
|
|
42 /*
|
|
43 * Register all the modules for this session...
|
|
44 */
|
|
45 aim__registermodule(sess, misc_modfirst); /* load the catch-all first */
|
|
46 aim__registermodule(sess, service_modfirst);
|
|
47 aim__registermodule(sess, locate_modfirst);
|
|
48 aim__registermodule(sess, buddylist_modfirst);
|
|
49 aim__registermodule(sess, msg_modfirst);
|
|
50 aim__registermodule(sess, adverts_modfirst);
|
|
51 aim__registermodule(sess, invite_modfirst);
|
|
52 aim__registermodule(sess, admin_modfirst);
|
|
53 aim__registermodule(sess, popups_modfirst);
|
|
54 aim__registermodule(sess, bos_modfirst);
|
|
55 aim__registermodule(sess, search_modfirst);
|
|
56 aim__registermodule(sess, stats_modfirst);
|
|
57 aim__registermodule(sess, translate_modfirst);
|
|
58 aim__registermodule(sess, chatnav_modfirst);
|
|
59 aim__registermodule(sess, chat_modfirst);
|
|
60 aim__registermodule(sess, odir_modfirst);
|
|
61 aim__registermodule(sess, bart_modfirst);
|
|
62 /* missing 0x11 - 0x12 */
|
|
63 aim__registermodule(sess, ssi_modfirst);
|
|
64 /* missing 0x14 */
|
|
65 aim__registermodule(sess, icq_modfirst);
|
|
66 /* missing 0x16 */
|
|
67 aim__registermodule(sess, auth_modfirst);
|
|
68 aim__registermodule(sess, email_modfirst);
|
|
69
|
|
70 return sess;
|
|
71 }
|
|
72
|
|
73 /**
|
|
74 * Logoff and deallocate a session.
|
|
75 *
|
|
76 * @param sess Session to kill
|
|
77 */
|
|
78 void
|
|
79 oscar_session_destroy(OscarSession *sess)
|
|
80 {
|
|
81 aim_cleansnacs(sess, -1);
|
|
82
|
|
83 while (sess->oscar_connections != NULL)
|
|
84 oscar_connection_destroy(sess, sess->oscar_connections->data);
|
|
85
|
|
86 aim__shutdownmodules(sess);
|
|
87
|
|
88 g_free(sess);
|
|
89 }
|