|
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
|
|
|
31 sess = g_new(OscarSession, 1);
|
|
|
32
|
|
|
33 sess->queue_outgoing = NULL;
|
|
|
34 sess->queue_incoming = NULL;
|
|
|
35 aim_initsnachash(sess);
|
|
|
36 sess->msgcookies = NULL;
|
|
|
37 sess->modlistv = NULL;
|
|
|
38 sess->snacid_next = 0x00000001;
|
|
|
39
|
|
|
40 sess->locate.userinfo = NULL;
|
|
|
41 sess->locate.torequest = NULL;
|
|
|
42 sess->locate.requested = NULL;
|
|
|
43 sess->locate.waiting_for_response = FALSE;
|
|
|
44 sess->ssi.received_data = 0;
|
|
|
45 sess->ssi.numitems = 0;
|
|
|
46 sess->ssi.official = NULL;
|
|
|
47 sess->ssi.local = NULL;
|
|
|
48 sess->ssi.pending = NULL;
|
|
|
49 sess->ssi.timestamp = (time_t)0;
|
|
|
50 sess->ssi.waiting_for_ack = 0;
|
|
|
51 sess->icq_info = NULL;
|
|
|
52 sess->authinfo = NULL;
|
|
|
53 sess->emailinfo = NULL;
|
|
|
54 sess->peer_connections = NULL;
|
|
|
55
|
|
|
56 /*
|
|
|
57 * This must always be set. Default to the queue-based
|
|
|
58 * version for back-compatibility.
|
|
|
59 */
|
|
|
60 aim_tx_setenqueue(sess, AIM_TX_QUEUED, NULL);
|
|
|
61
|
|
|
62 /*
|
|
|
63 * Register all the modules for this session...
|
|
|
64 */
|
|
|
65 aim__registermodule(sess, misc_modfirst); /* load the catch-all first */
|
|
|
66 aim__registermodule(sess, service_modfirst);
|
|
|
67 aim__registermodule(sess, locate_modfirst);
|
|
|
68 aim__registermodule(sess, buddylist_modfirst);
|
|
|
69 aim__registermodule(sess, msg_modfirst);
|
|
|
70 aim__registermodule(sess, adverts_modfirst);
|
|
|
71 aim__registermodule(sess, invite_modfirst);
|
|
|
72 aim__registermodule(sess, admin_modfirst);
|
|
|
73 aim__registermodule(sess, popups_modfirst);
|
|
|
74 aim__registermodule(sess, bos_modfirst);
|
|
|
75 aim__registermodule(sess, search_modfirst);
|
|
|
76 aim__registermodule(sess, stats_modfirst);
|
|
|
77 aim__registermodule(sess, translate_modfirst);
|
|
|
78 aim__registermodule(sess, chatnav_modfirst);
|
|
|
79 aim__registermodule(sess, chat_modfirst);
|
|
|
80 aim__registermodule(sess, odir_modfirst);
|
|
|
81 aim__registermodule(sess, bart_modfirst);
|
|
|
82 /* missing 0x11 - 0x12 */
|
|
|
83 aim__registermodule(sess, ssi_modfirst);
|
|
|
84 /* missing 0x14 */
|
|
|
85 aim__registermodule(sess, icq_modfirst);
|
|
|
86 /* missing 0x16 */
|
|
|
87 aim__registermodule(sess, auth_modfirst);
|
|
|
88 aim__registermodule(sess, email_modfirst);
|
|
|
89
|
|
|
90 return sess;
|
|
|
91 }
|
|
|
92
|
|
|
93 /**
|
|
|
94 * Logoff and deallocate a session.
|
|
|
95 *
|
|
|
96 * @param sess Session to kill
|
|
|
97 */
|
|
|
98 void
|
|
|
99 oscar_session_destroy(OscarSession *sess)
|
|
|
100 {
|
|
|
101 aim_cleansnacs(sess, -1);
|
|
|
102
|
|
|
103 while (sess->oscar_connections != NULL)
|
|
|
104 oscar_connection_destroy(sess, sess->oscar_connections->data);
|
|
|
105
|
|
|
106 aim__shutdownmodules(sess);
|
|
|
107
|
|
|
108 g_free(sess);
|
|
|
109 }
|