Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/family_icbm.c @ 30815:47dfe1d54e9e
Fixed (I hope) #12284.
incomingim_ch2_icqserverrelay() was doing something it wasn't supposed to.
I suppose the packet format was reverse-engineered wrongly eons ago.
The correct packet format can be found at http://iserverd.khstu.ru/oscar/message.html
(and also in every open-source OSCAR client I could get my hands on).
The funny thing is that before #12284 showed up everything worked
right due to another bug. I'm too lazy to type out all the details,
so I'll just include a reference to my conversation with Mark Doliner:
http://www.pidgin.im/nopaste/102
author | ivan.komarov@soc.pidgin.im |
---|---|
date | Sat, 24 Jul 2010 18:14:29 +0000 |
parents | 879baaf87aa2 |
children | 9d386bf63eab |
comparison
equal
deleted
inserted
replaced
30814:a347a4cd1caf | 30815:47dfe1d54e9e |
---|---|
1964 } | 1964 } |
1965 | 1965 |
1966 static void | 1966 static void |
1967 incomingim_ch2_icqserverrelay_free(OscarData *od, IcbmArgsCh2 *args) | 1967 incomingim_ch2_icqserverrelay_free(OscarData *od, IcbmArgsCh2 *args) |
1968 { | 1968 { |
1969 g_free((char *)args->info.rtfmsg.rtfmsg); | 1969 g_free((char *)args->info.rtfmsg.msg); |
1970 } | 1970 } |
1971 | 1971 |
1972 /* | 1972 /* |
1973 * The relationship between OSCAR_CAPABILITY_ICQSERVERRELAY and OSCAR_CAPABILITY_ICQRTF is | 1973 * The relationship between OSCAR_CAPABILITY_ICQSERVERRELAY and OSCAR_CAPABILITY_ICQRTF is |
1974 * kind of odd. This sends the client ICQRTF since that is all that I've seen | 1974 * kind of odd. This sends the client ICQRTF since that is all that I've seen |
1978 * | 1978 * |
1979 */ | 1979 */ |
1980 static void | 1980 static void |
1981 incomingim_ch2_icqserverrelay(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) | 1981 incomingim_ch2_icqserverrelay(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) |
1982 { | 1982 { |
1983 guint16 hdrlen, anslen, msglen; | 1983 guint16 hdrlen, msglen; |
1984 | 1984 |
1985 if (byte_stream_empty(servdata) < 24) | 1985 args->destructor = (void *)incomingim_ch2_icqserverrelay_free; |
1986 /* Someone sent us a short server relay ICBM. Weird. (Maybe?) */ | 1986 |
1987 return; | 1987 #define SKIP_HEADER(expected_hdrlen) \ |
1988 | 1988 hdrlen = byte_stream_getle16(servdata); \ |
1989 hdrlen = byte_stream_getle16(servdata); | 1989 if (hdrlen != expected_hdrlen) { \ |
1990 purple_debug_warning("oscar", "Expected to find a header with length " #expected_hdrlen "; ignoring message"); \ | |
1991 return; \ | |
1992 } \ | |
1990 byte_stream_advance(servdata, hdrlen); | 1993 byte_stream_advance(servdata, hdrlen); |
1991 | 1994 |
1992 hdrlen = byte_stream_getle16(servdata); | 1995 SKIP_HEADER(0x001b); |
1993 byte_stream_advance(servdata, hdrlen); | 1996 SKIP_HEADER(0x000e); |
1994 | 1997 |
1995 args->info.rtfmsg.msgtype = byte_stream_getle16(servdata); | 1998 args->info.rtfmsg.msgtype = byte_stream_get8(servdata); |
1996 | 1999 /* |
1997 anslen = byte_stream_getle32(servdata); | 2000 * Copied from http://iserverd.khstu.ru/oscar/message.html: |
1998 byte_stream_advance(servdata, anslen); | 2001 * xx byte message flags |
2002 * xx xx word (LE) status code | |
2003 * xx xx word (LE) priority code | |
2004 * | |
2005 * We don't need any of these, so just skip them. | |
2006 */ | |
2007 byte_stream_advance(servdata, 1 + 2 + 2); | |
1999 | 2008 |
2000 msglen = byte_stream_getle16(servdata); | 2009 msglen = byte_stream_getle16(servdata); |
2001 args->info.rtfmsg.rtfmsg = byte_stream_getstr(servdata, msglen); | 2010 args->info.rtfmsg.msg = byte_stream_getstr(servdata, msglen); |
2002 | |
2003 args->info.rtfmsg.fgcolor = byte_stream_getle32(servdata); | |
2004 args->info.rtfmsg.bgcolor = byte_stream_getle32(servdata); | |
2005 | |
2006 hdrlen = byte_stream_getle32(servdata); | |
2007 byte_stream_advance(servdata, hdrlen); | |
2008 | |
2009 args->destructor = (void *)incomingim_ch2_icqserverrelay_free; | |
2010 } | 2011 } |
2011 | 2012 |
2012 static void | 2013 static void |
2013 incomingim_ch2_sendfile_free(OscarData *od, IcbmArgsCh2 *args) | 2014 incomingim_ch2_sendfile_free(OscarData *od, IcbmArgsCh2 *args) |
2014 { | 2015 { |