Mercurial > pidgin
view libpurple/protocols/oscar/oscar_data.c @ 27161:7054f810b0f9
Check in code that connects to oscar using clientLogin. This is the
authentication scheme they've publically documented. We still use
the old MD5-style login as the default, but you can optionally try
this out by checking a check box on the advanced tab of your oscar
account.
Functionally everything is supposed to be the same. However, for
some reason users with Mobile IM forwarding turned on don't show
up online and can't be messaged. Not sure why.
Using clientLogin DOES make it easier for AOL to track us. And yes,
it probably makes it easier for AOL to block us, too. But I don't
believe they want to do that. I believe they're trying to keep their
network open, and I think we should appreciate that and try to work
with them. We're not just some small open source project that slips
under the radar unnoticed anymore.
It's good to have options, right?
None of this code was taken from anywhere (outside of libpurple). I
wrote it all from scratch (and took a few bits from other places in
libpurple). I did use the documentation on http://dev.aol.com/aim ,
but I don't believe that affects us from a licensing standpoint in
any way. If you disagree we should talk about it on the devel
mailing list.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 23 Jun 2009 18:20:12 +0000 |
parents | 986edbefc516 |
children | 420907755a2f |
line wrap: on
line source
/* * Purple's oscar protocol plugin * This file is the legal property of its developers. * Please see the AUTHORS file distributed alongside this file. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "oscar.h" typedef struct _SnacHandler SnacHandler; struct _SnacHandler { guint16 family; guint16 subtype; aim_rxcallback_t handler; guint16 flags; }; /** * Allocates a new OscarData and initializes it with default values. */ OscarData * oscar_data_new(void) { OscarData *od; od = g_new0(OscarData, 1); aim_initsnachash(od); od->snacid_next = 0x00000001; od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); od->handlerlist = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); /* * Register all the modules for this session... */ aim__registermodule(od, misc_modfirst); /* load the catch-all first */ aim__registermodule(od, service_modfirst); aim__registermodule(od, locate_modfirst); aim__registermodule(od, buddylist_modfirst); aim__registermodule(od, msg_modfirst); /* aim__registermodule(od, adverts_modfirst); */ /* aim__registermodule(od, invite_modfirst); */ aim__registermodule(od, admin_modfirst); aim__registermodule(od, popups_modfirst); aim__registermodule(od, bos_modfirst); aim__registermodule(od, search_modfirst); aim__registermodule(od, stats_modfirst); /* aim__registermodule(od, translate_modfirst); */ aim__registermodule(od, chatnav_modfirst); aim__registermodule(od, chat_modfirst); aim__registermodule(od, odir_modfirst); aim__registermodule(od, bart_modfirst); /* missing 0x11 - 0x12 */ aim__registermodule(od, ssi_modfirst); /* missing 0x14 */ aim__registermodule(od, icq_modfirst); /* missing 0x16 */ /* auth_modfirst is only needed if we're connecting with the old-style BUCP login */ aim__registermodule(od, auth_modfirst); aim__registermodule(od, email_modfirst); return od; } /** * Logoff and deallocate a session. * * @param od Session to kill */ void oscar_data_destroy(OscarData *od) { aim_cleansnacs(od, -1); /* Only used when connecting with clientLogin */ if (od->url_data != NULL) purple_util_fetch_url_cancel(od->url_data); while (od->requesticon) { g_free(od->requesticon->data); od->requesticon = g_slist_delete_link(od->requesticon, od->requesticon); } g_free(od->email); g_free(od->newp); g_free(od->oldp); if (od->getblisttimer > 0) purple_timeout_remove(od->getblisttimer); while (od->oscar_connections != NULL) flap_connection_destroy(od->oscar_connections->data, OSCAR_DISCONNECT_DONE, NULL); while (od->peer_connections != NULL) peer_connection_destroy(od->peer_connections->data, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); aim__shutdownmodules(od); g_hash_table_destroy(od->buddyinfo); g_hash_table_destroy(od->handlerlist); g_free(od); } void oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags) { SnacHandler *snac_handler; purple_debug_misc("oscar", "Adding handler for %04x/%04x\n", family, subtype); snac_handler = g_new0(SnacHandler, 1); snac_handler->family = family; snac_handler->subtype = subtype; snac_handler->flags = flags; snac_handler->handler = newhandler; g_hash_table_insert(od->handlerlist, GUINT_TO_POINTER((family << 16) + subtype), snac_handler); } aim_rxcallback_t aim_callhandler(OscarData *od, guint16 family, guint16 subtype) { SnacHandler *snac_handler; snac_handler = g_hash_table_lookup(od->handlerlist, GUINT_TO_POINTER((family << 16) + subtype)); return snac_handler ? snac_handler->handler : NULL; }