Changeset cfc8d58 for protocols/yahoo
- Timestamp:
- 2007-04-16T04:31:52Z (18 years ago)
- Branches:
- master
- Children:
- b3cae44
- Parents:
- 6bbb939
- Location:
- protocols/yahoo
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/yahoo/libyahoo2.c
r6bbb939 rcfc8d58 104 104 #define YAHOO_CALLBACK(x) x 105 105 #endif 106 107 static int yahoo_send_data(int fd, void *data, int len); 106 108 107 109 int yahoo_log_message(char * fmt, ...) … … 204 206 YAHOO_SERVICE_CHATLOGOUT = 0xa0, 205 207 YAHOO_SERVICE_CHATPING, 206 YAHOO_SERVICE_COMMENT = 0xa8 208 YAHOO_SERVICE_COMMENT = 0xa8, 209 YAHOO_SERVICE_STEALTH = 0xb9, 210 YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd, 211 YAHOO_SERVICE_PICTURE = 0xbe, 212 YAHOO_SERVICE_PICTURE_UPDATE = 0xc1, 213 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2 207 214 }; 208 215 … … 741 748 yahoo_packet_dump(data, len); 742 749 750 if( yid->type == YAHOO_CONNECTION_FT ) 751 yahoo_send_data(yid->fd, data, len); 752 else 743 753 yahoo_add_to_send_queue(yid, data, len); 744 754 FREE(data); … … 926 936 char *msg = NULL; 927 937 char *from = NULL; 938 char *to = NULL; 928 939 int stat = 0; 929 940 int accept = 0; … … 934 945 if (pair->key == 4) 935 946 from = pair->value; 947 if (pair->key == 5) 948 to = pair->value; 936 949 if (pair->key == 49) 937 950 msg = pair->value; … … 951 964 952 965 if (!strncasecmp(msg, "TYPING", strlen("TYPING"))) 953 YAHOO_CALLBACK(ext_yahoo_typing_notify)(yd->client_id, from, stat);966 YAHOO_CALLBACK(ext_yahoo_typing_notify)(yd->client_id, to, from, stat); 954 967 else if (!strncasecmp(msg, "GAME", strlen("GAME"))) 955 YAHOO_CALLBACK(ext_yahoo_game_notify)(yd->client_id, from, stat);968 YAHOO_CALLBACK(ext_yahoo_game_notify)(yd->client_id, to, from, stat); 956 969 else if (!strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) 957 970 { 958 971 if (!strcmp(ind, " ")) { 959 YAHOO_CALLBACK(ext_yahoo_webcam_invite)(yd->client_id, from);972 YAHOO_CALLBACK(ext_yahoo_webcam_invite)(yd->client_id, to, from); 960 973 } else { 961 974 accept = atoi(ind); … … 963 976 if (accept < 0) 964 977 accept = 0; 965 YAHOO_CALLBACK(ext_yahoo_webcam_invite_reply)(yd->client_id, from, accept);978 YAHOO_CALLBACK(ext_yahoo_webcam_invite_reply)(yd->client_id, to, from, accept); 966 979 } 967 980 } … … 1022 1035 } 1023 1036 if(url && from) 1024 YAHOO_CALLBACK(ext_yahoo_got_file)(yd->client_id, from, url, expires, msg, filename, filesize);1037 YAHOO_CALLBACK(ext_yahoo_got_file)(yd->client_id, to, from, url, expires, msg, filename, filesize); 1025 1038 1026 1039 } … … 1096 1109 ; 1097 1110 else if(members) 1098 YAHOO_CALLBACK(ext_yahoo_got_conf_invite)(yd->client_id, host, room, msg, members);1111 YAHOO_CALLBACK(ext_yahoo_got_conf_invite)(yd->client_id, id, host, room, msg, members); 1099 1112 else if(msg) 1100 YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, msg, 0 );1113 YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, msg, 0, E_CONFNOTAVAIL); 1101 1114 break; 1102 1115 case YAHOO_SERVICE_CONFADDINVITE: … … 1104 1117 ; 1105 1118 else 1106 YAHOO_CALLBACK(ext_yahoo_got_conf_invite)(yd->client_id, host, room, msg, members);1119 YAHOO_CALLBACK(ext_yahoo_got_conf_invite)(yd->client_id, id, host, room, msg, members); 1107 1120 break; 1108 1121 case YAHOO_SERVICE_CONFDECLINE: 1109 1122 if(who) 1110 YAHOO_CALLBACK(ext_yahoo_conf_userdecline)(yd->client_id, who, room, msg);1123 YAHOO_CALLBACK(ext_yahoo_conf_userdecline)(yd->client_id, id, who, room, msg); 1111 1124 break; 1112 1125 case YAHOO_SERVICE_CONFLOGON: 1113 1126 if(who) 1114 YAHOO_CALLBACK(ext_yahoo_conf_userjoin)(yd->client_id, who, room);1127 YAHOO_CALLBACK(ext_yahoo_conf_userjoin)(yd->client_id, id, who, room); 1115 1128 break; 1116 1129 case YAHOO_SERVICE_CONFLOGOFF: 1117 1130 if(who) 1118 YAHOO_CALLBACK(ext_yahoo_conf_userleave)(yd->client_id, who, room);1131 YAHOO_CALLBACK(ext_yahoo_conf_userleave)(yd->client_id, id, who, room); 1119 1132 break; 1120 1133 case YAHOO_SERVICE_CONFMSG: 1121 1134 if(who) 1122 YAHOO_CALLBACK(ext_yahoo_conf_message)(yd->client_id, who, room, msg, utf8);1135 YAHOO_CALLBACK(ext_yahoo_conf_message)(yd->client_id, id, who, room, msg, utf8); 1123 1136 break; 1124 1137 } … … 1128 1141 { 1129 1142 char *msg = NULL; 1143 char *id = NULL; 1130 1144 char *who = NULL; 1131 1145 char *room = NULL; … … 1144 1158 struct yahoo_pair *pair = l->data; 1145 1159 1160 if (pair->key == 1) { 1161 /* My identity */ 1162 id = pair->value; 1163 } 1164 1146 1165 if (pair->key == 104) { 1147 1166 /* Room name */ … … 1218 1237 if(!room) { 1219 1238 if (pkt->service == YAHOO_SERVICE_CHATLOGOUT) { /* yahoo originated chat logout */ 1220 YAHOO_CALLBACK(ext_yahoo_chat_yahoologout)(yid->yd->client_id );1239 YAHOO_CALLBACK(ext_yahoo_chat_yahoologout)(yid->yd->client_id, id); 1221 1240 return ; 1222 1241 } 1223 1242 if (pkt->service == YAHOO_SERVICE_COMMENT && chaterr) { 1224 YAHOO_CALLBACK(ext_yahoo_chat_yahooerror)(yid->yd->client_id );1225 return 1243 YAHOO_CALLBACK(ext_yahoo_chat_yahooerror)(yid->yd->client_id, id); 1244 return; 1226 1245 } 1227 1246 … … 1236 1255 } 1237 1256 if(firstjoin && members) { 1238 YAHOO_CALLBACK(ext_yahoo_chat_join)(yid->yd->client_id, room, topic, members, yid->fd);1257 YAHOO_CALLBACK(ext_yahoo_chat_join)(yid->yd->client_id, id, room, topic, members, yid->fd); 1239 1258 } else if(who) { 1240 1259 if(y_list_length(members) != 1) { … … 1245 1264 YList *n = members->next; 1246 1265 currentmember = members->data; 1247 YAHOO_CALLBACK(ext_yahoo_chat_userjoin)(yid->yd->client_id, room, currentmember);1266 YAHOO_CALLBACK(ext_yahoo_chat_userjoin)(yid->yd->client_id, id, room, currentmember); 1248 1267 y_list_free_1(members); 1249 1268 members=n; … … 1253 1272 case YAHOO_SERVICE_CHATEXIT: 1254 1273 if(who) { 1255 YAHOO_CALLBACK(ext_yahoo_chat_userleave)(yid->yd->client_id, room, who);1274 YAHOO_CALLBACK(ext_yahoo_chat_userleave)(yid->yd->client_id, id, room, who); 1256 1275 } 1257 1276 break; 1258 1277 case YAHOO_SERVICE_COMMENT: 1259 1278 if(who) { 1260 YAHOO_CALLBACK(ext_yahoo_chat_message)(yid->yd->client_id, who, room, msg, msgtype, utf8);1279 YAHOO_CALLBACK(ext_yahoo_chat_message)(yid->yd->client_id, id, who, room, msg, msgtype, utf8); 1261 1280 } 1262 1281 break; … … 1317 1336 YAHOO_CALLBACK(ext_yahoo_system_message)(yd->client_id, message->msg); 1318 1337 } else if (pkt->status <= 2 || pkt->status == 5) { 1319 YAHOO_CALLBACK(ext_yahoo_got_im)(yd->client_id, message-> from, message->msg, message->tm, pkt->status, message->utf8);1338 YAHOO_CALLBACK(ext_yahoo_got_im)(yd->client_id, message->to, message->from, message->msg, message->tm, pkt->status, message->utf8); 1320 1339 } else if (pkt->status == 0xffffffff) { 1321 YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, message->msg, 0 );1340 YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, message->msg, 0, E_SYSTEM); 1322 1341 } 1323 1342 free(message); … … 1332 1351 YList *l; 1333 1352 struct yahoo_data *yd = yid->yd; 1334 char *name = NULL; 1335 int state = 0; 1336 int away = 0; 1337 int idle = 0; 1338 char *msg = NULL; 1353 1354 struct user 1355 { 1356 char *name; /* 7 name */ 1357 int state; /* 10 state */ 1358 int flags; /* 13 flags, bit 0 = pager, bit 1 = chat, bit 2 = game */ 1359 int mobile; /* 60 mobile */ 1360 char *msg; /* 19 custom status message */ 1361 int away; /* 47 away (or invisible)*/ 1362 int buddy_session; /* 11 state */ 1363 int f17; /* 17 in chat? then what about flags? */ 1364 int idle; /* 137 seconds idle */ 1365 int f138; /* 138 state */ 1366 char *f184; /* 184 state */ 1367 int f192; /* 192 state */ 1368 int f10001; /* 10001 state */ 1369 int f10002; /* 10002 state */ 1370 int f198; /* 198 state */ 1371 char *f197; /* 197 state */ 1372 char *f205; /* 205 state */ 1373 int f213; /* 213 state */ 1374 } *u; 1375 1376 YList *users = 0; 1339 1377 1340 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) {1378 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { 1341 1379 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_DUPL, NULL); 1342 1380 return; … … 1362 1400 break; 1363 1401 case 7: /* the current buddy */ 1364 name = pair->value; 1402 u = y_new0(struct user, 1); 1403 u->name = pair->value; 1404 users = y_list_prepend(users, u); 1365 1405 break; 1366 1406 case 10: /* state */ 1367 state = strtol(pair->value, NULL, 10);1407 ((struct user*)users->data)->state = strtol(pair->value, NULL, 10); 1368 1408 break; 1369 1409 case 19: /* custom status message */ 1370 msg = pair->value;1410 ((struct user*)users->data)->msg = pair->value; 1371 1411 break; 1372 1412 case 47: /* is it an away message or not */ 1373 away = atoi(pair->value);1413 ((struct user*)users->data)->away = atoi(pair->value); 1374 1414 break; 1375 1415 case 137: /* seconds idle */ 1376 idle = atoi(pair->value);1377 break; 1378 case 11: /* what is this?*/1379 NOTICE(("key %d:%s", pair->key, pair->value));1416 ((struct user*)users->data)->idle = atoi(pair->value); 1417 break; 1418 case 11: /* this is the buddy's session id */ 1419 ((struct user*)users->data)->buddy_session = atoi(pair->value); 1380 1420 break; 1381 1421 case 17: /* in chat? */ 1382 break; 1383 case 13: /* in pager? */ 1384 if (pkt->service == YAHOO_SERVICE_LOGOFF || strtol(pair->value, NULL, 10) == 0) { 1385 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, YAHOO_STATUS_OFFLINE, NULL, 1); 1386 break; 1387 } 1388 if (state == YAHOO_STATUS_AVAILABLE) { 1389 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, state, NULL, 0); 1390 } else if (state == YAHOO_STATUS_CUSTOM) { 1391 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, state, msg, away); 1392 } else { 1393 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, state, NULL, idle); 1394 } 1395 1396 break; 1397 case 60: 1422 ((struct user*)users->data)->f17 = atoi(pair->value); 1423 break; 1424 case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */ 1425 ((struct user*)users->data)->flags = atoi(pair->value); 1426 break; 1427 case 60: /* SMS -> 1 MOBILE USER */ 1398 1428 /* sometimes going offline makes this 2, but invisible never sends it */ 1399 NOTICE(("key %d:%s", pair->key, pair->value)); 1400 break; 1429 ((struct user*)users->data)->mobile = atoi(pair->value); 1430 break; 1431 case 138: 1432 ((struct user*)users->data)->f138 = atoi(pair->value); 1433 break; 1434 case 184: 1435 ((struct user*)users->data)->f184 = pair->value; 1436 break; 1437 case 192: 1438 ((struct user*)users->data)->f192 = atoi(pair->value); 1439 break; 1440 case 10001: 1441 ((struct user*)users->data)->f10001 = atoi(pair->value); 1442 break; 1443 case 10002: 1444 ((struct user*)users->data)->f10002 = atoi(pair->value); 1445 break; 1446 case 198: 1447 ((struct user*)users->data)->f198 = atoi(pair->value); 1448 break; 1449 case 197: 1450 ((struct user*)users->data)->f197 = pair->value; 1451 break; 1452 case 205: 1453 ((struct user*)users->data)->f205 = pair->value; 1454 break; 1455 case 213: 1456 ((struct user*)users->data)->f213 = atoi(pair->value); 1457 break; 1401 1458 case 16: /* Custom error message */ 1402 YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, pair->value, 0 );1459 YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, pair->value, 0, E_CUSTOM); 1403 1460 break; 1404 1461 default: … … 1406 1463 break; 1407 1464 } 1465 } 1466 1467 while (users) { 1468 YList *t = users; 1469 struct user *u = users->data; 1470 1471 if (u->name != NULL) { 1472 if (pkt->service == YAHOO_SERVICE_LOGOFF || u->flags == 0) { 1473 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0); 1474 } else { 1475 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, u->state, u->msg, u->away, u->idle, u->mobile); 1476 } 1477 } 1478 1479 users = y_list_remove_link(users, users); 1480 y_list_free_1(t); 1481 FREE(u); 1408 1482 } 1409 1483 } … … 1510 1584 yahoo_packet_free(pkt); 1511 1585 1586 } 1587 1588 static void yahoo_process_picture_checksum( struct yahoo_input_data *yid, struct yahoo_packet *pkt) 1589 { 1590 struct yahoo_data *yd = yid->yd; 1591 char *from = NULL; 1592 char *to = NULL; 1593 int checksum = 0; 1594 YList *l; 1595 1596 for(l = pkt->hash; l; l = l->next) 1597 { 1598 struct yahoo_pair *pair = l->data; 1599 1600 switch(pair->key) 1601 { 1602 case 1: 1603 case 4: 1604 from = pair->value; 1605 case 5: 1606 to = pair->value; 1607 break; 1608 case 212: 1609 break; 1610 case 192: 1611 checksum = atoi( pair->value ); 1612 break; 1613 } 1614 } 1615 1616 YAHOO_CALLBACK(ext_yahoo_got_buddyicon_checksum)(yd->client_id,to,from,checksum); 1617 } 1618 1619 static void yahoo_process_picture(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 1620 { 1621 struct yahoo_data *yd = yid->yd; 1622 char *url = NULL; 1623 char *from = NULL; 1624 char *to = NULL; 1625 int status = 0; 1626 int checksum = 0; 1627 YList *l; 1628 1629 for(l = pkt->hash; l; l = l->next) 1630 { 1631 struct yahoo_pair *pair = l->data; 1632 1633 switch(pair->key) 1634 { 1635 case 1: 1636 case 4: /* sender */ 1637 from = pair->value; 1638 break; 1639 case 5: /* we */ 1640 to = pair->value; 1641 break; 1642 case 13: /* request / sending */ 1643 status = atoi( pair->value ); 1644 break; 1645 case 20: /* url */ 1646 url = pair->value; 1647 break; 1648 case 192: /*checksum */ 1649 checksum = atoi( pair->value ); 1650 break; 1651 } 1652 } 1653 1654 switch( status ) 1655 { 1656 case 1: /* this is a request, ignore for now */ 1657 YAHOO_CALLBACK(ext_yahoo_got_buddyicon_request)(yd->client_id, to, from); 1658 break; 1659 case 2: /* this is cool - we get a picture :) */ 1660 YAHOO_CALLBACK(ext_yahoo_got_buddyicon)(yd->client_id,to, from, url, checksum); 1661 break; 1662 } 1663 } 1664 1665 static void yahoo_process_picture_upload(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 1666 { 1667 struct yahoo_data *yd = yid->yd; 1668 YList *l; 1669 char *url = NULL; 1670 1671 if ( pkt->status != 1 ) 1672 return; /* something went wrong */ 1673 1674 for(l = pkt->hash; l; l = l->next) 1675 { 1676 struct yahoo_pair *pair = l->data; 1677 1678 switch(pair->key) 1679 { 1680 case 5: /* we */ 1681 break; 1682 case 20: /* url */ 1683 url = pair->value; 1684 break; 1685 case 27: /* local filename */ 1686 break; 1687 case 38: /* time */ 1688 break; 1689 } 1690 } 1691 1692 YAHOO_CALLBACK(ext_yahoo_buddyicon_uploaded)(yd->client_id, url); 1512 1693 } 1513 1694 … … 2154 2335 int online = FALSE; 2155 2336 int away = 0; 2337 int idle = 0; 2338 int mobile = 0; 2156 2339 2157 2340 YList *l; … … 2175 2358 else if (pair->key == 47) 2176 2359 away = strtol(pair->value, NULL, 10); 2360 else if (pair->key == 137) 2361 idle = strtol(pair->value, NULL, 10); 2362 else if (pair->key == 60) 2363 mobile = strtol(pair->value, NULL, 10); 2364 2177 2365 } 2178 2366 … … 2180 2368 YAHOO_CALLBACK(ext_yahoo_contact_added)(yd->client_id, id, who, msg); 2181 2369 else if (name) 2182 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, state, msg, away );2370 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, state, msg, away, idle, mobile); 2183 2371 else if(pkt->status == 0x07) 2184 2372 YAHOO_CALLBACK(ext_yahoo_rejected)(yd->client_id, who, msg); … … 2308 2496 2309 2497 /* if(status) 2310 YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, status, who, 0);2498 YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, who, 0, status); 2311 2499 */ 2312 2500 } … … 2332 2520 } 2333 2521 2334 NOTICE(("got voice chat invite from %s in %s ", who, room));2522 NOTICE(("got voice chat invite from %s in %s to identity %s", who, room, me)); 2335 2523 /* 2336 2524 * send: s:0 1:me 5:who 57:room 13:1 … … 2342 2530 * rejr: s:4 5:who 10:99 19:-1617114599 2343 2531 */ 2532 } 2533 2534 static void yahoo_process_ping(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 2535 { 2536 char *errormsg = NULL; 2537 2538 YList *l; 2539 for (l = pkt->hash; l; l = l->next) { 2540 struct yahoo_pair *pair = l->data; 2541 if (pair->key == 16) 2542 errormsg = pair->value; 2543 } 2544 2545 NOTICE(("got ping packet")); 2546 YAHOO_CALLBACK(ext_yahoo_got_ping)(yid->yd->client_id, errormsg); 2344 2547 } 2345 2548 … … 2519 2722 yahoo_process_webcam_key(yid, pkt); 2520 2723 break; 2724 case YAHOO_SERVICE_PING: 2725 yahoo_process_ping(yid, pkt); 2726 break; 2521 2727 case YAHOO_SERVICE_IDLE: 2522 2728 case YAHOO_SERVICE_MAILSTAT: … … 2526 2732 case YAHOO_SERVICE_ADDIDENT: 2527 2733 case YAHOO_SERVICE_ADDIGNORE: 2528 case YAHOO_SERVICE_PING:2529 2734 case YAHOO_SERVICE_GOTGROUPRENAME: 2530 2735 case YAHOO_SERVICE_GROUPRENAME: … … 2538 2743 yahoo_dump_unhandled(pkt); 2539 2744 break; 2745 case YAHOO_SERVICE_PICTURE: 2746 yahoo_process_picture(yid, pkt); 2747 break; 2748 case YAHOO_SERVICE_PICTURE_CHECKSUM: 2749 yahoo_process_picture_checksum(yid, pkt); 2750 break; 2751 case YAHOO_SERVICE_PICTURE_UPLOAD: 2752 yahoo_process_picture_upload(yid, pkt); 2753 break; 2540 2754 default: 2541 2755 WARNING(("unknown service 0x%02x", pkt->service)); … … 3347 3561 3348 3562 if(yid->type == YAHOO_CONNECTION_PAGER) { 3349 YAHOO_CALLBACK(ext_yahoo_ login_response)(yid->yd->client_id, YAHOO_LOGIN_SOCK, NULL);3563 YAHOO_CALLBACK(ext_yahoo_error)(yid->yd->client_id, "Connection closed by server", 1, E_CONNECTION); 3350 3564 } 3351 3565 … … 3495 3709 } 3496 3710 3497 void yahoo_send_im(int id, const char *from, const char *who, const char *what, int utf8 )3711 void yahoo_send_im(int id, const char *from, const char *who, const char *what, int utf8, int picture) 3498 3712 { 3499 3713 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 3500 3714 struct yahoo_packet *pkt = NULL; 3501 3715 struct yahoo_data *yd; 3716 char pic_str[10]; 3502 3717 3503 3718 if(!yid) … … 3508 3723 pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, yd->session_id); 3509 3724 3725 snprintf(pic_str, sizeof(pic_str), "%d", picture); 3726 3510 3727 if(from && strcmp(from, yd->user)) 3511 3728 yahoo_packet_hash(pkt, 0, yd->user); … … 3519 3736 yahoo_packet_hash(pkt, 63, ";0"); /* imvironment name; or ;0 */ 3520 3737 yahoo_packet_hash(pkt, 64, "0"); 3738 yahoo_packet_hash(pkt, 206, pic_str); 3521 3739 3522 3740 … … 3571 3789 else 3572 3790 service = YAHOO_SERVICE_ISAWAY; 3573 pkt = yahoo_packet_new(service, yd->current_status, yd->session_id); 3574 snprintf(s, sizeof(s), "%d", yd->current_status); 3575 yahoo_packet_hash(pkt, 10, s); 3576 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 3577 yahoo_packet_hash(pkt, 19, msg); 3578 yahoo_packet_hash(pkt, 47, away?"1":"0"); 3791 3792 if ((away == 2) && (yd->current_status == YAHOO_STATUS_AVAILABLE)) { 3793 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_BRB, yd->session_id); 3794 yahoo_packet_hash(pkt, 10, "999"); 3795 yahoo_packet_hash(pkt, 47, "2"); 3796 }else { 3797 pkt = yahoo_packet_new(service, YAHOO_STATUS_AVAILABLE, yd->session_id); 3798 snprintf(s, sizeof(s), "%d", yd->current_status); 3799 yahoo_packet_hash(pkt, 10, s); 3800 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 3801 yahoo_packet_hash(pkt, 19, msg); 3802 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 3803 } else { 3804 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 3805 } 3806 3807 3808 3579 3809 } 3580 3810 … … 3817 4047 } 3818 4048 3819 void yahoo_add_buddy(int id, const char *who, const char *group )4049 void yahoo_add_buddy(int id, const char *who, const char *group, const char *msg) 3820 4050 { 3821 4051 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); … … 3834 4064 yahoo_packet_hash(pkt, 7, who); 3835 4065 yahoo_packet_hash(pkt, 65, group); 4066 if (msg != NULL) /* add message/request "it's me add me" */ 4067 yahoo_packet_hash(pkt, 14, msg); 3836 4068 yahoo_send_packet(yid, pkt, 0); 3837 4069 yahoo_packet_free(pkt); … … 3895 4127 yahoo_packet_hash(pkt, 7, who); 3896 4128 yahoo_packet_hash(pkt, 13, unignore?"2":"1"); 4129 yahoo_send_packet(yid, pkt, 0); 4130 yahoo_packet_free(pkt); 4131 } 4132 4133 void yahoo_stealth_buddy(int id, const char *who, int unstealth) 4134 { 4135 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4136 struct yahoo_data *yd; 4137 struct yahoo_packet *pkt; 4138 4139 if(!yid) 4140 return; 4141 yd = yid->yd; 4142 4143 if (!yd->logged_in) 4144 return; 4145 4146 pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH, YAHOO_STATUS_AVAILABLE, yd->session_id); 4147 yahoo_packet_hash(pkt, 1, yd->user); 4148 yahoo_packet_hash(pkt, 7, who); 4149 yahoo_packet_hash(pkt, 31, unstealth?"2":"1"); 4150 yahoo_packet_hash(pkt, 13, "2"); 3897 4151 yahoo_send_packet(yid, pkt, 0); 3898 4152 yahoo_packet_free(pkt); … … 4202 4456 yahoo_packet_hash(pkt, 1, (from?from:yd->user)); 4203 4457 4458 yahoo_send_packet(yid, pkt, 0); 4459 4460 yahoo_packet_free(pkt); 4461 } 4462 4463 void yahoo_buddyicon_request(int id, const char *who) 4464 { 4465 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4466 struct yahoo_data *yd; 4467 struct yahoo_packet *pkt; 4468 4469 if( !yid ) 4470 return; 4471 4472 yd = yid->yd; 4473 4474 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, 0); 4475 yahoo_packet_hash(pkt, 4, yd->user); 4476 yahoo_packet_hash(pkt, 5, who); 4477 yahoo_packet_hash(pkt, 13, "1"); 4478 yahoo_send_packet(yid, pkt, 0); 4479 4480 yahoo_packet_free(pkt); 4481 } 4482 4483 void yahoo_send_picture_info(int id, const char *who, const char *url, int checksum) 4484 { 4485 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4486 struct yahoo_data *yd; 4487 struct yahoo_packet *pkt; 4488 char checksum_str[10]; 4489 4490 if( !yid ) 4491 return; 4492 4493 yd = yid->yd; 4494 4495 snprintf(checksum_str, sizeof(checksum_str), "%d", checksum); 4496 4497 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, 0); 4498 yahoo_packet_hash(pkt, 1, yd->user); 4499 yahoo_packet_hash(pkt, 4, yd->user); 4500 yahoo_packet_hash(pkt, 5, who); 4501 yahoo_packet_hash(pkt, 13, "2"); 4502 yahoo_packet_hash(pkt, 20, url); 4503 yahoo_packet_hash(pkt, 192, checksum_str); 4504 yahoo_send_packet(yid, pkt, 0); 4505 4506 yahoo_packet_free(pkt); 4507 } 4508 4509 void yahoo_send_picture_update(int id, const char *who, int type) 4510 { 4511 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4512 struct yahoo_data *yd; 4513 struct yahoo_packet *pkt; 4514 char type_str[10]; 4515 4516 if( !yid ) 4517 return; 4518 4519 yd = yid->yd; 4520 4521 snprintf(type_str, sizeof(type_str), "%d", type); 4522 4523 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_UPDATE, YAHOO_STATUS_AVAILABLE, 0); 4524 yahoo_packet_hash(pkt, 1, yd->user); 4525 yahoo_packet_hash(pkt, 5, who); 4526 yahoo_packet_hash(pkt, 206, type_str); 4527 yahoo_send_packet(yid, pkt, 0); 4528 4529 yahoo_packet_free(pkt); 4530 } 4531 4532 void yahoo_send_picture_checksum(int id, const char *who, int checksum) 4533 { 4534 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4535 struct yahoo_data *yd; 4536 struct yahoo_packet *pkt; 4537 char checksum_str[10]; 4538 4539 if( !yid ) 4540 return; 4541 4542 yd = yid->yd; 4543 4544 snprintf(checksum_str, sizeof(checksum_str), "%d", checksum); 4545 4546 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, 0); 4547 yahoo_packet_hash(pkt, 1, yd->user); 4548 if( who != 0 ) 4549 yahoo_packet_hash(pkt, 5, who); 4550 yahoo_packet_hash(pkt, 192, checksum_str); 4551 yahoo_packet_hash(pkt, 212, "1"); 4204 4552 yahoo_send_packet(yid, pkt, 0); 4205 4553 … … 4410 4758 }; 4411 4759 4760 static void _yahoo_send_picture_connected(int id, int fd, int error, void *data) 4761 { 4762 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_FT); 4763 struct send_file_data *sfd = data; 4764 struct yahoo_packet *pkt = sfd->pkt; 4765 unsigned char buff[1024]; 4766 4767 if(fd <= 0) { 4768 sfd->callback(id, fd, error, sfd->user_data); 4769 FREE(sfd); 4770 yahoo_packet_free(pkt); 4771 inputs = y_list_remove(inputs, yid); 4772 FREE(yid); 4773 return; 4774 } 4775 4776 yid->fd = fd; 4777 yahoo_send_packet(yid, pkt, 8); 4778 yahoo_packet_free(pkt); 4779 4780 snprintf((char *)buff, sizeof(buff), "29"); 4781 buff[2] = 0xc0; 4782 buff[3] = 0x80; 4783 4784 write(yid->fd, buff, 4); 4785 4786 /* YAHOO_CALLBACK(ext_yahoo_add_handler)(nyd->fd, YAHOO_INPUT_READ); */ 4787 4788 sfd->callback(id, fd, error, sfd->user_data); 4789 FREE(sfd); 4790 inputs = y_list_remove(inputs, yid); 4791 /* 4792 while(yahoo_tcp_readline(buff, sizeof(buff), nyd->fd) > 0) { 4793 if(!strcmp(buff, "")) 4794 break; 4795 } 4796 4797 */ 4798 yahoo_input_close(yid); 4799 } 4800 4801 void yahoo_send_picture(int id, const char *name, unsigned long size, 4802 yahoo_get_fd_callback callback, void *data) 4803 { 4804 struct yahoo_data *yd = find_conn_by_id(id); 4805 struct yahoo_input_data *yid; 4806 struct yahoo_server_settings *yss; 4807 struct yahoo_packet *pkt = NULL; 4808 char size_str[10]; 4809 char expire_str[10]; 4810 long content_length=0; 4811 unsigned char buff[1024]; 4812 char url[255]; 4813 struct send_file_data *sfd; 4814 4815 if(!yd) 4816 return; 4817 4818 yss = yd->server_settings; 4819 4820 yid = y_new0(struct yahoo_input_data, 1); 4821 yid->yd = yd; 4822 yid->type = YAHOO_CONNECTION_FT; 4823 4824 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_UPLOAD, YAHOO_STATUS_AVAILABLE, yd->session_id); 4825 4826 snprintf(size_str, sizeof(size_str), "%ld", size); 4827 snprintf(expire_str, sizeof(expire_str), "%ld", (long)604800); 4828 4829 yahoo_packet_hash(pkt, 0, yd->user); 4830 yahoo_packet_hash(pkt, 1, yd->user); 4831 yahoo_packet_hash(pkt, 14, ""); 4832 yahoo_packet_hash(pkt, 27, name); 4833 yahoo_packet_hash(pkt, 28, size_str); 4834 yahoo_packet_hash(pkt, 38, expire_str); 4835 4836 4837 content_length = YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt); 4838 4839 snprintf(url, sizeof(url), "http://%s:%d/notifyft", 4840 yss->filetransfer_host, yss->filetransfer_port); 4841 snprintf((char *)buff, sizeof(buff), "Y=%s; T=%s", 4842 yd->cookie_y, yd->cookie_t); 4843 inputs = y_list_prepend(inputs, yid); 4844 4845 sfd = y_new0(struct send_file_data, 1); 4846 sfd->pkt = pkt; 4847 sfd->callback = callback; 4848 sfd->user_data = data; 4849 yahoo_http_post(yid->yd->client_id, url, (char *)buff, content_length+4+size, 4850 _yahoo_send_picture_connected, sfd); 4851 } 4852 4412 4853 static void _yahoo_send_file_connected(int id, int fd, int error, void *data) 4413 4854 { -
protocols/yahoo/yahoo.c
r6bbb939 rcfc8d58 67 67 static int byahoo_chat_id = 0; 68 68 69 static char *byahoo_strip( c har *in )69 static char *byahoo_strip( const char *in ) 70 70 { 71 71 int len; … … 86 86 else if( strncmp( in, "\e[", 2 ) == 0 ) 87 87 { 88 c har *s;88 const char *s; 89 89 90 90 for( s = in + 2; *s && *s != 'm'; s ++ ); … … 172 172 struct byahoo_data *yd = ic->proto_data; 173 173 174 yahoo_send_im( yd->y2_id, NULL, who, what, 1 );174 yahoo_send_im( yd->y2_id, NULL, who, what, 1, 0 ); 175 175 176 176 return 1; … … 240 240 yd->current_status = YAHOO_STATUS_AVAILABLE; 241 241 242 yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL );242 yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL ? 2 : 0 ); 243 243 } 244 244 … … 274 274 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 275 275 276 yahoo_add_buddy( yd->y2_id, who, group ? group : BYAHOO_DEFAULT_GROUP );276 yahoo_add_buddy( yd->y2_id, who, group ? group : BYAHOO_DEFAULT_GROUP, NULL ); 277 277 } 278 278 … … 451 451 } 452 452 453 void ext_yahoo_login_response( int id, int succ, c har *url )453 void ext_yahoo_login_response( int id, int succ, const char *url ) 454 454 { 455 455 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 543 543 } 544 544 545 void ext_yahoo_status_changed( int id, c har *who, int stat, char *msg, int away)545 void ext_yahoo_status_changed( int id, const char *who, int stat, const char *msg, int away, int idle, int mobile ) 546 546 { 547 547 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 607 607 } 608 608 609 void ext_yahoo_got_im( int id, c har *who,char *msg, long tm, int stat, int utf8 )609 void ext_yahoo_got_im( int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8 ) 610 610 { 611 611 struct im_connection *ic = byahoo_get_ic_by_id( id ); 612 612 char *m = byahoo_strip( msg ); 613 613 614 serv_got_im( ic, who,m, 0, 0, strlen( m ) );614 serv_got_im( ic, (char*) who, (char*) m, 0, 0, strlen( m ) ); 615 615 g_free( m ); 616 616 } 617 617 618 void ext_yahoo_got_file( int id, char *who, char *url, long expires, char *msg, char *fname, unsigned long fesize ) 618 void ext_yahoo_got_file( int id, 619 const char *ignored, 620 const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize ) 619 621 { 620 622 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 623 625 } 624 626 625 void ext_yahoo_typing_notify( int id, c har *who, int stat )627 void ext_yahoo_typing_notify( int id, const char *ignored, const char *who, int stat ) 626 628 { 627 629 struct im_connection *ic = byahoo_get_ic_by_id( id ); 628 630 if (stat == 1) { 629 631 /* User is typing */ 630 serv_got_typing( ic, who, 1, 1 );632 serv_got_typing( ic, (char*) who, 1, 1 ); 631 633 } 632 634 else { 633 635 /* User stopped typing */ 634 serv_got_typing( ic, who, 1, 0 );635 } 636 } 637 638 void ext_yahoo_system_message( int id, c har *msg )636 serv_got_typing( ic, (char*) who, 1, 0 ); 637 } 638 } 639 640 void ext_yahoo_system_message( int id, const char *msg ) 639 641 { 640 642 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 643 645 } 644 646 645 void ext_yahoo_webcam_invite( int id, c har *from )647 void ext_yahoo_webcam_invite( int id, const char *ignored, const char *from ) 646 648 { 647 649 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 650 652 } 651 653 652 void ext_yahoo_error( int id, c har *err, int fatal)654 void ext_yahoo_error( int id, const char *err, int fatal, int num ) 653 655 { 654 656 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 719 721 } 720 722 721 int ext_yahoo_connect_async( int id, c har *host, int port, yahoo_connect_callback callback, void *data )723 int ext_yahoo_connect_async( int id, const char *host, int port, yahoo_connect_callback callback, void *data ) 722 724 { 723 725 struct byahoo_connect_callback_data *d; … … 740 742 /* Because we don't want asynchronous connects in BitlBee, and because 741 743 libyahoo doesn't seem to use this one anyway, this one is now defunct. */ 742 int ext_yahoo_connect(c har *host, int port)744 int ext_yahoo_connect(const char *host, int port) 743 745 { 744 746 #if 0 … … 796 798 } 797 799 798 void ext_yahoo_got_conf_invite( int id, char *who, char *room, char *msg, YList *members ) 800 void ext_yahoo_got_conf_invite( int id, const char *ignored, 801 const char *who, const char *room, const char *msg, YList *members ) 799 802 { 800 803 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 806 809 memset( inv, 0, sizeof( struct byahoo_conf_invitation ) ); 807 810 inv->name = g_strdup( room ); 808 inv->c = serv_got_joined_chat( ic, room );811 inv->c = serv_got_joined_chat( ic, (char*) room ); 809 812 inv->c->data = members; 810 813 inv->yid = id; … … 821 824 } 822 825 823 void ext_yahoo_conf_userdecline( int id, c har *who, char *room,char *msg )826 void ext_yahoo_conf_userdecline( int id, const char *ignored, const char *who, const char *room, const char *msg ) 824 827 { 825 828 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 828 831 } 829 832 830 void ext_yahoo_conf_userjoin( int id, c har *who,char *room )833 void ext_yahoo_conf_userjoin( int id, const char *ignored, const char *who, const char *room ) 831 834 { 832 835 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 836 839 837 840 if( c ) 838 add_chat_buddy( c, who ); 839 } 840 841 void ext_yahoo_conf_userleave( int id, char *who, char *room ) 841 add_chat_buddy( c, (char*) who ); 842 } 843 844 void ext_yahoo_conf_userleave( int id, const char *ignored, const char *who, const char *room ) 845 842 846 { 843 847 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 847 851 848 852 if( c ) 849 remove_chat_buddy( c, who, "" );850 } 851 852 void ext_yahoo_conf_message( int id, c har *who, char *room,char *msg, int utf8 )853 remove_chat_buddy( c, (char*) who, "" ); 854 } 855 856 void ext_yahoo_conf_message( int id, const char *ignored, const char *who, const char *room, const char *msg, int utf8 ) 853 857 { 854 858 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 859 863 860 864 if( c ) 861 serv_got_chat_in( c, who, 0,m, 0 );865 serv_got_chat_in( c, (char*) who, 0, (char*) m, 0 ); 862 866 g_free( m ); 863 867 } 864 868 865 void ext_yahoo_chat_cat_xml( int id, char *xml ) 866 { 867 } 868 869 void ext_yahoo_chat_join( int id, char *room, char *topic, YList *members, int fd ) 870 { 871 } 872 873 void ext_yahoo_chat_userjoin( int id, char *room, struct yahoo_chat_member *who ) 874 { 875 } 876 877 void ext_yahoo_chat_userleave( int id, char *room, char *who ) 878 { 879 } 880 881 void ext_yahoo_chat_message( int id, char *who, char *room, char *msg, int msgtype, int utf8 ) 882 { 883 } 884 885 void ext_yahoo_chat_yahoologout( int id ) 886 { 887 } 888 889 void ext_yahoo_chat_yahooerror( int id ) 890 { 891 } 892 893 void ext_yahoo_contact_added( int id, char *myid, char *who, char *msg ) 894 { 895 } 896 897 void ext_yahoo_rejected( int id, char *who, char *msg ) 898 { 899 } 900 901 void ext_yahoo_game_notify( int id, char *who, int stat ) 902 { 903 } 904 905 void ext_yahoo_mail_notify( int id, char *from, char *subj, int cnt ) 869 void ext_yahoo_chat_cat_xml( int id, const char *xml ) 870 { 871 } 872 873 void ext_yahoo_chat_join( int id, const char *who, const char *room, const char *topic, YList *members, int fd ) 874 { 875 } 876 877 void ext_yahoo_chat_userjoin( int id, const char *me, const char *room, struct yahoo_chat_member *who ) 878 { 879 free(who->id); 880 free(who->alias); 881 free(who->location); 882 free(who); 883 } 884 885 void ext_yahoo_chat_userleave( int id, const char *me, const char *room, const char *who ) 886 { 887 } 888 889 void ext_yahoo_chat_message( int id, const char *me, const char *who, const char *room, const char *msg, int msgtype, int utf8 ) 890 { 891 } 892 893 void ext_yahoo_chat_yahoologout( int id, const char *me ) 894 { 895 } 896 897 void ext_yahoo_chat_yahooerror( int id, const char *me ) 898 { 899 } 900 901 void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg ) 902 { 903 } 904 905 void ext_yahoo_rejected( int id, const char *who, const char *msg ) 906 { 907 } 908 909 void ext_yahoo_game_notify( int id, const char *me, const char *who, int stat ) 910 { 911 } 912 913 void ext_yahoo_mail_notify( int id, const char *from, const char *subj, int cnt ) 906 914 { 907 915 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 913 921 } 914 922 915 void ext_yahoo_webcam_invite_reply( int id, c har *from, int accept )916 { 917 } 918 919 void ext_yahoo_webcam_closed( int id, c har *who, int reason )923 void ext_yahoo_webcam_invite_reply( int id, const char *me, const char *from, int accept ) 924 { 925 } 926 927 void ext_yahoo_webcam_closed( int id, const char *who, int reason ) 920 928 { 921 929 } … … 925 933 } 926 934 927 void ext_yahoo_webcam_viewer( int id, c har *who, int connect )935 void ext_yahoo_webcam_viewer( int id, const char *who, int connect ) 928 936 { 929 937 } … … 933 941 } 934 942 935 int ext_yahoo_log( c har *fmt, ... )943 int ext_yahoo_log( const char *fmt, ... ) 936 944 { 937 945 return( 0 ); … … 941 949 { 942 950 } 951 952 void ext_yahoo_got_ping( int id, const char *msg) 953 { 954 } 955 956 void ext_yahoo_got_buddyicon (int id, const char *me, const char *who, const char *url, int checksum) {} 957 void ext_yahoo_got_buddyicon_checksum (int id, const char *me,const char *who, int checksum) {} 958 959 void ext_yahoo_got_buddyicon_request(int id, const char *me, const char *who){} 960 void ext_yahoo_buddyicon_uploaded(int id, const char *url){} -
protocols/yahoo/yahoo2.h
r6bbb939 rcfc8d58 120 120 /* from is the identity you're sending from. if NULL, the default is used */ 121 121 /* utf8 is whether msg is a utf8 string or not. */ 122 void yahoo_send_im(int id, const char *from, const char *who, const char *msg, int utf8 );122 void yahoo_send_im(int id, const char *from, const char *who, const char *msg, int utf8, int picture); 123 123 /* if type is true, send typing notice, else send stopped typing notice */ 124 124 void yahoo_send_typing(int id, const char *from, const char *who, int typ); … … 128 128 void yahoo_set_away(int id, enum yahoo_status state, const char *msg, int away); 129 129 130 void yahoo_add_buddy(int id, const char *who, const char *group );130 void yahoo_add_buddy(int id, const char *who, const char *group, const char *msg); 131 131 void yahoo_remove_buddy(int id, const char *who, const char *group); 132 132 void yahoo_reject_buddy(int id, const char *who, const char *msg); 133 void yahoo_stealth_buddy(int id, const char *who, int unstealth); 133 134 /* if unignore is true, unignore, else ignore */ 134 135 void yahoo_ignore_buddy(int id, const char *who, int unignore); … … 214 215 const char * yahoo_get_profile_url( void ); 215 216 217 void yahoo_buddyicon_request(int id, const char *who); 218 216 219 #include "yahoo_httplib.h" 217 220 -
protocols/yahoo/yahoo2_callbacks.h
r6bbb939 rcfc8d58 29 29 * declared in this file and defined in libyahoo2.c 30 30 */ 31 32 31 33 32 … … 67 66 68 67 69 70 68 /* 71 69 * The following functions need to be implemented in the client … … 96 94 * url - url to reactivate account if locked 97 95 */ 98 void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response)(int id, int succ, char *url); 99 100 96 void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response)(int id, int succ, const char *url); 101 97 102 98 … … 111 107 112 108 113 114 115 109 /* 116 110 * Name: ext_yahoo_got_ignore … … 123 117 124 118 125 126 127 128 119 /* 129 120 * Name: ext_yahoo_got_identities … … 136 127 137 128 138 139 140 141 129 /* 142 130 * Name: ext_yahoo_got_cookies … … 148 136 149 137 138 /* 139 * Name: ext_yahoo_got_ping 140 * Called when the ping packet is received from the server 141 * Params: 142 * id - the id that identifies the server connection 143 * errormsg - optional error message 144 */ 145 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping)(int id, const char *errormsg); 150 146 151 147 … … 159 155 * msg - the message if stat == YAHOO_STATUS_CUSTOM 160 156 * away - whether the contact is away or not (YAHOO_STATUS_CUSTOM) 161 * for YAHOO_STATUS_IDLE, this is the number of seconds he is idle162 * /163 void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed)(int id, char *who, int stat, char *msg, int away); 164 165 157 * idle - this is the number of seconds he is idle [if he is idle] 158 * mobile - this is set for mobile users/buddies 159 * TODO: add support for pager, chat, and game states 160 */ 161 void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed)(int id, const char *who, int stat, const char *msg, int away, int idle, int mobile); 166 162 167 163 … … 171 167 * Params: 172 168 * id - the id that identifies the server connection 169 * me - the identity the message was sent to 173 170 * who - the handle of the remote user 174 171 * msg - the message - NULL if stat == 2 … … 180 177 * utf8 - whether the message is encoded as utf8 or not 181 178 */ 182 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im)(int id, char *who, char *msg, long tm, int stat, int utf8); 183 184 179 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im)(int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8); 185 180 186 181 … … 190 185 * Params: 191 186 * id - the id that identifies the server connection 187 * me - the identity the invitation was sent to 192 188 * who - the user inviting you 193 189 * room - the room to join … … 195 191 * members - the initial members of the conference (null terminated list) 196 192 */ 197 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite)(int id, char *who, char *room, char *msg, YList *members); 198 199 193 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite)(int id, const char *me, const char *who, const char *room, const char *msg, YList *members); 200 194 201 195 … … 205 199 * Params: 206 200 * id - the id that identifies the server connection 201 * me - the identity in the conference 207 202 * who - the user who has declined 208 203 * room - the room 209 204 * msg - the declining message 210 205 */ 211 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline)(int id, char *who, char *room, char *msg); 212 213 206 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline)(int id, const char *me, const char *who, const char *room, const char *msg); 214 207 215 208 … … 219 212 * Params: 220 213 * id - the id that identifies the server connection 214 * me - the identity in the conference 221 215 * who - the user who has joined 222 216 * room - the room joined 223 217 */ 224 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin)(int id, char *who, char *room); 225 226 218 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin)(int id, const char *me, const char *who, const char *room); 227 219 228 220 … … 232 224 * Params: 233 225 * id - the id that identifies the server connection 226 * me - the identity in the conference 234 227 * who - the user who has left 235 228 * room - the room left 236 229 */ 237 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave)(int id, char *who, char *room); 238 239 240 241 230 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave)(int id, const char *me, const char *who, const char *room); 242 231 243 232 244 233 /* 245 234 * Name: ext_yahoo_chat_cat_xml 246 * Called when joining the chatroom.235 * Called when ? 247 236 * Params: 248 237 * id - the id that identifies the server connection 249 * room - the room joined, used in all other chat calls, freed by 250 * library after call 251 * topic - the topic of the room, freed by library after call 252 * members - the initial members of the chatroom (null terminated YList of 253 * yahoo_chat_member's) Must be freed by the client 254 */ 255 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml)(int id, char *xml); 256 257 258 259 260 238 * xml - ? 239 */ 240 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml)(int id, const char *xml); 261 241 262 242 … … 266 246 * Params: 267 247 * id - the id that identifies the server connection 248 * me - the identity in the chatroom 268 249 * room - the room joined, used in all other chat calls, freed by 269 250 * library after call … … 273 254 * fd - the socket where the connection is coming from (for tracking) 274 255 */ 275 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join)(int id, char *room, char *topic, YList *members, int fd); 276 277 278 279 256 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join)(int id, const char *me, const char *room, const char *topic, YList *members, int fd); 280 257 281 258 … … 285 262 * Params: 286 263 * id - the id that identifies the server connection 264 * me - the identity in the chatroom 287 265 * room - the room joined 288 266 * who - the user who has joined, Must be freed by the client 289 267 */ 290 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin)(int id, char *room, struct yahoo_chat_member *who); 291 292 268 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin)(int id, const char *me, const char *room, struct yahoo_chat_member *who); 293 269 294 270 … … 298 274 * Params: 299 275 * id - the id that identifies the server connection 276 * me - the identity in the chatroom 300 277 * room - the room left 301 278 * who - the user who has left (Just the User ID) 302 279 */ 303 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave)(int id, char *room, char *who); 304 305 280 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave)(int id, const char *me, const char *room, const char *who); 306 281 307 282 … … 311 286 * Params: 312 287 * id - the id that identifies the server connection 288 * me - the identity in the chatroom 313 289 * room - the room 314 290 * who - the user who messaged (Just the user id) … … 318 294 * utf8 - whether the message is utf8 encoded or not 319 295 */ 320 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message)(int id, char *who, char *room, char *msg, int msgtype, int utf8); 296 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message)(int id, const char *me, const char *who, const char *room, const char *msg, int msgtype, int utf8); 297 321 298 322 299 /* … … 329 306 * Params: 330 307 * id - the id that identifies this connection 308 * me - the identity in the chatroom 331 309 * Returns: 332 310 * nothing. 333 311 */ 334 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout)(int id); 312 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout)(int id, const char *me); 313 335 314 336 315 /* … … 344 323 * Params: 345 324 * id - the id that identifies this connection 325 * me - the identity in the chatroom 346 326 * Returns: 347 327 * nothing. 348 328 */ 349 350 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror)(int id); 329 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror)(int id, const char *me); 330 351 331 352 332 /* … … 355 335 * Params: 356 336 * id - the id that identifies the server connection 337 * me - the identity the conf message was sent to 357 338 * who - the user who messaged 358 339 * room - the room … … 360 341 * utf8 - whether the message is utf8 encoded or not 361 342 */ 362 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message)(int id, char *who, char *room, char *msg, int utf8); 363 364 343 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message)(int id, const char *me, const char *who, const char *room, const char *msg, int utf8); 365 344 366 345 … … 370 349 * Params: 371 350 * id - the id that identifies the server connection 351 * me - the identity the file was sent to 372 352 * who - the user who sent the file 373 353 * url - the file url … … 377 357 * fsize- the file size if direct transfer 378 358 */ 379 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_file)(int id, char *who, char *url, long expires, char *msg, char *fname, unsigned long fesize); 380 381 359 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_file)(int id, const char *me, const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize); 382 360 383 361 … … 391 369 * msg - any message sent 392 370 */ 393 void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added)(int id, char *myid, char *who, char *msg); 394 395 371 void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added)(int id, const char *myid, const char *who, const char *msg); 396 372 397 373 … … 404 380 * msg - any message sent 405 381 */ 406 void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected)(int id, char *who, char *msg); 407 408 382 void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected)(int id, const char *who, const char *msg); 409 383 410 384 … … 414 388 * Params: 415 389 * id - the id that identifies the server connection 390 * me - the handle of the identity the notification is sent to 416 391 * who - the handle of the remote user 417 392 * stat - 1 if typing, 0 if stopped typing 418 393 */ 419 void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify)(int id, char *who, int stat); 420 421 394 void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify)(int id, const char *me, const char *who, int stat); 422 395 423 396 … … 427 400 * Params: 428 401 * id - the id that identifies the server connection 402 * me - the handle of the identity the notification is sent to 429 403 * who - the handle of the remote user 430 404 * stat - 1 if game, 0 if stopped gaming 431 405 */ 432 void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify)(int id, char *who, int stat); 433 434 406 void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify)(int id, const char *me, const char *who, int stat); 435 407 436 408 … … 444 416 * cnt - mail count - 0 if new mail notification 445 417 */ 446 void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify)(int id, char *from, char *subj, int cnt); 447 448 418 void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify)(int id, const char *from, const char *subj, int cnt); 449 419 450 420 … … 456 426 * msg - the message 457 427 */ 458 void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message)(int id, char *msg); 459 460 461 462 463 464 465 466 467 468 428 void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message)(int id, const char *msg); 429 430 /* 431 * Name: ext_yahoo_got_buddyicon 432 * Buddy icon received 433 * Params: 434 * id - the id that identifies the server connection 435 * me - the handle of the identity the notification is sent to 436 * who - the person the buddy icon is for 437 * url - the url to use to load the icon 438 * checksum - the checksum of the icon content 439 */ 440 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon)(int id, const char *me, const char *who, const char *url, int checksum); 441 442 /* 443 * Name: ext_yahoo_got_buddyicon_checksum 444 * Buddy icon checksum received 445 * Params: 446 * id - the id that identifies the server connection 447 * me - the handle of the identity the notification is sent to 448 * who - the yahoo id of the buddy icon checksum is for 449 * checksum - the checksum of the icon content 450 */ 451 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum)(int id, const char *me,const char *who, int checksum); 452 453 /* 454 * Name: ext_yahoo_got_buddyicon_request 455 * Buddy icon request received 456 * Params: 457 * id - the id that identifies the server connection 458 * me - the handle of the identity the notification is sent to 459 * who - the yahoo id of the buddy that requested the buddy icon 460 */ 461 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request)(int id, const char *me, const char *who); 462 463 /* 464 * Name: ext_yahoo_got_buddyicon_request 465 * Buddy icon request received 466 * Params: 467 * id - the id that identifies the server connection 468 * url - remote url, the uploaded buddy icon can be fetched from 469 */ 470 void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded)(int id, const char *url); 469 471 470 472 /* … … 496 498 497 499 498 499 500 500 /* 501 501 * Name: ext_yahoo_webcam_invite … … 503 503 * Params: 504 504 * id - the id that identifies the server connection 505 * me - identity the invitation is to 505 506 * from - who the invitation is from 506 507 */ 507 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite)(int id, char *from); 508 509 508 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite)(int id, const char *me, const char *from); 510 509 511 510 … … 515 514 * Params: 516 515 * id - the id that identifies the server connection 516 * me - identity the invitation response is to 517 517 * from - who the invitation response is from 518 518 * accept - 0 (decline), 1 (accept) 519 519 */ 520 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply)(int id, char *from, int accept); 521 520 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply)(int id, const char *me, const char *from, int accept); 522 521 523 522 … … 534 533 * 4 = user does not have webcam online 535 534 */ 536 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed)(int id, c har *who, int reason);535 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed)(int id, const char *who, int reason); 537 536 538 537 … … 552 551 553 552 554 555 553 /* 556 554 * Name: ext_yahoo_error … … 560 558 * err - the error message 561 559 * fatal- whether this error is fatal to the connection or not 562 */ 563 void YAHOO_CALLBACK_TYPE(ext_yahoo_error)(int id, char *err, int fatal); 564 565 560 * num - Which error is this 561 */ 562 void YAHOO_CALLBACK_TYPE(ext_yahoo_error)(int id, const char *err, int fatal, int num); 566 563 567 564 … … 574 571 * connect - 0=disconnect 1=connect 2=request 575 572 */ 576 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer)(int id, char *who, int connect); 577 578 573 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer)(int id, const char *who, int connect); 579 574 580 575 … … 587 582 */ 588 583 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request)(int id, int send); 589 590 591 584 592 585 … … 599 592 * 0 600 593 */ 601 int YAHOO_CALLBACK_TYPE(ext_yahoo_log)(char *fmt, ...); 602 603 604 605 606 607 594 int YAHOO_CALLBACK_TYPE(ext_yahoo_log)(const char *fmt, ...); 608 595 609 596 … … 624 611 625 612 626 627 628 613 /* 629 614 * Name: ext_yahoo_remove_handler … … 634 619 */ 635 620 void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler)(int id, int tag); 636 637 638 639 621 640 622 … … 648 630 * a unix file descriptor to the socket 649 631 */ 650 int YAHOO_CALLBACK_TYPE(ext_yahoo_connect)(char *host, int port); 651 652 653 654 655 656 632 int YAHOO_CALLBACK_TYPE(ext_yahoo_connect)(const char *host, int port); 657 633 658 634 … … 675 651 * a unix file descriptor to the socket 676 652 */ 677 int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async)(int id, c har *host, int port,653 int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async)(int id, const char *host, int port, 678 654 yahoo_connect_callback callback, void *callback_data); 679 655 … … 686 662 */ 687 663 void yahoo_register_callbacks(struct yahoo_callbacks * tyc); 688 664 689 665 #undef YAHOO_CALLBACK_TYPE 690 666 … … 696 672 697 673 #endif 674 -
protocols/yahoo/yahoo2_types.h
r6bbb939 rcfc8d58 30 30 31 31 enum yahoo_status { 32 YAHOO_STATUS_DISCONNECTED = -1, 32 33 YAHOO_STATUS_AVAILABLE = 0, 33 34 YAHOO_STATUS_BRB, … … 43 44 YAHOO_STATUS_CUSTOM = 99, 44 45 YAHOO_STATUS_IDLE = 999, 46 YAHOO_STATUS_WEBLOGIN = 0x5a55aa55, 45 47 YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */ 46 YAHOO_STATUS_NOTIFY = 0x16 48 YAHOO_STATUS_NOTIFY = 0x16 /* TYPING */ 47 49 }; 48 50 #define YAHOO_STATUS_GAME 0x2 /* Games don't fit into the regular status model */ … … 50 52 enum yahoo_login_status { 51 53 YAHOO_LOGIN_OK = 0, 54 YAHOO_LOGIN_LOGOFF = 2, 52 55 YAHOO_LOGIN_UNAME = 3, 53 56 YAHOO_LOGIN_PASSWD = 13, … … 58 61 59 62 enum yahoo_error { 63 E_UNKNOWN = -1, 64 E_CONNECTION = -2, 65 E_SYSTEM = -3, 60 66 E_CUSTOM = 0, 61 67 … … 79 85 }; 80 86 87 #define YAHOO_PROTO_VER 0x000b 81 88 82 89 /* Yahoo style/color directives */ … … 116 123 }; 117 124 125 enum yahoo_stealth_visibility_type { 126 YAHOO_STEALTH_DEFAULT = 0, 127 YAHOO_STEALTH_ONLINE, 128 YAHOO_STEALTH_PERM_OFFLINE 129 }; 130 118 131 /* chat member attribs */ 119 132 #define YAHOO_CHAT_MALE 0x8000 -
protocols/yahoo/yahoo_util.c
r6bbb939 rcfc8d58 69 69 int i=0; 70 70 int l = strlen(sep); 71 if(nelem < 0) {71 if(nelem <= 0) { 72 72 char * s; 73 73 nelem=0; 74 for(s=strstr(str, sep); s; s=strstr(s+l, sep),nelem++) 75 ; 76 if(strcmp(str+strlen(str)-l, sep)) 77 nelem++; 74 if (*str) { 75 for(s=strstr(str, sep); s; s=strstr(s+l, sep),nelem++) 76 ; 77 if(strcmp(str+strlen(str)-l, sep)) 78 nelem++; 79 } 78 80 } 79 81 … … 87 89 } 88 90 89 if(i<nelem ) /* str didn't end with sep*/91 if(i<nelem && *str) /* str didn't end with sep, and str isn't empty */ 90 92 vector[i++] = strdup(p); 91 93
Note: See TracChangeset
for help on using the changeset viewer.