comparison src/protocols/yahoo/yahoo.c @ 10610:74cc119beceb

[gaim-migrate @ 12063] Better handling of nonYMSG packets in HEAD. I think needing this is madness. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sat, 19 Feb 2005 02:38:07 +0000
parents 96307e1a47c9
children 41a18bf60ee1
comparison
equal deleted inserted replaced
10609:6239870efd8e 10610:74cc119beceb
1951 int pos = 0; 1951 int pos = 0;
1952 int pktlen; 1952 int pktlen;
1953 1953
1954 if (yd->rxlen < YAHOO_PACKET_HDRLEN) 1954 if (yd->rxlen < YAHOO_PACKET_HDRLEN)
1955 return; 1955 return;
1956
1957 if (strncmp(yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) {
1958 /* HEY! This isn't even a YMSG packet. What
1959 * are you trying to pull? */
1960 guchar *start;
1961
1962 gaim_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!");
1963
1964 start = memchr(yd->rxqueue, 'Y', yd->rxlen);
1965 if (start) {
1966 g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue));
1967 yd->rxlen -= start - yd->rxqueue;
1968 continue;
1969 } else {
1970 /* hmm this could screw up with just the Y, YM, or YMS is at the very
1971 end of the packet */
1972 g_free(yd->rxqueue);
1973 yd->rxqueue = NULL;
1974 yd->rxlen = 0;
1975 return;
1976 }
1977 }
1956 1978
1957 pos += 4; /* YMSG */ 1979 pos += 4; /* YMSG */
1958 pos += 2; 1980 pos += 2;
1959 pos += 2; 1981 pos += 2;
1960 1982