annotate src/protocols/oscar/session.c @ 13373:1ca4a579eb57

[gaim-migrate @ 15746] Parts of sf patch #1438833, from Sadrul Habib Chowdhury "This patch enables removing message-text from a status. Currently when you have some status with a message, and you remove the message from the statusbox-entry, the new status with no message is not used (reported in a number of bugs, like #1431289, #1431801)." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 02 Mar 2006 04:51:09 +0000
parents b08f8f3c9197
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13255
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /*
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 * Gaim's oscar protocol plugin
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 * This file is the legal property of its developers.
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 * Please see the AUTHORS file distributed alongside this file.
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5 *
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 * This library is free software; you can redistribute it and/or
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 * version 2 of the License, or (at your option) any later version.
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 *
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 * This library is distributed in the hope that it will be useful,
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 * Lesser General Public License for more details.
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 *
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 * License along with this library; if not, write to the Free Software
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 */
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 #include "oscar.h"
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23 /**
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 * Allocates a new OscarSession and initializes it with default values.
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 */
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26 OscarSession *
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 oscar_session_new(void)
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 {
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 OscarSession *sess;
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30
13261
3b04ab4d96db [gaim-migrate @ 15627]
Mark Doliner <mark@kingant.net>
parents: 13255
diff changeset
31 sess = g_new0(OscarSession, 1);
13255
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 aim_initsnachash(sess);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34 sess->snacid_next = 0x00000001;
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 /*
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 * This must always be set. Default to the queue-based
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 * version for back-compatibility.
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 */
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 aim_tx_setenqueue(sess, AIM_TX_QUEUED, NULL);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42 /*
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43 * Register all the modules for this session...
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44 */
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
45 aim__registermodule(sess, misc_modfirst); /* load the catch-all first */
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
46 aim__registermodule(sess, service_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
47 aim__registermodule(sess, locate_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
48 aim__registermodule(sess, buddylist_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
49 aim__registermodule(sess, msg_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
50 aim__registermodule(sess, adverts_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
51 aim__registermodule(sess, invite_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
52 aim__registermodule(sess, admin_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
53 aim__registermodule(sess, popups_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
54 aim__registermodule(sess, bos_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
55 aim__registermodule(sess, search_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
56 aim__registermodule(sess, stats_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
57 aim__registermodule(sess, translate_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
58 aim__registermodule(sess, chatnav_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
59 aim__registermodule(sess, chat_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
60 aim__registermodule(sess, odir_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
61 aim__registermodule(sess, bart_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
62 /* missing 0x11 - 0x12 */
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
63 aim__registermodule(sess, ssi_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
64 /* missing 0x14 */
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
65 aim__registermodule(sess, icq_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
66 /* missing 0x16 */
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
67 aim__registermodule(sess, auth_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
68 aim__registermodule(sess, email_modfirst);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
69
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
70 return sess;
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
71 }
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
72
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
73 /**
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
74 * Logoff and deallocate a session.
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
75 *
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
76 * @param sess Session to kill
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
77 */
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
78 void
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
79 oscar_session_destroy(OscarSession *sess)
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
80 {
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
81 aim_cleansnacs(sess, -1);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
82
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
83 while (sess->oscar_connections != NULL)
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
84 oscar_connection_destroy(sess, sess->oscar_connections->data);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
85
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
86 aim__shutdownmodules(sess);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
87
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
88 g_free(sess);
f280bf585fb3 [gaim-migrate @ 15621]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
89 }