Wed, 28 Jul 2010 17:43:58 +0000
OK, I'm sick of constantly finding functions that are not used anywhere.
This should get rid of all unused functions and SNAC families.
Thanks, ncc project!
| 13593 | 1 | /* |
| 15884 | 2 | * Purple's oscar protocol plugin |
| 13593 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19113
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 13593 | 19 | */ |
| 20 | ||
| 21 | #include "oscar.h" | |
| 22 | ||
| 23 | typedef struct _SnacHandler SnacHandler; | |
| 24 | ||
| 25 | struct _SnacHandler | |
| 26 | { | |
| 27 | guint16 family; | |
|
15168
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
28 | guint16 subtype; |
| 13593 | 29 | aim_rxcallback_t handler; |
| 30 | guint16 flags; | |
| 31 | }; | |
| 32 | ||
| 33 | /** | |
| 34 | * Allocates a new OscarData and initializes it with default values. | |
| 35 | */ | |
| 36 | OscarData * | |
| 37 | oscar_data_new(void) | |
| 38 | { | |
| 39 | OscarData *od; | |
| 40 | ||
| 41 | od = g_new0(OscarData, 1); | |
| 42 | ||
| 43 | aim_initsnachash(od); | |
| 44 | od->snacid_next = 0x00000001; | |
|
15168
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
45 | od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
|
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
46 | od->handlerlist = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); |
| 13593 | 47 | |
| 48 | /* | |
| 49 | * Register all the modules for this session... | |
| 50 | */ | |
| 51 | aim__registermodule(od, misc_modfirst); /* load the catch-all first */ | |
| 52 | aim__registermodule(od, service_modfirst); | |
| 53 | aim__registermodule(od, locate_modfirst); | |
| 54 | aim__registermodule(od, buddylist_modfirst); | |
| 55 | aim__registermodule(od, msg_modfirst); | |
| 56 | aim__registermodule(od, admin_modfirst); | |
| 57 | aim__registermodule(od, popups_modfirst); | |
| 58 | aim__registermodule(od, bos_modfirst); | |
| 59 | aim__registermodule(od, search_modfirst); | |
| 60 | aim__registermodule(od, stats_modfirst); | |
| 61 | aim__registermodule(od, chatnav_modfirst); | |
| 62 | aim__registermodule(od, chat_modfirst); | |
| 63 | aim__registermodule(od, odir_modfirst); | |
| 64 | aim__registermodule(od, bart_modfirst); | |
| 65 | /* missing 0x11 - 0x12 */ | |
| 66 | aim__registermodule(od, ssi_modfirst); | |
| 67 | /* missing 0x14 */ | |
| 68 | aim__registermodule(od, icq_modfirst); | |
| 69 | /* missing 0x16 */ | |
|
27385
cd0d721fec8f
Check in code that connects to oscar using clientLogin. This is the
Mark Doliner <markdoliner@pidgin.im>
parents:
25527
diff
changeset
|
70 | /* auth_modfirst is only needed if we're connecting with the old-style BUCP login */ |
| 13593 | 71 | aim__registermodule(od, auth_modfirst); |
| 72 | aim__registermodule(od, email_modfirst); | |
| 73 | ||
| 74 | return od; | |
| 75 | } | |
| 76 | ||
| 77 | /** | |
| 78 | * Logoff and deallocate a session. | |
| 79 | * | |
| 80 | * @param od Session to kill | |
| 81 | */ | |
| 82 | void | |
| 83 | oscar_data_destroy(OscarData *od) | |
| 84 | { | |
| 85 | aim_cleansnacs(od, -1); | |
| 86 | ||
|
27385
cd0d721fec8f
Check in code that connects to oscar using clientLogin. This is the
Mark Doliner <markdoliner@pidgin.im>
parents:
25527
diff
changeset
|
87 | /* Only used when connecting with clientLogin */ |
|
cd0d721fec8f
Check in code that connects to oscar using clientLogin. This is the
Mark Doliner <markdoliner@pidgin.im>
parents:
25527
diff
changeset
|
88 | if (od->url_data != NULL) |
|
cd0d721fec8f
Check in code that connects to oscar using clientLogin. This is the
Mark Doliner <markdoliner@pidgin.im>
parents:
25527
diff
changeset
|
89 | purple_util_fetch_url_cancel(od->url_data); |
|
cd0d721fec8f
Check in code that connects to oscar using clientLogin. This is the
Mark Doliner <markdoliner@pidgin.im>
parents:
25527
diff
changeset
|
90 | |
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
91 | while (od->requesticon) |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
92 | { |
|
23894
00467d0ac393
Just a few little cleanups.
Mark Doliner <markdoliner@pidgin.im>
parents:
23890
diff
changeset
|
93 | g_free(od->requesticon->data); |
|
00467d0ac393
Just a few little cleanups.
Mark Doliner <markdoliner@pidgin.im>
parents:
23890
diff
changeset
|
94 | od->requesticon = g_slist_delete_link(od->requesticon, od->requesticon); |
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
95 | } |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
96 | g_free(od->email); |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
97 | g_free(od->newp); |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
98 | g_free(od->oldp); |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
99 | if (od->getblisttimer > 0) |
| 15884 | 100 | purple_timeout_remove(od->getblisttimer); |
| 13593 | 101 | while (od->oscar_connections != NULL) |
|
13609
a6fbfad454b6
[gaim-migrate @ 15994]
Mark Doliner <markdoliner@pidgin.im>
parents:
13598
diff
changeset
|
102 | flap_connection_destroy(od->oscar_connections->data, |
|
14454
df290cda81a3
[gaim-migrate @ 17099]
Mark Doliner <markdoliner@pidgin.im>
parents:
14410
diff
changeset
|
103 | OSCAR_DISCONNECT_DONE, NULL); |
| 13593 | 104 | |
| 105 | while (od->peer_connections != NULL) | |
| 106 | peer_connection_destroy(od->peer_connections->data, | |
|
14464
b7bca43f75b3
[gaim-migrate @ 17110]
Mark Doliner <markdoliner@pidgin.im>
parents:
14454
diff
changeset
|
107 | OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); |
| 13593 | 108 | |
| 109 | aim__shutdownmodules(od); | |
| 110 | ||
| 111 | g_hash_table_destroy(od->buddyinfo); | |
|
15168
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
112 | g_hash_table_destroy(od->handlerlist); |
| 13593 | 113 | |
| 114 | g_free(od); | |
| 115 | } | |
| 116 | ||
|
15168
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
117 | void |
|
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
118 | oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags) |
| 13593 | 119 | { |
| 120 | SnacHandler *snac_handler; | |
| 121 | ||
| 15884 | 122 | purple_debug_misc("oscar", "Adding handler for %04x/%04x\n", family, subtype); |
| 13593 | 123 | |
| 124 | snac_handler = g_new0(SnacHandler, 1); | |
| 125 | ||
| 126 | snac_handler->family = family; | |
|
15168
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
127 | snac_handler->subtype = subtype; |
| 13593 | 128 | snac_handler->flags = flags; |
| 129 | snac_handler->handler = newhandler; | |
| 130 | ||
|
15168
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
131 | g_hash_table_insert(od->handlerlist, |
|
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
132 | GUINT_TO_POINTER((family << 16) + subtype), |
|
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
133 | snac_handler); |
| 13593 | 134 | } |
| 135 | ||
|
15168
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
136 | aim_rxcallback_t |
|
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
137 | aim_callhandler(OscarData *od, guint16 family, guint16 subtype) |
| 13593 | 138 | { |
| 139 | SnacHandler *snac_handler; | |
| 140 | ||
|
15168
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
141 | snac_handler = g_hash_table_lookup(od->handlerlist, GUINT_TO_POINTER((family << 16) + subtype)); |
| 13593 | 142 | |
|
15168
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
14464
diff
changeset
|
143 | return snac_handler ? snac_handler->handler : NULL; |
| 13593 | 144 | } |