comparison src/protocols/yahoo/yahoo.c @ 9604:8e9727919633

[gaim-migrate @ 10447] Yahoo audibles (text only). (23:58:51) Kevin M Stange: Seriously - do us all a favor and unplug your computer now! committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Tue, 27 Jul 2004 05:23:03 +0000
parents 7a65fdba750f
children 6c44a5d7cf54
comparison
equal deleted inserted replaced
9603:10939dc36eac 9604:8e9727919633
1962 yahoo_friend_set_ip(f, tmp2); 1962 yahoo_friend_set_ip(f, tmp2);
1963 g_free(tmp2); 1963 g_free(tmp2);
1964 } 1964 }
1965 } 1965 }
1966 1966
1967 static void yahoo_process_audible(GaimConnection *gc, struct yahoo_packet *pkt)
1968 {
1969 char *who = NULL, *msg = NULL;
1970 GSList *l = pkt->hash;
1971
1972 while (l) {
1973 struct yahoo_pair *pair = l->data;
1974
1975 switch (pair->key) {
1976 case 4:
1977 who = pair->value;
1978 break;
1979 case 5:
1980 /* us */
1981 break;
1982 case 230:
1983 /* the audible, in foo.bar.baz format */
1984 break;
1985 case 231:
1986 /* the text of the audible */
1987 msg = pair->value;
1988 break;
1989 case 232:
1990 /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */
1991 break;
1992 }
1993
1994 l = l->next;
1995 }
1996
1997 if (!who || !msg)
1998 return;
1999 if (!g_utf8_validate(msg, -1, NULL)) {
2000 gaim_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n");
2001 return;
2002 }
2003
2004 serv_got_im(gc, who, msg, 0, time(NULL));
2005 }
2006
1967 static void yahoo_packet_process(GaimConnection *gc, struct yahoo_packet *pkt) 2007 static void yahoo_packet_process(GaimConnection *gc, struct yahoo_packet *pkt)
1968 { 2008 {
1969 switch (pkt->service) { 2009 switch (pkt->service) {
1970 case YAHOO_SERVICE_LOGON: 2010 case YAHOO_SERVICE_LOGON:
1971 case YAHOO_SERVICE_LOGOFF: 2011 case YAHOO_SERVICE_LOGOFF:
2066 yahoo_process_picture_checksum(gc, pkt); 2106 yahoo_process_picture_checksum(gc, pkt);
2067 break; 2107 break;
2068 case YAHOO_SERVICE_PICTURE_UPLOAD: 2108 case YAHOO_SERVICE_PICTURE_UPLOAD:
2069 yahoo_process_picture_upload(gc, pkt); 2109 yahoo_process_picture_upload(gc, pkt);
2070 break; 2110 break;
2111 case YAHOO_SERVICE_AUDIBLE:
2112 yahoo_process_audible(gc, pkt);
2071 default: 2113 default:
2072 gaim_debug(GAIM_DEBUG_ERROR, "yahoo", 2114 gaim_debug(GAIM_DEBUG_ERROR, "yahoo",
2073 "Unhandled service 0x%02x\n", pkt->service); 2115 "Unhandled service 0x%02x\n", pkt->service);
2074 break; 2116 break;
2075 } 2117 }